diff options
Diffstat (limited to 'src/main/java/jp')
925 files changed, 44382 insertions, 0 deletions
diff --git a/src/main/java/jp/plusplus/fbs/AchievementInsanity.class b/src/main/java/jp/plusplus/fbs/AchievementInsanity.class Binary files differnew file mode 100644 index 0000000..7a7e5be --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/AchievementInsanity.class diff --git a/src/main/java/jp/plusplus/fbs/AchievementInsanity.java b/src/main/java/jp/plusplus/fbs/AchievementInsanity.java new file mode 100644 index 0000000..3978c3d --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/AchievementInsanity.java @@ -0,0 +1,15 @@ +package jp.plusplus.fbs;
+
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.stats.Achievement;
+
+/**
+ * Created by plusplus_F on 2015/11/30.
+ */
+public class AchievementInsanity extends Achievement {
+ public AchievementInsanity(String name, int x, int y, ItemStack icon, Achievement parent) {
+ super(FBS.MODID+":"+name, "fbs."+name, x, y+3, icon, parent);
+ registerStat();
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/AchievementRegistry.class b/src/main/java/jp/plusplus/fbs/AchievementRegistry.class Binary files differnew file mode 100644 index 0000000..d12c63d --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/AchievementRegistry.class diff --git a/src/main/java/jp/plusplus/fbs/AchievementRegistry.java b/src/main/java/jp/plusplus/fbs/AchievementRegistry.java new file mode 100644 index 0000000..2f18e6c --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/AchievementRegistry.java @@ -0,0 +1,120 @@ +package jp.plusplus.fbs;
+
+import jp.plusplus.fbs.api.IPottery;
+import jp.plusplus.fbs.block.BlockCore;
+import jp.plusplus.fbs.item.ItemCore;
+import net.minecraft.item.ItemStack;
+import net.minecraft.stats.Achievement;
+import net.minecraftforge.common.AchievementPage;
+import net.minecraftforge.event.entity.player.AchievementEvent;
+
+/**
+ * Created by plusplus_F on 2015/11/30.
+ */
+public class AchievementRegistry {
+ private static AchievementRegistry instance;
+
+ public static Achievement insanity;
+ public static Achievement madness;
+ public static Achievement death;
+
+ public static Achievement bonfire;
+ public static Achievement extract;
+ public static Achievement enchant;
+
+ public static Achievement monocle;
+ public static Achievement book;
+ public static Achievement workbench;
+ public static Achievement circle;
+ public static Achievement witch;
+ public static Achievement resonance;
+ public static Achievement harvest;
+
+ public static Achievement autumn;
+ public static Achievement butterfly;
+ public static Achievement sublimation;
+ public static Achievement eternalAutumn;
+
+ public static Achievement warp;
+ public static Achievement crack;
+ public static Achievement contract;
+ public static Achievement tear;
+ public static Achievement evil;
+ public static Achievement best;
+ public static Achievement infinity;
+
+ public static Achievement beginner;
+ public static Achievement appraisal;
+ public static Achievement atelier;
+ public static Achievement alchemy;
+ public static Achievement herbGold;
+
+ public static Achievement potter;
+ public static Achievement grade;
+ public static Achievement soulful;
+
+ public static Achievement lucky;
+ public static Achievement ga;
+
+ private AchievementRegistry(){
+ }
+ private static AchievementRegistry instance(){
+ return instance;
+ }
+
+ public static void register(){
+ insanity=new AchievementInsanity("san", 7, -1, new ItemStack(ItemCore.lavender), null);
+ madness=new AchievementInsanity("madness", 9, -2, new ItemStack(ItemCore.redLily), insanity);
+ death=new AchievementInsanity("death", 9, -4, new ItemStack(ItemCore.redLilyDirty), madness);
+
+ bonfire=new AchievementInsanity("bonfire", 7, 1, new ItemStack(BlockCore.bonfire), null);
+ extract=new AchievementInsanity("extract", 9, 2, new ItemStack(ItemCore.alchemyMaterial, 1, 20), bonfire);
+ enchant=new AchievementInsanity("enchant", 10, 4, new ItemStack(ItemCore.enchantScroll), extract);
+
+ monocle=new AchievementInsanity("monocle", 0, 0, new ItemStack(ItemCore.monocle), null);
+ book=new AchievementInsanity("book", 3, 0, new ItemStack(ItemCore.bookOld, 1, 555), monocle);
+ workbench=new AchievementInsanity("workbench", 3, -2, new ItemStack(BlockCore.workbench), book);
+ circle=new AchievementInsanity("circle", 4, -4, new ItemStack(BlockCore.magicCore), workbench);
+ witch=new AchievementInsanity("witch", 5, -2, new ItemStack(ItemCore.membership), workbench);
+ resonance=new AchievementInsanity("resonance", 3, 2, new ItemStack(ItemCore.staff2_1), book);
+ harvest=new AchievementInsanity("harvest", 5, 1, new ItemStack(ItemCore.mpCoin), book).setSpecial();
+
+ autumn=new AchievementInsanity("autumn", -1, -3, new ItemStack(BlockCore.fallenLeaves), null);
+ butterfly=new AchievementInsanity("butterfly", -1, -5, new ItemStack(ItemCore.butterfly), autumn);
+ sublimation=new AchievementInsanity("sublimation", 1, -5, new ItemStack(ItemCore.butterfly), butterfly).setSpecial();
+ eternalAutumn=new AchievementInsanity("eternalAutumn", -2, -7, new ItemStack(BlockCore.portal2), butterfly);
+
+ warp=new AchievementInsanity("warp", 4, -6, new ItemStack(ItemCore.cloak), circle);
+ crack=new AchievementInsanity("crack", 5, -8, new ItemStack(ItemCore.stoneInactive), warp);
+ contract=new AchievementInsanity("contract", 7, -8, new ItemStack(ItemCore.spiritSword), crack);
+ tear=new AchievementInsanity("tear", 9, -7, new ItemStack(ItemCore.alchemyMaterial, 1, 40), contract);
+ evil=new AchievementInsanity("evil", 7, -6, new ItemStack(ItemCore.alchemyPotion, 1, 2), contract);
+ best=new AchievementInsanity("best", 8, -10, new ItemStack(ItemCore.spiritSword), contract).setSpecial();
+ infinity=new AchievementInsanity("infinity", 11, -7, new ItemStack(ItemCore.infinityArmor), tear).setSpecial();
+
+ beginner=new AchievementInsanity("beginner", -2, 2, new ItemStack(BlockCore.tableAlchemist), null);
+ appraisal=new AchievementInsanity("appraisal", -4, 1, new ItemStack(ItemCore.herbUnknown), beginner);
+ atelier=new AchievementInsanity("atelier", -4, -1, new ItemStack(BlockCore.alchemyCauldron), appraisal);
+ alchemy=new AchievementInsanity("alchemy", -5, -3, new ItemStack(ItemCore.alchemyRecipe), atelier);
+ herbGold=new AchievementInsanity("herbGold", -2, -1, new ItemStack(ItemCore.alchemyMaterial, 36), atelier);
+
+ potter=new AchievementInsanity("potter", 1, 2, new ItemStack(BlockCore.pottersWheel), null);
+ grade=new AchievementInsanity("grade", 0, 4, BlockCore.pot.getItemStack(IPottery.PotteryState.BAKED, IPottery.PotteryGrade.NORMAL, IPottery.PotterySize.MEDIUM, (byte)0, false), potter);
+ soulful=new AchievementInsanity("soulful", -2, 4, BlockCore.pot.getItemStack(IPottery.PotteryState.BAKED, IPottery.PotteryGrade.NORMAL, IPottery.PotterySize.LARGE, (byte)0, false), grade).setSpecial();
+
+ lucky=new AchievementInsanity("lucky", 1, -2, new ItemStack(ItemCore.mpCoin, 1, 5000), null).setSpecial();
+ ga=new AchievementInsanity("ga", 6, -4, new ItemStack(BlockCore.schoolTable), null);
+
+ Achievement[] page={
+ insanity,madness, death,
+ bonfire, extract, enchant,
+ monocle, book, workbench, circle, witch, resonance, harvest,
+ autumn, butterfly, sublimation, eternalAutumn,
+ warp, crack, contract, tear, evil, best, infinity,
+ beginner, appraisal, atelier, alchemy, herbGold,
+ potter, grade, soulful,
+ lucky, ga
+ };
+ AchievementPage.registerAchievementPage(new AchievementPage("Insanity", page));
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/FBS.class b/src/main/java/jp/plusplus/fbs/FBS.class Binary files differnew file mode 100644 index 0000000..f2ab1e1 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/FBS.class diff --git a/src/main/java/jp/plusplus/fbs/FBS.java b/src/main/java/jp/plusplus/fbs/FBS.java new file mode 100644 index 0000000..d0b30b9 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/FBS.java @@ -0,0 +1,223 @@ +package jp.plusplus.fbs;
+
+import cpw.mods.fml.common.*;
+import cpw.mods.fml.common.event.*;
+import cpw.mods.fml.common.network.NetworkRegistry;
+import cpw.mods.fml.common.registry.GameRegistry;
+import jp.plusplus.fbs.alchemy.AlchemyRegistry;
+import jp.plusplus.fbs.block.BlockCore;
+import jp.plusplus.fbs.command.*;
+import jp.plusplus.fbs.event.FBSEventHandler;
+import jp.plusplus.fbs.event.wish.WishHandler;
+import jp.plusplus.fbs.gui.GuiHandler;
+import jp.plusplus.fbs.mod.ForIR3;
+import jp.plusplus.fbs.render.RendererGameOverlay;
+import jp.plusplus.fbs.item.ItemCore;
+import jp.plusplus.fbs.packet.PacketHandler;
+import jp.plusplus.fbs.spirit.SpiritManager;
+import jp.plusplus.fbs.tab.*;
+import jp.plusplus.fbs.trouble.TroubleDamage;
+import jp.plusplus.fbs.trouble.TroubleDry;
+import jp.plusplus.fbs.trouble.TroubleHunger;
+import jp.plusplus.fbs.trouble.TroubleTiredness;
+import net.minecraft.creativetab.CreativeTabs;
+import cpw.mods.fml.common.Mod.EventHandler;
+import net.minecraft.item.EnumAction;
+import net.minecraft.util.Timer;
+import net.minecraftforge.common.MinecraftForge;
+import net.minecraftforge.common.config.Configuration;
+import net.minecraftforge.common.util.EnumHelper;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+import java.io.File;
+
+
+/**
+ * Created by plusplus_F on 2015/01/31.
+ */
+@Mod(modid = FBS.MODID, version = FBS.VERSION, name = FBS.NAME, dependencies = "required-after:Forge@[10.13.4.1448,);required-after:mceconomy2@[2.5.0,)")
+public class FBS {
+ public static final String NAME="Insanity";
+ public static final String MODID = "jp-plusplus-fbs";
+ public static final String VERSION = "1.2.0";
+
+ @Mod.Instance(FBS.MODID)
+ public static FBS instance;
+
+ public static final CreativeTabs tab =new Tab("tab-"+FBS.MODID);
+ public static final CreativeTabs tabBook=new TabBooks("tabBook-"+FBS.MODID);
+ public static final CreativeTabs tabPottery =new TabPottery("tabPottery-"+FBS.MODID);
+ public static final CreativeTabs tabAlchemy =new TabAlchemy("tabAlchemy-"+FBS.MODID);
+ public static final CreativeTabs tabSpirit =new TabSpirit("tabSpirit-"+FBS.MODID);
+
+ public static final int GUI_STAFF_ID =1;
+ public static final int GUI_MAGIC_COPY_ID =2;
+ public static final int GUI_ENCHANTMENT_ID=3;
+ public static final int GUI_MAGIC_WARP_ID =4;
+ public static final int GUI_MAGIC_CONTRACT_ID =5;
+ public static final int GUI_SPIRIT_MAIN_ID =6;
+ public static final int GUI_BASKET_ID =7;
+ public static final int GUI_SPIRIT_CONFIG_ID =8;
+ public static final int GUI_SPIRIT_LEARN_ID =9;
+ public static final int GUI_SPIRIT_SKILL_ID =10;
+ public static final int GUI_SHOP_AUTHOR_ID =11;
+ public static final int GUI_MAGIC_TIME_TRACE_ID =12;
+ public static final int GUI_MAGIC_POT_ID =13;
+ public static final int GUI_WISH_ID=14;
+
+ public static int dimensionCrackId =-10;
+ public static int dimensionAutumnId=-11;
+
+ public static Logger logger= LogManager.getLogger("Insanity");
+
+ public static EnumAction actionDecode;
+ public static EnumAction actionSpell;
+
+ public static int renderDirectionalId;
+ public static int renderCharmId;
+ public static int renderMirrorId;
+ public static int renderJarId;
+ public static int renderPottersWheelId;
+ public static int renderAlchemyCauldronId;
+ public static int renderDecorationId;
+ public static int renderAlchemyTableId;
+ public static int renderBarrierId;
+ public static int renderPortalWarpId;
+ public static int renderHerbId;
+ public static int renderMealId;
+ public static int renderMealInletId;
+ public static int renderMealTerminalId;
+
+ public static int sanityRecoveryRatio;
+
+ public static boolean insanityFromMobs;
+ public static boolean generatesOre;
+ public static boolean enableDescription;
+
+ public static boolean enableRecipeOak;
+ public static boolean enableRecipeLavender;
+ public static boolean enableRecipeRedLily;
+
+ public static boolean cooperatesAMT2;
+ public static boolean cooperatesSS2;
+ public static boolean cooperatesIC2;
+ public static boolean cooperatesIR3;
+
+
+ @SidedProxy(clientSide = "jp.plusplus.fbs.ProxyClient", serverSide = "jp.plusplus.fbs.ProxyServer")
+ public static ProxyServer proxy;
+
+ @EventHandler
+ public void preInit(FMLPreInitializationEvent event){
+ LoadConfiguration();
+
+ if (event.getSide().isClient()) {
+ MinecraftForge.EVENT_BUS.register(new RendererGameOverlay());
+ }
+
+ BlockCore.Init();
+ ItemCore.Init();
+
+ Registry.RegisterBooks();
+ Registry.RegisterMagics();
+
+
+ actionDecode=EnumHelper.addAction(FBS.MODID+"-decode");
+ actionSpell=EnumHelper.addAction(FBS.MODID+"-spell");
+
+ //AchievementChecker.init();
+ AchievementRegistry.register();
+ PacketHandler.init();
+ }
+
+ @EventHandler
+ public void init(FMLInitializationEvent event) {
+ NetworkRegistry.INSTANCE.registerGuiHandler(this, new GuiHandler());
+ proxy.register();
+ proxy.loadNEI();
+
+ FBSEventHandler epeh=new FBSEventHandler();
+ MinecraftForge.EVENT_BUS.register(epeh);
+ MinecraftForge.ORE_GEN_BUS.register(epeh);
+ FMLCommonHandler.instance().bus().register(epeh);
+ GameRegistry.registerFuelHandler(epeh);
+
+ AlchemyRegistry.RegisterAlchemy();
+ SpiritManager.register();
+ Registry.RegisterMP();
+
+ Registry.RegisterTrouble(new TroubleHunger(), 10);
+ Registry.RegisterTrouble(new TroubleDamage(), 20);
+ if(FBS.cooperatesSS2){
+ Registry.RegisterTrouble(new TroubleDry(), 10);
+ Registry.RegisterTrouble(new TroubleTiredness(), 10);
+ }
+ if(FBS.cooperatesIR3){
+ ForIR3.setup();
+ }
+
+ WishHandler.register();
+
+ /*
+ VillagerRegistry.instance().registerVillageTradeHandler(0, new VillagerTradeHandler());
+ Recipes.RegisterFilledCan();
+ Recipes.RegisterBuildingItems();
+ Recipes.SetUpCooperation();
+ MinecraftForge.addGrassSeed(new ItemStack(ItemCore.seedCotton), 5);
+ */
+
+ //chest
+ /*
+ ChestGenHooks.addItem(ChestGenHooks.DUNGEON_CHEST, new WeightedRandomChestContent(ItemCore.screw, 0, 1, 2, 2));
+ ChestGenHooks.addItem(ChestGenHooks.MINESHAFT_CORRIDOR, new WeightedRandomChestContent(ItemCore.screw, 0, 1, 2, 2));
+ ChestGenHooks.addItem(ChestGenHooks.VILLAGE_BLACKSMITH, new WeightedRandomChestContent(ItemCore.screw, 0, 1, 2, 2));
+ ChestGenHooks.addItem(ChestGenHooks.PYRAMID_DESERT_CHEST, new WeightedRandomChestContent(ItemCore.screw, 0, 1, 2, 2));
+ ChestGenHooks.addItem(ChestGenHooks.PYRAMID_JUNGLE_CHEST, new WeightedRandomChestContent(ItemCore.screw, 0, 1, 2, 2));
+ ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_CORRIDOR, new WeightedRandomChestContent(ItemCore.screw, 0, 1, 2, 2));
+ ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_LIBRARY, new WeightedRandomChestContent(ItemCore.screw, 0, 1, 2, 2));
+ ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_CROSSING, new WeightedRandomChestContent(ItemCore.screw, 0, 1, 2, 2));
+ */
+
+ }
+
+ public void LoadConfiguration(){
+ Configuration cfg=new Configuration(new File("./config/Insanity.cfg"));
+ cfg.load();
+
+ Registry.LoadIdFromCfg(cfg);
+
+ sanityRecoveryRatio=cfg.getInt("SanityRecoveryRatio", "General", 100, 0, 100, "");
+ enableDescription=cfg.getBoolean("EnableDescription", "General", true, "");
+ insanityFromMobs=cfg.getBoolean("InsanityFromMobs", "General", true, "");
+ generatesOre=cfg.getBoolean("GeneratesOre", "General", true, "");
+ cooperatesAMT2=(cfg.getBoolean("CooperatesAMT2", "General", true, "") && Loader.isModLoaded("DCsAppleMilk"));
+ cooperatesSS2=(cfg.getBoolean("CooperatesSS2", "General", true, "") && Loader.isModLoaded("SextiarySector"));
+ cooperatesIR3=(cfg.getBoolean("CooperatesIR3", "General", true, "") && Loader.isModLoaded("jp-plusplus-ir2"));
+
+ enableRecipeOak=cfg.getBoolean("EnableRecipeOak", "Recipe", false, "");
+ enableRecipeLavender=cfg.getBoolean("EnableRecipeLavender", "Recipe", false, "");
+ enableRecipeRedLily=cfg.getBoolean("EnableRecipeRedLily", "Recipe", false, "");
+
+ cfg.save();
+ }
+
+ @EventHandler
+ public void postInit(FMLPostInitializationEvent event) {
+ }
+
+ @EventHandler
+ public void receiveIMCE(FMLInterModComms.IMCEvent event){
+ //IMCEventReceiver.receive(event);
+ }
+
+ @EventHandler
+ public void onServerStart(FMLServerStartingEvent event){
+ event.registerServerCommand(new CommandSanityPoint());
+ event.registerServerCommand(new CommandMagicLevel());
+ event.registerServerCommand(new CommandMagicExp());
+ event.registerServerCommand(new CommandGetBook());
+ event.registerServerCommand(new CommandGetSpirit());
+ event.registerServerCommand(new CommandWish());
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/ProxyClient.class b/src/main/java/jp/plusplus/fbs/ProxyClient.class Binary files differnew file mode 100644 index 0000000..d5ee24e --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/ProxyClient.class diff --git a/src/main/java/jp/plusplus/fbs/ProxyClient.java b/src/main/java/jp/plusplus/fbs/ProxyClient.java new file mode 100644 index 0000000..abf68d6 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/ProxyClient.java @@ -0,0 +1,151 @@ +package jp.plusplus.fbs;
+
+import cpw.mods.fml.client.FMLClientHandler;
+import cpw.mods.fml.client.registry.ClientRegistry;
+import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
+import cpw.mods.fml.client.registry.RenderingRegistry;
+import cpw.mods.fml.common.Loader;
+import jp.plusplus.fbs.block.render.*;
+import jp.plusplus.fbs.entity.*;
+import jp.plusplus.fbs.entity.render.RenderAuthor;
+import jp.plusplus.fbs.entity.render.RenderButterfly;
+import jp.plusplus.fbs.entity.render.RenderTableware;
+import jp.plusplus.fbs.item.ItemCore;
+import jp.plusplus.fbs.model.ModelMagicBall;
+import jp.plusplus.fbs.model.ModelMagicBase;
+import jp.plusplus.fbs.nei.NEILoader;
+import jp.plusplus.fbs.pottery.RenderPottersWheel;
+import jp.plusplus.fbs.pottery.RenderPottery;
+import jp.plusplus.fbs.pottery.TileEntityPottery;
+import jp.plusplus.fbs.render.RendererBook;
+import jp.plusplus.fbs.entity.render.RenderMagicBase;
+import jp.plusplus.fbs.spirit.render.RenderAlice;
+import jp.plusplus.fbs.storage.*;
+import jp.plusplus.fbs.tileentity.*;
+import jp.plusplus.fbs.tileentity.render.RenderMagicCircle;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.renderer.entity.RendererLivingEntity;
+import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.util.Timer;
+import net.minecraft.world.World;
+import net.minecraftforge.client.MinecraftForgeClient;
+
+import java.util.HashMap;
+
+
+/**
+ * Created by plusplus_F on 2015/01/31.
+ */
+public class ProxyClient extends ProxyServer {
+ public Timer timer=new Timer(20);
+
+ private HashMap<String, RendererLivingEntity> spiritModels=new HashMap<String, RendererLivingEntity>();
+
+ @Override
+ public World getClientWorld() {
+ return FMLClientHandler.instance().getClient().theWorld;
+ }
+
+ @Override
+ public void register() {
+ super.register();
+
+ MinecraftForgeClient.registerItemRenderer(ItemCore.bookNoDecoded, new RendererBook());
+ MinecraftForgeClient.registerItemRenderer(ItemCore.bookSorcery, new RendererBook());
+
+ RenderingRegistry.registerEntityRenderingHandler(EntityButterfly.class, new RenderButterfly());
+ RenderingRegistry.registerEntityRenderingHandler(EntityTableware.class, new RenderTableware());
+ RenderingRegistry.registerEntityRenderingHandler(EntityMagicDig.class, new RenderMagicBase(new ModelMagicBase(0, 0)));
+ RenderingRegistry.registerEntityRenderingHandler(EntityMagicArrow.class, new RenderMagicBase(new ModelMagicBase(16, 0)));
+ RenderingRegistry.registerEntityRenderingHandler(EntityMagicWedge.class, new RenderMagicBase(new ModelMagicBase(0, 8)));
+ RenderingRegistry.registerEntityRenderingHandler(EntityMagicFireBolt.class, new RenderMagicBase(new ModelMagicBase(16, 8)));
+ RenderingRegistry.registerEntityRenderingHandler(EntityMagicHealingBall.class, new RenderMagicBase(new ModelMagicBall(48, 24)));
+ RenderingRegistry.registerEntityRenderingHandler(EntityMagicArrowFlexible.class, new RenderMagicBase(new ModelMagicBase(16, 0)));
+ RenderingRegistry.registerEntityRenderingHandler(EntityMagicAuthor.class, new RenderAuthor());
+
+ FBS.renderDirectionalId=registerRenderer(new RenderDirectional());
+ FBS.renderCharmId=registerRenderer(new RenderCharm());
+ FBS.renderPottersWheelId=registerRenderer(new RenderPottersWheel());
+
+ ClientRegistry.registerTileEntity(TileEntityMagicCore.class, FBS.MODID+"-magicCoreR", new RenderMagicCircle());
+
+ TileEntitySpecialRenderer tesr=new RenderPottery();
+ FBS.renderJarId=registerRenderer((ISimpleBlockRenderingHandler)tesr);
+ ClientRegistry.bindTileEntitySpecialRenderer(TileEntityPottery.class, tesr);
+
+ tesr=new RenderMirror();
+ FBS.renderMirrorId=registerRenderer((ISimpleBlockRenderingHandler)tesr);
+ ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMirror.class, tesr);
+
+ tesr=new RenderAlchemyCauldron();
+ FBS.renderAlchemyCauldronId=registerRenderer((ISimpleBlockRenderingHandler)tesr);
+ ClientRegistry.bindTileEntitySpecialRenderer(TileEntityAlchemyCauldron.class, tesr);
+
+ tesr=new RenderDecorations();
+ FBS.renderDecorationId=registerRenderer((ISimpleBlockRenderingHandler)tesr);
+ ClientRegistry.bindTileEntitySpecialRenderer(TileEntityForRender.class, tesr);
+
+ tesr=new RenderHarvestable();
+ FBS.renderHerbId=registerRenderer((ISimpleBlockRenderingHandler)tesr);
+ ClientRegistry.bindTileEntitySpecialRenderer(TileEntityHavestable.class, tesr);
+ ClientRegistry.bindTileEntitySpecialRenderer(TileEntityHavestableMushroom.class, tesr);
+
+ tesr=new RenderMealCrystal();
+ FBS.renderMealId=registerRenderer((ISimpleBlockRenderingHandler)tesr);
+ ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMeal.class, tesr);
+
+ tesr=new RenderMealInlet();
+ FBS.renderMealInletId=registerRenderer((ISimpleBlockRenderingHandler)tesr);
+ ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMealInlet.class, tesr);
+ ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMealOutletSingle.class, tesr);
+
+ tesr=new RenderMealTerminal();
+ FBS.renderMealTerminalId=registerRenderer((ISimpleBlockRenderingHandler)tesr);
+ ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMealTerminal.class, tesr);
+
+ FBS.renderBarrierId=registerRenderer(new RenderBarrier());
+ FBS.renderPortalWarpId=registerRenderer(new RenderPortalWarp());
+
+ registerSpiritModel("fbs.alice", new RenderAlice());
+ }
+
+ @Override
+ public int registerRenderer(ISimpleBlockRenderingHandler renderer){
+ int id=RenderingRegistry.getNextAvailableRenderId();
+ RenderingRegistry.registerBlockHandler(id, renderer);
+ //FMLLog.severe(renderer.toString());
+ return id;
+ }
+
+ public void registerSpiritModel(String character, RendererLivingEntity renderer){
+ spiritModels.put(character, renderer);
+ }
+ public RendererLivingEntity getSpiritModel(String character){
+ return spiritModels.get(character);
+ }
+
+ @Override
+ public void loadNEI(){
+ if(Loader.isModLoaded("NotEnoughItems")){
+ NEILoader.LoadNEI();
+ }
+ }
+ @Override
+ public EntityPlayer getEntityPlayerInstance(){
+ return Minecraft.getMinecraft().thePlayer;
+ }
+
+ @Override
+ public float getRenderPartialTicks(){
+ return timer.renderPartialTicks;
+ }
+ @Override
+ public void setRenderPartialTicks(float f){
+ timer.renderPartialTicks=f;
+ }
+ @Override
+ public void updateTimer(){
+ timer.updateTimer();
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/ProxyServer.class b/src/main/java/jp/plusplus/fbs/ProxyServer.class Binary files differnew file mode 100644 index 0000000..467a09a --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/ProxyServer.class diff --git a/src/main/java/jp/plusplus/fbs/ProxyServer.java b/src/main/java/jp/plusplus/fbs/ProxyServer.java new file mode 100644 index 0000000..5a21789 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/ProxyServer.java @@ -0,0 +1,51 @@ +package jp.plusplus.fbs;
+
+import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
+import jp.plusplus.fbs.storage.ChunkLoadManager;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.world.World;
+import net.minecraftforge.common.ForgeChunkManager;
+
+/**
+ * Created by plusplus_F on 2015/01/31.
+ */
+public class ProxyServer {
+
+ public World getClientWorld() {
+ return null;
+ }
+ public void register() {
+
+ Registry.RegisterOreDictionary();
+ Registry.RegisterCraftingRecipes();
+ Registry.RegisterChestContents();
+ Registry.RegisterEntities();
+ Registry.RegisterTileEntities();
+ Registry.RegisterPotion();
+ Registry.RegisterWorldGen();
+
+ registerAchievement();
+
+ ForgeChunkManager.setForcedChunkLoadingCallback(FBS.instance, ChunkLoadManager.instance());
+ }
+ public int registerRenderer(ISimpleBlockRenderingHandler renderer){
+ return -1;
+ }
+ public void registerAchievement(){
+ //AchievementChecker.register();
+ }
+
+ public void loadNEI(){}
+ public EntityPlayer getEntityPlayerInstance(){
+ return null;
+ }
+
+ // なんでクラスそのものにCLIENT限定とかつけてんの?
+ public float getRenderPartialTicks(){
+ return 0;
+ }
+ public void setRenderPartialTicks(float f){
+ }
+ public void updateTimer(){
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/RecipeBladeSpice.class b/src/main/java/jp/plusplus/fbs/RecipeBladeSpice.class Binary files differnew file mode 100644 index 0000000..fb15368 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/RecipeBladeSpice.class diff --git a/src/main/java/jp/plusplus/fbs/RecipeBladeSpice.java b/src/main/java/jp/plusplus/fbs/RecipeBladeSpice.java new file mode 100644 index 0000000..e396cec --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/RecipeBladeSpice.java @@ -0,0 +1,122 @@ +package jp.plusplus.fbs;
+
+import jp.plusplus.fbs.alchemy.AlchemyRegistry;
+import jp.plusplus.fbs.alchemy.ItemAlchemyIntermediateMaterial;
+import jp.plusplus.fbs.alchemy.characteristic.CharacteristicBase;
+import jp.plusplus.fbs.alchemy.characteristic.CharacteristicQuality;
+import net.minecraft.inventory.InventoryCrafting;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.item.ItemSword;
+import net.minecraft.item.crafting.IRecipe;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.world.World;
+
+import java.util.ArrayList;
+
+/**
+ * Created by plusplus_F on 2016/02/23.
+ */
+public class RecipeBladeSpice implements IRecipe {
+ public static final String AMOUNT="fbs.bladeSpiceAmount";
+ public static final String EFFECTS="fbs.bladeSpiceEffect";
+
+ private ItemStack result;
+ @Override
+ public boolean matches(InventoryCrafting p_77569_1_, World p_77569_2_) {
+ result = null;
+ int size = p_77569_1_.getSizeInventory();
+
+ //剣と刃薬を探す
+ ItemStack sword = null;
+ NBTTagCompound now=null;
+ ArrayList<CharacteristicBase> cbList = null;
+ for (int i = 0; i < size; i++) {
+ ItemStack itemStack = p_77569_1_.getStackInSlot(i);
+ if (itemStack == null) continue;
+ Item item = itemStack.getItem();
+
+ if (item instanceof ItemSword) {
+ if (sword != null) return false;
+
+ now = itemStack.getTagCompound();
+ if (now == null) {
+ sword = itemStack;
+ now = new NBTTagCompound();
+ } else if (!now.hasKey(AMOUNT)) {
+ sword = itemStack;
+ }
+ } else if (item instanceof ItemAlchemyIntermediateMaterial && itemStack.getItemDamage() == 5) {
+ if (cbList != null) return false;
+ cbList = AlchemyRegistry.ReadCharacteristicFromNBT(itemStack.getTagCompound());
+ } else {
+ //剣でもなく刃薬以外なら弾く
+ return false;
+ }
+ }
+ if (sword == null || now==null || cbList == null || cbList.isEmpty()) return false;
+
+ result = new ItemStack(sword.getItem(), sword.stackSize, sword.getItemDamage());
+ NBTTagCompound nbt = (NBTTagCompound)now.copy();
+ int amount=16;
+
+ //書き込む特性と、特性が持続する回数を決定する
+ ArrayList<CharacteristicBase> cbs=new ArrayList<CharacteristicBase>();
+ for(CharacteristicBase cb : cbList){
+ if(cb instanceof CharacteristicQuality){
+ amount=(int)(amount*cb.getMPScale());
+ }
+ else{
+ cbs.add(cb);
+ }
+ }
+
+ //書き込む
+ NBTTagCompound tagCB=new NBTTagCompound();
+ nbt.setInteger(AMOUNT, amount);
+ AlchemyRegistry.WriteCharacteristicToNBT(tagCB, cbs);
+ nbt.setTag(EFFECTS, tagCB);
+ result.setTagCompound(nbt);
+
+ return true;
+ }
+
+ @Override
+ public ItemStack getCraftingResult(InventoryCrafting p_77572_1_) {
+ return result;
+ }
+
+ @Override
+ public int getRecipeSize() {
+ return 2;
+ }
+
+ @Override
+ public ItemStack getRecipeOutput() {
+ return result;
+ }
+
+ public static ArrayList<CharacteristicBase> getCharacteristics(ItemStack sword){
+ if(sword.getItem() instanceof ItemSword && sword.getTagCompound()!=null && sword.getTagCompound().hasKey(RecipeBladeSpice.AMOUNT)){
+ return AlchemyRegistry.ReadCharacteristicFromNBT(sword.getTagCompound().getCompoundTag(RecipeBladeSpice.EFFECTS));
+ }
+ return new ArrayList<CharacteristicBase>();
+ }
+
+ public static void consumeBladeSpiceAmount(ItemStack sword){
+ if(sword.getItem() instanceof ItemSword){
+ NBTTagCompound nbt=sword.getTagCompound();
+ if(nbt==null || !nbt.hasKey(AMOUNT)) return;
+
+ int t=nbt.getInteger(AMOUNT)-1;
+ if(t>0){
+ nbt.removeTag(AMOUNT);
+ nbt.setInteger(AMOUNT, t);
+ }
+ else{
+ nbt.removeTag(AMOUNT);
+ nbt.removeTag(EFFECTS);
+ }
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/RecipePotionBless.class b/src/main/java/jp/plusplus/fbs/RecipePotionBless.class Binary files differnew file mode 100644 index 0000000..57ff5ff --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/RecipePotionBless.class diff --git a/src/main/java/jp/plusplus/fbs/RecipePotionBless.java b/src/main/java/jp/plusplus/fbs/RecipePotionBless.java new file mode 100644 index 0000000..214cd00 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/RecipePotionBless.java @@ -0,0 +1,87 @@ +package jp.plusplus.fbs;
+
+import jp.plusplus.fbs.alchemy.AlchemyRegistry;
+import jp.plusplus.fbs.alchemy.ItemAlchemyIntermediateMaterial;
+import jp.plusplus.fbs.alchemy.characteristic.CharacteristicBase;
+import jp.plusplus.fbs.alchemy.characteristic.CharacteristicQuality;
+import jp.plusplus.fbs.item.ItemCore;
+import net.minecraft.enchantment.Enchantment;
+import net.minecraft.enchantment.EnchantmentHelper;
+import net.minecraft.inventory.InventoryCrafting;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.item.ItemSword;
+import net.minecraft.item.crafting.IRecipe;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.world.World;
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+/**
+ * Created by plusplus_F on 2016/02/23.
+ */
+public class RecipePotionBless implements IRecipe {
+ public static final int LV=2;
+
+ private ItemStack result;
+ @Override
+ public boolean matches(InventoryCrafting p_77569_1_, World p_77569_2_) {
+ result = null;
+ int size = p_77569_1_.getSizeInventory();
+
+ //装備と祝福ポーションを探す
+ ItemStack tool = null;
+ ItemStack pot=null;
+ for (int i = 0; i < size; i++) {
+ ItemStack itemStack = p_77569_1_.getStackInSlot(i);
+ if (itemStack == null) continue;
+ Item item = itemStack.getItem();
+
+ if (item.isItemTool(itemStack) && item.getItemEnchantability(itemStack)>0) {
+ if (tool != null) return false;
+ tool=itemStack;
+ if(tool.isItemEnchanted()){
+ Map m= EnchantmentHelper.getEnchantments(tool);
+ if(m.containsKey(Enchantment.unbreaking.effectId)){
+ return false;
+ }
+ }
+ } else if (item== ItemCore.potionBless) {
+ if(pot==null) pot=itemStack;
+ else return false;
+ } else {
+ return false;
+ }
+ }
+ if (tool == null || pot==null) return false;
+
+ result = new ItemStack(tool.getItem(), tool.stackSize, tool.getItemDamage());
+ if(tool.hasTagCompound()) result.setTagCompound((NBTTagCompound)tool.getTagCompound().copy());
+ else result.setTagCompound(new NBTTagCompound());
+
+ Map m=null;
+ if(result.isItemEnchanted()) m=EnchantmentHelper.getEnchantments(result);
+ else m=new LinkedHashMap();
+
+ m.put(Enchantment.unbreaking.effectId, LV);
+ EnchantmentHelper.setEnchantments(m, result);
+ return true;
+ }
+
+ @Override
+ public ItemStack getCraftingResult(InventoryCrafting p_77572_1_) {
+ return result;
+ }
+
+ @Override
+ public int getRecipeSize() {
+ return 2;
+ }
+
+ @Override
+ public ItemStack getRecipeOutput() {
+ return result;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/Registry$BookData.class b/src/main/java/jp/plusplus/fbs/Registry$BookData.class Binary files differnew file mode 100644 index 0000000..b49936e --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/Registry$BookData.class diff --git a/src/main/java/jp/plusplus/fbs/Registry$ChestContent.class b/src/main/java/jp/plusplus/fbs/Registry$ChestContent.class Binary files differnew file mode 100644 index 0000000..98d3492 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/Registry$ChestContent.class diff --git a/src/main/java/jp/plusplus/fbs/Registry$ItemManaContainer.class b/src/main/java/jp/plusplus/fbs/Registry$ItemManaContainer.class Binary files differnew file mode 100644 index 0000000..1bd5b48 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/Registry$ItemManaContainer.class diff --git a/src/main/java/jp/plusplus/fbs/Registry$ItemSanity.class b/src/main/java/jp/plusplus/fbs/Registry$ItemSanity.class Binary files differnew file mode 100644 index 0000000..3c13449 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/Registry$ItemSanity.class diff --git a/src/main/java/jp/plusplus/fbs/Registry$MagicCircle.class b/src/main/java/jp/plusplus/fbs/Registry$MagicCircle.class Binary files differnew file mode 100644 index 0000000..997fc22 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/Registry$MagicCircle.class diff --git a/src/main/java/jp/plusplus/fbs/Registry$MagicData.class b/src/main/java/jp/plusplus/fbs/Registry$MagicData.class Binary files differnew file mode 100644 index 0000000..a23a99a --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/Registry$MagicData.class diff --git a/src/main/java/jp/plusplus/fbs/Registry$MobSanity.class b/src/main/java/jp/plusplus/fbs/Registry$MobSanity.class Binary files differnew file mode 100644 index 0000000..6e9a5fe --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/Registry$MobSanity.class diff --git a/src/main/java/jp/plusplus/fbs/Registry$RecipePair.class b/src/main/java/jp/plusplus/fbs/Registry$RecipePair.class Binary files differnew file mode 100644 index 0000000..3d96f68 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/Registry$RecipePair.class diff --git a/src/main/java/jp/plusplus/fbs/Registry$WeightedTrouble.class b/src/main/java/jp/plusplus/fbs/Registry$WeightedTrouble.class Binary files differnew file mode 100644 index 0000000..adcca9f --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/Registry$WeightedTrouble.class diff --git a/src/main/java/jp/plusplus/fbs/Registry.class b/src/main/java/jp/plusplus/fbs/Registry.class Binary files differnew file mode 100644 index 0000000..8c21b6c --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/Registry.class diff --git a/src/main/java/jp/plusplus/fbs/Registry.java b/src/main/java/jp/plusplus/fbs/Registry.java new file mode 100644 index 0000000..0149d5e --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/Registry.java @@ -0,0 +1,1526 @@ +package jp.plusplus.fbs;
+
+import cpw.mods.fml.common.FMLLog;
+import cpw.mods.fml.common.Loader;
+import cpw.mods.fml.common.registry.EntityRegistry;
+import cpw.mods.fml.common.registry.GameRegistry;
+import cpw.mods.fml.relauncher.CoreModManager;
+import jp.plusplus.fbs.api.*;
+import jp.plusplus.fbs.block.BlockCore;
+import jp.plusplus.fbs.block.BlockBlock;
+import jp.plusplus.fbs.entity.*;
+import jp.plusplus.fbs.api.event.PlayerDecodedBookEvent;
+import jp.plusplus.fbs.exprop.FBSEntityProperties;
+import jp.plusplus.fbs.exprop.SanityManager;
+import jp.plusplus.fbs.item.ItemCore;
+import jp.plusplus.fbs.item.ItemGem;
+import jp.plusplus.fbs.magic.*;
+import jp.plusplus.fbs.magic.enchant.*;
+import jp.plusplus.fbs.magic.resonance.FlexibleResonance;
+import jp.plusplus.fbs.magic.resonance.ShapedResonance;
+import jp.plusplus.fbs.mod.ShopAuthor;
+import jp.plusplus.fbs.mod.ShopWitch;
+import jp.plusplus.fbs.potion.PotionCleverness;
+import jp.plusplus.fbs.potion.PotionContract;
+import jp.plusplus.fbs.pottery.PotteryRegistry;
+import jp.plusplus.fbs.pottery.TileEntityKiln;
+import jp.plusplus.fbs.pottery.TileEntityPottersWheel;
+import jp.plusplus.fbs.pottery.TileEntityPottery;
+import jp.plusplus.fbs.storage.TileEntityMeal;
+import jp.plusplus.fbs.storage.TileEntityMealInlet;
+import jp.plusplus.fbs.storage.TileEntityMealOutletSingle;
+import jp.plusplus.fbs.storage.TileEntityMealTerminal;
+import jp.plusplus.fbs.tileentity.*;
+import jp.plusplus.fbs.trouble.*;
+import jp.plusplus.fbs.world.autumn.WorldProviderAutumn;
+import jp.plusplus.fbs.world.biome.BiomeAutumn;
+import jp.plusplus.fbs.world.crack.WorldProviderCrack;
+import jp.plusplus.fbs.world.crack.biome.BiomeGenCrack;
+import jp.plusplus.fbs.world.crack.structure.MapGenSchool;
+import jp.plusplus.fbs.world.structure.MapGenStudy;
+import jp.plusplus.fbs.world.structure.StructureSealedLib1;
+import jp.plusplus.fbs.world.structure.StructureSealedLibStart;
+import net.minecraft.block.Block;
+import net.minecraft.block.material.Material;
+import net.minecraft.enchantment.EnchantmentHelper;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.boss.EntityWither;
+import net.minecraft.entity.monster.*;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.Blocks;
+import net.minecraft.init.Items;
+import net.minecraft.inventory.InventoryCrafting;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemDye;
+import net.minecraft.item.ItemStack;
+import net.minecraft.item.crafting.IRecipe;
+import net.minecraft.item.crafting.ShapedRecipes;
+import net.minecraft.item.crafting.ShapelessRecipes;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.potion.Potion;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.StatCollector;
+import net.minecraft.util.WeightedRandomChestContent;
+import net.minecraft.world.World;
+import net.minecraft.world.biome.BiomeGenBase;
+import net.minecraft.world.gen.structure.MapGenStructureIO;
+import net.minecraftforge.common.BiomeManager;
+import net.minecraftforge.common.ChestGenHooks;
+import net.minecraftforge.common.DimensionManager;
+import net.minecraftforge.common.MinecraftForge;
+import net.minecraftforge.common.config.Configuration;
+import net.minecraftforge.fluids.FluidContainerRegistry;
+import net.minecraftforge.oredict.OreDictionary;
+import net.minecraftforge.oredict.ShapedOreRecipe;
+import net.minecraftforge.oredict.ShapelessOreRecipe;
+import shift.mceconomy2.api.MCEconomyAPI;
+import shift.sextiarysector.SextiarySector;
+
+import java.util.*;
+
+/**
+ * Createdby pluslus_Fon 2015/06/06.
+ * レシピやらなんやらを一括で管理しているクラス
+ * なにか追加したかったらとりあえずここのstaticなメソッドをみるといいよ
+ */
+public class Registry {
+ private static Registry instance=new Registry();
+
+ private Random rand=new Random();
+ private HashMap<String, BookData> books=new HashMap<String, BookData>();
+ private HashMap<String, MagicData> magics=new HashMap<String, MagicData>();
+ private ArrayList<IResonance> resonances=new ArrayList<IResonance>();
+ private ArrayList<ChestContent> chestContents=new ArrayList<ChestContent>();
+ private ArrayList<RecipePair> craftingRecipes=new ArrayList<RecipePair>();
+ private ArrayList<MagicCircle> magicCircles=new ArrayList<MagicCircle>();
+ private ArrayList<ItemSanity> sanityItems=new ArrayList<ItemSanity>();
+ private ArrayList<ItemManaContainer> manaItems=new ArrayList<ItemManaContainer>();
+ private ArrayList<MobSanity> sanityMobs=new ArrayList<MobSanity>();
+ public ArrayList<PotteryRegistry.PotteryPair> potteries=new ArrayList<PotteryRegistry.PotteryPair>();
+ private ArrayList<WeightedTrouble> troubles=new ArrayList<WeightedTrouble>();
+ private ArrayList<String> fortuneCookies=new ArrayList<String>();
+ private int troublesWeightSum;
+
+ public static int eIdButterfly;
+ public static int eIdProjectileBase;
+ public static int eIdDig;
+ public static int eIdArrow;
+ public static int eIdWedge;
+ public static int eIdFireBolt;
+ public static int eIdIceSpear;
+ public static int eIdCanon;
+ public static int eIdHealingBall;
+ public static int eIdHealingRain;
+ public static int eIdTeleport;
+ public static int eIdArrowResona;
+ public static int eIdTableware;
+ public static int eIdAuthor;
+ public static int eIdDummy;
+
+ public static int shopMCE2Id;
+ public static int shopAuthorId;
+
+ public static int bIdAutumn=42;
+ public static BiomeGenBase biomeAutumn;
+ public static int bIdCrack=43;
+ public static BiomeGenBase biomeCrack;
+
+ public static int pIdContract=80;
+ public static Potion potionContract;
+ public static int pIdCleverness=81;
+ public static Potion potionCleverness;
+
+ public static void RegisterOreDictionary() {
+ String[] dyes = {"Black", "Red", "Green", "Brown", "Blue", "Purple", "Cyan", "LightGray", "Gray", "Pink", "Lime", "Yellow", "LightBlue", "Magenta", "Orange", "White"};
+
+ for(int i=0;i<3;i++){
+ OreDictionary.registerOre(ItemGem.NAMES[i], new ItemStack(ItemCore.gem, 1, i));
+ OreDictionary.registerOre("ore"+BlockBlock.NAMES[i], new ItemStack(BlockCore.ore, 1, i));
+ OreDictionary.registerOre("block"+BlockBlock.NAMES[i], new ItemStack(BlockCore.block, 1, i));
+ }
+
+ for (int i = 0; i < ItemGem.NAMES.length; i++) {
+ if(i!=3) OreDictionary.registerOre(ItemGem.NAMES[i], new ItemStack(ItemCore.gem, 1, i));
+ OreDictionary.registerOre("fbs.gem", new ItemStack(ItemCore.gem, 1, i));
+ }
+ OreDictionary.registerOre("fbs.gem", Items.diamond);
+ OreDictionary.registerOre("fbs.gem", Items.emerald);
+
+ for (int i = 0; i < 16; i++) {
+ String s = ItemDye.field_150921_b[i];
+ OreDictionary.registerOre("dye" + dyes[i], new ItemStack(ItemCore.charm, 1, i));
+ }
+ OreDictionary.registerOre("fbs.charm", new ItemStack(ItemCore.charm, 1, OreDictionary.WILDCARD_VALUE));
+
+
+ RegisterItemSanity(new ItemStack(ItemCore.lavender), 1, 2);
+ RegisterItemSanity(new ItemStack(ItemCore.potionSan), 3, 10);
+ RegisterItemSanity(new ItemStack(Items.apple), 1, 2);
+ RegisterItemSanity(new ItemStack(Items.golden_carrot), 2, 4);
+ RegisterItemSanity(new ItemStack(Items.golden_apple, 1, 0), 2, 6);
+ RegisterItemSanity(new ItemStack(Items.golden_apple, 1, 1), 3, 10);
+ RegisterItemSanity(new ItemStack(Items.rotten_flesh), 1, -2);
+ RegisterItemSanity(new ItemStack(Items.spider_eye), 1, -2);
+ }
+ public static void RegisterCraftingRecipes(){
+ FluidContainerRegistry.registerFluidContainer(BlockCore.mana, new ItemStack(ItemCore.bucketMana), new ItemStack(Items.bucket));
+
+ GameRegistry.addRecipe(new RecipeBladeSpice());
+ GameRegistry.addRecipe(new RecipePotionBless());
+
+ GameRegistry.addShapelessRecipe(new ItemStack(ItemCore.seedRedLily, 2), new ItemStack(ItemCore.redLily));
+ GameRegistry.addShapelessRecipe(new ItemStack(ItemCore.seedRedLily, 2), new ItemStack(ItemCore.redLilyDirty));
+ GameRegistry.addShapelessRecipe(new ItemStack(Items.gunpowder), new ItemStack(ItemCore.alchemyIntermediateMaterial, 1, 1));
+ GameRegistry.addShapelessRecipe(new ItemStack(ItemCore.cookieFortune), new ItemStack(Items.cookie), new ItemStack(Items.paper));
+
+ for(int i=0;i< BlockBlock.NAMES.length;i++){
+ GameRegistry.addRecipe(new ItemStack(BlockCore.block, 1, i), "xxx","xxx","xxx", 'x',new ItemStack(ItemCore.gem, 1, i));
+ GameRegistry.addShapelessRecipe(new ItemStack(ItemCore.gem, 9, i), new ItemStack(BlockCore.block, 1, i));
+ GameRegistry.addSmelting(new ItemStack(BlockCore.ore, 1, i),new ItemStack(ItemCore.gem, 1, i), 1.0f);
+ }
+
+ GameRegistry.addRecipe(new ItemStack(ItemCore.bookmark), " s"," p ","p ", 's',new ItemStack(Items.string), 'p',new ItemStack(Items.paper));
+ GameRegistry.addRecipe(new ItemStack(ItemCore.monocleWood), "ii ","i i"," i ", 'i', new ItemStack(BlockCore.plank));
+ GameRegistry.addRecipe(new ItemStack(ItemCore.monocle), "ii ","iei"," i ", 'i',new ItemStack(Items.iron_ingot), 'e',new ItemStack(Items.ender_pearl));
+ GameRegistry.addRecipe(new ItemStack(ItemCore.monocleGold), "ii ","iei"," i ", 'i',new ItemStack(Items.gold_ingot), 'e',new ItemStack(Items.ender_eye));
+ GameRegistry.addRecipe(new ItemStack(BlockCore.workbench), "ww","ww", 'w',new ItemStack(BlockCore.plank));
+ GameRegistry.addRecipe(new ItemStack(BlockCore.extractingFurnace), "sss","fwb","sss", 'w',new ItemStack(BlockCore.plank), 's',new ItemStack(Blocks.cobblestone), 'f',new ItemStack(Blocks.furnace), 'b',new ItemStack(Items.bucket));
+ GameRegistry.addRecipe(new ItemStack(BlockCore.fillingTable), "sss","sws","sss", 'w',new ItemStack(BlockCore.plank), 's',new ItemStack(Blocks.cobblestone));
+ GameRegistry.addRecipe(new ItemStack(BlockCore.bookshelf), "www","bbb","www", 'w',new ItemStack(BlockCore.plank), 'b',new ItemStack(Items.book));
+ GameRegistry.addRecipe(new ItemStack(ItemCore.net), " w"," s ","s ", 'w',new ItemStack(Blocks.wool, 1, OreDictionary.WILDCARD_VALUE), 's',new ItemStack(ItemCore.stick));
+ GameRegistry.addRecipe(new ShapedOreRecipe(BlockCore.bonfire, "w w"," w ","w w", 'w',"logWood"));
+
+ GameRegistry.addRecipe(new ItemStack(BlockCore.pottersWheel), "ccc","sws", 'c',new ItemStack(Blocks.stone_slab), 's',new ItemStack(Blocks.cobblestone), 'w',Blocks.crafting_table);
+ GameRegistry.addRecipe(new ItemStack(BlockCore.kiln), "sss","s s","fff", 's',new ItemStack(Blocks.cobblestone), 'f',Blocks.furnace);
+ GameRegistry.addRecipe(new ItemStack(ItemCore.clayWet, 8), "ccc","cwc","ccc", 'c',new ItemStack(Items.clay_ball), 'w',new ItemStack(Items.water_bucket));
+ GameRegistry.addRecipe(new ItemStack(ItemCore.clayGlow, 8), "ccc","cwc","ccc", 'c',new ItemStack(ItemCore.clayWet), 'w',new ItemStack(Items.glowstone_dust));
+
+ GameRegistry.addRecipe(new ItemStack(BlockCore.tableAlchemist), "bbb","www","w w", 'b',Items.book, 'w', BlockCore.plank);
+ GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(BlockCore.alchemyCauldron), "gjg","ggg","b b", 'b',Blocks.brick_block, 'g',Items.gold_ingot, 'j', "fbs.gem"));
+ GameRegistry.addRecipe(new ItemStack(ItemCore.basket), "sss","scs","sss", 's',Items.stick, 'c', Blocks.chest);
+
+ GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(BlockCore.schoolTable, 4), "www", "i i", 'w',"plankWood", 'i',Items.iron_ingot));
+
+ GameRegistry.addShapelessRecipe(new ItemStack(ItemCore.stoneActive), new ItemStack(ItemCore.stoneInactive), new ItemStack(ItemCore.alchemyIntermediateMaterial, 1, 4));
+ GameRegistry.addShapelessRecipe(new ItemStack(ItemCore.stoneActiveMale), new ItemStack(ItemCore.stoneInactive), new ItemStack(ItemCore.alchemyIntermediateMaterial, 1, 4), new ItemStack(ItemCore.gem, 1, 1));
+ GameRegistry.addShapelessRecipe(new ItemStack(ItemCore.stoneActiveFemale), new ItemStack(ItemCore.stoneInactive), new ItemStack(ItemCore.alchemyIntermediateMaterial, 1, 4), new ItemStack(ItemCore.gem, 1, 0));
+
+ GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ItemCore.gem, 1, 3), " t ","tgt"," t ", 't',new ItemStack(ItemCore.alchemyMaterial, 1, 40), 'g',"fbs.gem"));
+ GameRegistry.addShapedRecipe(new ItemStack(ItemCore.infinityHelm), "ggg", "g g", 'g', new ItemStack(ItemCore.gem, 1, 3));
+ GameRegistry.addShapedRecipe(new ItemStack(ItemCore.infinityArmor), "g g","ggg","ggg", 'g',new ItemStack(ItemCore.gem,1,3));
+ GameRegistry.addShapedRecipe(new ItemStack(ItemCore.infinityLegs), "ggg","g g","g g", 'g',new ItemStack(ItemCore.gem,1,3));
+ GameRegistry.addShapedRecipe(new ItemStack(ItemCore.infinityBoots), "g g","g g", 'g',new ItemStack(ItemCore.gem,1,3));
+
+ //救済措置
+ if(FBS.enableRecipeOak) GameRegistry.addRecipe(new ItemStack(BlockCore.plank, 8), "www","wew","www", 'w',new ItemStack(Blocks.planks, 1, 0), 'e',new ItemStack(Items.ender_pearl));
+ if(FBS.enableRecipeLavender) GameRegistry.addRecipe(new ItemStack(ItemCore.seedLavender, 4), " s ","sps"," s ", 's',new ItemStack(Items.wheat_seeds), 'p',new ItemStack(Items.dye, 1, 5));
+ if(FBS.enableRecipeLavender) GameRegistry.addRecipe(new ItemStack(ItemCore.seedRedLily, 4), " s ", "sps", " s ", 's', new ItemStack(Items.wheat_seeds), 'p', new ItemStack(Items.dye, 1, 1));
+
+ RegisterShapedRecipe(new ItemStack(ItemCore.monocle), 400, "ii ", "i i", " i ", 'i', new ItemStack(Items.iron_ingot));
+ RegisterShapedRecipe(new ItemStack(ItemCore.monocleGold), 650, "ii ", "i i", " i ", 'i', new ItemStack(Items.gold_ingot));
+ RegisterShapedRecipe(new ItemStack(ItemCore.potionOblivion), 800, "nln", "lpl", "nln", 'n', new ItemStack(Items.nether_wart), 'l', new ItemStack(ItemCore.lavender), 'p', new ItemStack(Items.potionitem));
+ RegisterShapedRecipe(new ItemStack(ItemCore.potionSan), 500, "lll", "lpl", "lll", 'l', new ItemStack(ItemCore.lavender), 'p', new ItemStack(Items.potionitem));
+ RegisterShapedOreRecipe(new ItemStack(BlockCore.magicCore), 250, "ccc", "c c", "ccc", 'c', "fbs.charm");
+ RegisterShapedRecipe(new ItemStack(ItemCore.membership), 100, "ppp", "pip", "ppp", 'p', new ItemStack(Items.paper), 'i', new ItemStack(Items.dye, 1, 0));
+ RegisterShapedRecipe(new ItemStack(BlockCore.mirror), 800, "wgw", "wmw", "wgw", 'w', new ItemStack(BlockCore.plank), 'g',new ItemStack(Blocks.glass), 'm',new ItemStack(ItemCore.membership));
+ RegisterShapedOreRecipe(new ItemStack(ItemCore.bookWhite), 100, " i ", "cbc", 'i', new ItemStack(Items.dye, 1, 0), 'c', "fbs.charm", 'b', new ItemStack(ItemCore.bookBroken, 1, OreDictionary.WILDCARD_VALUE));
+ RegisterShapedRecipe(new ItemStack(BlockCore.portal2), 250, "www", "wbw", "www", 'w', new ItemStack(BlockCore.plank), 'b', new ItemStack(ItemCore.butterfly));
+ RegisterShapedOreRecipe(new ItemStack(BlockCore.mealCrystal), 2000, " r ", " d ", "s a", 'r', "blockRuby", 's', "blockSapphire", 'a', "blockAmethyst", 'd', new ItemStack(Blocks.diamond_block));
+ RegisterShapedOreRecipe(new ItemStack(BlockCore.mealInlet), 250, "g","p", 'g',"fbs.gem", 'p',"plankWood");
+ RegisterShapedOreRecipe(new ItemStack(BlockCore.mealOutletSingle), 250, "p","g", 'g',"fbs.gem", 'p',"plankWood");
+ RegisterShapedOreRecipe(new ItemStack(BlockCore.mealTerminal), 500, "g","c","g", 'g',"fbs.gem", 'c',new ItemStack(Blocks.chest));
+
+ RegisterShapedRecipe(new ItemStack(ItemCore.tableware, 2, 0), 10, "i "," "," ", 'i',new ItemStack(Items.iron_ingot));
+ RegisterShapedRecipe(new ItemStack(ItemCore.tableware, 2, 1), 10, " i "," "," ", 'i',new ItemStack(Items.iron_ingot));
+ RegisterShapedRecipe(new ItemStack(ItemCore.tableware, 2, 2), 10, " i"," "," ", 'i',new ItemStack(Items.iron_ingot));
+
+ RegisterShapelessRecipe(new ItemStack(Blocks.mossy_cobblestone), 10, new ItemStack(Blocks.cobblestone), new ItemStack(Items.wheat_seeds));
+ RegisterShapelessRecipe(new ItemStack(Blocks.stonebrick,1,1), 10, new ItemStack(Blocks.stonebrick, 1, 0), new ItemStack(Items.wheat_seeds));
+ RegisterShapelessRecipe(new ItemStack(Blocks.grass), 10, new ItemStack(Blocks.dirt, 1, 0), new ItemStack(Items.wheat_seeds));
+ RegisterShapelessRecipe(new ItemStack(Blocks.mycelium), 10, new ItemStack(Blocks.dirt, 1, 0), new ItemStack(Blocks.red_mushroom));
+ RegisterShapelessRecipe(new ItemStack(Blocks.web), 50, new ItemStack(Items.string));
+ RegisterShapelessRecipe(new ItemStack(Blocks.ice), 25, new ItemStack(Items.water_bucket));
+ RegisterShapelessRecipe(new ItemStack(ItemCore.stick), 50, new ItemStack(Items.stick));
+
+ for(int i=0;i<16;i++){
+ RegisterShapelessRecipe(new ItemStack(ItemCore.charm, 1, i), 50, new ItemStack(Items.dye, 1, i));
+ }
+
+ RegisterShapelessOreRecipe(new ItemStack(ItemCore.staffHead1), 600, "fbs.charm", "fbs.gem");
+ RegisterShapelessOreRecipe(new ItemStack(ItemCore.staffHead2), 1200, "fbs.charm", "fbs.gem", "fbs.gem");
+ RegisterShapelessOreRecipe(new ItemStack(ItemCore.staffHead3), 1800, "fbs.charm", "fbs.gem", "fbs.gem", "fbs.gem");
+ RegisterShapelessOreRecipe(new ItemStack(ItemCore.staffHead4), 2400, "fbs.charm", "fbs.gem", "fbs.gem", "fbs.gem", "fbs.gem");
+ RegisterShapelessOreRecipe(new ItemStack(ItemCore.staffHead5), 3000, "fbs.charm", "fbs.gem", "fbs.gem", "fbs.gem", "fbs.gem", "fbs.gem");
+
+ RegisterShapedRecipe(new ItemStack(ItemCore.staff1_1), 100, " h", " s ", "s ", 'h', new ItemStack(ItemCore.staffHead1), 's', new ItemStack(ItemCore.stick));
+ RegisterShapedRecipe(new ItemStack(ItemCore.staff1_2), 100, " h"," s ","s ", 'h',new ItemStack(ItemCore.staffHead2), 's',new ItemStack(ItemCore.stick));
+ RegisterShapedRecipe(new ItemStack(ItemCore.staff1_3), 100, " h", " s ", "s ", 'h', new ItemStack(ItemCore.staffHead3), 's', new ItemStack(ItemCore.stick));
+ RegisterShapedRecipe(new ItemStack(ItemCore.staff1_4), 100, " h"," s ","s ", 'h',new ItemStack(ItemCore.staffHead4), 's',new ItemStack(ItemCore.stick));
+ RegisterShapedRecipe(new ItemStack(ItemCore.staff1_5), 100, " h", " s ", "s ", 'h', new ItemStack(ItemCore.staffHead5), 's', new ItemStack(ItemCore.stick));
+
+ RegisterShapedRecipe(new ItemStack(ItemCore.staff2_1), 200, " h ", " sh", "s ", 'h', new ItemStack(ItemCore.staffHead1), 's', new ItemStack(ItemCore.stick));
+ RegisterShapedRecipe(new ItemStack(ItemCore.staff2_2), 200, " h ", " sh", "s ", 'h', new ItemStack(ItemCore.staffHead2), 's', new ItemStack(ItemCore.stick));
+ RegisterShapedRecipe(new ItemStack(ItemCore.staff2_3), 200, " h ", " sh", "s ", 'h', new ItemStack(ItemCore.staffHead3), 's', new ItemStack(ItemCore.stick));
+ RegisterShapedRecipe(new ItemStack(ItemCore.staff2_4), 200, " h ", " sh", "s ", 'h', new ItemStack(ItemCore.staffHead4), 's', new ItemStack(ItemCore.stick));
+ RegisterShapedRecipe(new ItemStack(ItemCore.staff2_5), 200, " h ", " sh", "s ", 'h', new ItemStack(ItemCore.staffHead5), 's', new ItemStack(ItemCore.stick));
+
+ //------------------------------------マナ抽出----------------------------------------------
+
+ RegisterManaContainer(new ItemStack(Items.ender_pearl), 75);
+ RegisterManaContainer(new ItemStack(Items.ender_eye), 125);
+ RegisterManaContainer(new ItemStack(Items.dye, 1, 4), 50);
+ RegisterManaContainer(new ItemStack(Items.nether_star), 2000);
+ RegisterManaContainer(new ItemStack(ItemCore.stick), 50);
+ RegisterManaContainer(new ItemStack(ItemCore.charm, 1, 32767), 50);
+ RegisterManaContainer(new ItemStack(BlockCore.magicCore), 100);
+ RegisterManaContainer(new ItemStack(ItemCore.butterfly), 100);
+ RegisterManaContainer(new ItemStack(ItemCore.instantMana), 500);
+ RegisterManaContainer(new ItemStack(ItemCore.redLilyDirty), 25);
+
+ if(Loader.isModLoaded("Thaumcraft")){
+ RegisterManaContainer("Thaumcraft:ItemResource", 11, 100);
+ RegisterManaContainer("Thaumcraft:ItemResource", 12, 100);
+ RegisterManaContainer("Thaumcraft:blockCustomPlant", 5, 50);
+ }
+
+ //
+ PotteryRegistry.register();
+
+ //
+ RegisterFortuneCookieMessage("item");
+ RegisterFortuneCookieMessage("message");
+ RegisterFortuneCookieMessage("trivia");
+ }
+ public static void RegisterBooks(){
+ RegisterBook("fbs.voini", 1, false, 0.7f, 75, 1, 4, 10);
+ RegisterBook("fbs.nether", 3, false, 0.85f, 81, 1, 3, 10);
+ RegisterBook("fbs.zombiePig", 5, false, 0.75f, 88, 1, 8, 10);
+ RegisterBook("fbs.hero", 8, false, 0.7f, 96, 2, 6, 10);
+ RegisterBook("fbs.necro", 10, false, 0.65f, 110, 2, 4, 10);
+ RegisterBook("fbs.creeper", 13, false, 0.6f, 130, 3, 3, 10);
+ RegisterBook("fbs.sera", 15, false, 0.6f, 145, 2, 6, 10);
+ RegisterBook("fbs.rlyeh", 20, false, 0.5f, 180, 2, 8, 10);
+ RegisterBook("fbs.hastur", 23, false, 0.5f, 210, 2, 10, 10);
+ RegisterBook("fbs.ponape", 25, false, 0.5f, 230, 3, 8, 10);
+ RegisterBook("fbs.blaze", 28, false, 0.58f, 250, 2, 10, 10);
+ RegisterBook("fbs.dragon", 30, false, 0.55f, 280, 3, 10, 10);
+ RegisterBook("fbs.cassandra", 30, false, 0.55f, 280, 3, 10, 10);
+ RegisterBook("fbs.ender", 32, false, 0.60f, 300, 3, 8, 10);
+ RegisterBook("fbs.unauss", 35, false, 0.48f, 360, 4, 10, 10);
+ RegisterBook("fbs.villager", 38, false, 0.52f, 390, 5, 10, 10);
+ RegisterBook("fbs.eibon", 40, false, 0.4f, 430, 1, 100, 10);
+ }
+ public static void RegisterMagics() {
+ FBSRecipeAPI.AddMagic("fbs.touch", 3, 0.6f, 60, 2, 6, 10, "fbs.touch", 10, 5, 16, 64, MagicTouch.class);
+ FBSRecipeAPI.AddMagic("fbs.arrow", 3, 0.6f, 60, 2, 6, 10, "fbs.projectile", 10, 5, 16, 64, MagicArrow.class);
+ FBSRecipeAPI.AddMagic("fbs.cleverness", 3, 0.6f, 60, 2, 6, 10, "fbs.self", 3*20, 5, 8, 32, MagicCleverness.class);
+
+ FBSRecipeAPI.AddMagic("fbs.digTouch", 5, 0.5f, 70, 2, 6, 10, "fbs.touch", 20, 8, 16, 64, MagicDigTouch.class);
+ FBSRecipeAPI.AddMagic("fbs.dig", 5, 0.5f, 70, 2, 6, 10, "fbs.projectile", 20, 8, 16, 64, MagicDig.class);
+ FBSRecipeAPI.AddMagic("fbs.wedge", 5, 0.5f, 70, 2, 6, 10, "fbs.projectile", 20, 8f, 10, 32, MagicWedge.class);
+ FBSRecipeAPI.AddMagic("fbs.healingBall", 5, 0.35f, 75, 2, 6, 10, "fbs.utility", 2*20, 20f, 8, 16, MagicHealingBall.class);
+ FBSRecipeAPI.AddMagic("fbs.damageBoost", 5, 0.35f, 75, 2, 6, 10, "fbs.self", 5*20, 8f, 15, 18, MagicDamageBoost.class);
+ FBSRecipeAPI.AddMagic("fbs.poison", 5, 0.38f, 70, 2, 6, 10, "fbs.touch", 20*2, 5, 10, 32, MagicPoison.class);
+
+ FBSRecipeAPI.AddMagic("fbs.return", 8, 0.45f, 80, 2, 6, 10, "fbs.self", 20 * 8, 25, 6, 18, MagicReturn.class);
+ FBSRecipeAPI.AddMagic("fbs.regeneration", 8, 0.45f, 80, 2, 6, 10, "fbs.self", 20 * 5, 25, 6, 18, MagicRegeneration.class);
+ FBSRecipeAPI.AddMagic("fbs.vortex", 8, 0.45f, 80, 2, 6, 10, "fbs.range", 20, 10, 8, 32, MagicVortex.class);
+
+ FBSRecipeAPI.AddMagic("fbs.fireBolt", 10, 0.45f, 100, 2, 6, 10, "fbs.projectile", 20, 10, 16, 64, MagicFireBolt.class);
+ FBSRecipeAPI.AddMagic("fbs.butterfly", 10, 0.38f, 100, 2, 4, 10, "fbs.self", 3*20, 15, 16, 64, MagicButterfly.class);
+ FBSRecipeAPI.AddMagic("fbs.contract", 10, 0.40f, 120, 2, 6, 10, "fbs.utility", 6 * 20, 20, 1, 4, MagicContract.class);
+ RegisterMagicCircle("fbs.contract", "fffff", "f1 4f", "f f", "fb 2f", "fffff");
+
+ FBSRecipeAPI.AddMagic("fbs.jump", 13, 0.45f, 115, 2, 4, 10, "fbs.self", 20, 20, 12, 32, MagicJump.class);
+ FBSRecipeAPI.AddMagic("fbs.barrier", 13, 0.35f, 120, 2, 4, 10, "fbs.utility", 4*20, 30, 8, 16, MagicBarrier.class);
+ RegisterMagicCircle("fbs.barrier","555","5 5","555");
+
+ FBSRecipeAPI.AddMagic("fbs.speed", 15, 0.35f, 120, 3, 10, 10, "fbs.self", 5 * 20, 25, 6, 18, MagicSpeed.class);
+ FBSRecipeAPI.AddMagic("fbs.contractEffect", 15, 0.35f, 120, 3, 10, 10, "fbs.self", 5 * 20, 25, 6, 18, MagicContractEffect.class);
+
+ FBSRecipeAPI.AddMagic("fbs.dagon", 20, 0.35f, 150, 2, 6, 10, "fbs.self", 5 * 20, 30, 6, 18, MagicDagon.class);
+ FBSRecipeAPI.AddMagic("fbs.fireArmor", 20, 0.35f, 150, 3, 6, 10, "fbs.self", 5 * 20, 30, 6, 18, MagicFireArmor.class);
+ FBSRecipeAPI.AddMagic("fbs.warp", 20, 0.40f, 160, 2, 6, 10, "fbs.utility", 3*20, 35, 8, 32, MagicWarp.class);
+ RegisterMagicCircle("fbs.warp", "01234", "5 6", "7 8", "9 a", "bcdef");
+
+ FBSRecipeAPI.AddMagic("fbs.timeAcc", 30, 0.35f, 240, 1, 50, 10, "fbs.utility", 3 * 20, 50, 4, 12, MagicTimeAcc.class);
+ FBSRecipeAPI.AddMagic("fbs.timeTrace", 30, 0.35f, 240, 1, 50, 10, "fbs.utility", 3 * 20, 50, 4, 12, MagicTimeTrace.class);
+ RegisterMagicCircle("fbs.timeTrace", "444", "4 4", "444");
+ FBSRecipeAPI.AddMagic("fbs.copy", 30, 0.2f, 250, 4, 10, 10, "fbs.utility", 3*20, 60, 6, 18, MagicCopy.class);
+ RegisterMagicCircle("fbs.copy", "01234", "5edc6", "7b 58", "9421a", "bcdef");
+
+ FBSRecipeAPI.AddMagic("fbs.evKing", 31, 0.2f, 245, 4, 10, 10, "fbs.utility", 6 * 20, 50, 6, 18, MagicEvolutionKing.class);
+
+ FBSRecipeAPI.AddMagic("fbs.invisible", 35, 0.35f, 270, 4, 10, 10, "fbs.self", 6 * 20, 55, 4, 16, MagicInvisible.class);
+
+ FBSRecipeAPI.AddMagic("fbs.contemporary", 40, 0.35f, 320, 4, 10, 10, "fbs.self", 6*20, 58, 2, 8, MagicContemporary.class);
+ FBSRecipeAPI.AddMagic("fbs.summonVillager", 40, 0.35f, 320, 4, 10, 10, "fbs.self", 8 * 20, 60, 2, 8, MagicSummonVillager.class);
+ RegisterMagicCircle("fbs.summonVillager", "a2a", "2 2", "a2a");
+ FBSRecipeAPI.AddMagic("fbs.harvest", 40, 0.2f, 330, 4, 10, 10, "fbs.self", 3 * 20, 65, 2, 4, MagicHarvest.class);
+ RegisterMagicCircle("fbs.harvest", "bbbbb", "bf fb", "b b", "bf fb", "bbbbb");
+ FBSRecipeAPI.AddMagic("fbs.wish", 40, 0.1f, 450, 3, 8, 5, "fbs.utility", 15 * 20, 200, 1, 3, MagicWish.class);
+
+ //---------------------------レゾナンス-----------------------------------
+ RegisterBook("fbs.failure", 1, true, 1.0f, 1, 1, 6, 0);
+ RegisterMagic("fbs.failure", "fbs.self", 20, 1, 1, 1, MagicFailure.class);
+
+ RegisterBook("fbs.healingSelf", 10, true, 1.0f, 1, 1, 6, 0);
+ RegisterMagic("fbs.healingSelf", "fbs.self", 20*2, 150, 1, 1, MagicHealingSelf.class);
+ RegisterResonance("fbs.healingSelf", "fbs.healingBall", "fbs.regeneration");
+
+ RegisterBook("fbs.hurricane", 15, true, 1.0f, 1, 1, 6, 0);
+ RegisterMagic("fbs.hurricane", "fbs.range", 20, 200, 1, 1, MagicLoveHurricane.class);
+ RegisterResonance("fbs.hurricane", "fbs.vortex", "fbs.jump");
+
+ RegisterBook("resonance.fbs.touch", 10, true, 1.0f, 1, 1, 6, 0);
+ RegisterMagic("resonance.fbs.touch", "fbs.touch", 20*2, 80, 1, 1, MagicTouchFlexible.class);
+ RegisterResonance(new FlexibleResonance("fbs.touch"));
+
+ RegisterBook("resonance.fbs.arrow", 12, true, 1.0f, 1, 1, 6, 0);
+ RegisterMagic("resonance.fbs.arrow", "fbs.projectile", 20*2, 80, 1, 1, MagicArrowFlexible.class);
+ RegisterResonance(new FlexibleResonance("fbs.arrow"));
+
+ RegisterBook("resonance.fbs.vortex", 15, true, 1.0f, 1, 1, 6, 0);
+ RegisterMagic("resonance.fbs.vortex", "fbs.range", 20*2, 80, 1, 1, MagicVortexFlexible.class);
+ RegisterResonance(new FlexibleResonance("fbs.vortex"));
+ }
+ public static void RegisterEntities(){
+ EntityRegistry.registerModEntity(EntityButterfly.class, FBS.MODID+"-butterfly", eIdButterfly, FBS.instance, 256, 1, false);
+ EntityRegistry.registerModEntity(EntityTableware.class, FBS.MODID+"-tableware", eIdTableware, FBS.instance, 256, 1, true);
+ EntityRegistry.registerModEntity(EntityMagicAuthor.class, FBS.MODID+"-author", eIdAuthor, FBS.instance, 256, 1, false);
+ EntityRegistry.registerModEntity(EntityLivingDummy.class, FBS.MODID+"-dummy", eIdDummy, FBS.instance, 256, 1, false);
+
+ EntityRegistry.registerModEntity(EntityMagicProjectileBase.class, FBS.MODID+"-base", eIdProjectileBase, FBS.instance, 128, 5, true);
+ EntityRegistry.registerModEntity(EntityMagicDig.class, FBS.MODID+"-dig", eIdDig, FBS.instance, 128, 5, true);
+ EntityRegistry.registerModEntity(EntityMagicArrow.class, FBS.MODID + "-arrow", eIdArrow, FBS.instance, 128, 5, true);
+ EntityRegistry.registerModEntity(EntityMagicWedge.class, FBS.MODID + "-wedge", eIdWedge, FBS.instance, 128, 5, true);
+ EntityRegistry.registerModEntity(EntityMagicFireBolt.class, FBS.MODID + "-fireBolt", eIdFireBolt, FBS.instance, 128, 5, true);
+ EntityRegistry.registerModEntity(EntityMagicHealingBall.class, FBS.MODID + "-healingBall", eIdHealingBall, FBS.instance, 128, 5, true);
+ EntityRegistry.registerModEntity(EntityMagicArrowFlexible.class, FBS.MODID + "-arrowFlexible", eIdArrowResona, FBS.instance, 128, 5, true);
+
+ RegisterMobSanity(EntityZombie.class, 1, -2);
+ RegisterMobSanity(EntityPigZombie.class, 1, -2);
+ RegisterMobSanity(EntityEnderman.class, 1, -6);
+ RegisterMobSanity(EntityWither.class, 3, -8);
+ }
+ public static void RegisterTileEntities(){
+ GameRegistry.registerTileEntity(TileEntityExtractingFurnace.class, FBS.MODID + "-extractingFurnace");
+ GameRegistry.registerTileEntity(TileEntityFillingTable.class, FBS.MODID + "-fillingTable");
+ GameRegistry.registerTileEntity(TileEntityFBSWorkbench.class, FBS.MODID + "-workbench");
+ GameRegistry.registerTileEntity(TileEntityMagicCore.class, FBS.MODID + "-magicCore");
+ GameRegistry.registerTileEntity(TileEntityPottery.class, FBS.MODID+"-pottery");
+ GameRegistry.registerTileEntity(TileEntityPottersWheel.class, FBS.MODID+"-pottersWheel");
+ GameRegistry.registerTileEntity(TileEntityKiln.class, FBS.MODID+"-kiln");
+ GameRegistry.registerTileEntity(TileEntityAlchemyCauldron.class, FBS.MODID+"-alchemyCauldron");
+ GameRegistry.registerTileEntity(TileEntityForRender.class, FBS.MODID+"-forRender");
+ GameRegistry.registerTileEntity(TileEntityPortalWarp.class, FBS.MODID+"-portal1");
+ GameRegistry.registerTileEntity(TileEntityHavestable.class, FBS.MODID+"-harvestable1");
+ GameRegistry.registerTileEntity(TileEntityHavestableMushroom.class, FBS.MODID+"-harvestable2");
+ GameRegistry.registerTileEntity(TileEntityHavestableGrass.class, FBS.MODID+"-harvestable3");
+ GameRegistry.registerTileEntity(TileEntityMirror.class, FBS.MODID+"-mirror");
+ GameRegistry.registerTileEntity(TileEntityMeal.class, FBS.MODID+"-meal");
+ GameRegistry.registerTileEntity(TileEntityMealInlet.class, FBS.MODID+"-mealInlet");
+ GameRegistry.registerTileEntity(TileEntityMealOutletSingle.class, FBS.MODID+"-mealOutletSingle");
+ GameRegistry.registerTileEntity(TileEntityMealTerminal.class, FBS.MODID+"-mealTerminal");
+ }
+ public static void RegisterPotion(){
+ potionContract=new PotionContract(pIdContract);
+ potionCleverness=new PotionCleverness(pIdCleverness);
+ }
+ public static void RegisterChestContents(){
+ int recipeBookNum=11;
+
+ //------------------- 封印された図書館 --------------------------------
+ RegisterChestContent(0, new ItemStack(ItemCore.lavender, 5), 10);
+ RegisterChestContent(0, new ItemStack(ItemCore.seedLavender, 5), 10);
+ RegisterChestContent(0, new ItemStack(ItemCore.enchantScroll, 1), 10);
+ RegisterChestContent(0, new ItemStack(ItemCore.potionBless, 3), 10);
+ RegisterChestContent(0, new ItemStack(Items.dye, 3, 0), 10);
+ RegisterChestContent(0, new ItemStack(Items.leather, 3), 8);
+ RegisterChestContent(0, new ItemStack(ItemCore.redLily, 5), 5);
+ RegisterChestContent(0, new ItemStack(ItemCore.seedRedLily, 5), 5);
+ for(int i=0;i<recipeBookNum;i++) RegisterChestContent(0, new ItemStack(ItemCore.alchemyRecipe, 1, i), 5);
+ RegisterChestContent(0, new ItemStack(Items.iron_ingot, 3), 5);
+ RegisterChestContent(0, new ItemStack(Items.gold_ingot, 3), 3);
+ RegisterChestContent(0, new ItemStack(Items.ghast_tear, 2), 3);
+ RegisterChestContent(0, new ItemStack(ItemCore.cloak), 2);
+ RegisterChestContent(0, new ItemStack(ItemCore.luckyDagger), 2);
+ //RegisterChestContent(0, new ItemStack(Items.enchanted_book), 3);
+
+ //------------------- 魔術師の収穫 --------------------------------
+ RegisterChestContent(1, new ItemStack(ItemCore.mpCoin, 1, 500), 30);
+ RegisterChestContent(1, new ItemStack(Items.iron_ingot), 10);
+ RegisterChestContent(1, new ItemStack(Items.gold_nugget), 10);
+ RegisterChestContent(1, new ItemStack(Items.gold_ingot), 10);
+ RegisterChestContent(1, new ItemStack(Items.golden_carrot), 10);
+ RegisterChestContent(1, new ItemStack(Items.golden_apple, 1, 0), 8);
+ RegisterChestContent(1, new ItemStack(Items.iron_sword), 5);
+ RegisterChestContent(1, new ItemStack(Items.iron_helmet), 5);
+ RegisterChestContent(1, new ItemStack(Items.iron_chestplate), 5);
+ RegisterChestContent(1, new ItemStack(Items.iron_leggings), 5);
+ RegisterChestContent(1, new ItemStack(Items.iron_boots), 5);
+ RegisterChestContent(1, new ItemStack(Items.iron_horse_armor), 5);
+ RegisterChestContent(1, new ItemStack(Items.diamond), 5);
+ RegisterChestContent(1, new ItemStack(Items.emerald), 5);
+ RegisterChestContent(1, new ItemStack(ItemCore.mpCoin, 1, 2000), 5);
+ RegisterChestContent(1, new ItemStack(ItemCore.gem, 1, 0), 5);
+ RegisterChestContent(1, new ItemStack(ItemCore.gem, 1, 1), 5);
+ RegisterChestContent(1, new ItemStack(ItemCore.gem, 1, 2), 5);
+ RegisterChestContent(1, new ItemStack(Items.golden_apple, 1, 1), 3);
+ RegisterChestContent(1, new ItemStack(Items.diamond_sword), 3);
+ RegisterChestContent(1, new ItemStack(Items.diamond_helmet), 3);
+ RegisterChestContent(1, new ItemStack(Items.diamond_chestplate), 3);
+ RegisterChestContent(1, new ItemStack(Items.diamond_leggings), 3);
+ RegisterChestContent(1, new ItemStack(Items.diamond_boots), 3);
+ RegisterChestContent(1, new ItemStack(Items.diamond_horse_armor), 3);
+ RegisterChestContent(1, new ItemStack(ItemCore.luckyDagger), 2);
+ RegisterChestContent(1, new ItemStack(Items.nether_star), 1);
+
+ //------------------- 学校のチェスト --------------------------------
+ RegisterChestContent(2, new ItemStack(ItemCore.lavender, 5), 10);
+ RegisterChestContent(2, new ItemStack(ItemCore.seedLavender, 5), 10);
+ RegisterChestContent(2, new ItemStack(ItemCore.potionBless, 3), 10);
+ RegisterChestContent(2, new ItemStack(ItemCore.redLily, 5), 10);
+ RegisterChestContent(2, new ItemStack(ItemCore.seedRedLily, 5), 10);
+ RegisterChestContent(2, new ItemStack(Items.book, 1), 10);
+ for(int i=0;i<recipeBookNum;i++) RegisterChestContent(2, new ItemStack(ItemCore.alchemyRecipe, 1, i), 8);
+ RegisterChestContent(2, new ItemStack(ItemCore.stoneInactive), 8);
+ RegisterChestContent(2, new ItemStack(ItemCore.stoneInactive), 5);
+ RegisterChestContent(2, new ItemStack(ItemCore.gem, 1, 0), 5);
+ RegisterChestContent(2, new ItemStack(ItemCore.gem, 1, 1), 5);
+ RegisterChestContent(2, new ItemStack(ItemCore.gem, 1, 2), 5);
+ RegisterChestContent(2, new ItemStack(Items.diamond), 5);
+ RegisterChestContent(2, new ItemStack(ItemCore.cloak), 2);
+ RegisterChestContent(2, new ItemStack(ItemCore.luckyDagger), 2);
+
+ for(int i=0;i<recipeBookNum;i++){
+ ChestGenHooks.addItem(ChestGenHooks.PYRAMID_JUNGLE_CHEST, new WeightedRandomChestContent(new ItemStack(ItemCore.alchemyRecipe, 1, i), 1, 1, 5));
+ ChestGenHooks.addItem(ChestGenHooks.PYRAMID_DESERT_CHEST, new WeightedRandomChestContent(new ItemStack(ItemCore.alchemyRecipe, 1, i), 1, 1, 5));
+ ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_LIBRARY, new WeightedRandomChestContent(new ItemStack(ItemCore.alchemyRecipe, 1, i), 1, 1, 5));
+ ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_CROSSING, new WeightedRandomChestContent(new ItemStack(ItemCore.alchemyRecipe, 1, i), 1, 1, 5));
+ ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_CORRIDOR, new WeightedRandomChestContent(new ItemStack(ItemCore.alchemyRecipe, 1, i), 1, 1, 5));
+ ChestGenHooks.addItem(ChestGenHooks.DUNGEON_CHEST, new WeightedRandomChestContent(new ItemStack(ItemCore.alchemyRecipe, 1, i), 1, 1, 5));
+ ChestGenHooks.addItem(ChestGenHooks.MINESHAFT_CORRIDOR, new WeightedRandomChestContent(new ItemStack(ItemCore.alchemyRecipe, 1, i), 1, 1, 5));
+ }
+ }
+ public static void RegisterWorldGen(){
+ biomeAutumn=new BiomeAutumn(bIdAutumn);
+ BiomeManager.addBiome(BiomeManager.BiomeType.WARM, new BiomeManager.BiomeEntry(biomeAutumn, 13));
+ biomeCrack=new BiomeGenCrack(bIdCrack);
+ //BiomeManager.addBiome(BiomeManager.BiomeType, new BiomeManager.BiomeEntry(biomeCrack, 10));
+
+ MapGenStructureIO.registerStructure(StructureSealedLibStart.class, FBS.MODID + "-SealedLibStart");
+ MapGenStructureIO.func_143031_a(StructureSealedLib1.class, FBS.MODID+"-SealedLib1");
+
+ MapGenStructureIO.registerStructure(MapGenStudy.Start.class, FBS.MODID+"-StudyStart");
+ MapGenStructureIO.func_143031_a(MapGenStudy.Structure.class, FBS.MODID + "-Study1");
+
+ MapGenStructureIO.registerStructure(MapGenSchool.Start.class, FBS.MODID+"-SchoolStart");
+ MapGenStructureIO.func_143031_a(MapGenSchool.Hall1.class, FBS.MODID + "-School-Hall1");;
+ MapGenStructureIO.func_143031_a(MapGenSchool.Hall2.class, FBS.MODID + "-School-Hall2");
+ MapGenStructureIO.func_143031_a(MapGenSchool.Entrance.class, FBS.MODID + "-School-Entrance");
+ MapGenStructureIO.func_143031_a(MapGenSchool.Stairway.class, FBS.MODID + "-School-Stairway");
+ MapGenStructureIO.func_143031_a(MapGenSchool.RoomBase.class, FBS.MODID + "-School-RoomBase");
+ MapGenStructureIO.func_143031_a(MapGenSchool.RoomStudy.class, FBS.MODID + "-School-RoomStudy");
+ MapGenStructureIO.func_143031_a(MapGenSchool.RoomClassroom.class, FBS.MODID + "-School-RoomClassroom");
+ MapGenStructureIO.func_143031_a(MapGenSchool.RoomZombie.class, FBS.MODID + "-School-RoomZombie");
+
+ DimensionManager.registerProviderType(FBS.dimensionCrackId, WorldProviderCrack.class, false);
+ DimensionManager.registerDimension(FBS.dimensionCrackId, FBS.dimensionCrackId);
+
+ DimensionManager.registerProviderType(FBS.dimensionAutumnId, WorldProviderAutumn.class, false);
+ DimensionManager.registerDimension(FBS.dimensionAutumnId, FBS.dimensionAutumnId);
+
+
+ /*
+ BiomeManager.addBiome(BiomeManager.BiomeType.DESERT, new BiomeManager.BiomeEntry(biomeAutumn, 30));
+ BiomeManager.addBiome(BiomeManager.BiomeType.COOL, new BiomeManager.BiomeEntry(biomeAutumn, 30));
+ BiomeManager.addBiome(BiomeManager.BiomeType.ICY, new BiomeManager.BiomeEntry(biomeAutumn, 30));
+ */
+ }
+ public static void RegisterMP(){
+ //Registry.RegisterMP((IPottery) BlockCore.pot);
+ //Registry.RegisterMP((IPottery) BlockCore.jar);
+
+ MCEconomyAPI.addPurchaseItem(new ItemStack(ItemCore.alchemyPotion, 1, 0), 100);
+ MCEconomyAPI.addPurchaseItem(new ItemStack(ItemCore.alchemyPotion, 1, 1), 150);
+
+ MCEconomyAPI.addPurchaseItem(new ItemStack(BlockCore.pot, 1, OreDictionary.WILDCARD_VALUE), -1);
+
+ MCEconomyAPI.addPurchaseItem(new ItemStack(BlockCore.workbench), -1);
+ MCEconomyAPI.addPurchaseItem(new ItemStack(BlockCore.extractingFurnace), -1);
+ MCEconomyAPI.addPurchaseItem(new ItemStack(BlockCore.fillingTable), -1);
+ MCEconomyAPI.addPurchaseItem(new ItemStack(BlockCore.bookshelf), 2);
+ MCEconomyAPI.addPurchaseItem(new ItemStack(BlockCore.plank), 2);
+ MCEconomyAPI.addPurchaseItem(new ItemStack(BlockCore.magicCore), 100);
+ MCEconomyAPI.addPurchaseItem(new ItemStack(ItemCore.instantMana), 30);
+ MCEconomyAPI.addPurchaseItem(new ItemStack(ItemCore.membership), -1);
+ MCEconomyAPI.addPurchaseItem(new ItemStack(ItemCore.butterfly), -1);
+ MCEconomyAPI.addPurchaseItem(new ItemStack(ItemCore.enchantScroll), -1);
+
+ MCEconomyAPI.addPurchaseItem(new ItemStack(ItemCore.gem, 1, 32767), 800);
+ MCEconomyAPI.addPurchaseItem(new ItemStack(ItemCore.charm, 1, 32767), 10);
+ MCEconomyAPI.addPurchaseItem(new ItemStack(ItemCore.monocleWood), -1);
+ MCEconomyAPI.addPurchaseItem(new ItemStack(ItemCore.monocle), -1);
+ MCEconomyAPI.addPurchaseItem(new ItemStack(ItemCore.monocleGold), -1);
+ MCEconomyAPI.addPurchaseItem(new ItemStack(ItemCore.bucketMana), 20);
+ MCEconomyAPI.addPurchaseItem(new ItemStack(ItemCore.staff1_1), -1);
+ MCEconomyAPI.addPurchaseItem(new ItemStack(ItemCore.staff1_2), -1);
+ MCEconomyAPI.addPurchaseItem(new ItemStack(ItemCore.staff1_3), -1);
+ MCEconomyAPI.addPurchaseItem(new ItemStack(ItemCore.staff1_4), -1);
+ MCEconomyAPI.addPurchaseItem(new ItemStack(ItemCore.staff1_5), -1);
+ MCEconomyAPI.addPurchaseItem(new ItemStack(ItemCore.staff2_1), -1);
+ MCEconomyAPI.addPurchaseItem(new ItemStack(ItemCore.staff2_2), -1);
+ MCEconomyAPI.addPurchaseItem(new ItemStack(ItemCore.staff2_3), -1);
+ MCEconomyAPI.addPurchaseItem(new ItemStack(ItemCore.staff2_4), -1);
+ MCEconomyAPI.addPurchaseItem(new ItemStack(ItemCore.staff2_5), -1);
+ MCEconomyAPI.addPurchaseItem(new ItemStack(ItemCore.stick), 0);
+ MCEconomyAPI.addPurchaseItem(new ItemStack(ItemCore.lavender), 2);
+ MCEconomyAPI.addPurchaseItem(new ItemStack(ItemCore.seedLavender), 1);
+ MCEconomyAPI.addPurchaseItem(new ItemStack(ItemCore.bookOld, 1, 32767), -1);
+ MCEconomyAPI.addPurchaseItem(new ItemStack(ItemCore.bookNoDecoded, 1, 32767), -1);
+ MCEconomyAPI.addPurchaseItem(new ItemStack(ItemCore.bookSorcery, 1, 32767), -1);
+ MCEconomyAPI.addPurchaseItem(new ItemStack(ItemCore.potionSan), 200);
+ MCEconomyAPI.addPurchaseItem(new ItemStack(ItemCore.potionOblivion), 350);
+
+ MCEconomyAPI.addPurchaseItem(new ItemStack(BlockCore.alchemyCauldron), -1);
+ MCEconomyAPI.addPurchaseItem(new ItemStack(BlockCore.tableAlchemist), -1);
+ MCEconomyAPI.addPurchaseItem(new ItemStack(ItemCore.mushroomUnknown), 0);
+ MCEconomyAPI.addPurchaseItem(new ItemStack(ItemCore.herbUnknown), 0);
+ MCEconomyAPI.addPurchaseItem(new ItemStack(ItemCore.grassUnknown), 0);
+ MCEconomyAPI.addPurchaseItem(new ItemStack(ItemCore.seedsUnknown), 0);
+ MCEconomyAPI.addPurchaseItem(new ItemStack(ItemCore.flowerUnknown), 0);
+ MCEconomyAPI.addPurchaseItem(new ItemStack(ItemCore.fruitsUnknown), 0);
+ MCEconomyAPI.addPurchaseItem(new ItemStack(ItemCore.alchemyMaterial, 1, OreDictionary.WILDCARD_VALUE), -1);
+ MCEconomyAPI.addPurchaseItem(new ItemStack(ItemCore.alchemyRecipe, 1, OreDictionary.WILDCARD_VALUE), -1);
+
+ shopMCE2Id=MCEconomyAPI.registerShop(new ShopWitch());
+ shopAuthorId=MCEconomyAPI.registerShop(new ShopAuthor());
+ }
+
+ /**
+ * 陶芸品の売却価格をMCE2に設定する
+ * @param ip
+ */
+ public static void RegisterMP(IPottery ip){
+ ArrayList<ItemStack> list=ip.getAllPattern();
+ if(list==null || list.isEmpty()) return;
+
+ for(ItemStack i : list){
+ MCEconomyAPI.addPurchaseItem(i, ip.getMP(i));
+ }
+ }
+
+ public static void LoadIdFromCfg(Configuration cfg) {
+ eIdButterfly = cfg.get("Entity", "IdButterfly", 15).getInt();
+ eIdProjectileBase = cfg.get("Entity", "IdProjBase", 16).getInt();
+ eIdDig = cfg.get("Entity", "IdDig", 17).getInt();
+ eIdArrow = cfg.get("Entity", "IdArrow", 18).getInt();
+ eIdWedge = cfg.get("Entity", "IdWedge", 19).getInt();
+ eIdFireBolt = cfg.get("Entity", "IdFireBolt", 20).getInt();
+ eIdHealingBall = cfg.get("Entity", "IdHealingBall", 21).getInt();
+ eIdArrowResona = cfg.get("Entity", "IdArrowResona", 22).getInt();
+ eIdTableware = cfg.get("Entity", "IdTableware", 23).getInt();
+ eIdAuthor = cfg.get("Entity", "IdAuthor", 24).getInt();
+ eIdDummy = cfg.get("Entity", "IdDummy", 25).getInt();
+
+ ItemCore.eIdSanity = cfg.get("Enchantment", "IdSanityProtect", 65).getInt();
+ ItemCore.eIdCleverness = cfg.get("Enchantment", "IdSanityCleverness", 66).getInt();
+ ItemCore.eIdWealth = cfg.get("Enchantment", "IdSanityWealth", 67).getInt();
+
+ bIdAutumn = cfg.getInt("BiomeIdAutumn", "WorldGen", Registry.bIdAutumn, 0, 256, "");
+ bIdCrack = cfg.getInt("BiomeIdCrack", "WorldGen", Registry.bIdCrack, 0, 256, "");
+
+ FBS.dimensionAutumnId=cfg.getInt("DimensionIdAutumn", "WorldGen", FBS.dimensionAutumnId, -1024, 1023, "");
+ FBS.dimensionCrackId=cfg.getInt("DimensionIdCrack", "WorldGen", FBS.dimensionCrackId, -1024, 1023, "");
+
+ boolean flag = false;
+ for (String s : CoreModManager.getLoadedCoremods()) {
+ if (s.equalsIgnoreCase("PotionExtension-1.7.10-1.1.0.jar")) {
+ flag = true;
+ break;
+ }
+ }
+ pIdContract = cfg.get("Potion", "Contract", flag ? 80 : 25).getInt();
+ pIdCleverness = cfg.get("Potion", "Cleverness", flag ? 81 : 26).getInt();
+ }
+
+ public static ArrayList<RecipePair> getCraftingRecipes(){
+ return instance.craftingRecipes;
+ }
+
+ /*
+ ####################################################
+ Book
+ ####################################################
+ */
+
+ /**
+ * 書物を登録する。
+ * @param title
+ * @param lv
+ * @param isMagic 魔導書であるかどうか。trueの場合MagicDataも登録必須となる
+ * @param prob 適正時の解読確率
+ * @param exp 解読成功時の魔術経験値
+ * @param sanTrial 解読失敗時正気度喪失のXdYのX
+ * @param sanMax 解読失敗時正気度喪失のXdYのY
+ * @param weight GetRandomBookでの出現の重み
+ */
+ public static void RegisterBook(String title, int lv, boolean isMagic, float prob, double exp, int sanTrial, int sanMax, int weight){
+ BookData bd=new BookData();
+ bd.title=title;
+ bd.lv=lv;
+ bd.isMagic=isMagic;
+ bd.scProb=prob;
+ bd.exp=exp;
+ bd.sanTrial=sanTrial;
+ bd.sanMax=sanMax;
+ bd.weight=weight;
+
+ instance.books.put(title, bd);
+ }
+
+ private static BookData cashBook;
+ public static BookData GetBook(String title){
+ if(cashBook!=null && cashBook.title.equals(title)) return cashBook;
+ cashBook=instance.books.get(title);
+ return cashBook;
+ }
+ public static BookData GetBookDataFromItemStack(ItemStack itemStack){
+ if(!itemStack.hasTagCompound()) return null;
+ NBTTagCompound nbt=itemStack.getTagCompound();
+ return Registry.GetBook(nbt.getString("title"));
+ }
+ public static String GetLocalizedBookTitle(String title){
+ return StatCollector.translateToLocal("book." + title + ".title");
+ }
+ public static String GetUnlocalizedBookTitleFromItemStack(ItemStack itemStack){
+ if(!itemStack.hasTagCompound()) return null;
+ NBTTagCompound nbt=itemStack.getTagCompound();
+ return nbt.getString("title");
+ }
+
+ /**
+ * 本の解読を試みる
+ * @param title
+ * @param player
+ * @param sim
+ * @return
+ */
+ public static boolean TryDecodingBook(String title, EntityPlayer player, boolean sim){
+ if(!instance.books.containsKey(title)) return false;
+
+ BookData bd=GetBook(title);
+ FBSEntityProperties prop=FBSEntityProperties.get(player);
+ if(bd==null || prop==null) return false;
+ int mLv=FBSEntityPropertiesAPI.GetMagicLevel(player);
+
+ float prob=GetDecodingProbability(mLv, bd.lv, bd.scProb);
+ if(instance.rand.nextFloat()<prob || player.capabilities.isCreativeMode){
+ //success
+ if(sim){
+ PlayerDecodedBookEvent ev=new PlayerDecodedBookEvent(player, bd, true);
+ boolean hc=MinecraftForge.EVENT_BUS.post(ev);
+ if(!hc){
+ String tmp=String.format(StatCollector.translateToLocal("info.fbs.book.success"), bd.getLocalizedTitle());
+ tmp=tmp+String.format("(EXP+%.2f)", bd.exp);
+ player.addChatComponentMessage(new ChatComponentText(tmp));
+
+ prop.addDecodedBook(bd.title);
+ SanityManager.addExp(player, bd.exp, true);
+ }
+ }
+ return true;
+ }
+ else{
+ //failure
+ if(sim){
+ PlayerDecodedBookEvent ev=new PlayerDecodedBookEvent(player, bd, false);
+ boolean hc=MinecraftForge.EVENT_BUS.post(ev);
+ if(!hc){
+ double e=0;
+ if(prob>0) e=bd.exp*0.2;
+
+ String tmp=String.format(StatCollector.translateToLocal("info.fbs.book.failure"), bd.getLocalizedTitle());
+ tmp=tmp+String.format("(EXP+%.2f)", e);
+ player.addChatComponentMessage(new ChatComponentText(tmp));
+
+ SanityManager.addExp(player, e, true);
+ SanityManager.loseSanity(player, bd.sanTrial, bd.sanMax, true);
+
+ //いたずらの発生確率(%):(書物のレベル)*1.5+(書物とプレイヤーのレベル差)*10
+ //魔導書の場合1.5倍
+ //最大80%
+ if(bd.lv>=5){
+ int sub=bd.lv-mLv;
+ float prob2=1.5f*bd.lv+(sub>0?sub*0.05f:0);
+ if(bd.isMagic) prob2*=1.5f;
+ if(prob2>0.8f) prob2=0.8f;
+ if(instance.rand.nextFloat()<prob2){
+ randomTrouble(player.worldObj, player, bd);
+ }
+ }
+ }
+ }
+ return false;
+ }
+ }
+ public static float GetDecodingProbability(int playerLv, int bookLv, float baseProb){
+ float probExt;
+
+ //書物より10レベル以上低ければ ... 解読率0%
+ //書物よりレベルが低ければ ... 差1レベルにつき解読率10%マイナス補正
+ //書物よりレベルが高ければ ... 差1レベルにつき解読率10%プラス補正
+ //書物より10レベル以上高ければ ... 解読率200%
+
+ int d=bookLv-playerLv;
+
+ if(d>=10) probExt=0.0f;
+ else if(d>0) probExt=1.0f-0.1f*d;
+ else if(d>-10) probExt=1.0f-0.1f*d;
+ else probExt=2.0f;
+
+ return probExt*baseProb;
+ }
+ public static ItemStack GetRandomBook(int lv){
+ //Generate Available Book List
+ int weightSum=0;
+ LinkedList<BookData> available=new LinkedList<BookData>();
+ Iterator<Map.Entry<String,BookData>> itAv=instance.books.entrySet().iterator();
+ while(itAv.hasNext()){
+ BookData p=itAv.next().getValue();
+ if(p.weight>0 && (p.lv<=lv+5 || lv==-1)) {
+ available.add(p);
+ weightSum+=p.weight;
+ }
+ }
+
+ //get
+ Iterator<BookData> it=available.iterator();
+ int r=instance.rand.nextInt(weightSum);
+ int sum=0;
+ while(it.hasNext()){
+ BookData f=it.next();
+ sum+=f.weight;
+ if(r<=sum){
+ ItemStack result = new ItemStack(ItemCore.bookNoDecoded, 1, instance.rand.nextInt(0xfff+1));
+ NBTTagCompound nbt = new NBTTagCompound();
+ nbt.setString("title", f.title);
+ result.setTagCompound(nbt);
+
+ return result;
+ }
+ }
+ return null;
+ }
+ public static ItemStack GetBookItemStack(String title){
+ ItemStack result = new ItemStack(ItemCore.bookNoDecoded, 1, instance.rand.nextInt(0xfff+1));
+ NBTTagCompound nbt = new NBTTagCompound();
+ nbt.setString("title", title);
+ result.setTagCompound(nbt);
+
+ return result;
+ }
+
+ public static Map.Entry<String, BookData>[] GetBooks(){
+ Map.Entry<String, BookData>[] ret=new Map.Entry[instance.books.size()];
+ instance.books.entrySet().toArray(ret);
+ return ret;
+ }
+ public static String GetDecoderNameFromItemStack(ItemStack itemStack){
+ if(!itemStack.hasTagCompound()) return null;
+ NBTTagCompound nbt=itemStack.getTagCompound();
+ return nbt.getString("decoder");
+ }
+
+
+ /*
+ ####################################################
+ Magic
+ ####################################################
+ */
+ public static void RegisterMagic(String title, String type, int aria, double exp, int min, int max, Class<? extends MagicBase> magic){
+ MagicData md=new Registry.MagicData();
+ md.title=title;
+ md.ariaTick=aria;
+ md.magic=magic;
+ md.exp=exp;
+ md.minUse=min;
+ md.maxUse=max;
+ md.type=type;
+
+ instance.magics.put(title, md);
+ }
+
+ private static MagicData cashMagic;
+ public static MagicData GetMagic(String title){
+ if(cashMagic!=null && cashMagic.title.equals(title)) return cashMagic;
+ cashMagic=instance.magics.get(title);
+ return cashMagic;
+ }
+ public static MagicData GetMagicDataFromItemStack(ItemStack itemStack){
+ if(!itemStack.hasTagCompound()) return null;
+ NBTTagCompound nbt=itemStack.getTagCompound();
+ return Registry.GetMagic(nbt.getString("title"));
+ }
+
+
+ /*
+ ####################################################
+ Trouble
+ ####################################################
+ */
+ public static void RegisterTrouble(TroubleBase tb, int w){
+ instance.troubles.add(new WeightedTrouble(tb, w));
+ instance.troublesWeightSum+=w;
+ }
+ public static void randomTrouble(World world, EntityPlayer player, BookData bd){
+ int ws=0;
+ ArrayList<WeightedTrouble> availabes=new ArrayList<WeightedTrouble>();
+ for(WeightedTrouble wt : instance.troubles){
+ if(wt.get().getMinimumMagicLv()<=bd.lv){
+ availabes.add(wt);
+ ws+=wt.weight();
+ }
+ }
+ if(availabes.isEmpty()) return;
+
+ int wws=0;
+ int r=instance.rand.nextInt(ws);
+ for(WeightedTrouble wt : availabes){
+ if(r<wws+wt.weight()){
+ player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal(wt.get().getMessage())));
+ wt.get().done(world, player, bd);
+ return;
+ }
+ wws+=wt.weight();
+ }
+ }
+
+
+ /*
+ ####################################################
+ Resonance
+ ####################################################
+ */
+ private static IResonance cashResona;
+ public void __rgResona(IResonance r){
+ MagicData md=GetMagic(r.getResonanceMagicName());
+ if(md!=null) md.isResonance=true;
+
+ if(instance.resonances.isEmpty()){
+ instance.resonances.add(r);
+ }
+ else{
+ //優先度ソートしつつ入れる
+ for(int i=0;i<instance.resonances.size();i++){
+ if(r.priority()>=instance.resonances.get(i).priority()){
+ instance.resonances.add(i, r);
+ return;
+ }
+ }
+ instance.resonances.add(r);
+ }
+
+ }
+ public static void RegisterResonance(String title, String... books) {
+ instance.__rgResona(new ShapedResonance(title, books));
+ }
+ public static void RegisterResonance(IResonance r){
+ instance.__rgResona(r);
+ }
+ public static MagicData GetResonanceMagicData(LinkedList<ItemStack> items){
+ if(items.isEmpty()) return null;
+
+ //共鳴判定用リストの作成
+ MagicData[] magics=new MagicData[items.size()];
+ for(int i=0;i<magics.length;i++){
+ magics[i]=GetMagicDataFromItemStack(items.get(i));
+ if(magics[i]==null && magics.length>=2) return GetMagic("fbs.failure");
+ }
+
+ if(items.size()>=2){
+ if(cashResona!=null && cashResona.isMatch(magics)) return GetMagic(cashResona.getResonanceMagicName());
+
+ for(IResonance r : instance.resonances){
+ if(r.isMatch(magics)){
+ cashResona=r;
+ return GetMagic(r.getResonanceMagicName());
+ }
+ }
+ return GetMagic("fbs.failure");
+ }
+ return GetMagicDataFromItemStack(items.get(0));
+ }
+ public static boolean IsResonance(String title){
+ if(cashResona!=null && cashResona.getResonanceMagicName().equals(title)) return true;
+ for(IResonance r : instance.resonances){
+ if(r.getResonanceMagicName().equals(title)){
+ cashResona=r;
+ return true;
+ }
+ }
+ return false;
+ }
+ public static IResonance GetResonance(String title){
+ if(cashResona!=null && cashResona.getResonanceMagicName().equals(title)) return cashResona;
+
+ for(IResonance r : instance.resonances){
+ if(r.getResonanceMagicName().equals(title)){
+ cashResona=r;
+ return r;
+ }
+ }
+ return null;
+ }
+
+
+ /*
+ ####################################################
+ Chest
+ ####################################################
+ */
+ public static void RegisterChestContent(int type, ItemStack item, int weight){
+ ChestContent cc=new ChestContent();
+ cc.type=type;
+ cc.itemStack=item;
+ cc.weight=weight;
+ instance.chestContents.add(cc);
+ }
+ public static void GetChestContents(int type, ItemStack[] inventory, float prob){
+ //available
+ LinkedList<ChestContent> available=new LinkedList<ChestContent>();
+ int weightSum=0;
+ for(ChestContent cc : instance.chestContents){
+ if(cc.type==type){
+ available.add(cc);
+ weightSum+=cc.weight;
+ }
+ }
+
+ //generate
+ for(int i=0;i<inventory.length;i++){
+ if(instance.rand.nextFloat()>=prob) continue;
+
+ int r=instance.rand.nextInt(weightSum);
+ int s=0;
+ for(ChestContent cc : available){
+ s+=cc.weight;
+ if(r<s){
+ inventory[i]=cc.get();
+ break;
+ }
+ }
+ }
+ }
+ public static ArrayList<ChestContent> GetChestContents(int type){
+ ArrayList<ChestContent> ret=new ArrayList<ChestContent>();
+ for(ChestContent cc : instance.chestContents){
+ if(cc.type==type) ret.add(cc);
+ }
+ return ret;
+ }
+
+
+ /*
+ ####################################################
+ Crafting
+ ####################################################
+ */
+ public void _rgCrafting(IRecipe r, int mana){
+ craftingRecipes.add(new RecipePair(r, mana));
+ }
+ public static void RegisterRecipe(IRecipe recipe, int mana){ instance._rgCrafting(recipe, mana);}
+ public static void RegisterShapedRecipe(ItemStack out, int mana, Object ... params) {
+ String s = "";
+ int i = 0;
+ int j = 0;
+ int k = 0;
+
+ if (params[i] instanceof String[]) {
+ String[] astring = (String[]) ((String[]) params[i++]);
+
+ for (int l = 0; l < astring.length; ++l) {
+ String s1 = astring[l];
+ ++k;
+ j = s1.length();
+ s = s + s1;
+ }
+ } else {
+ while (params[i] instanceof String) {
+ String s2 = (String) params[i++];
+ ++k;
+ j = s2.length();
+ s = s + s2;
+ }
+ }
+
+ HashMap hashmap;
+
+ for (hashmap = new HashMap(); i < params.length; i += 2) {
+ Character character = (Character) params[i];
+ ItemStack itemstack1 = null;
+
+ if (params[i + 1] instanceof Item) {
+ itemstack1 = new ItemStack((Item) params[i + 1]);
+ } else if (params[i + 1] instanceof Block) {
+ itemstack1 = new ItemStack((Block) params[i + 1], 1, 32767);
+ } else if (params[i + 1] instanceof ItemStack) {
+ itemstack1 = (ItemStack) params[i + 1];
+ }
+
+ hashmap.put(character, itemstack1);
+ }
+
+ ItemStack[] aitemstack = new ItemStack[j * k];
+ for (int i1 = 0; i1 < j * k; ++i1) {
+ char c0 = s.charAt(i1);
+
+ if (hashmap.containsKey(Character.valueOf(c0))) {
+ aitemstack[i1] = ((ItemStack) hashmap.get(Character.valueOf(c0))).copy();
+ } else {
+ aitemstack[i1] = null;
+ }
+ }
+
+ ShapedRecipes shapedrecipes = new ShapedRecipes(j, k, aitemstack, out);
+ instance._rgCrafting(shapedrecipes, mana);
+ }
+ public static void RegisterShapelessRecipe(ItemStack out, int mana, Object ... params) {
+ ArrayList arraylist = new ArrayList();
+ Object[] aobject = params;
+ int i = params.length;
+
+ for (int j = 0; j < i; ++j) {
+ Object object1 = aobject[j];
+
+ if (object1 instanceof ItemStack) {
+ arraylist.add(((ItemStack) object1).copy());
+ } else if (object1 instanceof Item) {
+ arraylist.add(new ItemStack((Item) object1));
+ } else {
+ if (!(object1 instanceof Block)) {
+ throw new RuntimeException("Invalid shapeless recipy!");
+ }
+
+ arraylist.add(new ItemStack((Block) object1));
+ }
+ }
+
+
+ instance._rgCrafting(new ShapelessRecipes(out, arraylist), mana);
+ }
+ public static void RegisterShapedOreRecipe(ItemStack out, int mana, Object ... params){
+ instance._rgCrafting(new ShapedOreRecipe(out, params), mana);
+ }
+ public static void RegisterShapelessOreRecipe(ItemStack out, int mana, Object ... params){
+ instance._rgCrafting(new ShapelessOreRecipe(out, params), mana);
+ }
+ public static RecipePair FindMatchingRecipe(InventoryCrafting p_82787_1_, World p_82787_2_) {
+ int i = 0;
+ ItemStack itemstack = null;
+ ItemStack itemstack1 = null;
+ int j;
+
+ for (j = 0; j < p_82787_1_.getSizeInventory(); ++j) {
+ ItemStack itemstack2 = p_82787_1_.getStackInSlot(j);
+
+ if (itemstack2 != null) {
+ if (i == 0) {
+ itemstack = itemstack2;
+ }
+
+ if (i == 1) {
+ itemstack1 = itemstack2;
+ }
+
+ ++i;
+ }
+ }
+
+ for (j = 0; j < instance.craftingRecipes.size(); ++j) {
+ RecipePair rp = instance.craftingRecipes.get(j);
+ if (rp.recipe.matches(p_82787_1_, p_82787_2_)) {
+ return rp;
+ }
+ }
+
+ return null;
+ }
+
+
+
+ /*
+ ####################################################
+ Sanity
+ ####################################################
+ */
+ private static ItemSanity cachedItemSanity;
+ public static void RegisterItemSanity(ItemStack item, int trial, int max){
+ instance.sanityItems.add(new ItemSanity(item, trial, max));
+ }
+ public static ItemSanity GetItemSanity(ItemStack item){
+ if(cachedItemSanity !=null && cachedItemSanity.equals(item)) return cachedItemSanity;
+ for(ItemSanity it : instance.sanityItems){
+ if(it.equals(item)){
+ cachedItemSanity =it;
+ return cachedItemSanity;
+ }
+ }
+ return null;
+ }
+
+ private static MobSanity cachedMobSanity;
+ public static void RegisterMobSanity(Class<? extends IMob> type, int trial, int max){
+ instance.sanityMobs.add(new MobSanity(type, trial, max));
+ }
+ public static MobSanity GetMobSanity(Entity e){
+ if(cachedMobSanity !=null && cachedMobSanity.equals(e)) return cachedMobSanity;
+ for(MobSanity it : instance.sanityMobs){
+ if(it.equals(e)){
+ cachedMobSanity=it;
+ return cachedMobSanity;
+ }
+ }
+ return null;
+ }
+
+
+ /*
+ ####################################################
+ Magic Circle
+ ####################################################
+ */
+
+ /**
+ * 魔法陣を登録する
+ * @param name
+ * @param charms クラフトレシピのように、0-fの16個の値を文字列で、3*3以上の正方形になるように並べる。
+ * この値はアイテム時のチャームのメタ値を表す。半角スペースはそこにチャームが必要ないことを示す。
+ * また、中心には必ず魔法陣の核が置かれるため、そこは不問となる。
+ */
+ public static void RegisterMagicCircle(String name, String ... charms){
+ MagicCircle mc=new MagicCircle();
+ if(!mc.parse(name, charms)) return;
+
+ instance.magicCircles.add(mc);
+ }
+ public static String FindMatchingMagicCircle(World world, int cx, int cy, int cz, int radius){
+ for(MagicCircle mc : instance.magicCircles){
+ if(mc.isMatch(world, cx-radius, cy, cz-radius, radius*2+1)) return mc.name;
+ }
+ return null;
+ }
+
+ /*
+ ####################################################
+ Mana Container
+ ####################################################
+ */
+ private static ItemManaContainer cashMana;
+ public static void RegisterManaContainer(ItemStack item, int amount){
+ if(item==null || amount<=0) return;
+ instance.manaItems.add(new ItemManaContainer(item, amount));
+ }
+ public static void RegisterManaContainer(String itemName, int meta, int amount){
+ Item item=(Item)Item.itemRegistry.getObject(itemName);
+ if(item!=null){
+ RegisterManaContainer(new ItemStack(item, 1, meta), amount);
+ }
+ }
+ public static int GetContainsMana(ItemStack item){
+ if(cashMana!=null && cashMana.item.isItemEqual(item)) return cashMana.amount;
+ for(ItemManaContainer im : instance.manaItems){
+ if(im.item.isItemEqual(item)){
+ cashMana=im;
+ return im.amount;
+ }
+ }
+ return 0;
+ }
+ public static ArrayList<ItemManaContainer> GetManaContainers(){
+ return instance.manaItems;
+ }
+
+ /*
+ ####################################################
+ Fortune Cookie
+ ####################################################
+ */
+ public static void RegisterFortuneCookieMessage(String message){
+ instance.fortuneCookies.add(message);
+ }
+ public static String GetRandomMessage(){
+ return instance.fortuneCookies.get(instance.rand.nextInt(instance.fortuneCookies.size()));
+ }
+ public static int GetRandomMessageVariant(String message){
+ int num;
+
+ try{
+ num=Integer.parseInt(StatCollector.translateToLocal("info.fbs.lottery."+message));
+ }
+ catch (Exception e){
+ num=1;
+ }
+
+ return instance.rand.nextInt(num);
+ }
+ public static String GetLocalizedFortuneCookieMessage(String message, int variant){
+ return StatCollector.translateToLocal("info.fbs.lottery."+message+"."+variant);
+ }
+
+ public static class BookData{
+ public String title;
+ public int lv;
+ public double exp;
+ public float scProb;
+ public boolean isMagic;
+ public int sanTrial;
+ public int sanMax;
+ public int weight;
+
+ public BookData copy(){
+ BookData bd=new BookData();
+ bd.title=title;
+ bd.lv=lv;
+ bd.exp=exp;
+ bd.scProb=scProb;
+ bd.isMagic=isMagic;
+ bd.sanTrial=sanTrial;
+ bd.sanMax=sanMax;
+ bd.weight=weight;
+ return bd;
+ }
+ public String getLocalizedTitle(){
+ return StatCollector.translateToLocal("book." + title + ".title");
+ }
+ }
+ public static class MagicData{
+ public String title;
+ public String type;
+ public int ariaTick;
+ public Class<? extends MagicBase> magic;
+ public double exp;
+ public int maxUse, minUse;
+ public boolean isResonance;
+
+ public MagicData copy(){
+ MagicData md=new MagicData();
+ md.title=title;
+ md.ariaTick=ariaTick;
+ md.magic=magic;
+ md.exp=exp;
+ md.minUse=minUse;
+ md.maxUse=maxUse;
+ md.type=type;
+
+ return md;
+ }
+ public String getLocalizedTitle(){
+ return StatCollector.translateToLocal("book." + title + ".title");
+ }
+ public MagicBase getMagic(World world, EntityPlayer player, boolean isSpelled){
+ try{
+ MagicBase mb = magic.newInstance();
+ mb.player =player;
+ mb.world=world;
+ mb.magicData=copy();
+ mb.bookData=Registry.GetBook(title);
+ mb.rand=Registry.instance.rand;
+ mb.isSpelled=isSpelled;
+ mb.property= FBSEntityProperties.get(player);
+ mb.usingStaff=false;
+ return mb;
+ }
+ catch (Exception exc){
+ FBS.logger.error("Error:initializing MagicBase", exc);
+ }
+ return null;
+ }
+ }
+ public static class ChestContent{
+ public int type;
+ public ItemStack itemStack;
+ public int weight;
+
+ public ItemStack get(){
+ ItemStack ret=itemStack.copy();
+
+ //スタックサイズの決定
+ ret.stackSize=1;
+ if(itemStack.stackSize>1){
+ ret.stackSize+=instance.rand.nextInt(itemStack.stackSize);
+ }
+
+ //エンチャント処理
+ if(itemStack.getItem()==Items.book && instance.rand.nextFloat()<1.5f){
+ ret=EnchantmentHelper.addRandomEnchantment(instance.rand, ret, 30);
+ ret.stackSize=1;
+ }
+ else if(itemStack.getItem()==ItemCore.enchantScroll){
+ ItemStack dummy=EnchantmentHelper.addRandomEnchantment(instance.rand, new ItemStack(Items.book), 30);
+ Map e=EnchantmentHelper.getEnchantments(dummy);
+ while(e.size()>=2){
+ e.remove(e.keySet().iterator().next());
+ }
+ EnchantmentHelper.setEnchantments(e, ret);
+ ret.stackSize=1;
+ }
+ return ret;
+ }
+ }
+ public static class RecipePair{
+ public IRecipe recipe;
+ public int mana;
+
+ public RecipePair(IRecipe r, int m){
+ recipe=r;
+ mana=m;
+ }
+ }
+ public static class MagicCircle{
+ public String name;
+ public int size;
+ public int[][] charms;
+ public int[][] charms1;
+ public int[][] charms2;
+ public int[][] charms3;
+ public boolean isEnable=false;
+
+ public boolean parse(String name, String ... params) {
+ this.name=name;
+
+ if(params.length<=1 || params.length>5){
+ FMLLog.severe("Failed to parse Magic Circle : Magic circle has invalid size");
+ isEnable=false;
+ return false;
+ }
+
+ if (params.length != params[0].length()) {
+ FMLLog.severe("Failed to parse Magic Circle : Magic circle is not square");
+ isEnable=false;
+ return false;
+ }
+ if (params.length%2==0) {
+ FMLLog.severe("Failed to parse Magic Circle : Magic circle do not have center");
+ isEnable=false;
+ return false;
+ }
+
+ size = params.length;
+ isEnable=true;
+
+ charms = new int[size][size];
+ for (int i = 0; i < size; i++) {
+ for (int k = 0; k < size; k++) {
+ String c=params[i].substring(k, k+1);
+ if(c.equals(" ")) charms[i][k]=-1;
+ else charms[i][k] = Integer.parseInt(c, 16)^15;
+ }
+ }
+ charms1=new int[size][size];
+ for(int i=0;i<size;i++){
+ for(int k=0;k<size;k++){
+ charms1[k][size-1-i]=charms[i][k];
+ }
+ }
+ charms2=new int[size][size];
+ for(int i=0;i<size;i++){
+ for(int k=0;k<size;k++){
+ charms2[k][size-1-i]=charms1[i][k];
+ }
+ }
+ charms3=new int[size][size];
+ for(int i=0;i<size;i++){
+ for(int k=0;k<size;k++){
+ charms3[k][size-1-i]=charms2[i][k];
+ }
+ }
+
+ return true;
+ }
+
+ public boolean isMatch(World world, int bx, int by, int bz, int size){
+ if(!isEnable || size!=this.size) return false;
+
+ return check(charms, world, bx, by, bz, size) || check(charms1, world, bx, by, bz, size) ||
+ check(charms2, world, bx, by, bz, size) || check(charms3, world, bx, by, bz, size);
+ }
+
+ private boolean check(int[][] c, World world, int bx, int by, int bz, int size){
+ for(int i=0;i<size;i++){
+ for(int k=0;k<size;k++){
+ Block b=world.getBlock(bx+k, by, bz+i);
+ if(i==size/2 && i==k && b==BlockCore.magicCore) continue;
+ if(c[i][k]==-1){
+ if(b.getMaterial()!=Material.air) return false;
+ }
+ else{
+ if(b!=BlockCore.charm && b.getMaterial()!=Material.air) return false;
+ if(world.getBlockMetadata(bx+k, by, bz+i)!=c[i][k]) return false;
+ }
+ }
+ }
+ return true;
+ }
+ }
+ public static class ItemSanity{
+ public ItemStack item;
+ public int trial;
+ public int max;
+
+ public ItemSanity(ItemStack i, int t, int m){
+ item=i;
+ trial=t;
+ max=m;
+ }
+
+ public boolean equals(ItemStack item){
+ return this.item.isItemEqual(item);
+ }
+ public void sanity(EntityPlayer ep){
+ if(max>0) SanityManager.addSanity(ep, trial, max, true);
+ else if(max<0) SanityManager.loseSanity(ep, trial, -max, true);
+ }
+ }
+ public static class ItemManaContainer{
+ public ItemStack item;
+ public int amount;
+ public ItemManaContainer(ItemStack i, int a){
+ item=i;
+ amount=a;
+ }
+ }
+ public static class MobSanity{
+ public Class<? extends IMob> mob;
+ public int trial;
+ public int max;
+
+ public MobSanity(Class<? extends IMob> type, int t, int m){
+ mob=type;
+ trial=t;
+ max=m;
+ }
+
+ public boolean equals(Entity e){
+ return e.getClass().isAssignableFrom(mob);
+ }
+ public void sanity(EntityPlayer ep){
+ if(max>0) SanityManager.addSanity(ep, trial, max, true);
+ else if(max<0) SanityManager.loseSanity(ep, trial, -max, true);
+ }
+ }
+
+ public static class WeightedTrouble{
+ private TroubleBase tb;
+ private int w;
+
+ public WeightedTrouble(TroubleBase tb, int weight){
+ this.tb=tb;
+ this.w=weight;
+ }
+
+ public TroubleBase get(){ return tb; }
+ public int weight(){ return w; }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/alchemy/AlchemyRegistry$AppraisalItemStack.class b/src/main/java/jp/plusplus/fbs/alchemy/AlchemyRegistry$AppraisalItemStack.class Binary files differnew file mode 100644 index 0000000..76135d6 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/alchemy/AlchemyRegistry$AppraisalItemStack.class diff --git a/src/main/java/jp/plusplus/fbs/alchemy/AlchemyRegistry$ItemPair.class b/src/main/java/jp/plusplus/fbs/alchemy/AlchemyRegistry$ItemPair.class Binary files differnew file mode 100644 index 0000000..8327cd1 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/alchemy/AlchemyRegistry$ItemPair.class diff --git a/src/main/java/jp/plusplus/fbs/alchemy/AlchemyRegistry$ProductExpPair.class b/src/main/java/jp/plusplus/fbs/alchemy/AlchemyRegistry$ProductExpPair.class Binary files differnew file mode 100644 index 0000000..824df68 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/alchemy/AlchemyRegistry$ProductExpPair.class diff --git a/src/main/java/jp/plusplus/fbs/alchemy/AlchemyRegistry$Recipe.class b/src/main/java/jp/plusplus/fbs/alchemy/AlchemyRegistry$Recipe.class Binary files differnew file mode 100644 index 0000000..10956fd --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/alchemy/AlchemyRegistry$Recipe.class diff --git a/src/main/java/jp/plusplus/fbs/alchemy/AlchemyRegistry$WeightedItemStack.class b/src/main/java/jp/plusplus/fbs/alchemy/AlchemyRegistry$WeightedItemStack.class Binary files differnew file mode 100644 index 0000000..d7f8094 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/alchemy/AlchemyRegistry$WeightedItemStack.class diff --git a/src/main/java/jp/plusplus/fbs/alchemy/AlchemyRegistry.class b/src/main/java/jp/plusplus/fbs/alchemy/AlchemyRegistry.class Binary files differnew file mode 100644 index 0000000..db67bb8 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/alchemy/AlchemyRegistry.class diff --git a/src/main/java/jp/plusplus/fbs/alchemy/AlchemyRegistry.java b/src/main/java/jp/plusplus/fbs/alchemy/AlchemyRegistry.java new file mode 100644 index 0000000..c14952b --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/alchemy/AlchemyRegistry.java @@ -0,0 +1,907 @@ +package jp.plusplus.fbs.alchemy;
+
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.alchemy.characteristic.*;
+import jp.plusplus.fbs.item.ItemCore;
+import net.minecraft.init.Blocks;
+import net.minecraft.init.Items;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.nbt.NBTTagList;
+import net.minecraft.util.StatCollector;
+import net.minecraftforge.oredict.OreDictionary;
+
+import java.util.*;
+
+/**
+ * Created by plusplus_F on 2015/09/08.
+ * たぶん錬金術はわりと規模がでかくなると思うんで分離
+ */
+public class AlchemyRegistry {
+ //特性
+ private ArrayList<Class<? extends CharacteristicBase>> characteristics=new ArrayList<Class<? extends CharacteristicBase>>();
+ private HashMap<Class<? extends CharacteristicBase>, Integer> characteristicsIdMap=new HashMap<Class<? extends CharacteristicBase>, Integer>();
+ //素材
+ private HashMap<String, ArrayList<ItemStack>> materials=new HashMap<String, ArrayList<ItemStack>>();
+ private HashMap<ItemStack, ArrayList<String>> materialNames=new HashMap<ItemStack, ArrayList<String>>();
+ //鑑定
+ private HashMap<AppraisalItemStack, ArrayList<WeightedItemStack>> appraisalItems=new HashMap<AppraisalItemStack, ArrayList<WeightedItemStack>>();
+ //調合
+ private ArrayList<Recipe> recipes=new ArrayList<Recipe>();
+ private ArrayList<ProductExpPair> productExpPairs=new ArrayList<ProductExpPair>();
+ //カゴ
+ private ArrayList<ItemStack> basketItems=new ArrayList<ItemStack>();
+
+ private static AlchemyRegistry instance=new AlchemyRegistry();
+ private static Random rand=new Random();
+
+ private AlchemyRegistry(){}
+
+ public static Random getRandom(){ return instance.rand; }
+
+
+ public static void RegisterAlchemy(){
+ //-------------------------------------------------------------------------------------------------------
+ // 特性
+ //-------------------------------------------------------------------------------------------------------
+ AddCharacteristic(CharacteristicSanity.Gain.class);
+ AddCharacteristic(CharacteristicSanity.Lose.class);
+ AddCharacteristic(CharacteristicHealth.Gain.class);
+ AddCharacteristic(CharacteristicHealth.Lose.class);
+ if(FBS.cooperatesSS2){
+ AddCharacteristic(CharacteristicWater.Gain.class);
+ AddCharacteristic(CharacteristicWater.Lose.class);
+ AddCharacteristic(CharacteristicStamina.Gain.class);
+ AddCharacteristic(CharacteristicStamina.Lose.class);
+ }
+ AddCharacteristic(CharacteristicExp.Gain.class);
+ AddCharacteristic(CharacteristicExp.Lose.class);
+ AddCharacteristic(CharacteristicLook.class);
+ AddCharacteristic(CharacteristicWeight.class);
+ AddCharacteristic(CharacteristicQuality.class);
+ AddCharacteristic(CharacteristicCleverness.Gain.class);
+ AddCharacteristic(CharacteristicPoison.Gain.class);
+ AddCharacteristic(CharacteristicPoison.Lose.class);
+ AddCharacteristic(CharacteristicPower.Gain.class);
+ AddCharacteristic(CharacteristicPower.Lose.class);
+ AddCharacteristic(CharacteristicSpeed.Gain.class);
+ AddCharacteristic(CharacteristicSpeed.Lose.class);
+ AddCharacteristic(CharacteristicConfusion.Gain.class);
+ AddCharacteristic(CharacteristicConfusion.Lose.class);
+
+ //-------------------------------------------------------------------------------------------------------
+ // 鑑定
+ //-------------------------------------------------------------------------------------------------------
+ RegisterAppraisal(new ItemStack(Items.potionitem), new ItemStack(ItemCore.alchemyMaterial, 1, 0), 63);
+ RegisterAppraisal(new ItemStack(Items.potionitem), new ItemStack(ItemCore.alchemyMaterial, 1, 1), 1);
+ RegisterAppraisal(new ItemStack(Items.lava_bucket), new ItemStack(ItemCore.alchemyMaterial, 1, 2), 1);
+
+ RegisterAppraisal("treeLeaves", new ItemStack(ItemCore.alchemyMaterial, 1, 3), 63);
+ RegisterAppraisal("treeLeaves", new ItemStack(ItemCore.alchemyMaterial, 1, 6), 1);
+ RegisterAppraisal(new ItemStack(Items.stick), new ItemStack(ItemCore.alchemyMaterial, 1, 4), 63);
+ RegisterAppraisal(new ItemStack(Items.stick), new ItemStack(ItemCore.alchemyMaterial, 1, 7), 1);
+
+ for(int i=0;i<ItemAlchemyMaterial.NAMES.length;i++){
+ if(ItemAlchemyMaterial.NAMES[i].startsWith("herb") && i!=18 && i!=36 && i!=37){
+ RegisterAppraisal(new ItemStack(ItemCore.herbUnknown), new ItemStack(ItemCore.alchemyMaterial, 1, i), 10);
+ }
+ if(ItemAlchemyMaterial.NAMES[i].startsWith("seeds")){
+ RegisterAppraisal(new ItemStack(ItemCore.seedsUnknown), new ItemStack(ItemCore.alchemyMaterial, 1, i), 10);
+ }
+ if(ItemAlchemyMaterial.NAMES[i].startsWith("grass")){
+ RegisterAppraisal(new ItemStack(ItemCore.grassUnknown), new ItemStack(ItemCore.alchemyMaterial, 1, i), 10);
+ }
+ if(ItemAlchemyMaterial.NAMES[i].startsWith("flower") || i==31 || i==35){
+ RegisterAppraisal(new ItemStack(ItemCore.flowerUnknown), new ItemStack(ItemCore.alchemyMaterial, 1, i), 10);
+ }
+ if(ItemAlchemyMaterial.NAMES[i].startsWith("fruits") && i!=24){
+ RegisterAppraisal(new ItemStack(ItemCore.fruitsUnknown), new ItemStack(ItemCore.alchemyMaterial, 1, i), 10);
+ }
+ if(ItemAlchemyMaterial.NAMES[i].startsWith("mushroom") && i!=25 && (i<42 || i>45)){
+ RegisterAppraisal(new ItemStack(ItemCore.mushroomUnknown), new ItemStack(ItemCore.alchemyMaterial, 1, i), 10);
+ }
+ }
+ RegisterAppraisal(new ItemStack(ItemCore.herbUnknown), new ItemStack(ItemCore.alchemyMaterial, 1, 18), 60);
+ RegisterAppraisal(new ItemStack(ItemCore.herbUnknown), new ItemStack(ItemCore.alchemyMaterial, 1, 36), 3);
+ RegisterAppraisal(new ItemStack(ItemCore.herbUnknown), new ItemStack(ItemCore.alchemyMaterial, 1, 37), 3);
+
+ RegisterAppraisal(new ItemStack(ItemCore.mushroomUnknown), new ItemStack(ItemCore.alchemyMaterial, 1, 25), 50);
+ RegisterAppraisal(new ItemStack(ItemCore.mushroomUnknown), new ItemStack(ItemCore.alchemyMaterial, 1, 42), 3);
+ RegisterAppraisal(new ItemStack(ItemCore.mushroomUnknown), new ItemStack(ItemCore.alchemyMaterial, 1, 43), 3);
+ RegisterAppraisal(new ItemStack(ItemCore.mushroomUnknown), new ItemStack(ItemCore.alchemyMaterial, 1, 44), 3);
+ RegisterAppraisal(new ItemStack(ItemCore.mushroomUnknown), new ItemStack(ItemCore.alchemyMaterial, 1, 45), 3);
+
+ for(int i=0;i<ItemEatableAlchemyMaterial.NAMES.length;i++){
+ if(ItemEatableAlchemyMaterial.NAMES[i].startsWith("herb")){
+ RegisterAppraisal(new ItemStack(ItemCore.herbUnknown), new ItemStack(ItemCore.alchemyMaterialEatable, 1, i), 10);
+ }
+ if(ItemEatableAlchemyMaterial.NAMES[i].startsWith("seeds")){
+ RegisterAppraisal(new ItemStack(ItemCore.seedsUnknown), new ItemStack(ItemCore.alchemyMaterialEatable, 1, i), 10);
+ }
+ if(ItemEatableAlchemyMaterial.NAMES[i].startsWith("grass")){
+ RegisterAppraisal(new ItemStack(ItemCore.grassUnknown), new ItemStack(ItemCore.alchemyMaterialEatable, 1, i), 10);
+ }
+ if(ItemEatableAlchemyMaterial.NAMES[i].startsWith("flower")){
+ RegisterAppraisal(new ItemStack(ItemCore.flowerUnknown), new ItemStack(ItemCore.alchemyMaterialEatable, 1, i), 10);
+ }
+ if(ItemEatableAlchemyMaterial.NAMES[i].startsWith("fruits")){
+ RegisterAppraisal(new ItemStack(ItemCore.fruitsUnknown), new ItemStack(ItemCore.alchemyMaterialEatable, 1, i), 10);
+ }
+ if(ItemEatableAlchemyMaterial.NAMES[i].startsWith("mushroom")){
+ RegisterAppraisal(new ItemStack(ItemCore.mushroomUnknown), new ItemStack(ItemCore.alchemyMaterialEatable, 1, i), 10);
+ }
+ }
+
+ //-------------------------------------------------------------------------------------------------------
+ // 素材
+ //-------------------------------------------------------------------------------------------------------
+ for(int i=0;i<ItemAlchemyMaterial.NAMES.length;i++){
+ String t=ItemAlchemyMaterial.NAMES[i];
+
+ if(t.startsWith("grass") || t.startsWith("roots") || t.startsWith("grass") || t.startsWith("flower") || t.startsWith("seeds") || t.startsWith("fruits")){
+ RegisterMaterial("plant", new ItemStack(ItemCore.alchemyMaterial, 1, i));
+ }
+
+ if(t.startsWith("herb")) RegisterMaterial("herb", new ItemStack(ItemCore.alchemyMaterial, 1, i));
+ if(t.startsWith("mushroom")) RegisterMaterial("mushroom", new ItemStack(ItemCore.alchemyMaterial, 1, i));
+
+ if(t.startsWith("roots")) RegisterMaterial("roots", new ItemStack(ItemCore.alchemyMaterial, 1, i));
+ if(t.startsWith("branch")) RegisterMaterial("branch", new ItemStack(ItemCore.alchemyMaterial, 1, i));
+ if(t.startsWith("leaves")) RegisterMaterial("leaves", new ItemStack(ItemCore.alchemyMaterial, 1, i));
+
+ if(t.endsWith("Unclean")) RegisterMaterial("unclean", new ItemStack(ItemCore.alchemyMaterial, 1, i));
+ }
+ for(int i=0;i<ItemEatableAlchemyMaterial.NAMES.length;i++){
+ String t=ItemEatableAlchemyMaterial.NAMES[i];
+ if(t.startsWith("grass") || t.startsWith("roots") || t.startsWith("grass") || t.startsWith("flower") || t.startsWith("seeds") || t.startsWith("fruits")){
+ RegisterMaterial("plant", new ItemStack(ItemCore.alchemyMaterialEatable, 1, i));
+ }
+
+ if(t.startsWith("herb")) RegisterMaterial("herb", new ItemStack(ItemCore.alchemyMaterialEatable, 1, i));
+ if(t.startsWith("mushroom")) RegisterMaterial("mushroom", new ItemStack(ItemCore.alchemyMaterialEatable, 1, i));
+
+ if(t.startsWith("roots")) RegisterMaterial("roots", new ItemStack(ItemCore.alchemyMaterialEatable, 1, i));
+ if(t.startsWith("branch")) RegisterMaterial("branch", new ItemStack(ItemCore.alchemyMaterialEatable, 1, i));
+ if(t.startsWith("leaves")) RegisterMaterial("leaves", new ItemStack(ItemCore.alchemyMaterialEatable, 1, i));
+
+ if(t.endsWith("Unclean")) RegisterMaterial("unclean", new ItemStack(ItemCore.alchemyMaterialEatable, 1, i));
+ }
+ //RegisterMaterial("herb", new ItemStack(ItemCore.alchemyIntermediateMaterial, 1, 2));
+ RegisterMaterial("herb", new ItemStack(ItemCore.alchemyIntermediateMaterial, 1, 3));
+
+ RegisterMaterial("potion base", new ItemStack(ItemCore.alchemyMaterial, 1, 18));
+ RegisterMaterial("potion base", new ItemStack(ItemCore.alchemyMaterial, 1, 25));
+ RegisterMaterial("potion base", new ItemStack(ItemCore.alchemyIntermediateMaterial, 1, 0));
+
+ //for(int i=9;i<18;i++) if(!ItemAlchemyMaterial.NAMES[i].startsWith("seeds")) RegisterMaterial("potion flavor", new ItemStack(ItemCore.alchemyMaterial, 1, i));
+ for(int i=19;i<25;i++) RegisterMaterial("potion flavor", new ItemStack(ItemCore.alchemyMaterial, 1, i));
+ for(int i=36;i<40;i++) RegisterMaterial("potion flavor", new ItemStack(ItemCore.alchemyMaterial, 1, i));
+ //for(int i=41;i<46;i++) RegisterMaterial("potion flavor", new ItemStack(ItemCore.alchemyMaterial, 1, i));
+ //for(int i=2;i<7;i++) RegisterMaterial("potion flavor", new ItemStack(ItemCore.alchemyMaterialEatable, 1, i));
+ RegisterMaterial("potion flavor", new ItemStack(ItemCore.alchemyMaterial, 1, 40));
+ RegisterMaterial("potion flavor", new ItemStack(ItemCore.alchemyIntermediateMaterial, 1, 2));
+ RegisterMaterial("potion flavor", new ItemStack(ItemCore.alchemyIntermediateMaterial, 1, 3));
+ RegisterMaterial("potion flavor", new ItemStack(ItemCore.alchemyIntermediateMaterial, 1, 6));
+ RegisterMaterial("potion flavor", new ItemStack(ItemCore.alchemyIntermediateMaterial, 1, 7));
+
+ RegisterMaterial("activator", new ItemStack(ItemCore.alchemyIntermediateMaterial, 1, 4));
+
+ RegisterMaterial("spirit medium", new ItemStack(ItemCore.alchemyMaterial, 1, 22));
+ RegisterMaterial("spirit medium", new ItemStack(ItemCore.alchemyMaterial, 1, 40));
+
+ RegisterMaterial("water", new ItemStack(ItemCore.alchemyMaterial, 1, 0));
+ RegisterMaterial("water", new ItemStack(ItemCore.alchemyMaterial, 1, 1));
+ RegisterMaterial("lava", new ItemStack(ItemCore.alchemyMaterial, 1, 2));
+
+ RegisterMaterial("poisonous", new ItemStack(ItemCore.alchemyMaterial, 1, 26));
+ RegisterMaterial("poisonous", new ItemStack(ItemCore.alchemyMaterial, 1, 27));
+ RegisterMaterial("poisonous", new ItemStack(ItemCore.alchemyMaterial, 1, 29));
+ RegisterMaterial("poisonous", new ItemStack(ItemCore.alchemyMaterial, 1, 30));
+ RegisterMaterial("poisonous", new ItemStack(ItemCore.alchemyMaterial, 1, 41));
+ RegisterMaterial("poisonous", new ItemStack(ItemCore.alchemyMaterial, 1, 42));
+ RegisterMaterial("poisonous", new ItemStack(ItemCore.alchemyMaterial, 1, 45));
+ RegisterMaterial("poisonous", new ItemStack(ItemCore.alchemyMaterialEatable, 1, 3));
+
+ RegisterMaterial("explosive", new ItemStack(ItemCore.alchemyMaterial, 1, 28));
+ RegisterMaterial("explosive", new ItemStack(ItemCore.alchemyMaterial, 1, 34));
+ RegisterMaterial("explosive", new ItemStack(ItemCore.alchemyMaterial, 1, 38));
+ RegisterMaterial("explosive", new ItemStack(ItemCore.alchemyIntermediateMaterial, 1, 1));
+ //-------------------------------------------------------------------------------------------------------
+ // 調合
+ //-------------------------------------------------------------------------------------------------------
+ RegisterRecipe(new ItemStack(ItemCore.alchemyRecipe, 1, 0), new ItemStack(ItemCore.alchemyPotion, 1, 0), 5, 0.6f, 100, "water", "potion base", "potion flavor");
+ RegisterRecipe(new ItemStack(ItemCore.alchemyRecipe, 1, 1), new ItemStack(ItemCore.alchemyPotion, 1, 1), 10, 0.55f, 150, "water", "potion base", "potion flavor", "potion flavor");
+ RegisterRecipe(new ItemStack(ItemCore.alchemyRecipe, 1, 2), new ItemStack(ItemCore.alchemyIntermediateMaterial, 1, 0), 1, 0.85f, 20, "water");
+ RegisterRecipe(new ItemStack(ItemCore.alchemyRecipe, 1, 3), new ItemStack(ItemCore.alchemyIntermediateMaterial, 1, 1), 3, 0.7f, 20, "explosive");
+ RegisterRecipe(new ItemStack(ItemCore.alchemyRecipe, 1, 4), new ItemStack(ItemCore.alchemyIntermediateMaterial, 1, 2), 7, 0.6f, 80, "herb", "herb", "herb");
+ RegisterRecipe(new ItemStack(ItemCore.alchemyRecipe, 1, 5), new ItemStack(ItemCore.alchemyIntermediateMaterial, 1, 3), 7, 0.6f, 80, "herb", "herb", "herb");
+ RegisterRecipe(new ItemStack(ItemCore.alchemyRecipe, 1, 6), new ItemStack(ItemCore.alchemyIntermediateMaterial, 1, 4), 12, 0.45f, 150, "water", "potion base", "explosive");
+ RegisterRecipe(new ItemStack(ItemCore.alchemyRecipe, 1, 7), new ItemStack(ItemCore.alchemyPotion, 1, 2), 15, 0.45f, 200, "water", "potion base", "spirit medium");
+ RegisterRecipe(new ItemStack(ItemCore.alchemyRecipe, 1, 8), new ItemStack(ItemCore.alchemyIntermediateMaterial, 1, 5), 10, 0.5f, 110, "activator", "potion flavor");
+ RegisterRecipe(new ItemStack(ItemCore.alchemyRecipe, 1, 9), new ItemStack(ItemCore.alchemyIntermediateMaterial, 1, 6), 1, 0.75f, 20, "plant");
+ RegisterRecipe(new ItemStack(ItemCore.alchemyRecipe, 1, 10), new ItemStack(ItemCore.alchemyIntermediateMaterial, 1, 7), 1, 0.75f, 20, "mushroom");
+
+
+ //-------------------------------------------------------------------------------------------------------
+ // 錬金アイテム以外でカゴに入るアイテム
+ //-------------------------------------------------------------------------------------------------------
+ RegisterBasketItem(new ItemStack(ItemCore.herbUnknown));
+ RegisterBasketItem(new ItemStack(ItemCore.grassUnknown));
+ RegisterBasketItem(new ItemStack(ItemCore.fruitsUnknown));
+ RegisterBasketItem(new ItemStack(ItemCore.flowerUnknown));
+ RegisterBasketItem(new ItemStack(ItemCore.seedsUnknown));
+ RegisterBasketItem(new ItemStack(ItemCore.mushroomUnknown));
+ }
+
+ /**
+ * デフォルト特性を持った状態でItemStackを生成する
+ * @param item IAlchemyMaterialまたはIAlchemyProductのいずれかを実装したItem
+ * @param stacksize
+ * @param meta
+ * @return
+ */
+ public static ItemStack getItemStack(Item item, int stacksize, int meta){
+ ItemStack itemStack=new ItemStack(item, stacksize, meta);
+ itemStack.setTagCompound(new NBTTagCompound());
+ if(item instanceof IAlchemyMaterial){
+ AlchemyRegistry.WriteCharacteristicToNBT(itemStack.getTagCompound(), ((IAlchemyMaterial) item).addCharacteristics(itemStack, rand));
+ }
+ if(item instanceof IAlchemyProduct){
+ AlchemyRegistry.WriteCharacteristicToNBT(itemStack.getTagCompound(), ((IAlchemyProduct) item).getDefaultCharacteristics(itemStack, rand));
+ }
+ return itemStack;
+ }
+
+ //--------------------------------------------------------------------------------------
+ // 特性
+ //--------------------------------------------------------------------------------------
+
+ /**
+ * 特性を登録する
+ * @param chara
+ */
+ public static void AddCharacteristic(Class<? extends CharacteristicBase> chara){
+ instance.characteristics.add(chara);
+ instance.characteristicsIdMap.put(chara, instance.characteristics.size()-1);
+ }
+
+ /**
+ * 特性からIdを得る
+ * @param chara
+ * @return
+ */
+ public static int GetCharacteristicId(Class<? extends CharacteristicBase> chara){
+ if(!instance.characteristicsIdMap.containsKey(chara)){
+ AddCharacteristic(chara);
+ }
+
+ return instance.characteristicsIdMap.get(chara);
+ }
+
+ /**
+ * Idから特性を得る
+ * @param id
+ * @return
+ */
+ public static Class<? extends CharacteristicBase> GetCharacteristicFromId(int id){
+ if(id<0 || id>=instance.characteristics.size()) return null;
+ return instance.characteristics.get(id);
+ }
+
+ /**
+ * 特性のリストをnbtに書き込む
+ * @param nbt
+ * @param list
+ */
+ public static void WriteCharacteristicToNBT(NBTTagCompound nbt, ArrayList<CharacteristicBase> list){
+ NBTTagList tags=new NBTTagList();
+ for(CharacteristicBase cb : list){
+ NBTTagCompound tag=new NBTTagCompound();
+ tag.setInteger("id", cb.getId());
+ cb.writeToNBT(tag);
+ tags.appendTag(tag);
+ }
+
+ nbt.setTag("characteristics", tags);
+ nbt.setBoolean("appraisal", true);
+ }
+
+ /**
+ * nbtから特性リストを得る
+ * @param nbt
+ * @return
+ */
+ public static ArrayList<CharacteristicBase> ReadCharacteristicFromNBT(NBTTagCompound nbt){
+ ArrayList<CharacteristicBase> ret=new ArrayList<CharacteristicBase>();
+
+ if(nbt!=null && nbt.hasKey("characteristics")){
+ NBTTagList tags=(NBTTagList)nbt.getTag("characteristics");
+ for(int i=0;i<tags.tagCount();i++){
+ NBTTagCompound tag=tags.getCompoundTagAt(i);
+ int id=tag.getInteger("id");
+ try{
+ CharacteristicBase cb=GetCharacteristicFromId(id).newInstance();
+ cb.readFromNBT(tag);
+ ret.add(cb);
+ }
+ catch (Exception e){
+ FBS.logger.error(e.toString());
+ }
+ }
+ }
+
+ return ret;
+ }
+
+ /**
+ * listに特性一覧表を追加する
+ * @param itemStack
+ * @param list
+ * @param flag
+ */
+ public static void AddCharacteristicsInfo(ItemStack itemStack, List list, boolean flag){
+ list.add(StatCollector.translateToLocal("alchemy.fbs.characteristic"));
+ if(itemStack.hasTagCompound()){
+ ArrayList<CharacteristicBase> cbs=AlchemyRegistry.ReadCharacteristicFromNBT(itemStack.getTagCompound());
+
+ for(CharacteristicBase cb : cbs){
+ list.add(cb.getNameColor()+"-"+cb.getLocalizedName()+":"+cb.getLocalizedEffectValue());
+ }
+ }
+ }
+
+ //--------------------------------------------------------------------------------------
+ // 素材
+ //--------------------------------------------------------------------------------------
+
+ /**
+ * 素材としてアイテムスタックを登録する
+ * @param name
+ * @param itemStack
+ */
+ public static void RegisterMaterial(String name, ItemStack itemStack){
+ if(!instance.materials.containsKey(name)){
+ ArrayList<ItemStack> list=new ArrayList<ItemStack>();
+ instance.materials.put(name, list);
+ }
+
+ instance.materials.get(name).add(itemStack);
+ RegisterMaterialName(itemStack, name);
+ }
+
+ /**
+ * アイテムスタックがその素材として使えるかを返す
+ * @param name
+ * @param itemStack
+ * @return
+ */
+ public static boolean IsMatching(String name, ItemStack itemStack){
+ if(!instance.materials.containsKey(name)) return false;
+ ArrayList<ItemStack> list=instance.materials.get(name);
+
+ for(ItemStack item : list){
+ if(item.isItemEqual(itemStack)){
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ private static Map.Entry<ItemStack, ArrayList<String>> cachedMaterial;
+ /**
+ * アイテムスタックの持つ素材名を得る
+ * @param itemStack
+ * @return
+ */
+ public static ArrayList<String> GetMaterialNames(ItemStack itemStack){
+ if(cachedMaterial!=null && cachedMaterial.getKey().isItemEqual(itemStack)){
+ return cachedMaterial.getValue();
+ }
+
+ for(Map.Entry<ItemStack, ArrayList<String>> e : instance.materialNames.entrySet()){
+ if(e.getKey().isItemEqual(itemStack)){
+ cachedMaterial=e;
+ return e.getValue();
+ }
+ }
+ return null;
+ }
+ private static void RegisterMaterialName(ItemStack itemStack, String name){
+ ArrayList<String> list=GetMaterialNames(itemStack);
+
+ if(list!=null){
+ //素材名リストがある場合直接追加
+ list.add(name);
+ }
+ else{
+ //素材名リストがない場合リスト作ってマップに追加
+ list=new ArrayList<String>();
+ list.add(name);
+
+ instance.materialNames.put(itemStack, list);
+ }
+ }
+
+ /**
+ * listに素材名一覧を追加する
+ * @param itemStack
+ * @param list
+ * @param flag
+ */
+ public static void AddMaterialInfo(ItemStack itemStack, List list, boolean flag){
+ list.add(StatCollector.translateToLocal("alchemy.fbs.material"));
+ ArrayList<String> names= AlchemyRegistry.GetMaterialNames(itemStack);
+ if(names!=null && !names.isEmpty()){
+ for(String str : names){
+ list.add("-"+str);
+ }
+ }
+ }
+ //--------------------------------------------------------------------------------------
+ // 鑑定
+ //--------------------------------------------------------------------------------------
+
+ /**
+ * 鑑定アイテムを登録する
+ * @param input
+ * @param output 鑑定品(ItemはIAlchemyMaterialを継承しておくこと)
+ * @param weight 出現重み
+ */
+ public static void RegisterAppraisal(ItemStack input, ItemStack output, int weight){
+ AppraisalItemStack ais=new AppraisalItemStack(input);
+ ArrayList<WeightedItemStack> list=GetAppraisals(ais);
+ list.add(new WeightedItemStack(weight, output));
+ }
+ /**
+ * 鑑定アイテムを登録する(鉱石辞書編)
+ * @param input
+ * @param output 鑑定品(ItemはIAlchemyMaterialを継承しておくこと)
+ * @param weight 出現重み
+ */
+ public static void RegisterAppraisal(String input, ItemStack output, int weight){
+ AppraisalItemStack ais=new AppraisalItemStack(input);
+ ArrayList<WeightedItemStack> list=GetAppraisals(ais);
+ list.add(new WeightedItemStack(weight, output));
+ }
+ private static ArrayList<WeightedItemStack> GetAppraisals(AppraisalItemStack ais){
+ ArrayList<WeightedItemStack> list;
+
+ for(AppraisalItemStack aiss : instance.appraisalItems.keySet()){
+ if(aiss.equals(ais)){
+ return instance.appraisalItems.get(aiss);
+ }
+ }
+ list=new ArrayList<WeightedItemStack>();
+ instance.appraisalItems.put(ais, list);
+ return list;
+ }
+
+ public static ArrayList<WeightedItemStack> GetAppraisalList(ItemStack input){
+ for(AppraisalItemStack aiss : instance.appraisalItems.keySet()){
+ if(aiss.isItemEqual(input)) return instance.appraisalItems.get(aiss);
+ }
+ return null;
+ }
+ public static ArrayList<ItemPair> GetAlllAppraisal(){
+ ArrayList<ItemPair> ret=new ArrayList<ItemPair>();
+ for(Map.Entry<AppraisalItemStack, ArrayList<WeightedItemStack>> e : instance.appraisalItems.entrySet()){
+ for(WeightedItemStack wis : e.getValue()){
+ ret.add(new ItemPair(e.getKey().getItemStack(), wis.getItemStack()));
+ }
+ }
+ return ret;
+ }
+
+ /**
+ * そのアイテムが鑑定できるか判定する
+ * @param input
+ * @return
+ */
+ public static boolean CanAppraisal(ItemStack input){
+ NBTTagCompound nbt=input.getTagCompound();
+ if(nbt!=null && nbt.getBoolean("appraisal")) return false;
+
+ return GetAppraisalList(input)!=null;
+ }
+
+ /**
+ * 鑑定したアイテムを得る。この時ランダムで特性が付与される。
+ * @param input
+ * @return 鑑定できないアイテムであればnull
+ */
+ public static ItemStack GetRandomAppraisal(ItemStack input){
+ ArrayList<WeightedItemStack> list=GetAppraisalList(input);
+ if(list.isEmpty()) return null;
+
+ int ws=0;
+ for(WeightedItemStack wis : list){
+ ws+=wis.getWeight();
+ }
+
+ int r=instance.rand.nextInt(ws);
+ ws=0;
+ for(int i=0;i<list.size();i++){
+ WeightedItemStack wis=list.get(i);
+ if(r<wis.getWeight()+ws){
+ ItemStack ret=wis.getItemStack().copy();
+
+ //アイテムに特性を付与
+ ArrayList<CharacteristicBase> cList=((IAlchemyMaterial)ret.getItem()).addCharacteristics(ret, instance.rand);
+ if(cList!=null && !cList.isEmpty()){
+ ret.setTagCompound(new NBTTagCompound());
+ WriteCharacteristicToNBT(ret.getTagCompound(), cList);
+ // FBS.logger.info("written");
+ }
+ //FBS.logger.info(cList.toString());
+
+ return ret;
+ }
+ ws+=wis.getWeight();
+ }
+
+ return null;
+ }
+
+
+ //--------------------------------------------------------------------------------------
+ // 調合
+ //--------------------------------------------------------------------------------------
+ private static Recipe cachedRecipe;
+ public static void RegisterRecipe(ItemStack key, ItemStack output, int lv, float prob, double exp, String ... materials){
+ instance.recipes.add(new Recipe(lv, prob, key, output, materials));
+ RegisterProductExpPair(output, exp);
+ }
+ public static Recipe GetRecipe(ItemStack key){
+ if(cachedRecipe!=null && cachedRecipe.isKey(key)) return cachedRecipe;
+
+ for(Recipe r : instance.recipes){
+ if(r.isKey(key)){
+ cachedRecipe=r;
+ return cachedRecipe;
+ }
+ }
+
+ return null;
+ }
+ /**
+ * レシピと投入済み素材リストから、inputが未投入の素材か判定する
+ * @param key
+ * @param input
+ * @param inputMaterials
+ * @return
+ */
+ public static boolean IsMaterial(ItemStack key, ItemStack input, ArrayList<ItemStack> inputMaterials){
+ //レシピを得る
+ Recipe r=GetRecipe(key);
+ return IsMaterial(r, input, inputMaterials);
+ }
+ public static boolean IsMaterial(Recipe recipe, ItemStack input, ArrayList<ItemStack> inputMaterials){
+ if(recipe==null) return false;
+
+ //matから未投入素材リストを得る
+ LinkedList<String> mats=recipe.getMaterialList();
+ LinkedList<ItemStack> tmp=new LinkedList<ItemStack>(inputMaterials);
+ for(int i=0;i<mats.size();){
+ String name=mats.get(i);
+
+ boolean found=false;
+ for(ItemStack is : tmp){
+ if(IsMatching(name, is)){
+ tmp.remove(is);
+ found=true;
+ break;
+ }
+ }
+ if(found){
+ mats.remove(i);
+ continue;
+ }
+ i++;
+ }
+
+ //未投入リストにinputが含まれているか判定
+ for(String name : mats){
+ if(IsMatching(name, input)) return true;
+ }
+ return false;
+ }
+
+ public static boolean IsSatisfied(ItemStack key, ArrayList<ItemStack> inputMaterials){
+ return IsSatisfied(GetRecipe(key), inputMaterials);
+ }
+ public static boolean IsSatisfied(Recipe recipe, ArrayList<ItemStack> inputMaterials){
+ if(recipe==null) return false;
+
+ //matから未投入素材リストを得る
+ LinkedList<String> mats=recipe.getMaterialList();
+
+ //投入素材数が違うのに条件を満たしているはずがないだろ!
+ if(inputMaterials.size()!=mats.size()){
+ return false;
+ }
+
+ //投入素材リストを走査し、必要素材リストの中身を抜いていく
+ LinkedList<ItemStack> tmp=new LinkedList<ItemStack>(inputMaterials);
+ for(int i=0;i<mats.size();){
+ String name=mats.get(i);
+
+ boolean found=false;
+ for(ItemStack is : tmp){
+ if(IsMatching(name, is)){
+ tmp.remove(is);
+ found=true;
+ break;
+ }
+ }
+ if(found){
+ mats.remove(i);
+ continue;
+ }
+ i++;
+ }
+
+ //条件を満たしていればこの時点で必要素材リストは空のはずである
+ return mats.isEmpty();
+ }
+
+ /**
+ * レシピと投入済み素材リストから、特性が付与された完成品を得る
+ * @param key
+ * @param inputMaterials
+ * @return
+ */
+ public static ItemStack GetAlchemyProduct(ItemStack key, ArrayList<ItemStack> inputMaterials){
+ Recipe r=GetRecipe(key);
+ ItemStack ret=r.getProduct();
+
+ IAlchemyProduct prod=((IAlchemyProduct) ret.getItem());
+ ArrayList<CharacteristicBase> characteristics;//完成品の持つ特性
+
+ //------------------------初期特性------------------------------
+ characteristics=prod.getDefaultCharacteristics(ret, instance.rand);
+
+ //-----------------------引継ぎ特性-----------------------------
+ LinkedList<CharacteristicBase> inherits=new LinkedList<CharacteristicBase>();
+ for(ItemStack mat : inputMaterials){
+ ArrayList<CharacteristicBase> aList=ReadCharacteristicFromNBT(mat.getTagCompound());
+ for(CharacteristicBase cb : aList){
+ if(prod.canInherit(ret, cb)) inherits.add(cb);
+ }
+ }
+
+ //-----------------------引継ぎ判定-----------------------------
+ int max=prod.getMaxInheritAmount(ret);
+ for(int i=0;i<max && !inherits.isEmpty();i++){
+ int index=instance.rand.nextInt(inherits.size());
+ CharacteristicBase cb=inherits.get(index);
+
+ //その特性を既に持っているか
+ boolean had=false;
+ for(CharacteristicBase ccbb : characteristics){
+ if(ccbb.getClass().equals(cb.getClass())){
+ had=true;
+ break;
+ }
+ }
+ if(had){
+ inherits.remove(index);
+ continue;
+ }
+
+ characteristics.add(cb);
+ }
+
+ //------------------------特性を書き込む-------------------------------
+ if(!ret.hasTagCompound()) ret.setTagCompound(new NBTTagCompound());
+ WriteCharacteristicToNBT(ret.getTagCompound(), characteristics);
+
+ return ret;
+ }
+ public static ItemStack GetAlchemyProduct(Recipe recipe, ArrayList<ItemStack> inputMaterials){
+ ItemStack ret=recipe.getProduct().copy();
+
+ IAlchemyProduct prod=((IAlchemyProduct) ret.getItem());
+ ArrayList<CharacteristicBase> characteristics;//完成品の持つ特性
+
+ //------------------------初期特性------------------------------
+ characteristics=prod.getDefaultCharacteristics(ret, instance.rand);
+
+ //-----------------------引継ぎ特性-----------------------------
+ LinkedList<CharacteristicBase> inherits=new LinkedList<CharacteristicBase>();
+ for(ItemStack mat : inputMaterials){
+ ArrayList<CharacteristicBase> aList=ReadCharacteristicFromNBT(mat.getTagCompound());
+ for(CharacteristicBase cb : aList){
+ if(prod.canInherit(ret, cb)) inherits.add(cb);
+ }
+ }
+
+ //-----------------------引継ぎ判定-----------------------------
+ int max=prod.getMaxInheritAmount(ret);
+ for(int i=0;i<max && !inherits.isEmpty();i++){
+ int index=instance.rand.nextInt(inherits.size());
+ CharacteristicBase cb=inherits.get(index);
+ inherits.remove(index);
+
+ //その特性を既に持っているか
+ boolean had=false;
+ int cbIndex=-1;
+ for(int k=0;k<characteristics.size();k++){
+ if(characteristics.get(k).getClass().equals(cb.getClass())){
+ had=true;
+ cbIndex=k;
+ break;
+ }
+ }
+ if(had){
+ //特性が被った場合、より値の大きいものが優先される。
+ if(characteristics.get(cbIndex).getValue()<cb.getValue()) characteristics.remove(cbIndex);
+ else{
+ i--;
+ continue;
+ }
+ }
+
+ characteristics.add(cb);
+ }
+
+ //------------------------特性を書き込む-------------------------------
+ if(!ret.hasTagCompound()) ret.setTagCompound(new NBTTagCompound());
+ WriteCharacteristicToNBT(ret.getTagCompound(), characteristics);
+
+ return ret;
+ }
+ public static ArrayList<Recipe> GetRecieps(){
+ return instance.recipes;
+ }
+
+ private static ProductExpPair cachedPEP;
+ public static void RegisterProductExpPair(ItemStack p, double e){
+ instance.productExpPairs.add(new ProductExpPair(p, e));
+ }
+ public static double GetProductExp(ItemStack p){
+ if(cachedPEP!=null && cachedPEP.isItemEqual(p)){
+ return cachedPEP.getExp();
+ }
+
+ for(ProductExpPair pep : instance.productExpPairs){
+ if(pep.isItemEqual(p)){
+ cachedPEP=pep;
+ return pep.getExp();
+ }
+ }
+
+ return 0;
+ }
+
+ private static ItemStack cachedBasketItem;
+ public static void RegisterBasketItem(ItemStack itemStack){
+ instance.basketItems.add(itemStack);
+ }
+ public static boolean isBasketItem(ItemStack itemStack){
+ if(cachedBasketItem!=null && cachedBasketItem.isItemEqual(itemStack)) return true;
+
+ for(ItemStack is : instance.basketItems){
+ if(is.isItemEqual(itemStack)){
+ cachedBasketItem=is;
+ return true;
+ }
+ }
+ return false;
+ }
+
+ //-------------------------------------------------------------------------------------
+ public static class AppraisalItemStack{
+ private boolean isOre;
+ private int oreId;
+ private ItemStack itemStack;
+
+ public AppraisalItemStack(ItemStack item){
+ isOre=false;
+ itemStack=item;
+ }
+ public AppraisalItemStack(String oreId){
+ isOre=true;
+ this.oreId= OreDictionary.getOreID(oreId);
+ }
+ public boolean isItemEqual(ItemStack m){
+ if (isOre){
+ int[] ids=OreDictionary.getOreIDs(m);
+ for(int i : ids){
+ if(i==oreId) return true;
+ }
+ return false;
+ }
+ else{
+ return itemStack.isItemEqual(m);
+ }
+ }
+
+ public ItemStack getItemStack(){
+ if(itemStack==null && isOre){
+ itemStack=OreDictionary.getOres(OreDictionary.getOreName(oreId)).get(0).copy();
+ }
+ return itemStack;
+ }
+
+ @Override
+ public boolean equals(Object obj){
+ if(obj instanceof AppraisalItemStack){
+ AppraisalItemStack ais=(AppraisalItemStack)obj;
+ if(isOre!=ais.isOre) return false;
+ return isOre?oreId==ais.oreId:itemStack.isItemEqual(ais.itemStack);
+ }
+ return false;
+ }
+ }
+ public static class WeightedItemStack{
+ private int weight;
+ private ItemStack itemStack;
+
+ public WeightedItemStack(int w, ItemStack stack){
+ weight=w;
+ itemStack=stack;
+ }
+
+ public int getWeight(){ return weight; }
+ public ItemStack getItemStack(){ return itemStack; }
+
+ }
+ public static class Recipe{
+ protected int level;
+ protected float prob;
+ protected ItemStack key;
+ protected ItemStack output;
+ protected String[] materials;
+
+ public Recipe(int level, float prob, ItemStack key, ItemStack output, String ... materials){
+ this.level=level;
+ this.prob=prob;
+ this.key=key;
+ this.output=output;
+ this.materials=materials;
+ }
+
+ public ItemStack getKey(){ return key; }
+ public boolean isKey(ItemStack itemStack){
+ return key.isItemEqual(itemStack);
+ }
+ public ItemStack getProduct(){
+ return output;
+ }
+ public int getLevel(){ return level; }
+ public float getProb(){ return prob; }
+
+ public LinkedList<String> getMaterialList(){
+ LinkedList<String> list=new LinkedList<String>();
+ for(String n : materials) list.add(n);
+ return list;
+ }
+ }
+ public static class ProductExpPair{
+ public ItemStack product;
+ public double exp;
+
+ public ProductExpPair(ItemStack p, double e){
+ product=p;
+ exp=e;
+ }
+ public boolean isItemEqual(ItemStack item){
+ return product.isItemEqual(item);
+ }
+ public double getExp(){
+ return exp;
+ }
+ }
+ public static class ItemPair{
+ private ItemStack item1;
+ private ItemStack item2;
+ public ItemPair(ItemStack i1, ItemStack i2){
+ item1=i1;
+ item2=i2;
+ }
+ public ItemStack getItem1(){ return item1; }
+ public ItemStack getItem2(){ return item2; }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/alchemy/IAlchemyMaterial.class b/src/main/java/jp/plusplus/fbs/alchemy/IAlchemyMaterial.class Binary files differnew file mode 100644 index 0000000..ed9cc6b --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/alchemy/IAlchemyMaterial.class diff --git a/src/main/java/jp/plusplus/fbs/alchemy/IAlchemyMaterial.java b/src/main/java/jp/plusplus/fbs/alchemy/IAlchemyMaterial.java new file mode 100644 index 0000000..10b1a98 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/alchemy/IAlchemyMaterial.java @@ -0,0 +1,24 @@ +package jp.plusplus.fbs.alchemy;
+
+import jp.plusplus.fbs.alchemy.characteristic.CharacteristicBase;
+import jp.plusplus.fbs.world.biome.WorldGenDirtyOak;
+import net.minecraft.item.ItemStack;
+import net.minecraft.world.World;
+
+import java.util.ArrayList;
+import java.util.Random;
+
+/**
+ * Created by plusplus_F on 2015/09/08.
+ * 素材アイテムが実装すべきインターフェース
+ */
+public interface IAlchemyMaterial {
+ /**
+ * 鑑定時に特性を付与するための特性リストをランダムで生成する。
+ * 戻り値の内容が全てItemStackに付与される
+ * @param itemStack
+ * @param rand
+ * @return アイテムスタックに付与される特性(Nullable)
+ */
+ ArrayList<CharacteristicBase> addCharacteristics(ItemStack itemStack, Random rand);
+}
diff --git a/src/main/java/jp/plusplus/fbs/alchemy/IAlchemyProduct.class b/src/main/java/jp/plusplus/fbs/alchemy/IAlchemyProduct.class Binary files differnew file mode 100644 index 0000000..472d110 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/alchemy/IAlchemyProduct.class diff --git a/src/main/java/jp/plusplus/fbs/alchemy/IAlchemyProduct.java b/src/main/java/jp/plusplus/fbs/alchemy/IAlchemyProduct.java new file mode 100644 index 0000000..1104aee --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/alchemy/IAlchemyProduct.java @@ -0,0 +1,35 @@ +package jp.plusplus.fbs.alchemy;
+
+import jp.plusplus.fbs.alchemy.characteristic.CharacteristicBase;
+import net.minecraft.item.ItemStack;
+
+import java.util.ArrayList;
+import java.util.Random;
+
+/**
+ * Created by plusplus_F on 2015/09/09.
+ * 大釜によって作成できるアイテムに実装すべきインターフェース
+ */
+public interface IAlchemyProduct {
+ /**
+ * その特性を引き継げるか判定する
+ * @param cb 判定したい特性
+ * @return true:引継ぎ可能
+ */
+ boolean canInherit(ItemStack itemStack, CharacteristicBase cb);
+
+ /**
+ * 特性引継ぎ時に、引継ぎ可能な特性の数を返す
+ * @param itemStack
+ * @return
+ */
+ int getMaxInheritAmount(ItemStack itemStack);
+
+ /**
+ * 調合した際に、最初から付与されている特性リストを返す
+ * (このメソッドでは特性を付与しない!)
+ * @param itemStack
+ * @return
+ */
+ ArrayList<CharacteristicBase> getDefaultCharacteristics(ItemStack itemStack, Random rand);
+}
diff --git a/src/main/java/jp/plusplus/fbs/alchemy/ItemAlchemyIntermediateMaterial.class b/src/main/java/jp/plusplus/fbs/alchemy/ItemAlchemyIntermediateMaterial.class Binary files differnew file mode 100644 index 0000000..42eb338 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/alchemy/ItemAlchemyIntermediateMaterial.class diff --git a/src/main/java/jp/plusplus/fbs/alchemy/ItemAlchemyIntermediateMaterial.java b/src/main/java/jp/plusplus/fbs/alchemy/ItemAlchemyIntermediateMaterial.java new file mode 100644 index 0000000..c574a47 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/alchemy/ItemAlchemyIntermediateMaterial.java @@ -0,0 +1,143 @@ +package jp.plusplus.fbs.alchemy;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.alchemy.characteristic.*;
+import jp.plusplus.fbs.item.ItemBase;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.IIcon;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Random;
+
+/**
+ * Created by plusplus_F on 2015/10/19.
+ * 中間素材だよ!中間素材!
+ */
+public class ItemAlchemyIntermediateMaterial extends ItemBase implements IAlchemyMaterial, IAlchemyProduct {
+ public static String[] NAMES={
+ //0
+ "neutralizer", "gunpowder", "herbPowder", "herbDense", "potionActivate", "bladeSpice", "plantPowder", "mushroomPowder"
+ };
+ protected IIcon[] icons;
+
+ public ItemAlchemyIntermediateMaterial(){
+ setMaxDamage(0);
+ setHasSubtypes(true);
+ setCreativeTab(FBS.tabAlchemy);
+ }
+
+ @Override
+ public int getMetadata(int par1) {
+ return par1;
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void getSubItems(Item item, CreativeTabs tab, List list) {
+ for(int i=0;i<NAMES.length;i++){
+ ItemStack it=new ItemStack(item, 1, i);
+ it.setTagCompound(new NBTTagCompound());
+ ArrayList<CharacteristicBase> cbs=addCharacteristics(it, AlchemyRegistry.getRandom());
+ AlchemyRegistry.WriteCharacteristicToNBT(it.getTagCompound(), cbs);
+
+ list.add(it);
+ }
+ }
+
+ @Override
+ public String getUnlocalizedName(ItemStack p_77667_1_) {
+ int meta=p_77667_1_.getItemDamage();
+ if(meta<0 ||meta>=NAMES.length) meta=0;
+
+ return "item.fbs.intermediate." + NAMES[meta];
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void registerIcons(IIconRegister register) {
+ icons=new IIcon[NAMES.length];
+
+ for(int i=0;i<NAMES.length;i++){
+ icons[i]=register.registerIcon(FBS.MODID+":"+NAMES[i]);
+ }
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public IIcon getIconFromDamage(int p_77617_1_) {
+ return icons[p_77617_1_];
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void addInformation(ItemStack itemStack, EntityPlayer player, List list, boolean p_77624_4_) {
+ AlchemyRegistry.AddCharacteristicsInfo(itemStack, list, p_77624_4_);
+ if(itemStack.getItemDamage()!=5){
+ AlchemyRegistry.AddMaterialInfo(itemStack, list, p_77624_4_);
+ }
+ }
+
+ //-----------------------------------IAlchemyMaterial---------------------------------------------
+ @Override
+ public ArrayList<CharacteristicBase> addCharacteristics(ItemStack itemStack, Random rand) {
+ ArrayList<CharacteristicBase> list=new ArrayList<CharacteristicBase>();
+ return list;
+ }
+
+ //-----------------------------------IAlchemyProduct---------------------------------------------
+ @Override
+ public boolean canInherit(ItemStack itemStack, CharacteristicBase cb) {
+ int meta=itemStack.getItemDamage();
+
+ if(cb instanceof CharacteristicQuality){
+ return true;
+ }
+
+ if(meta!=0 && meta!=4 && cb instanceof CharacteristicWeight){
+ return true;
+ }
+
+ if((meta==2 || meta==3 || meta==6 || meta==7) &&
+ (cb instanceof CharacteristicHealth || cb instanceof CharacteristicSanity || cb instanceof CharacteristicStamina
+ || cb instanceof CharacteristicExp)){
+ return true;
+ }
+
+ if((meta==5 || meta==6 || meta==8) &&
+ (cb instanceof CharacteristicPoison || cb instanceof CharacteristicSpeed || cb instanceof CharacteristicHealth
+ || cb instanceof CharacteristicConfusion || cb instanceof CharacteristicPower)){
+ return true;
+ }
+
+ /*
+ if(meta==3 && cb instanceof CharacteristicLook){
+ return true;
+ }
+ */
+
+ return false;
+ }
+
+ @Override
+ public int getMaxInheritAmount(ItemStack itemStack) {
+ int meta=itemStack.getItemDamage();
+ if(meta==2 || meta==3) return 4;
+ if(meta==5) return 3;
+ if(meta==6 || meta==7) return 5;
+ return 2;
+ }
+
+ @Override
+ public ArrayList<CharacteristicBase> getDefaultCharacteristics(ItemStack itemStack, Random rand) {
+ ArrayList<CharacteristicBase> ret=new ArrayList<CharacteristicBase>();
+ return ret;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/alchemy/ItemAlchemyMaterial.class b/src/main/java/jp/plusplus/fbs/alchemy/ItemAlchemyMaterial.class Binary files differnew file mode 100644 index 0000000..78475a9 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/alchemy/ItemAlchemyMaterial.class diff --git a/src/main/java/jp/plusplus/fbs/alchemy/ItemAlchemyMaterial.java b/src/main/java/jp/plusplus/fbs/alchemy/ItemAlchemyMaterial.java new file mode 100644 index 0000000..c8b6cf6 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/alchemy/ItemAlchemyMaterial.java @@ -0,0 +1,307 @@ +package jp.plusplus.fbs.alchemy;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.alchemy.characteristic.*;
+import jp.plusplus.fbs.item.ItemBase;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.client.resources.I18n;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.item.crafting.FurnaceRecipes;
+import net.minecraft.item.crafting.IRecipe;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.IIcon;
+import net.minecraft.util.StatCollector;
+import net.minecraft.world.World;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Random;
+
+/**
+ * Created by plusplus_F on 2015/09/09.
+ */
+public class ItemAlchemyMaterial extends ItemBase implements IAlchemyMaterial {
+ public static String[] NAMES={
+ //0
+ "water","waterUnclean","lava",
+
+ //3
+ "leafTree","branchTree","rootsTree","leafUnclean","branchUnclean","rootsUnclean",
+
+ //9
+ "grassAntidote","grassVine","rootsRakuyo","grassRakuyo","seedsRyusen","flowerRyusen","seedsPower","seedsDefence","fruitsWalnut",
+
+ //18
+ "herbBase","herbBlood","herbMana","herbStamina","herbSoul","herbMandrake","fruitsMandrake",
+
+ //25
+ "mushroomBlue","mushroomPoisonous","mushroomTiredness","mushroomNitrogen","mushroomTsukiyo",
+
+ //30
+ "flowerFox", "grassOtogiri", "grassEnmei", "flowerTsukimi", "grassGunpowder", "grassNightShade",
+
+ //36
+ "herbGold", "herbEnder", "herbExplosive", "herbUnclean", "tearSpirit",
+
+ //41
+ "mushroomParalysis", "mushroomSuperParalysis", "mushroomReishi", "mushroomGold", "mushroomChaos"
+ };
+ protected IIcon[] icons;
+
+ public ItemAlchemyMaterial(){
+ setMaxDamage(0);
+ setHasSubtypes(true);
+ setCreativeTab(FBS.tabAlchemy);
+ }
+
+ @Override
+ public int getMetadata(int par1) {
+ return par1;
+ }
+
+ @Override
+ public String getUnlocalizedName(ItemStack p_77667_1_) {
+ int meta=p_77667_1_.getItemDamage();
+ if(meta<0 ||meta>=NAMES.length) meta=0;
+
+ return "item.fbs.material." + NAMES[meta];
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void getSubItems(Item item, CreativeTabs tab, List list) {
+ for(int i=0;i<NAMES.length;i++){
+ ItemStack it=new ItemStack(item, 1, i);
+ it.setTagCompound(new NBTTagCompound());
+ ArrayList<CharacteristicBase> cbs=addCharacteristics(it, AlchemyRegistry.getRandom());
+ AlchemyRegistry.WriteCharacteristicToNBT(it.getTagCompound(), cbs);
+
+ list.add(it);
+ }
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void registerIcons(IIconRegister register) {
+ icons=new IIcon[NAMES.length];
+
+ for(int i=0;i<NAMES.length;i++){
+ icons[i]=register.registerIcon(FBS.MODID+":"+NAMES[i]);
+ }
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public IIcon getIconFromDamage(int p_77617_1_) {
+ if(p_77617_1_<0 || p_77617_1_>=icons.length) p_77617_1_=0;
+ return icons[p_77617_1_];
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void addInformation(ItemStack itemStack, EntityPlayer player, List list, boolean p_77624_4_) {
+ AlchemyRegistry.AddCharacteristicsInfo(itemStack, list, p_77624_4_);
+ AlchemyRegistry.AddMaterialInfo(itemStack, list, p_77624_4_);
+ }
+
+ //------------------------------- IAlchemyMaterial -----------------------------------
+
+ @Override
+ public ArrayList<CharacteristicBase> addCharacteristics(ItemStack itemStack, Random rand) {
+ int meta=itemStack.getItemDamage();
+ ArrayList<CharacteristicBase> list=new ArrayList<CharacteristicBase>();
+ CharacteristicBase cb;
+
+ //--------------------------なんにでもつくやつ--------------------------------
+ float r;
+ //見た目
+ if(meta==1 || meta==6 || meta==7 || meta==8 || meta==39){
+ //不浄なやつ
+ cb = new CharacteristicLook();
+ cb.setValue(3);
+ list.add(cb);
+ }
+ else {
+ /*
+ r = rand.nextFloat();
+ if (r < 0.08f) {
+ cb = new CharacteristicLook();
+ cb.setValue(0);
+ list.add(cb);
+ } else if (r < 0.38f) {
+ cb = new CharacteristicLook();
+ cb.setValue(1);
+ list.add(cb);
+ } else if (r < 0.58f) {
+ cb = new CharacteristicLook();
+ cb.setValue(2);
+ list.add(cb);
+ }
+ */
+ }
+ //品質
+ r = rand.nextFloat();
+ if (r < 0.08f) {
+ cb = new CharacteristicQuality();
+ cb.setValue(0);
+ list.add(cb);
+ } else if (r < 0.38f) {
+ cb = new CharacteristicQuality();
+ cb.setValue(1);
+ list.add(cb);
+ } else if (r < 0.58f) {
+ cb = new CharacteristicQuality();
+ cb.setValue(2);
+ list.add(cb);
+ }
+
+ //--------------------------個別--------------------------------
+ if(meta==40){
+ cb = new CharacteristicSanity.Gain();
+ cb.setValue(0);
+ list.add(cb);
+ }
+ if(meta==1 || meta==6 || meta==7 || meta==8 || meta==37 || meta==39){
+ cb = new CharacteristicSanity.Lose();
+ cb.setValue(rand.nextFloat()<0.3f?1:0);
+ list.add(cb);
+ }
+ if(meta==45){
+ cb = new CharacteristicSanity.Lose();
+ cb.setValue(2);
+ list.add(cb);
+ }
+
+ if(meta==19 || meta==32 || meta==23 || meta==24){
+ cb=new CharacteristicHealth.Gain();
+ cb.setValue(0);
+ list.add(cb);
+ }
+ if(meta==31 || meta==36 || meta==44){
+ cb=new CharacteristicHealth.Gain();
+ cb.setValue(1);
+ list.add(cb);
+ }
+ if(meta==29){
+ cb=new CharacteristicHealth.Lose();
+ cb.setValue(0);
+ list.add(cb);
+ }
+
+ if(FBS.cooperatesSS2){
+ if(meta==0 || meta==1){
+ cb=new CharacteristicWater.Gain();
+ cb.setValue(0);
+ list.add(cb);
+ }
+ if(meta==11 || meta==12 || meta==13 || meta==21 || meta==23 || meta==24){
+ cb=new CharacteristicStamina.Gain();
+ cb.setValue(0);
+ list.add(cb);
+ }
+ if(meta==14){
+ cb=new CharacteristicStamina.Gain();
+ cb.setValue(1);
+ list.add(cb);
+ }
+ if(meta==44){
+ cb=new CharacteristicStamina.Gain();
+ cb.setValue(2);
+ list.add(cb);
+ }
+ if(meta==27){
+ cb=new CharacteristicStamina.Lose();
+ cb.setValue(0);
+ list.add(cb);
+ }
+ }
+
+ if(meta==36 || meta==37 || meta==43){
+ cb=new CharacteristicExp.Gain();
+ cb.setValue(0);
+ list.add(cb);
+ }
+ if(meta==44){
+ cb=new CharacteristicExp.Gain();
+ cb.setValue(2);
+ list.add(cb);
+ }
+
+ if(meta==26 || meta==29){
+ cb=new CharacteristicPoison.Gain();
+ cb.setValue(0);
+ list.add(cb);
+ }
+ if(meta==30 || meta==45){
+ cb=new CharacteristicPoison.Gain();
+ cb.setValue(1);
+ list.add(cb);
+ }
+ if(meta==9 || meta==11 || meta==12){
+ cb=new CharacteristicPoison.Lose();
+ cb.setValue(0);
+ list.add(cb);
+ }
+
+ if(meta==28 || meta==38){
+ cb=new CharacteristicPower.Gain();
+ cb.setValue(0);
+ list.add(cb);
+ }
+ if(meta==15){
+ cb=new CharacteristicPower.Gain();
+ cb.setValue(1);
+ list.add(cb);
+ }
+ if(meta==27 || meta==41){
+ cb=new CharacteristicPower.Lose();
+ cb.setValue(0);
+ list.add(cb);
+ }
+ if(meta==42){
+ cb=new CharacteristicPower.Lose();
+ cb.setValue(1);
+ list.add(cb);
+ }
+
+ if(meta==13 || meta==14){
+ cb=new CharacteristicCleverness.Gain();
+ cb.setValue(0);
+ list.add(cb);
+ }
+ if(meta==43){
+ cb=new CharacteristicCleverness.Gain();
+ cb.setValue(2);
+ list.add(cb);
+ }
+
+ if(meta==35){
+ cb=new CharacteristicSpeed.Gain();
+ cb.setValue(0);
+ list.add(cb);
+ }
+ if(meta==27){
+ cb=new CharacteristicSpeed.Lose();
+ cb.setValue(0);
+ list.add(cb);
+ }
+ if(meta==41){
+ cb=new CharacteristicSpeed.Lose();
+ cb.setValue(1);
+ list.add(cb);
+ }
+ if(meta==42){
+ cb=new CharacteristicSpeed.Lose();
+ cb.setValue(2);
+ list.add(cb);
+ }
+
+ return list;
+ }
+
+}
diff --git a/src/main/java/jp/plusplus/fbs/alchemy/ItemAlchemyPotion.class b/src/main/java/jp/plusplus/fbs/alchemy/ItemAlchemyPotion.class Binary files differnew file mode 100644 index 0000000..9b577c7 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/alchemy/ItemAlchemyPotion.class diff --git a/src/main/java/jp/plusplus/fbs/alchemy/ItemAlchemyPotion.java b/src/main/java/jp/plusplus/fbs/alchemy/ItemAlchemyPotion.java new file mode 100644 index 0000000..1e487b8 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/alchemy/ItemAlchemyPotion.java @@ -0,0 +1,149 @@ +package jp.plusplus.fbs.alchemy;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.alchemy.characteristic.*;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.EnumAction;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemFood;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.IIcon;
+import net.minecraft.util.StatCollector;
+import net.minecraft.world.World;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Random;
+
+/**
+ * Created by plusplus_F on 2015/09/23.
+ */
+public class ItemAlchemyPotion extends ItemFood implements IAlchemyProduct {
+ public static final String[] NAMES={"potion", "ointment", "potionSpirit"};
+ protected IIcon[] icons;
+
+ public ItemAlchemyPotion() {
+ super(0, 0, false);
+ setCreativeTab(FBS.tabAlchemy);
+ setAlwaysEdible();
+ setMaxStackSize(1);
+ setHasSubtypes(true);
+ setMaxDamage(0);
+ }
+
+ public ItemStack onEaten(ItemStack p_77654_1_, World p_77654_2_, EntityPlayer p_77654_3_) {
+ --p_77654_1_.stackSize;
+
+ //特性の効果発動
+ ArrayList<CharacteristicBase> list=AlchemyRegistry.ReadCharacteristicFromNBT(p_77654_1_.getTagCompound());
+ for(CharacteristicBase cb : list) cb.affectEntity(p_77654_2_, p_77654_3_);
+
+ return p_77654_1_;
+ }
+
+ public EnumAction getItemUseAction(ItemStack p_77661_1_)
+ {
+ return EnumAction.drink;
+ }
+
+ @Override
+ public int getMetadata(int par1) {
+ return par1;
+ }
+
+ @Override
+ public String getUnlocalizedName(ItemStack p_77667_1_) {
+ int meta=p_77667_1_.getItemDamage();
+ if(meta<0 ||meta>=NAMES.length) meta=0;
+
+ return "item.fbs.alchemy." + NAMES[meta];
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void getSubItems(Item item, CreativeTabs tab, List list) {
+ for(int i=0;i<NAMES.length;i++){
+ ItemStack it=new ItemStack(item, 1, i);
+ it.setTagCompound(new NBTTagCompound());
+ ArrayList<CharacteristicBase> cbs=getDefaultCharacteristics(it, AlchemyRegistry.getRandom());
+ AlchemyRegistry.WriteCharacteristicToNBT(it.getTagCompound(), cbs);
+
+ list.add(it);
+ }
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void registerIcons(IIconRegister register) {
+ icons=new IIcon[NAMES.length];
+ for(int i=0;i<icons.length;i++) icons[i]=register.registerIcon(FBS.MODID+":"+NAMES[i]);
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public IIcon getIconFromDamage(int p_77617_1_) {
+ if(p_77617_1_<0 || p_77617_1_>=icons.length) p_77617_1_=0;
+ return icons[p_77617_1_];
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void addInformation(ItemStack itemStack, EntityPlayer player, List list, boolean p_77624_4_) {
+ AlchemyRegistry.AddCharacteristicsInfo(itemStack, list, p_77624_4_);
+ }
+
+ //----------------------------------------------------------------------------------
+
+ @Override
+ public boolean canInherit(ItemStack itemStack, CharacteristicBase cb) {
+ int meta=itemStack.getItemDamage();
+
+ if(meta==0 && (cb instanceof CharacteristicWater)){
+ return true;
+ }
+
+ if(cb instanceof CharacteristicLook) return false;
+ if(cb instanceof CharacteristicWeight) return false;
+
+ return true;
+ }
+
+ @Override
+ public int getMaxInheritAmount(ItemStack itemStack) {
+ return itemStack.getItemDamage()==0?3:5;
+ }
+
+ @Override
+ public ArrayList<CharacteristicBase> getDefaultCharacteristics(ItemStack itemStack, Random rand) {
+ ArrayList<CharacteristicBase> ret=new ArrayList<CharacteristicBase>();
+ int d=itemStack.getItemDamage();
+ CharacteristicBase cb;
+
+ if(FBS.cooperatesSS2 && d==0){
+ //水分
+ cb=new CharacteristicWater.Gain();
+ cb.setValue(0);
+ ret.add(cb);
+ }
+ if(d==2){
+ if(FBS.cooperatesSS2){
+ //水分
+ cb=new CharacteristicWater.Gain();
+ cb.setValue(0);
+ ret.add(cb);
+ }
+
+ //SAN
+ cb=new CharacteristicSanity.Lose();
+ cb.setValue(1);
+ ret.add(cb);
+ }
+
+ return ret;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/alchemy/ItemEatableAlchemyMaterial.class b/src/main/java/jp/plusplus/fbs/alchemy/ItemEatableAlchemyMaterial.class Binary files differnew file mode 100644 index 0000000..e0c906c --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/alchemy/ItemEatableAlchemyMaterial.class diff --git a/src/main/java/jp/plusplus/fbs/alchemy/ItemEatableAlchemyMaterial.java b/src/main/java/jp/plusplus/fbs/alchemy/ItemEatableAlchemyMaterial.java new file mode 100644 index 0000000..d5e0ecb --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/alchemy/ItemEatableAlchemyMaterial.java @@ -0,0 +1,178 @@ +package jp.plusplus.fbs.alchemy;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.alchemy.characteristic.*;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemFood;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.potion.Potion;
+import net.minecraft.potion.PotionEffect;
+import net.minecraft.util.IIcon;
+import net.minecraft.world.World;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Random;
+
+/**
+ * Created by plusplus_F on 2016/02/23.
+ */
+public class ItemEatableAlchemyMaterial extends ItemFood implements IAlchemyMaterial {
+ public static String[] NAMES={
+ "mushroomQli", "mushroomMatsu", "mushroomWarai", "mushroomNigaQli",
+
+ //4
+ "fruitsStamina", "fruitsItete", "fruitsSassa"
+ };
+
+ protected int[] heal={
+ 2, 6, 2, 2, 2, 2, 2
+ };
+ protected float[] sat={
+ 0.15f, 0.5f, 0.15f, 0.15f, 0.1f, 0.1f, 0.1f
+ };
+
+ protected IIcon[] icons;
+
+ public ItemEatableAlchemyMaterial() {
+ super(0, 0, false);
+ setMaxDamage(0);
+ setHasSubtypes(true);
+ setCreativeTab(FBS.tabAlchemy);
+ }
+
+ @Override
+ public int getMetadata(int par1) {
+ return par1;
+ }
+
+ @Override
+ public String getUnlocalizedName(ItemStack p_77667_1_) {
+ int meta=p_77667_1_.getItemDamage();
+ if(meta<0 ||meta>=NAMES.length) meta=0;
+
+ return "item.fbs.material." + NAMES[meta];
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void getSubItems(Item item, CreativeTabs tab, List list) {
+ for(int i=0;i<NAMES.length;i++){
+ ItemStack it=new ItemStack(item, 1, i);
+ it.setTagCompound(new NBTTagCompound());
+ ArrayList<CharacteristicBase> cbs=addCharacteristics(it, AlchemyRegistry.getRandom());
+ AlchemyRegistry.WriteCharacteristicToNBT(it.getTagCompound(), cbs);
+
+ list.add(it);
+ }
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void registerIcons(IIconRegister register) {
+ icons=new IIcon[NAMES.length];
+
+ for(int i=0;i<NAMES.length;i++){
+ icons[i]=register.registerIcon(FBS.MODID+":"+NAMES[i]);
+ }
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public IIcon getIconFromDamage(int p_77617_1_) {
+ if(p_77617_1_<0 || p_77617_1_>=icons.length) p_77617_1_=0;
+ return icons[p_77617_1_];
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void addInformation(ItemStack itemStack, EntityPlayer player, List list, boolean p_77624_4_) {
+ AlchemyRegistry.AddCharacteristicsInfo(itemStack, list, p_77624_4_);
+ AlchemyRegistry.AddMaterialInfo(itemStack, list, p_77624_4_);
+ }
+
+
+ @Override
+ public int func_150905_g(ItemStack p_150905_1_) {
+ return heal[p_150905_1_.getItemDamage()];
+ }
+
+ @Override
+ public float func_150906_h(ItemStack p_150906_1_) {
+ return sat[p_150906_1_.getItemDamage()];
+ }
+
+ @Override
+ protected void onFoodEaten(ItemStack p_77849_1_, World p_77849_2_, EntityPlayer p_77849_3_) {
+ //特性の効果発動
+ if (!p_77849_2_.isRemote) {
+ ArrayList<CharacteristicBase> list = AlchemyRegistry.ReadCharacteristicFromNBT(p_77849_1_.getTagCompound());
+ for (CharacteristicBase cb : list) cb.affectEntity(p_77849_2_, p_77849_3_);
+ }
+ }
+
+ @Override
+ public ArrayList<CharacteristicBase> addCharacteristics(ItemStack itemStack, Random rand) {
+ int meta=itemStack.getItemDamage();
+ ArrayList<CharacteristicBase> list=new ArrayList<CharacteristicBase>();
+ CharacteristicBase cb;
+
+ //--------------------------なんにでもつくやつ--------------------------------
+ float r;
+ //品質
+ r = rand.nextFloat();
+ if (r < 0.08f) {
+ cb = new CharacteristicQuality();
+ cb.setValue(0);
+ list.add(cb);
+ } else if (r < 0.38f) {
+ cb = new CharacteristicQuality();
+ cb.setValue(1);
+ list.add(cb);
+ } else if (r < 0.58f) {
+ cb = new CharacteristicQuality();
+ cb.setValue(2);
+ list.add(cb);
+ }
+
+ if(FBS.cooperatesSS2){
+ if(meta==1 || meta==4){
+ cb = new CharacteristicStamina.Gain();
+ cb.setValue(0);
+ list.add(cb);
+ }
+ }
+
+ if(meta==3){
+ cb = new CharacteristicPoison.Gain();
+ cb.setValue(0);
+ list.add(cb);
+ }
+
+ if(meta==2){
+ cb = new CharacteristicConfusion.Gain();
+ cb.setValue(0);
+ list.add(cb);
+ }
+
+ if(meta==5){
+ cb = new CharacteristicHealth.Lose();
+ cb.setValue(0);
+ list.add(cb);
+ }
+
+ if(meta==6){
+ cb = new CharacteristicSpeed.Gain();
+ cb.setValue(0);
+ list.add(cb);
+ }
+
+ return list;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/alchemy/ItemRecipeBook$1.class b/src/main/java/jp/plusplus/fbs/alchemy/ItemRecipeBook$1.class Binary files differnew file mode 100644 index 0000000..14493c0 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/alchemy/ItemRecipeBook$1.class diff --git a/src/main/java/jp/plusplus/fbs/alchemy/ItemRecipeBook.class b/src/main/java/jp/plusplus/fbs/alchemy/ItemRecipeBook.class Binary files differnew file mode 100644 index 0000000..9c2d64c --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/alchemy/ItemRecipeBook.class diff --git a/src/main/java/jp/plusplus/fbs/alchemy/ItemRecipeBook.java b/src/main/java/jp/plusplus/fbs/alchemy/ItemRecipeBook.java new file mode 100644 index 0000000..45c8717 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/alchemy/ItemRecipeBook.java @@ -0,0 +1,68 @@ +package jp.plusplus.fbs.alchemy;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.alchemy.characteristic.CharacteristicBase;
+import jp.plusplus.fbs.item.ItemBase;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.StatCollector;
+
+import java.util.*;
+
+/**
+ * Created by plusplus_F on 2015/09/25.
+ */
+public class ItemRecipeBook extends ItemBase{
+ public ItemRecipeBook(){
+ setCreativeTab(FBS.tabAlchemy);
+ setUnlocalizedName("recipe");
+ setTextureName("recipe");
+ setMaxDamage(0);
+ setHasSubtypes(true);
+ }
+
+ @Override
+ public int getMetadata(int par1) {
+ return par1;
+ }
+
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void getSubItems(Item item, CreativeTabs tab, List list) {
+ ArrayList<AlchemyRegistry.Recipe> rbs=new ArrayList<AlchemyRegistry.Recipe>();
+ for(AlchemyRegistry.Recipe r : AlchemyRegistry.GetRecieps()){
+ if(r.getKey().getItem()==this){
+ rbs.add(r);
+ }
+ }
+ Collections.sort(rbs, new Comparator<AlchemyRegistry.Recipe>() {
+ @Override
+ public int compare(AlchemyRegistry.Recipe o1, AlchemyRegistry.Recipe o2) {
+ return o1.level-o2.level;
+ }
+ });
+ for(AlchemyRegistry.Recipe r : rbs){
+ list.add(r.getKey().copy());
+ }
+ }
+
+ @Override
+ public void addInformation(ItemStack item, EntityPlayer p_77624_2_, List list, boolean flag) {
+ AlchemyRegistry.Recipe r = AlchemyRegistry.GetRecipe(item);
+ if (r != null) {
+ list.add(r.getProduct().getDisplayName());
+ list.add(StatCollector.translateToLocal("info.fbs.book.lv")+":" + r.getLevel());
+ list.add("["+StatCollector.translateToLocal("alchemy.fbs.usage")+"]");
+ for (String n : r.getMaterialList()) {
+ list.add("-"+n);
+ }
+ }
+ }
+
+}
diff --git a/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicBase$Type.class b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicBase$Type.class Binary files differnew file mode 100644 index 0000000..cc595d7 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicBase$Type.class diff --git a/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicBase.class b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicBase.class Binary files differnew file mode 100644 index 0000000..ba19c11 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicBase.class diff --git a/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicBase.java b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicBase.java new file mode 100644 index 0000000..2141768 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicBase.java @@ -0,0 +1,114 @@ +package jp.plusplus.fbs.alchemy.characteristic;
+
+import com.mojang.realmsclient.gui.ChatFormatting;
+import jp.plusplus.fbs.alchemy.AlchemyRegistry;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.StatCollector;
+import net.minecraft.world.World;
+
+/**
+ * Created by plusplus_F on 2015/09/08.
+ * 錬金術の素材・生成品の「特性」
+ */
+public abstract class CharacteristicBase {
+ protected int value;
+ protected String uName="";
+
+ public CharacteristicBase(){}
+
+ /**
+ * 特性の強さの単位を得る
+ * @return 特性の強さの単位
+ */
+ public abstract Type getType();
+
+ /**
+ * 生成品のMP価格への倍率補正を返す
+ * @return 価格倍率
+ */
+ public float getMPScale(){
+ return 1.f;
+ }
+
+ /**
+ * この特性を持つアイテムをplayerが使用した際に行う処理
+ * @param world
+ * @param entity
+ */
+ public void affectEntity(World world, EntityLivingBase entity){}
+
+ /**
+ * ツールチップでの表示色を返す
+ * @return 表示色
+ */
+ public ChatFormatting getNameColor(){
+ return ChatFormatting.GRAY;
+ }
+
+ public void writeToNBT(NBTTagCompound nbt){
+ nbt.setInteger("value", getValue());
+ }
+ public void readFromNBT(NBTTagCompound nbt){
+ value=nbt.getInteger("value");
+ }
+
+ public int getValue(){ return getType().getCorrectedValue(value); }
+ /**
+ * 効果の強さを設定する
+ * @param value
+ */
+ public void setValue(int value){
+ this.value=value;
+ }
+
+
+ public int getId(){
+ return AlchemyRegistry.GetCharacteristicId(this.getClass());
+ }
+
+ public void setUnlocalizedName(String u){ uName=u; }
+ public String getUnlocalizedName(){
+ return "alchemy.chara."+uName;
+ }
+ public String getLocalizedName(){
+ return StatCollector.translateToLocal(getUnlocalizedName());
+ }
+
+ public String getUnlocalizedEffectValue(){
+ return getType().getUnlocalizedName(value);
+ }
+ public String getLocalizedEffectValue(){
+ return StatCollector.translateToLocal(getUnlocalizedEffectValue());
+ }
+
+ /**
+ * 特性の持つ、効果の強さの単位
+ * 特性はvalueが大きい順に優先される
+ */
+ public enum Type{
+ SCALE("fbs.small", "fbs.medium", "fbs.large"),
+ LENGTH("fbs.short", "fbs.medium", "fbs.long"),
+ LOOK("fbs.look.beautiful", "fbs.look.good", "fbs.look.dirty", "fbs.look.strange"),
+ WEIGHT("fbs.light", "fbs.heavy"),
+ QUALITY("fbs.great", "fbs.good", "fbs.bad"),
+ NONE();
+
+ private String[] str;
+ Type(String ... name){
+ str=name;
+ }
+ public String getUnlocalizedName(int value){
+ if(str==null || str.length==0) return "";
+
+ value=getCorrectedValue(value);
+ return "alchemy.effect."+str[value];
+ }
+ public int getCorrectedValue(int value){
+ if(value<0 || value>=str.length) value=0;
+ return value;
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicCleverness$Gain.class b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicCleverness$Gain.class Binary files differnew file mode 100644 index 0000000..b8e6b78 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicCleverness$Gain.class diff --git a/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicCleverness$Lose.class b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicCleverness$Lose.class Binary files differnew file mode 100644 index 0000000..9ebbfb8 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicCleverness$Lose.class diff --git a/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicCleverness.class b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicCleverness.class Binary files differnew file mode 100644 index 0000000..e8adc96 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicCleverness.class diff --git a/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicCleverness.java b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicCleverness.java new file mode 100644 index 0000000..4088d99 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicCleverness.java @@ -0,0 +1,45 @@ +package jp.plusplus.fbs.alchemy.characteristic;
+
+import com.mojang.realmsclient.gui.ChatFormatting;
+import jp.plusplus.fbs.Registry;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.potion.Potion;
+import net.minecraft.potion.PotionEffect;
+import net.minecraft.world.World;
+
+/**
+ * Created by plusplus_F on 2015/09/20.
+ */
+public class CharacteristicCleverness extends CharacteristicBase {
+ protected boolean reverse;
+ public CharacteristicCleverness(boolean minus){
+ reverse=minus;
+ setUnlocalizedName("fbs.cleverness."+(reverse?"lose":"gain"));
+ }
+
+ @Override
+ public Type getType() {
+ return Type.LENGTH;
+ }
+
+ @Override
+ public void affectEntity(World world, EntityLivingBase entity){
+ int lv=getType().getCorrectedValue(value);
+ int d=60+60*lv;
+
+ if(reverse) entity.removePotionEffect(Potion.poison.getId());
+ else entity.addPotionEffect(new PotionEffect(Registry.potionCleverness.getId(), 20*d, lv+1));
+ }
+
+ @Override
+ public ChatFormatting getNameColor(){
+ return reverse?ChatFormatting.RED:ChatFormatting.DARK_GREEN;
+ }
+
+ public static class Gain extends CharacteristicCleverness {
+ public Gain(){ super(false); }
+ }
+ public static class Lose extends CharacteristicCleverness {
+ public Lose(){ super(true); }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicConfusion$Gain.class b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicConfusion$Gain.class Binary files differnew file mode 100644 index 0000000..4601fff --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicConfusion$Gain.class diff --git a/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicConfusion$Lose.class b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicConfusion$Lose.class Binary files differnew file mode 100644 index 0000000..292384c --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicConfusion$Lose.class diff --git a/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicConfusion.class b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicConfusion.class Binary files differnew file mode 100644 index 0000000..e582350 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicConfusion.class diff --git a/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicConfusion.java b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicConfusion.java new file mode 100644 index 0000000..2db11fe --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicConfusion.java @@ -0,0 +1,43 @@ +package jp.plusplus.fbs.alchemy.characteristic;
+
+import com.mojang.realmsclient.gui.ChatFormatting;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.potion.Potion;
+import net.minecraft.potion.PotionEffect;
+import net.minecraft.world.World;
+
+/**
+ * Created by plusplus_F on 2015/09/20.
+ */
+public class CharacteristicConfusion extends CharacteristicBase {
+ protected boolean reverse;
+ public CharacteristicConfusion(boolean minus){
+ reverse=minus;
+ setUnlocalizedName("fbs.poison."+(reverse?"lose":"gain"));
+ }
+
+ @Override
+ public Type getType() {
+ return Type.LENGTH;
+ }
+
+ @Override
+ public void affectEntity(World world, EntityLivingBase entity){
+ int d=10+10*getType().getCorrectedValue(value);
+
+ if(reverse) entity.removePotionEffect(Potion.confusion.getId());
+ else entity.addPotionEffect(new PotionEffect(Potion.confusion.getId(), 20*d, 1));
+ }
+
+ @Override
+ public ChatFormatting getNameColor(){
+ return !reverse?ChatFormatting.RED:ChatFormatting.DARK_GREEN;
+ }
+
+ public static class Gain extends CharacteristicConfusion {
+ public Gain(){ super(false); }
+ }
+ public static class Lose extends CharacteristicConfusion {
+ public Lose(){ super(true); }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicExp$Gain.class b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicExp$Gain.class Binary files differnew file mode 100644 index 0000000..7c2bda5 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicExp$Gain.class diff --git a/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicExp$Lose.class b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicExp$Lose.class Binary files differnew file mode 100644 index 0000000..7c800f8 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicExp$Lose.class diff --git a/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicExp.class b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicExp.class Binary files differnew file mode 100644 index 0000000..f7fa9da --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicExp.class diff --git a/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicExp.java b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicExp.java new file mode 100644 index 0000000..f206c73 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicExp.java @@ -0,0 +1,53 @@ +package jp.plusplus.fbs.alchemy.characteristic;
+
+import com.mojang.realmsclient.gui.ChatFormatting;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemExpBottle;
+import net.minecraft.util.DamageSource;
+import net.minecraft.world.World;
+
+/**
+ * Created by plusplus_F on 2015/09/24.
+ */
+public class CharacteristicExp extends CharacteristicBase {
+ protected boolean reverse;
+ public CharacteristicExp(boolean minus){
+ reverse=minus;
+ setUnlocalizedName("fbs.exp."+(reverse?"lose":"gain"));
+ }
+
+ @Override
+ public Type getType() {
+ return Type.SCALE;
+ }
+
+ @Override
+ public void affectEntity(World world, EntityLivingBase entity){
+ if(!(entity instanceof EntityPlayer)) return;
+ EntityPlayer ep=(EntityPlayer)entity;
+
+ int d=6+6*getType().getCorrectedValue(value);
+
+ if(reverse) {
+ ep.experience -= (float) d / (float) ep.xpBarCap();
+ for (ep.experienceTotal -= d; ep.experience < 0.0F; ep.experience /= (float) ep.xpBarCap()) {
+ ep.experience = (1.0f - ep.experience) * (float) ep.xpBarCap();
+ ep.addExperienceLevel(-1);
+ }
+ }
+ else ((EntityPlayer) entity).addExperience(d);
+ }
+
+ @Override
+ public ChatFormatting getNameColor(){
+ return reverse?ChatFormatting.RED:ChatFormatting.DARK_GREEN;
+ }
+
+ public static class Gain extends CharacteristicExp {
+ public Gain(){ super(false); }
+ }
+ public static class Lose extends CharacteristicExp {
+ public Lose(){ super(true); }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicHealth$Gain.class b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicHealth$Gain.class Binary files differnew file mode 100644 index 0000000..afdc59e --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicHealth$Gain.class diff --git a/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicHealth$Lose.class b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicHealth$Lose.class Binary files differnew file mode 100644 index 0000000..5cf0a9e --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicHealth$Lose.class diff --git a/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicHealth.class b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicHealth.class Binary files differnew file mode 100644 index 0000000..0688752 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicHealth.class diff --git a/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicHealth.java b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicHealth.java new file mode 100644 index 0000000..ac4c46f --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicHealth.java @@ -0,0 +1,45 @@ +package jp.plusplus.fbs.alchemy.characteristic;
+
+import com.mojang.realmsclient.gui.ChatFormatting;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.potion.Potion;
+import net.minecraft.potion.PotionEffect;
+import net.minecraft.util.DamageSource;
+import net.minecraft.world.World;
+
+/**
+ * Created by plusplus_F on 2015/09/20.
+ */
+public class CharacteristicHealth extends CharacteristicBase {
+ protected boolean reverse;
+ public CharacteristicHealth(boolean minus){
+ reverse=minus;
+ setUnlocalizedName("fbs.life."+(reverse?"lose":"gain"));
+ }
+
+ @Override
+ public Type getType() {
+ return Type.SCALE;
+ }
+
+ @Override
+ public void affectEntity(World world, EntityLivingBase entity){
+ float d=6+6*getType().getCorrectedValue(value);
+
+ if(reverse) entity.attackEntityFrom(new DamageSource(""), d);
+ else entity.heal(d);
+ }
+
+ @Override
+ public ChatFormatting getNameColor(){
+ return reverse?ChatFormatting.RED:ChatFormatting.DARK_GREEN;
+ }
+
+ public static class Gain extends CharacteristicHealth{
+ public Gain(){ super(false); }
+ }
+ public static class Lose extends CharacteristicHealth{
+ public Lose(){ super(true); }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicLook.class b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicLook.class Binary files differnew file mode 100644 index 0000000..26b62bd --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicLook.class diff --git a/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicLook.java b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicLook.java new file mode 100644 index 0000000..192ce6c --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicLook.java @@ -0,0 +1,25 @@ +package jp.plusplus.fbs.alchemy.characteristic;
+
+/**
+ * Created by plusplus_F on 2015/09/24.
+ */
+public class CharacteristicLook extends CharacteristicBase {
+
+ public CharacteristicLook(){
+ setUnlocalizedName("fbs.look");
+ }
+
+ public float getMPScale(){
+ int v=getValue();
+ if(v==0) return 2.0f;
+ if(v==1) return 1.5f;
+ if(v==2) return 0.5f;
+ if(v==3) return 1.0f;
+ return 1.f;
+ }
+
+ @Override
+ public Type getType() {
+ return Type.LOOK;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicPoison$Gain.class b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicPoison$Gain.class Binary files differnew file mode 100644 index 0000000..16ccc66 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicPoison$Gain.class diff --git a/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicPoison$Lose.class b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicPoison$Lose.class Binary files differnew file mode 100644 index 0000000..487a67e --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicPoison$Lose.class diff --git a/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicPoison.class b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicPoison.class Binary files differnew file mode 100644 index 0000000..0e9196c --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicPoison.class diff --git a/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicPoison.java b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicPoison.java new file mode 100644 index 0000000..cfbe4ba --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicPoison.java @@ -0,0 +1,44 @@ +package jp.plusplus.fbs.alchemy.characteristic;
+
+import com.mojang.realmsclient.gui.ChatFormatting;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.potion.Potion;
+import net.minecraft.potion.PotionEffect;
+import net.minecraft.util.DamageSource;
+import net.minecraft.world.World;
+
+/**
+ * Created by plusplus_F on 2015/09/20.
+ */
+public class CharacteristicPoison extends CharacteristicBase {
+ protected boolean reverse;
+ public CharacteristicPoison(boolean minus){
+ reverse=minus;
+ setUnlocalizedName("fbs.poison."+(reverse?"lose":"gain"));
+ }
+
+ @Override
+ public Type getType() {
+ return Type.LENGTH;
+ }
+
+ @Override
+ public void affectEntity(World world, EntityLivingBase entity){
+ int d=10+10*getType().getCorrectedValue(value);
+
+ if(reverse) entity.removePotionEffect(Potion.poison.getId());
+ else entity.addPotionEffect(new PotionEffect(Potion.poison.getId(), 20*d, 1));
+ }
+
+ @Override
+ public ChatFormatting getNameColor(){
+ return !reverse?ChatFormatting.RED:ChatFormatting.DARK_GREEN;
+ }
+
+ public static class Gain extends CharacteristicPoison {
+ public Gain(){ super(false); }
+ }
+ public static class Lose extends CharacteristicPoison {
+ public Lose(){ super(true); }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicPower$Gain.class b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicPower$Gain.class Binary files differnew file mode 100644 index 0000000..707e1d2 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicPower$Gain.class diff --git a/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicPower$Lose.class b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicPower$Lose.class Binary files differnew file mode 100644 index 0000000..7a0b04b --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicPower$Lose.class diff --git a/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicPower.class b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicPower.class Binary files differnew file mode 100644 index 0000000..b1c523f --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicPower.class diff --git a/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicPower.java b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicPower.java new file mode 100644 index 0000000..42021ee --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicPower.java @@ -0,0 +1,50 @@ +package jp.plusplus.fbs.alchemy.characteristic;
+
+import com.mojang.realmsclient.gui.ChatFormatting;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.potion.Potion;
+import net.minecraft.potion.PotionEffect;
+import net.minecraft.world.World;
+
+/**
+ * Created by plusplus_F on 2015/09/20.
+ */
+public class CharacteristicPower extends CharacteristicBase {
+ protected boolean reverse;
+ public CharacteristicPower(boolean minus){
+ reverse=minus;
+ setUnlocalizedName("fbs.power."+(reverse?"lose":"gain"));
+ }
+
+ @Override
+ public Type getType() {
+ return Type.LENGTH;
+ }
+
+ @Override
+ public void affectEntity(World world, EntityLivingBase entity){
+ int lv=getType().getCorrectedValue(value);
+ int d=30+30*lv;
+
+ if(reverse){
+ entity.removePotionEffect(Potion.damageBoost.getId());
+ entity.addPotionEffect(new PotionEffect(Potion.weakness.getId(), 20*d, lv+1));
+ }
+ else{
+ entity.removePotionEffect(Potion.weakness.getId());
+ entity.addPotionEffect(new PotionEffect(Potion.damageBoost.getId(), 20*d, lv+1));
+ }
+ }
+
+ @Override
+ public ChatFormatting getNameColor(){
+ return reverse?ChatFormatting.RED:ChatFormatting.DARK_GREEN;
+ }
+
+ public static class Gain extends CharacteristicPower {
+ public Gain(){ super(false); }
+ }
+ public static class Lose extends CharacteristicPower {
+ public Lose(){ super(true); }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicQuality.class b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicQuality.class Binary files differnew file mode 100644 index 0000000..63ef353 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicQuality.class diff --git a/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicQuality.java b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicQuality.java new file mode 100644 index 0000000..171bf94 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicQuality.java @@ -0,0 +1,24 @@ +package jp.plusplus.fbs.alchemy.characteristic;
+
+/**
+ * Created by plusplus_F on 2015/09/24.
+ */
+public class CharacteristicQuality extends CharacteristicBase {
+
+ public CharacteristicQuality(){
+ setUnlocalizedName("fbs.quality");
+ }
+
+ public float getMPScale(){
+ int v=getValue();
+ if(v==0) return 3.0f;
+ if(v==1) return 1.5f;
+ if(v==2) return 0.8f;
+ return 1.f;
+ }
+
+ @Override
+ public Type getType() {
+ return Type.QUALITY;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicSanity$Gain.class b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicSanity$Gain.class Binary files differnew file mode 100644 index 0000000..26f3693 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicSanity$Gain.class diff --git a/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicSanity$Lose.class b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicSanity$Lose.class Binary files differnew file mode 100644 index 0000000..6f5dcac --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicSanity$Lose.class diff --git a/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicSanity.class b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicSanity.class Binary files differnew file mode 100644 index 0000000..72c6889 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicSanity.class diff --git a/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicSanity.java b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicSanity.java new file mode 100644 index 0000000..f49734b --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicSanity.java @@ -0,0 +1,45 @@ +package jp.plusplus.fbs.alchemy.characteristic;
+
+import com.mojang.realmsclient.gui.ChatFormatting;
+import jp.plusplus.fbs.exprop.SanityManager;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.util.DamageSource;
+import net.minecraft.world.World;
+
+/**
+ * Created by plusplus_F on 2015/09/20.
+ */
+public class CharacteristicSanity extends CharacteristicBase {
+ protected boolean reverse;
+ public CharacteristicSanity(boolean minus){
+ reverse=minus;
+ setUnlocalizedName("fbs.sanity."+(reverse?"lose":"gain"));
+ }
+
+ @Override
+ public Type getType() {
+ return Type.SCALE;
+ }
+
+ @Override
+ public void affectEntity(World world, EntityLivingBase entity){
+ if(!(entity instanceof EntityPlayer)) return;
+
+ int t=getType().getCorrectedValue(value);
+ if(reverse) SanityManager.loseSanity((EntityPlayer)entity, 1+t, 6, true);
+ else SanityManager.addSanity((EntityPlayer) entity, 1 + t, 6, true);
+ }
+
+ @Override
+ public ChatFormatting getNameColor(){
+ return reverse?ChatFormatting.RED:ChatFormatting.DARK_GREEN;
+ }
+
+ public static class Gain extends CharacteristicSanity {
+ public Gain(){ super(false); }
+ }
+ public static class Lose extends CharacteristicSanity {
+ public Lose(){ super(true); }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicSpeed$Gain.class b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicSpeed$Gain.class Binary files differnew file mode 100644 index 0000000..128823f --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicSpeed$Gain.class diff --git a/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicSpeed$Lose.class b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicSpeed$Lose.class Binary files differnew file mode 100644 index 0000000..46f61dd --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicSpeed$Lose.class diff --git a/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicSpeed.class b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicSpeed.class Binary files differnew file mode 100644 index 0000000..2552c14 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicSpeed.class diff --git a/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicSpeed.java b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicSpeed.java new file mode 100644 index 0000000..54e478f --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicSpeed.java @@ -0,0 +1,48 @@ +package jp.plusplus.fbs.alchemy.characteristic;
+
+import com.mojang.realmsclient.gui.ChatFormatting;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.potion.Potion;
+import net.minecraft.potion.PotionEffect;
+import net.minecraft.world.World;
+
+/**
+ * Created by plusplus_F on 2015/02/23.
+ */
+public class CharacteristicSpeed extends CharacteristicBase {
+ protected boolean reverse;
+ public CharacteristicSpeed(boolean minus){
+ reverse=minus;
+ setUnlocalizedName("fbs.speed."+(reverse?"lose":"gain"));
+ }
+
+ @Override
+ public Type getType() {
+ return Type.LENGTH;
+ }
+
+ @Override
+ public void affectEntity(World world, EntityLivingBase entity) {
+ int d = 10 + 10 * getType().getCorrectedValue(value);
+
+ if (reverse) {
+ entity.removePotionEffect(Potion.moveSlowdown.getId());
+ entity.addPotionEffect(new PotionEffect(Potion.moveSpeed.getId(), 20 * d, 1));
+ } else {
+ entity.removePotionEffect(Potion.moveSpeed.getId());
+ entity.addPotionEffect(new PotionEffect(Potion.moveSlowdown.getId(), 20 * d, 1));
+ }
+ }
+
+ @Override
+ public ChatFormatting getNameColor(){
+ return reverse?ChatFormatting.RED:ChatFormatting.DARK_GREEN;
+ }
+
+ public static class Gain extends CharacteristicSpeed {
+ public Gain(){ super(false); }
+ }
+ public static class Lose extends CharacteristicSpeed {
+ public Lose(){ super(true); }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicStamina$Gain.class b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicStamina$Gain.class Binary files differnew file mode 100644 index 0000000..ee7b1dc --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicStamina$Gain.class diff --git a/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicStamina$Lose.class b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicStamina$Lose.class Binary files differnew file mode 100644 index 0000000..028bae8 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicStamina$Lose.class diff --git a/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicStamina.class b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicStamina.class Binary files differnew file mode 100644 index 0000000..995c511 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicStamina.class diff --git a/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicStamina.java b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicStamina.java new file mode 100644 index 0000000..bca5d3d --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicStamina.java @@ -0,0 +1,55 @@ +package jp.plusplus.fbs.alchemy.characteristic;
+
+import com.mojang.realmsclient.gui.ChatFormatting;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.EntityPlayerMP;
+import net.minecraft.world.World;
+import shift.sextiarysector.api.SextiarySectorAPI;
+import shift.sextiarysector.packet.PacketPlayerData;
+import shift.sextiarysector.packet.SSPacketHandler;
+import shift.sextiarysector.player.CustomPlayerData;
+import shift.sextiarysector.player.EntityPlayerManager;
+import shift.sextiarysector.player.MoistureStats;
+import shift.sextiarysector.player.StaminaStats;
+
+/**
+ * Created by plusplus_F on 2015/09/24.
+ */
+public class CharacteristicStamina extends CharacteristicBase {
+ protected boolean reverse;
+ public CharacteristicStamina(boolean minus){
+ reverse=minus;
+ setUnlocalizedName("fbs.stamina."+(reverse?"lose":"gain"));
+ }
+
+ @Override
+ public Type getType() {
+ return Type.SCALE;
+ }
+
+ @Override
+ public void affectEntity(World world, EntityLivingBase entity){
+ if(!(entity instanceof EntityPlayer)) return;
+ int d=30+30*getType().getCorrectedValue(value);
+
+ EntityPlayer ep=(EntityPlayer) entity;
+
+ if(reverse) SextiarySectorAPI.addStaminaExhaustion(ep, d * 10);
+ else SextiarySectorAPI.addStaminaStats(ep, d, 0.1f);
+
+ if(ep instanceof EntityPlayerMP) SSPacketHandler.INSTANCE.sendTo(new PacketPlayerData(EntityPlayerManager.getCustomPlayerData(ep)), (EntityPlayerMP)ep);
+ }
+
+ @Override
+ public ChatFormatting getNameColor(){
+ return reverse?ChatFormatting.RED:ChatFormatting.DARK_GREEN;
+ }
+
+ public static class Gain extends CharacteristicStamina {
+ public Gain(){ super(false); }
+ }
+ public static class Lose extends CharacteristicStamina {
+ public Lose(){ super(true); }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicWater$Gain.class b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicWater$Gain.class Binary files differnew file mode 100644 index 0000000..2c6d26b --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicWater$Gain.class diff --git a/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicWater$Lose.class b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicWater$Lose.class Binary files differnew file mode 100644 index 0000000..136e8b8 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicWater$Lose.class diff --git a/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicWater.class b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicWater.class Binary files differnew file mode 100644 index 0000000..01c1d29 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicWater.class diff --git a/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicWater.java b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicWater.java new file mode 100644 index 0000000..dfc6f0a --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicWater.java @@ -0,0 +1,59 @@ +package jp.plusplus.fbs.alchemy.characteristic;
+
+import com.mojang.realmsclient.gui.ChatFormatting;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.EntityPlayerMP;
+import net.minecraft.util.DamageSource;
+import net.minecraft.world.World;
+import shift.sextiarysector.api.SextiarySectorAPI;
+import shift.sextiarysector.packet.PacketPlayerData;
+import shift.sextiarysector.packet.SSPacketHandler;
+import shift.sextiarysector.player.CustomPlayerData;
+import shift.sextiarysector.player.EntityPlayerManager;
+import shift.sextiarysector.player.MoistureStats;
+
+/**
+ * Created by plusplus_F on 2015/09/24.
+ */
+public class CharacteristicWater extends CharacteristicBase {
+ protected boolean reverse;
+ public CharacteristicWater(boolean minus){
+ reverse=minus;
+ setUnlocalizedName("fbs.water."+(reverse?"lose":"gain"));
+ }
+
+ @Override
+ public Type getType() {
+ return Type.SCALE;
+ }
+
+ @Override
+ public void affectEntity(World world, EntityLivingBase entity){
+ if(!(entity instanceof EntityPlayer)) return;
+ int d=6+6*getType().getCorrectedValue(value);
+
+ CustomPlayerData cpd= EntityPlayerManager.getCustomPlayerData((EntityPlayer)entity);
+ if(cpd==null) return;
+ MoistureStats ms=cpd.getMoisture();
+
+ EntityPlayer ep=(EntityPlayer) entity;
+
+ if(reverse) SextiarySectorAPI.addMoistureExhaustion(ep, d*2);
+ else SextiarySectorAPI.addMoistureStats(ep, d, 0.1f);
+
+ if(ep instanceof EntityPlayerMP) SSPacketHandler.INSTANCE.sendTo(new PacketPlayerData(EntityPlayerManager.getCustomPlayerData(ep)), (EntityPlayerMP) ep);
+ }
+
+ @Override
+ public ChatFormatting getNameColor(){
+ return reverse?ChatFormatting.RED:ChatFormatting.DARK_GREEN;
+ }
+
+ public static class Gain extends CharacteristicWater {
+ public Gain(){ super(false); }
+ }
+ public static class Lose extends CharacteristicWater {
+ public Lose(){ super(true); }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicWeight.class b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicWeight.class Binary files differnew file mode 100644 index 0000000..62bc1ad --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicWeight.class diff --git a/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicWeight.java b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicWeight.java new file mode 100644 index 0000000..fa27b5d --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicWeight.java @@ -0,0 +1,23 @@ +package jp.plusplus.fbs.alchemy.characteristic;
+
+/**
+ * Created by plusplus_F on 2015/09/24.
+ */
+public class CharacteristicWeight extends CharacteristicBase {
+
+ public CharacteristicWeight(){
+ setUnlocalizedName("fbs.weight");
+ }
+
+ public float getMPScale(){
+ int v=getValue();
+ if(v==0) return 0.75f;
+ if(v==1) return 1.25f;
+ return 1.f;
+ }
+
+ @Override
+ public Type getType() {
+ return Type.WEIGHT;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/api/FBSEntityPropertiesAPI.class b/src/main/java/jp/plusplus/fbs/api/FBSEntityPropertiesAPI.class Binary files differnew file mode 100644 index 0000000..7873baa --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/api/FBSEntityPropertiesAPI.class diff --git a/src/main/java/jp/plusplus/fbs/api/FBSEntityPropertiesAPI.java b/src/main/java/jp/plusplus/fbs/api/FBSEntityPropertiesAPI.java new file mode 100644 index 0000000..d351f7b --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/api/FBSEntityPropertiesAPI.java @@ -0,0 +1,153 @@ +package jp.plusplus.fbs.api;
+
+import jp.plusplus.fbs.Registry;
+import jp.plusplus.fbs.exprop.FBSEntityProperties;
+import jp.plusplus.fbs.exprop.SanityManager;
+import jp.plusplus.fbs.item.enchant.EnchantmentCleverness;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.util.MathHelper;
+
+import javax.swing.text.html.parser.Entity;
+
+/**
+ * Created by plusplus_F on 2015/09/05.
+ * FBS,TFKの独自ステータスに関してはここで弄るといいと思います。
+ */
+public class FBSEntityPropertiesAPI {
+
+ /**
+ * playerの現在の正気度を得る
+ * @param player 対象プレイヤー
+ * @return 現在の正気度
+ */
+ public static int GetSanityPoint(EntityPlayer player){
+ FBSEntityProperties prop=FBSEntityProperties.get(player);
+ return prop.getSanity();
+ }
+
+ /**
+ * playerの最大正気度を得る
+ * @param player 対象プレイヤー
+ * @return 最大正気度
+ */
+ public static int GetMaxSanityPoint(EntityPlayer player){
+ FBSEntityProperties prop=FBSEntityProperties.get(player);
+ return prop.getMaxSanity();
+ }
+
+ /**
+ * プレイヤー1人を対象に発動する。そのプレイヤーに正気度を与える
+ * @param player 対象プレイヤー
+ * @param trial ダイスを振る回数 (0<)
+ * @param max 何面ダイス? (0<)
+ * @param sim 実際に結果を反映させるか否か
+ * @return 変化量
+ */
+ public static int AddSanity(EntityPlayer player, int trial, int max, boolean sim){
+ return SanityManager.addSanity(player, trial, max, sim);
+ }
+
+ /**
+ * プレイヤー1人を対象に発動する。そのプレイヤーの正気度を失わせる
+ * @param player 対象プレイヤー
+ * @param trial ダイスを振る回数 (0<)
+ * @param max 何面ダイス? (0<)
+ * @param sim 実際に結果を反映させるか否か
+ * @return 変化量
+ */
+ public static int LoseSanity(EntityPlayer player, int trial, int max, boolean sim){
+ return SanityManager.loseSanity(player, trial, max, sim);
+ }
+
+ /**
+ * playerの補正無しの魔術レベルを得る
+ * @param player 対象プレイヤー
+ * @return 魔術レベル
+ */
+ public static int GetMagicLevelRaw(EntityPlayer player){
+ FBSEntityProperties prop=FBSEntityProperties.get(player);
+ return prop.getMagicLevel();
+ }
+
+ /**
+ * playerの補正済みの魔術レベルを得る
+ * @param player 対象プレイヤー
+ * @return 魔術レベル
+ */
+ public static int GetMagicLevel(EntityPlayer player){
+ FBSEntityProperties prop=FBSEntityProperties.get(player);
+ int l=prop.getMagicLevel();
+
+ //ポーション効果
+ int peff;
+ if(player.isPotionActive(Registry.potionCleverness)){
+ peff=4*(1+player.getActivePotionEffect(Registry.potionCleverness).getAmplifier());
+ }
+ else{
+ peff=0;
+ }
+
+ //エンチャント補正
+ int eSum= EnchantmentCleverness.getSum(player);
+ int eeff;
+ if(eSum<=5) eeff=5;
+ else if(eSum<=11) eeff=5+MathHelper.floor_float(0.5f*(eSum-5));
+ else eeff=8+MathHelper.floor_float(2.f/14.f*(eSum-11));
+
+ //
+ return l+peff+eeff;
+ }
+
+
+ /**
+ * playerの魔術レベルを設定する
+ * @param player 対象プレイヤー
+ * @param lv 魔術レベル
+ */
+ public static void SetMagicLevel(EntityPlayer player, int lv){
+ FBSEntityProperties prop=FBSEntityProperties.get(player);
+ prop.setMagicLevel(lv);
+ SanityManager.sendPacket(player);
+ }
+
+ /**
+ * playerの魔術経験値を得る
+ * @param player 対象プレイヤー
+ * @return 魔術経験値
+ */
+ public static double GetMagicEXP(EntityPlayer player){
+ FBSEntityProperties prop=FBSEntityProperties.get(player);
+ return prop.getEXP();
+ }
+
+ /**
+ * playerのLvUPに必要な魔術経験値を得る
+ * @param player 対象プレイヤー
+ * @return 必要な魔術経験値
+ */
+ public static double GetNextMagicEXP(EntityPlayer player){
+ FBSEntityProperties prop=FBSEntityProperties.get(player);
+ return prop.getNext();
+ }
+
+ /**
+ * 魔術経験値を与える。レベルアップの判定と処理もされる
+ * @param player 対象プレイヤー
+ * @param exp (0<)
+ * @param sim 実際に結果を反映させるか否か
+ * @return 変化量
+ */
+ public static double AddExp(EntityPlayer player, double exp, boolean sim){
+ return SanityManager.addExp(player, exp, sim);
+ }
+
+ /**
+ * その本が解読したことがあるかどうかを返す
+ * @param player 対象プレイヤー
+ * @param name 対象の書物
+ * @return trueなら解読したことがある
+ */
+ public static boolean IsBookDecoded(EntityPlayer player, String name){
+ return FBSEntityProperties.get(player).isDecoded(name);
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/api/FBSRecipeAPI.class b/src/main/java/jp/plusplus/fbs/api/FBSRecipeAPI.class Binary files differnew file mode 100644 index 0000000..034e6e5 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/api/FBSRecipeAPI.class diff --git a/src/main/java/jp/plusplus/fbs/api/FBSRecipeAPI.java b/src/main/java/jp/plusplus/fbs/api/FBSRecipeAPI.java new file mode 100644 index 0000000..0251b7c --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/api/FBSRecipeAPI.java @@ -0,0 +1,148 @@ +package jp.plusplus.fbs.api;
+
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.Registry;
+import net.minecraft.entity.monster.IMob;
+import net.minecraft.item.ItemStack;
+import net.minecraft.item.crafting.IRecipe;
+
+/**
+ * Created by plusplus_F on 2015/09/05.
+ * 外部からレシピをどうにかしたいときに使ってください。
+ * 別にRegistryを直接叩いてもいいけどね。
+ */
+public class FBSRecipeAPI {
+ /**
+ * アイテムに対し抽出炉で抽出できる魔力量を登録する
+ * @param item
+ * @param amount 正の数
+ */
+ public static void AddManaContainer(ItemStack item, int amount){
+ if(amount<=0){
+ FBS.logger.error("Error:fault adding mana container. " + item.getDisplayName() + "(" + amount + ")");
+ return;
+ }
+ Registry.RegisterManaContainer(item, amount);
+ }
+
+ /**
+ * 魔術師の作業台でのクラフトレシピを登録する
+ * @param recipe 登録レシピ
+ * @param amount 消費魔力量(正の数)
+ */
+ public static void AddCrafting(IRecipe recipe, int amount){
+ if(amount<=0){
+ FBS.logger.error("Error:fault adding crafting. " + recipe.getRecipeOutput().getDisplayName() + "(" + amount + ")");
+ return;
+ }
+ Registry.RegisterRecipe(recipe, amount);
+ }
+
+ /**
+ * 古書を登録する
+ * @param title 書物のUnlocalizedタイトル
+ * @param lv 適性魔術レベル(0<lv)
+ * @param prob 解読成功確率(0<prob<=1)
+ * @param exp 基本経験値(0<=exp)
+ * @param sanTrial 正気度ロールXdYのX(0<=)
+ * @param sanMax 正気度ロールXdYのY(0<=)
+ * @param weight 出現時の重み(基本値10)
+ */
+ public static boolean AddBook(String title, int lv, float prob, double exp, int sanTrial, int sanMax, int weight){
+ if(title==null || lv<=0 || prob<=0 || exp<0 || sanTrial<0 || sanMax<0 || weight<0){
+ FBS.logger.error("Error:fault adding book. " + title + "(lv" + lv + ",prob" + prob + ",exp" + exp + "," + sanTrial + "d" + sanMax + ",weight" + weight);
+ return false;
+ }
+ Registry.RegisterBook(title, lv, false, prob, exp, sanTrial, sanMax, weight);
+ return true;
+ }
+
+ /**
+ * 魔法を登録する。書物も一緒に登録される
+ * @param title 書物のUnlocalizedタイトル
+ * @param lv 適性魔術レベル(0<lv)
+ * @param prob 解読成功確率(0<prob<=1)
+ * @param exp 基本経験値(0<=exp)
+ * @param sanTrial 正気度ロールXdYのX(0<=)
+ * @param sanMax 正気度ロールXdYのY(0<=)
+ * @param weight 出現時の重み(基本値10)
+ * @param type 魔法の種類
+ * @param aria 詠唱tick数
+ * @param exp2 魔法行使の基本経験値
+ * @param minUse 解読時設定される使用回数の最小
+ * @param maxUse 解読時設定される使用回数の最大
+ * @param magic 魔法のクラス
+ */
+ public static void AddMagic(String title, int lv, float prob, double exp, int sanTrial, int sanMax, int weight, String type, int aria, double exp2, int minUse, int maxUse, Class<? extends MagicBase> magic){
+ if(title==null || lv<=0 || prob<=0 || exp<0 || sanTrial<0 || sanMax<0 || weight<0){
+ FBS.logger.error("Error:fault adding book. " + title + "(lv" + lv + ",prob" + prob + ",exp" + exp + "," + sanTrial + "d" + sanMax + ",weight" + weight);
+ return;
+ }
+ Registry.RegisterBook(title, lv, true, prob, exp, sanTrial, sanMax, weight);
+
+ if(type==null || aria<=0 || exp2<=0 || minUse<0 || maxUse<minUse || magic==null){
+ FBS.logger.error("Error:fault adding magic. " + title + "(aria" + aria + ",exp2" + exp2 + ",use" + minUse + "..." + maxUse + "," + magic.toString());
+ return;
+ }
+ Registry.RegisterMagic(title, type, aria, exp2, minUse, maxUse, magic);
+ }
+
+ /**
+ * TFKの構造物のチェスト内容を登録する
+ * @param id 封印された図書館:0
+ * @param item
+ * @param weight 出現の重み(0<)
+ */
+ public static void AddChestContent(int id, ItemStack item, int weight){
+ if(id<0 || item==null || weight<=0){
+ FBS.logger.error("Error:fault adding chest content. id" + id + "," + item.getDisplayName() + ",weight" + weight);
+ return;
+ }
+ Registry.RegisterChestContent(id, item, weight);
+ }
+
+ /**
+ * 魔法陣を登録する。
+ * 魔法陣は文字列の配列で表され、n*nのサイズである必要がある(nは奇数)。
+ * 使用できる文字は0~9,a-fであり、これは各チャームのメタ値に対応している。
+ * また、空白' 'も使用でき、これはそこにはチャームが無いことを示す。
+ * 魔法陣の中央は常に核が置かれるため、中央の値は無視される。
+ * @param name 登録名
+ * @param charms 魔法陣のチャーム配置
+ */
+ public static void AddMagicCircle(String name, String ... charms){
+ if(name==null || charms==null){
+ FBS.logger.error("Error:fault adding chest content. " + name + "," + charms);
+ return;
+ }
+ Registry.RegisterMagicCircle(name, charms);
+ }
+
+ /**
+ * アイテム使用時のプレイヤーの正気度の変化量を登録する。
+ * @param item
+ * @param trial 正気度ロールXdYのX(0<)
+ * @param max 正気度ロールXdYのY(!=0)
+ */
+ public static void AddItemSanity(ItemStack item, int trial, int max){
+ if(item==null || trial<=0 || max==0){
+ FBS.logger.error("Error:fault registering item. " + item.getDisplayName()+","+trial+"d"+max);
+ return;
+ }
+ Registry.RegisterItemSanity(item, trial, max);
+ }
+
+ /**
+ * Mob攻撃時のプレイヤーの正気度の変化量を登録する。
+ * @param type Mobのクラス
+ * @param trial 正気度ロールXdYのX(0<)
+ * @param max 正気度ロールXdYのY(!=0)
+ */
+ public static void AddMobSanity(Class<? extends IMob> type, int trial, int max){
+ if(type==null || trial<=0 || max==0){
+ FBS.logger.error("Error:fault registering mob. " + type.toString()+","+trial+"d"+max);
+ return;
+ }
+ Registry.RegisterMobSanity(type, trial, max);
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/api/IHarvestable.class b/src/main/java/jp/plusplus/fbs/api/IHarvestable.class Binary files differnew file mode 100644 index 0000000..0749eca --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/api/IHarvestable.class diff --git a/src/main/java/jp/plusplus/fbs/api/IHarvestable.java b/src/main/java/jp/plusplus/fbs/api/IHarvestable.java new file mode 100644 index 0000000..1b2f7c2 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/api/IHarvestable.java @@ -0,0 +1,67 @@ +package jp.plusplus.fbs.api;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.world.World;
+
+import java.util.ArrayList;
+import java.util.Random;
+
+/**
+ * Created by plusplus_F on 2015/11/09.
+ * 右クリックで収穫可能なブロック
+ */
+public interface IHarvestable {
+ /**
+ * 収穫可能な状態にあるか調べる
+ * @param world
+ * @param x
+ * @param y
+ * @param z
+ * @return
+ */
+ public boolean canHarvest(World world, int x, int y, int z);
+
+ /**
+ * 収穫可能な状態を目指して成長させる
+ * @param world
+ * @param x
+ * @param y
+ * @param z
+ * @param rand
+ */
+ public void glow(World world, int x, int y, int z, Random rand);
+
+ /**
+ * 収穫可能なアイテムの一覧を入手する
+ * @param world
+ * @param x
+ * @param y
+ * @param z
+ * @return
+ */
+ public ArrayList<ItemStack> getHarvestItems(World world, int x, int y, int z);
+
+ /**
+ * プレイヤーによって収穫する
+ * @param world
+ * @param x
+ * @param y
+ * @param z
+ * @param player
+ * @param rand
+ * @return
+ */
+ public ArrayList<ItemStack> harvest(World world, int x, int y, int z, Random rand, EntityPlayer player);
+
+ /**
+ * 収穫機など、プレイヤー以外が収穫する
+ * @param world
+ * @param x
+ * @param y
+ * @param z
+ * @param rand
+ * @return
+ */
+ public ArrayList<ItemStack> harvest(World world, int x, int y, int z, Random rand);
+}
diff --git a/src/main/java/jp/plusplus/fbs/api/IMagicEnchant$ParticleColor.class b/src/main/java/jp/plusplus/fbs/api/IMagicEnchant$ParticleColor.class Binary files differnew file mode 100644 index 0000000..ea46b90 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/api/IMagicEnchant$ParticleColor.class diff --git a/src/main/java/jp/plusplus/fbs/api/IMagicEnchant.class b/src/main/java/jp/plusplus/fbs/api/IMagicEnchant.class Binary files differnew file mode 100644 index 0000000..0353f8f --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/api/IMagicEnchant.class diff --git a/src/main/java/jp/plusplus/fbs/api/IMagicEnchant.java b/src/main/java/jp/plusplus/fbs/api/IMagicEnchant.java new file mode 100644 index 0000000..404b378 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/api/IMagicEnchant.java @@ -0,0 +1,44 @@ +package jp.plusplus.fbs.api;
+
+import net.minecraft.entity.EntityLivingBase;
+
+/**
+ * Created by plusplus_F on 2015/06/22.
+ * 付与魔法とするMagicBaseのサブクラスが実装すべきインターフェース
+ * このインターフェースを実装していると付与魔法として扱われる
+ */
+public interface IMagicEnchant {
+ /**
+ * 対象Entityに何かしらの効果を与える。
+ * これは主に共鳴魔法から呼び出される。
+ * @param entity 付与対象Entity
+ * @param success 魔法の成功可否(true:成功)
+ */
+ public void enchant(EntityLivingBase entity, boolean success);
+
+ /**
+ * ダメージ計算時に実ダメージに乗算される値を返す
+ * @param entity 付与対象となるEntity
+ * @return 実ダメージ値に乗算される補正値(0以上)
+ */
+ public float damageScale(EntityLivingBase entity);
+
+ /**
+ * ダメージ計算時に実ダメージに加算される値を返す
+ * @param entity 付与対象となるEntity
+ * @return 実ダメージ値に加算される補正値(0以上)
+ */
+ public float damageValue(EntityLivingBase entity);
+
+ /**
+ * パーティクルの色を設定する
+ */
+ public ParticleColor setParticleColor();
+
+ public static class ParticleColor{
+ public float red,green,blue;
+ public ParticleColor(){
+ red=green=blue=1;
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/api/IPottery$1.class b/src/main/java/jp/plusplus/fbs/api/IPottery$1.class Binary files differnew file mode 100644 index 0000000..3a0ed2a --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/api/IPottery$1.class diff --git a/src/main/java/jp/plusplus/fbs/api/IPottery$PotteryGrade.class b/src/main/java/jp/plusplus/fbs/api/IPottery$PotteryGrade.class Binary files differnew file mode 100644 index 0000000..2c43117 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/api/IPottery$PotteryGrade.class diff --git a/src/main/java/jp/plusplus/fbs/api/IPottery$PotterySize.class b/src/main/java/jp/plusplus/fbs/api/IPottery$PotterySize.class Binary files differnew file mode 100644 index 0000000..26be3ee --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/api/IPottery$PotterySize.class diff --git a/src/main/java/jp/plusplus/fbs/api/IPottery$PotteryState.class b/src/main/java/jp/plusplus/fbs/api/IPottery$PotteryState.class Binary files differnew file mode 100644 index 0000000..2120a46 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/api/IPottery$PotteryState.class diff --git a/src/main/java/jp/plusplus/fbs/api/IPottery.class b/src/main/java/jp/plusplus/fbs/api/IPottery.class Binary files differnew file mode 100644 index 0000000..f747611 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/api/IPottery.class diff --git a/src/main/java/jp/plusplus/fbs/api/IPottery.java b/src/main/java/jp/plusplus/fbs/api/IPottery.java new file mode 100644 index 0000000..b2d081a --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/api/IPottery.java @@ -0,0 +1,253 @@ +package jp.plusplus.fbs.api;
+
+import net.minecraft.block.Block;
+import net.minecraft.client.model.ModelBase;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.ResourceLocation;
+import net.minecraft.util.StatCollector;
+
+import java.util.ArrayList;
+import java.util.Random;
+
+/**
+ * Created by plusplus_F on 2015/08/26.
+ * 陶芸品。ブロックに実装する事。
+ */
+public interface IPottery {
+
+ /**
+ * 指定の値のItemStackを返す
+ * @param state
+ * @param grade
+ * @param size
+ * @param pattern
+ * @param hasEffect
+ * @return
+ */
+ public ItemStack getItemStack(PotteryState state, PotteryGrade grade, PotterySize size, byte pattern, boolean hasEffect);
+
+ /**
+ * Sizeを設定する
+ * @param itemStack
+ * @param size
+ */
+ public void setSize(ItemStack itemStack, PotterySize size);
+
+ /**
+ * サイズを返す
+ * @param nbt
+ * @return
+ */
+ public PotterySize getSize(NBTTagCompound nbt);
+
+
+ /**
+ * 品質を設定する
+ * @param itemStack
+ * @param grade
+ */
+ public void setGrade(ItemStack itemStack, PotteryGrade grade);
+
+ /**
+ * 品質を*ランダムに*設定する
+ * @param itemStack
+ * @param rand
+ */
+ public void setGrade(ItemStack itemStack, Random rand);
+
+ /**
+ * 品質を返す
+ * @param nbt
+ * @return
+ */
+ public PotteryGrade getGrade(NBTTagCompound nbt);
+
+ /**
+ * 模様を設定する
+ * @param itemStack
+ * @param pattern
+ */
+ public void setPattern(ItemStack itemStack, byte pattern);
+
+ /**
+ * 模様を返す
+ * @param nbt
+ * @return
+ */
+ public byte getPattern(NBTTagCompound nbt);
+
+ /**
+ * 状態を設定する
+ * 特殊効果持ちの陶芸品を作る場合、ここでBAKEDに遷移する際にアイテムスタックを弄ること
+ * @param itemStack
+ * @param state
+ */
+ public void setState(ItemStack itemStack, PotteryState state);
+ /**
+ * 状態を返す
+ * @param nbt
+ * @return
+ */
+ public PotteryState getState(NBTTagCompound nbt);
+
+ /**
+ * 効果持ちフラグを設定する
+ * @param itemStack
+ * @param eff
+ * @return
+ */
+ public void setEffect(ItemStack itemStack, boolean eff);
+
+ /**
+ * 魔法の効果を持つか
+ * @param nbt
+ * @return
+ */
+ public boolean hasEffect(NBTTagCompound nbt);
+
+ /**
+ * hasEffect():true時に、窯で焼きあがる際に呼ばれる
+ * 効果持ちのItemStackを返す
+ * @param itemStack
+ * @return
+ */
+ public ItemStack getEnchantedItemStack(ItemStack itemStack, Random rand);
+
+ /**
+ * 描画用メタデータを得る
+ * 2211 0000
+ * 0:模様
+ * 1:大きさ
+ * 2:状態
+ * @param nbt
+ * @return
+ */
+ public int getMetadata(NBTTagCompound nbt);
+
+ /**
+ * モデル描画に使うRLを返す
+ * @param metadata
+ * @return
+ */
+ public ResourceLocation getResourceLocation(int metadata);
+
+ /**
+ * モデル描画に使うMBを返す
+ * @param metadata
+ * @return
+ */
+ public ModelBase getModel(int metadata);
+
+ /**
+ * ブロックを返す。基本はthisを返す
+ * @return
+ */
+ public Block getBlockType();
+
+ /**
+ * 乾燥にかかる*秒数*を返す
+ * @param nbt
+ * @return
+ */
+ public int getDrySec(NBTTagCompound nbt);
+
+ /**
+ * そのアイテムを売却した際の価格を返す
+ * @param itemStack
+ * @return
+ */
+ public int getMP(ItemStack itemStack);
+
+ /**
+ * 表示されるローカライズされた名前を得る
+ * @param nbt
+ * @return
+ */
+ public String getLocalizedName(NBTTagCompound nbt);
+
+ /**
+ * 「完成品の」取り得る全てのパターンを返す
+ * 返り値はMPやCreativeTabの登録に使われる
+ * @return
+ */
+ public ArrayList<ItemStack> getAllPattern();
+
+ /**
+ * 被弾時に壺が割れる確率を得る
+ * @param itemStack
+ * @return
+ */
+ public float getCrashProbability(ItemStack itemStack);
+
+ public static enum PotteryState{
+ MOLDED(0), DRY(1), BAKED(2), INVALID_VALUE(-1);
+
+ PotteryState(int v){ value=(byte)v; }
+
+ private byte value;
+ public byte getValue(){ return value; }
+
+ public static PotteryState Get(int v){
+ if(v==MOLDED.getValue()) return MOLDED;
+ if(v==DRY.getValue()) return DRY;
+ if(v==BAKED.getValue()) return BAKED;
+ return INVALID_VALUE;
+ }
+ public static String GetLocalizedPrefix(PotteryState state){
+ if(state==MOLDED) return StatCollector.translateToLocal("pottery.fbs.molded");
+ if(state==DRY) return StatCollector.translateToLocal("pottery.fbs.dry");
+ return "";
+ }
+ }
+ public static enum PotterySize{
+ SMALL(0), MEDIUM(1), LARGE(2);
+
+ PotterySize(int v){ value=(byte)v; }
+
+ private byte value;
+ public byte getValue(){ return value; }
+
+ public static PotterySize Get(int v){
+ if(v==SMALL.getValue()) return SMALL;
+ if(v==LARGE.getValue()) return LARGE;
+ return MEDIUM;
+ }
+ public static String GetLocalizedPrefix(PotterySize size){
+ String str;
+ switch (size){
+ case SMALL: str= StatCollector.translateToLocal("pottery.fbs.small"); break;
+ case LARGE: str=StatCollector.translateToLocal("pottery.fbs.large"); break;
+ default: str=""; break;
+ }
+ return str;
+ }
+ }
+ public static enum PotteryGrade{
+ BAD(0), NORMAL(1), GOOD(2), GREAT(3), SOULFUL(4);
+
+ PotteryGrade(int v){ value=(byte)v; }
+
+ private byte value;
+ public byte getValue(){ return value; }
+
+ public static PotteryGrade Get(int v){
+ if(v==BAD.getValue()) return BAD;
+ if(v==GOOD.getValue()) return GOOD;
+ if(v==GREAT.getValue()) return GREAT;
+ if(v==SOULFUL.getValue()) return SOULFUL;
+ return NORMAL;
+ }
+ public static String GetLocalizedPrefix(PotteryGrade grade){
+ String str;
+ switch (grade){
+ case BAD: str=StatCollector.translateToLocal("pottery.fbs.bad"); break;
+ case GOOD: str=StatCollector.translateToLocal("pottery.fbs.good"); break;
+ case GREAT: str=StatCollector.translateToLocal("pottery.fbs.great"); break;
+ case SOULFUL: str=StatCollector.translateToLocal("pottery.fbs.soulful"); break;
+ default: str=""; break;
+ }
+ return str;
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/api/IResonance.class b/src/main/java/jp/plusplus/fbs/api/IResonance.class Binary files differnew file mode 100644 index 0000000..7212d82 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/api/IResonance.class diff --git a/src/main/java/jp/plusplus/fbs/api/IResonance.java b/src/main/java/jp/plusplus/fbs/api/IResonance.java new file mode 100644 index 0000000..234af55 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/api/IResonance.java @@ -0,0 +1,43 @@ +package jp.plusplus.fbs.api;
+
+import jp.plusplus.fbs.Registry;
+
+/**
+ * Created by pluslus_F on 2015/06/23.
+ * 魔導書の共鳴の判定と情報提供用のインターフェース
+ * 独自共鳴はこれを実装してRegistryに登録するといいよ
+ */
+public interface IResonance {
+
+ /**
+ * 同じクラスのインスタンスを返す
+ * @return 自身のインスタンス
+ */
+ public IResonance copy();
+
+ /**
+ * 共鳴できるかどうかの判定
+ * @param magics スタッフにセットされた魔法
+ * @return true:共鳴可
+ */
+ public boolean isMatch(Registry.MagicData[] magics);
+
+ /**
+ * 共鳴後の魔法の登録名を返す
+ * @return 共鳴後の魔法の登録名
+ */
+ public String getResonanceMagicName();
+
+ /**
+ * 共鳴後の魔法のクライアント側に表示される名前を返す
+ * @param titles 共鳴に使用されている魔法の登録名
+ * @return ローカライズ後の表示名
+ */
+ public String getDisplayMagicName(String[] titles);
+
+ /**
+ * 共鳴判定時の優先度を返す
+ * @return 優先度(0が最低値)
+ */
+ public int priority();
+}
diff --git a/src/main/java/jp/plusplus/fbs/api/MagicBase.class b/src/main/java/jp/plusplus/fbs/api/MagicBase.class Binary files differnew file mode 100644 index 0000000..74122e9 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/api/MagicBase.class diff --git a/src/main/java/jp/plusplus/fbs/api/MagicBase.java b/src/main/java/jp/plusplus/fbs/api/MagicBase.java new file mode 100644 index 0000000..e122b33 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/api/MagicBase.java @@ -0,0 +1,188 @@ +package jp.plusplus.fbs.api;
+
+import cpw.mods.fml.common.FMLLog;
+import jp.plusplus.fbs.Registry;
+import jp.plusplus.fbs.exprop.FBSEntityProperties;
+import jp.plusplus.fbs.exprop.SanityManager;
+import jp.plusplus.fbs.tileentity.TileEntityMagicCore;
+import net.minecraft.block.Block;
+import net.minecraft.block.material.Material;
+import net.minecraft.client.entity.EntityClientPlayerMP;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.*;
+import net.minecraft.world.World;
+
+import java.util.List;
+import java.util.Random;
+
+/**
+ * Createdby pluslus_Fon 2015/06/06.
+ * ItemBookSorceryによって発動される魔法の基底クラス
+ * 魔法を追加したくばこのクラスを継承すればよい
+ */
+public abstract class MagicBase {
+ /**
+ * 術者
+ */
+ public EntityPlayer player;
+ /**
+ * 術者のSAN値やら魔術Lvやら
+ */
+ public FBSEntityProperties property;
+ /**
+ * 登録されてい魔法データ
+ */
+ public Registry.MagicData magicData;
+ /**
+ * 登録されている書物データ
+ */
+ public Registry.BookData bookData;
+ /**
+ * worldのインスタンス
+ * 基本的に全て isRemote は false となる
+ */
+ public World world;
+ /**
+ * 乱数を使うならコレ
+ */
+ public Random rand;
+ /**
+ * キチンと詠唱されたか否か
+ * true:詠唱
+ * false:詠唱破棄
+ */
+ public boolean isSpelled;
+ /**
+ * スタッフを用いているか否か
+ * true:用いている
+ */
+ public boolean usingStaff;
+
+
+ /**
+ * 魔法が成功したかを判定する
+ * このメソッドが呼ばれる際、既に各フィールドはセットされている
+ * @return true:成功
+ */
+ public abstract boolean checkSuccess();
+
+ /**
+ * 行使成功時の魔法処理
+ */
+ public abstract void success();
+ /**
+ * 行使失敗時の魔法処理
+ */
+ public abstract void failure();
+
+ /**
+ * 魔法陣の登録名を返す。
+ * nullの場合、その魔法は魔法陣を必要としない
+ * @return 魔法陣の登録名
+ */
+ public String getMagicCircleName(){
+ return "null";
+ }
+
+ /**
+ * 術者が魔法陣の中心にいるか判定する
+ * @param name 対象魔法陣の登録名
+ * @return true:*まほうじんのなかにいる*
+ */
+ public boolean checkMagicCircle(String name){
+ int x= MathHelper.floor_double(player.posX);
+ int y=MathHelper.floor_double(player.posY);
+ int z=MathHelper.floor_double(player.posZ);
+
+ TileEntity e=world.getTileEntity(x,y,z);
+ if(!(e instanceof TileEntityMagicCore)){
+ return false;
+ }
+ return ((TileEntityMagicCore) e).getCircleName().equals(name);
+ }
+
+ /**
+ * 術者の正気度を(trial)D(max)で喪失させる。
+ * @param trial
+ * @param max
+ */
+ protected void sanity(int trial, int max){
+ SanityManager.loseSanity(player, trial, max, true);
+ }
+
+ /**
+ * 術者に失敗時のメッセージを表示させる
+ */
+ public void failureMessage(){
+ player.addChatComponentMessage(new ChatComponentText(String.format(StatCollector.translateToLocal("info.fbs.magic.failure"), magicData.getLocalizedTitle())));
+ }
+
+ /**
+ * 現在の魔術レベルとこの魔法の適正魔術Lvとの差を求める
+ * @return (魔術レベル)-(適性魔術レベル)
+ */
+ public int getLvDiff(){
+ return property.getMagicLevel()-bookData.lv;
+ }
+
+ /**
+ * 術者が触れたブロックの座標を返す
+ * @return
+ */
+ public Vec3 getTouchPosition(){
+ Vec3 stPos = Vec3.createVectorHelper(player.posX, player.posY + player.getEyeHeight(), player.posZ);
+ Vec3 vec=player.getLookVec();
+ vec.xCoord=vec.xCoord*5+stPos.xCoord;
+ vec.yCoord=vec.yCoord*5+stPos.yCoord;
+ vec.zCoord=vec.zCoord*5+stPos.zCoord;
+ MovingObjectPosition movingobjectposition = world.func_147447_a(stPos, vec, false, true, false);
+ if(movingobjectposition!=null){
+ Vec3 p=Vec3.createVectorHelper(movingobjectposition.blockX, movingobjectposition.blockY, movingobjectposition.blockZ);
+ return p;
+ }
+
+ return null;
+ }
+
+ /**
+ * 術者が触れたEntityを返す
+ * @return 触れたEntity
+ */
+ public Entity getTouchEntity(){
+ Vec3 stPos = Vec3.createVectorHelper(player.posX, player.posY + player.getEyeHeight(), player.posZ);
+ Vec3 vec=player.getLookVec();
+ vec.xCoord=vec.xCoord*5;
+ vec.yCoord=vec.yCoord*5;
+ vec.zCoord=vec.zCoord*5;
+
+ Vec3 enPos=stPos.addVector(vec.xCoord, vec.yCoord, vec.zCoord);
+
+ AxisAlignedBB aabb=AxisAlignedBB.getBoundingBox(stPos.xCoord, stPos.yCoord, stPos.zCoord, stPos.xCoord+1, stPos.yCoord+1, stPos.zCoord+1);
+ List list = world.getEntitiesWithinAABB(EntityLivingBase.class, aabb.addCoord(vec.xCoord, vec.yCoord, vec.zCoord).expand(1.0D, 1.0D, 1.0D));
+
+ double r=0;
+ Entity ret=null;
+ for (int l = 0; l < list.size(); ++l) {
+ Entity entity1 = (Entity) list.get(l);
+ if(!entity1.isEntityEqual(player) && entity1.canBeCollidedWith()){
+ float f1 = 0.3F;
+ AxisAlignedBB axisalignedbb1 = entity1.boundingBox.expand((double) f1, (double) f1, (double) f1);
+ MovingObjectPosition movingobjectposition1 = axisalignedbb1.calculateIntercept(stPos, enPos);
+
+ if (movingobjectposition1 != null) {
+ double d1 = enPos.distanceTo(movingobjectposition1.hitVec);
+
+ if (d1 < r || r == 0.0D) {
+ ret=entity1;
+ r=d1;
+ }
+ }
+ }
+ }
+
+ return ret;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/api/MagicEnchantBase.class b/src/main/java/jp/plusplus/fbs/api/MagicEnchantBase.class Binary files differnew file mode 100644 index 0000000..50e61c4 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/api/MagicEnchantBase.class diff --git a/src/main/java/jp/plusplus/fbs/api/MagicEnchantBase.java b/src/main/java/jp/plusplus/fbs/api/MagicEnchantBase.java new file mode 100644 index 0000000..fedf3ba --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/api/MagicEnchantBase.java @@ -0,0 +1,55 @@ +package jp.plusplus.fbs.api;
+
+import jp.plusplus.fbs.api.IMagicEnchant;
+import jp.plusplus.fbs.api.MagicBase;
+import net.minecraft.entity.EntityLivingBase;
+
+/**
+ * Created by pluslus_F on 2015/06/22.
+ */
+public abstract class MagicEnchantBase extends MagicBase implements IMagicEnchant {
+ protected int trial, max;
+
+ public MagicEnchantBase(int t, int m){
+ trial=t;
+ max=m;
+ }
+
+ @Override
+ public void success() {
+ enchant(player, true);
+ }
+
+ @Override
+ public void failure() {
+ sanity(trial, max);
+ enchant(player, false);
+ }
+
+ public int getAmplifier(int rate){
+ int t=getLvDiff();
+ if(t<=0) return 1;
+ int a=1+t/rate;
+ return a>5?5:a;
+ }
+ public int getDuration(int base, float rate){
+ int t=getLvDiff();
+ if(t<=0) return 20*base;
+ return (int)(20*(base+t/rate));
+ }
+
+ @Override
+ public float damageScale(EntityLivingBase entity){
+ return 0.f;
+ }
+
+ @Override
+ public float damageValue(EntityLivingBase entity){
+ return 0.f;
+ }
+
+ @Override
+ public ParticleColor setParticleColor(){
+ return new ParticleColor();
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/api/event/CheckingMonocleEvent.class b/src/main/java/jp/plusplus/fbs/api/event/CheckingMonocleEvent.class Binary files differnew file mode 100644 index 0000000..b99737a --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/api/event/CheckingMonocleEvent.class diff --git a/src/main/java/jp/plusplus/fbs/api/event/CheckingMonocleEvent.java b/src/main/java/jp/plusplus/fbs/api/event/CheckingMonocleEvent.java new file mode 100644 index 0000000..dbbf74f --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/api/event/CheckingMonocleEvent.java @@ -0,0 +1,35 @@ +package jp.plusplus.fbs.api.event;
+
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.event.entity.player.PlayerEvent;
+import net.minecraft.entity.player.EntityPlayer;
+
+/**
+ * Created by plusplus_F on 2016/03/06.
+ *
+ * プレイヤーがモノクルを持っているかの判定イベント
+ */
+public class CheckingMonocleEvent extends PlayerEvent {
+ private boolean has;
+ private ItemStack monocle;
+
+ public CheckingMonocleEvent(EntityPlayer player, ItemStack has) {
+ super(player);
+ this.has=(has!=null);
+ monocle=has;
+ }
+
+ public boolean hasMonocle(){
+ return has;
+ }
+ public ItemStack getMonocle(){
+ return monocle;
+ }
+
+ public void setMonocle(ItemStack itemStack){
+ if(itemStack!=null){
+ has=true;
+ monocle=itemStack;
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/api/event/DamageMonocleEvent.class b/src/main/java/jp/plusplus/fbs/api/event/DamageMonocleEvent.class Binary files differnew file mode 100644 index 0000000..099299f --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/api/event/DamageMonocleEvent.class diff --git a/src/main/java/jp/plusplus/fbs/api/event/DamageMonocleEvent.java b/src/main/java/jp/plusplus/fbs/api/event/DamageMonocleEvent.java new file mode 100644 index 0000000..be7237b --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/api/event/DamageMonocleEvent.java @@ -0,0 +1,23 @@ +package jp.plusplus.fbs.api.event;
+
+import net.minecraftforge.event.entity.player.PlayerEvent;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+
+/**
+ * Created by plusplus_F on 2016/03/06.
+ *
+ * モノクルの耐久度を消費するときのイベント
+ */
+public class DamageMonocleEvent extends PlayerEvent {
+ private ItemStack monocle;
+
+ public DamageMonocleEvent(EntityPlayer player, ItemStack monocle) {
+ super(player);
+ this.monocle=monocle;
+ }
+
+ public ItemStack getMonocle(){
+ return monocle;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/api/event/PlayerDecodedBookEvent.class b/src/main/java/jp/plusplus/fbs/api/event/PlayerDecodedBookEvent.class Binary files differnew file mode 100644 index 0000000..4afa0fe --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/api/event/PlayerDecodedBookEvent.class diff --git a/src/main/java/jp/plusplus/fbs/api/event/PlayerDecodedBookEvent.java b/src/main/java/jp/plusplus/fbs/api/event/PlayerDecodedBookEvent.java new file mode 100644 index 0000000..7367dfb --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/api/event/PlayerDecodedBookEvent.java @@ -0,0 +1,37 @@ +package jp.plusplus.fbs.api.event;
+
+import jp.plusplus.fbs.Registry;
+import net.minecraftforge.event.entity.player.PlayerEvent;
+import net.minecraft.entity.player.EntityPlayer;
+
+/**
+ * Createdby pluslus_Fon 2015/06/14.
+ * プレイヤーが魔導書を使用した際に呼ばれるイベント
+ */
+public class PlayerDecodedBookEvent extends PlayerEvent {
+ private Registry.BookData bookData;
+ private boolean success;
+
+ public PlayerDecodedBookEvent(EntityPlayer player, Registry.BookData bd, boolean success) {
+ super(player);
+ bookData=bd.copy();
+ this.success=success;
+ }
+
+ @Override
+ public boolean isCancelable() {
+ return true;
+ }
+
+ /**
+ * 使用した書物
+ * @return
+ */
+ public Registry.BookData getBook(){ return bookData; }
+
+ /**
+ * 魔法の行使に成功したか
+ * @return
+ */
+ public boolean isSuccess(){ return success; }
+}
diff --git a/src/main/java/jp/plusplus/fbs/api/event/PlayerSanityEvent.class b/src/main/java/jp/plusplus/fbs/api/event/PlayerSanityEvent.class Binary files differnew file mode 100644 index 0000000..5568b76 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/api/event/PlayerSanityEvent.class diff --git a/src/main/java/jp/plusplus/fbs/api/event/PlayerSanityEvent.java b/src/main/java/jp/plusplus/fbs/api/event/PlayerSanityEvent.java new file mode 100644 index 0000000..4425ce0 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/api/event/PlayerSanityEvent.java @@ -0,0 +1,32 @@ +package jp.plusplus.fbs.api.event;
+
+import net.minecraftforge.event.entity.player.PlayerEvent;
+import net.minecraft.entity.player.EntityPlayer;
+
+/**
+ * Createdby pluslus_Fon 2015/06/05.
+ *
+ * newChangeLVは機能しないので注意
+ */
+public class PlayerSanityEvent extends PlayerEvent {
+ private int changeSanity, changeLv;
+ private double changeExp;
+
+ public int newChangeSanity, newChangeLv;
+ public double newChangeExp;
+
+ public PlayerSanityEvent(EntityPlayer player, int ds, double de, int dl) {
+ super(player);
+ newChangeSanity=changeSanity=ds;
+ newChangeExp=changeExp=de;
+ newChangeLv=changeLv=dl;
+ }
+
+ public boolean isCancelable() {
+ return true;
+ }
+
+ public int getChangeSanity(){ return changeSanity; }
+ public int getChangeLv(){ return changeLv; }
+ public double getChangeEXP(){ return changeExp; }
+}
diff --git a/src/main/java/jp/plusplus/fbs/api/event/PlayerSanityRollEvent.class b/src/main/java/jp/plusplus/fbs/api/event/PlayerSanityRollEvent.class Binary files differnew file mode 100644 index 0000000..9827f8f --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/api/event/PlayerSanityRollEvent.class diff --git a/src/main/java/jp/plusplus/fbs/api/event/PlayerSanityRollEvent.java b/src/main/java/jp/plusplus/fbs/api/event/PlayerSanityRollEvent.java new file mode 100644 index 0000000..b6bb1b5 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/api/event/PlayerSanityRollEvent.java @@ -0,0 +1,24 @@ +package jp.plusplus.fbs.api.event;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraftforge.event.entity.player.PlayerEvent;
+
+/**
+ * Created by plusplus_F on 2016/03/09.
+ */
+public class PlayerSanityRollEvent extends PlayerEvent {
+ private int trial, max;
+ public int newTrial, newMax;
+
+ public PlayerSanityRollEvent(EntityPlayer player, int trial, int max) {
+ super(player);
+ this.trial=newTrial=trial;
+ this.max=newMax=max;
+ }
+
+ @Override
+ public boolean isCancelable(){ return true; }
+
+ public int getTrial(){ return trial; }
+ public int getMax(){ return max; }
+}
diff --git a/src/main/java/jp/plusplus/fbs/api/event/PlayerUseMagicEvent$Post.class b/src/main/java/jp/plusplus/fbs/api/event/PlayerUseMagicEvent$Post.class Binary files differnew file mode 100644 index 0000000..17e6d0c --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/api/event/PlayerUseMagicEvent$Post.class diff --git a/src/main/java/jp/plusplus/fbs/api/event/PlayerUseMagicEvent$Pre.class b/src/main/java/jp/plusplus/fbs/api/event/PlayerUseMagicEvent$Pre.class Binary files differnew file mode 100644 index 0000000..5fc40c5 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/api/event/PlayerUseMagicEvent$Pre.class diff --git a/src/main/java/jp/plusplus/fbs/api/event/PlayerUseMagicEvent.class b/src/main/java/jp/plusplus/fbs/api/event/PlayerUseMagicEvent.class Binary files differnew file mode 100644 index 0000000..2530d1b --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/api/event/PlayerUseMagicEvent.class diff --git a/src/main/java/jp/plusplus/fbs/api/event/PlayerUseMagicEvent.java b/src/main/java/jp/plusplus/fbs/api/event/PlayerUseMagicEvent.java new file mode 100644 index 0000000..d396dd9 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/api/event/PlayerUseMagicEvent.java @@ -0,0 +1,36 @@ +package jp.plusplus.fbs.api.event;
+
+import jp.plusplus.fbs.api.MagicBase;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.event.entity.player.PlayerEvent;
+
+/**
+ * Created by pluslus_F on 2015/06/18.
+ */
+public class PlayerUseMagicEvent extends PlayerEvent {
+ public MagicBase magic;
+ public ItemStack[] books;
+
+ public PlayerUseMagicEvent(EntityPlayer player, MagicBase mb, ItemStack[] b) {
+ super(player);
+ magic=mb;
+ books=b;
+ }
+
+ @Override
+ public boolean isCancelable(){
+ return true;
+ }
+
+ public static class Pre extends PlayerUseMagicEvent{
+ public Pre(EntityPlayer player, MagicBase mb, ItemStack[] b) {
+ super(player, mb, b);
+ }
+ }
+ public static class Post extends PlayerUseMagicEvent{
+ public Post(EntityPlayer player, MagicBase mb, ItemStack[] b) {
+ super(player, mb, b);
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/api/event/SpiritTalkEvent.class b/src/main/java/jp/plusplus/fbs/api/event/SpiritTalkEvent.class Binary files differnew file mode 100644 index 0000000..a34a0e7 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/api/event/SpiritTalkEvent.class diff --git a/src/main/java/jp/plusplus/fbs/api/event/SpiritTalkEvent.java b/src/main/java/jp/plusplus/fbs/api/event/SpiritTalkEvent.java new file mode 100644 index 0000000..2f00298 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/api/event/SpiritTalkEvent.java @@ -0,0 +1,30 @@ +package jp.plusplus.fbs.api.event;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.event.entity.player.PlayerEvent;
+
+/**
+ * Created by pluslus_F on 2015/06/17.
+ * 精霊武器との会話イベント
+ */
+public class SpiritTalkEvent extends PlayerEvent {
+ private String character;
+ private String event;
+ private Object[] params;
+ public SpiritTalkEvent(EntityPlayer player, String character, String event, Object ... params) {
+ super(player);
+ this.character=character;
+ this.event=event;
+ this.params=params;
+ }
+
+ @Override
+ public boolean isCancelable() {
+ return true;
+ }
+
+ public String getCharacter(){ return character; }
+ public String getEvent(){ return event; }
+ public Object[] getParams(){ return params; }
+}
diff --git a/src/main/java/jp/plusplus/fbs/block/BlockAlchemistTable.class b/src/main/java/jp/plusplus/fbs/block/BlockAlchemistTable.class Binary files differnew file mode 100644 index 0000000..4ab9238 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/BlockAlchemistTable.class diff --git a/src/main/java/jp/plusplus/fbs/block/BlockAlchemistTable.java b/src/main/java/jp/plusplus/fbs/block/BlockAlchemistTable.java new file mode 100644 index 0000000..29ceaa0 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/BlockAlchemistTable.java @@ -0,0 +1,128 @@ +package jp.plusplus.fbs.block;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.AchievementRegistry;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.alchemy.AlchemyRegistry;
+import jp.plusplus.fbs.tileentity.TileEntityForRender;
+import net.minecraft.block.Block;
+import net.minecraft.block.ITileEntityProvider;
+import net.minecraft.block.material.Material;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.MathHelper;
+import net.minecraft.world.IBlockAccess;
+import net.minecraft.world.World;
+
+/**
+ * Created by plusplus_F on 2015/09/20.
+ */
+public class BlockAlchemistTable extends BlockBase implements ITileEntityProvider{
+ public static int[] X_SHIFT=new int[]{-1,1,0,0};
+ public static int[] Z_SHIFT=new int[]{0,0,1,-1};
+ private static boolean breakFlag=false;
+
+ public BlockAlchemistTable() {
+ super(Material.wood);
+ setBlockTextureName("bookshelfTop");
+ setStepSound(Block.soundTypeWood);
+ setHardness(1.0f);
+ setResistance(17.5f);
+ setHarvestLevel("axe", 0);
+ setBlockName("translator");
+ setCreativeTab(FBS.tabAlchemy);
+ }
+
+ @Override
+ public int getRenderType(){
+ return FBS.renderDecorationId;
+ }
+ @Override
+ public boolean renderAsNormalBlock(){
+ return false;
+ }
+
+ @Override
+ public boolean isOpaqueCube() {
+ return false;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public boolean shouldSideBeRendered(IBlockAccess p_149646_1_, int p_149646_2_, int p_149646_3_, int p_149646_4_, int p_149646_5_) {
+ return true;
+ }
+
+
+ @Override
+ public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer player, int par6, float par7, float par8, float par9) {
+ ItemStack itemStack = player.getCurrentEquippedItem();
+ if (itemStack != null && AlchemyRegistry.CanAppraisal(itemStack)) {
+ if (!par1World.isRemote) {
+ ItemStack get = AlchemyRegistry.GetRandomAppraisal(itemStack);
+ player.entityDropItem(get, player.getEyeHeight());
+ player.triggerAchievement(AchievementRegistry.appraisal);
+
+ if(!player.capabilities.isCreativeMode){
+ ItemStack con=itemStack.getItem().getContainerItem(itemStack);
+ if(con!=null) player.entityDropItem(con.copy(), player.getEyeHeight());
+
+ itemStack.stackSize--;
+ if (itemStack.stackSize <= 0) player.setCurrentItemOrArmor(0, null);
+ }
+ player.inventory.markDirty();
+ }
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
+ if((p_149915_2_&8)==0) return new TileEntityForRender();
+ return null;
+ }
+
+ @Override
+ public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack item) {
+ int l = MathHelper.floor_double((double) (entity.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
+ int pSide=2;
+
+ //プレイヤーの向きの決定
+ switch (l){
+ case 0: pSide=2; break;
+ case 1: pSide=5; break;
+ case 2: pSide=3; break;
+ case 3: pSide=4; break;
+ }
+
+ world.setBlockMetadataWithNotify(x,y,z,pSide, 2);
+ world.setBlock(x+X_SHIFT[pSide-2], y, z+Z_SHIFT[pSide-2], this, 8|pSide, 2);
+ }
+
+ @Override
+ public void breakBlock(World par1World, int x, int y, int z, Block block, int par6){
+ int meta=par6;
+
+ if(!breakFlag){
+ breakFlag=true;
+
+ if((meta&8)<2) meta=((meta&8)|2);
+
+ if((meta&8)!=0){
+ meta=(meta&7);
+ par1World.func_147480_a(x-X_SHIFT[meta-2], y, z-Z_SHIFT[meta-2], false);
+ }
+ else{
+ par1World.func_147480_a(x+X_SHIFT[meta-2], y, z+Z_SHIFT[meta-2], false);
+ }
+
+ breakFlag=false;
+ return;
+ }
+
+ super.breakBlock(par1World, x,y,z, block, par6);
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/block/BlockAlchemyCauldron$BlockPos.class b/src/main/java/jp/plusplus/fbs/block/BlockAlchemyCauldron$BlockPos.class Binary files differnew file mode 100644 index 0000000..b72dae8 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/BlockAlchemyCauldron$BlockPos.class diff --git a/src/main/java/jp/plusplus/fbs/block/BlockAlchemyCauldron.class b/src/main/java/jp/plusplus/fbs/block/BlockAlchemyCauldron.class Binary files differnew file mode 100644 index 0000000..97d7c99 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/BlockAlchemyCauldron.class diff --git a/src/main/java/jp/plusplus/fbs/block/BlockAlchemyCauldron.java b/src/main/java/jp/plusplus/fbs/block/BlockAlchemyCauldron.java new file mode 100644 index 0000000..c34b77d --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/BlockAlchemyCauldron.java @@ -0,0 +1,202 @@ +package jp.plusplus.fbs.block;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.tileentity.TileEntityAlchemyCauldron;
+import jp.plusplus.fbs.tileentity.TileEntityExtractingFurnace;
+import net.minecraft.block.Block;
+import net.minecraft.block.ITileEntityProvider;
+import net.minecraft.block.material.Material;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.item.EntityItem;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.MathHelper;
+import net.minecraft.world.IBlockAccess;
+import net.minecraft.world.World;
+
+import java.util.ArrayList;
+
+/**
+ * Created by plusplus_F on 2015/09/24.
+ */
+public class BlockAlchemyCauldron extends BlockBase implements ITileEntityProvider {
+ public static final int X_SHIFT[]={0,1,0,1};
+ public static final int Z_SHIFT[]={0,0,1,1};
+
+ private static boolean breakFlag=false;
+
+ public BlockAlchemyCauldron() {
+ super(Material.rock);
+ setBlockName("alchemyCauldron");
+ setHarvestLevel("pickaxe", 2);
+ setResistance(80.0f);
+ setHardness(3.0f);
+ setStepSound(soundTypeStone);
+ setBlockTextureName("alchemyCauldron");
+ setCreativeTab(FBS.tabAlchemy);
+ }
+
+ public ArrayList<BlockPos> getBlocks(World w, int x, int y, int z){
+ ArrayList<BlockPos> pos=new ArrayList<BlockPos>();
+ for(int i=0;i<4;i++) pos.add(new BlockPos(x+X_SHIFT[i], y, z+Z_SHIFT[i], i));
+ return pos;
+ }
+
+ @Override
+ public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
+ if((p_149915_2_&7)==0) return new TileEntityAlchemyCauldron();
+ return null;
+ }
+
+ @Override
+ public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
+ int meta=par1World.getBlockMetadata(par2, par3, par4)&7;
+
+ if(meta==0){
+ TileEntity e=par1World.getTileEntity(par2, par3, par4);
+ if(!par1World.isRemote && e instanceof TileEntityAlchemyCauldron){
+ par5EntityPlayer.openGui(FBS.instance, -1, par1World, par2, par3, par4);
+ }
+ return true;
+ }
+ else{
+ return par1World.getBlock(par2-X_SHIFT[meta], par3, par4-Z_SHIFT[meta]).onBlockActivated(par1World, par2-X_SHIFT[meta], par3, par4-Z_SHIFT[meta], par5EntityPlayer, par6, par7, par8, par9);
+ }
+ }
+ @Override
+ public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack item) {
+ int l = MathHelper.floor_double((double) (entity.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
+ int pSide=0;
+
+ /*
+ //プレイヤーの向きの決定
+ switch (l){
+ case 0: pSide=2; break;
+ case 1: pSide=5; break;
+ case 2: pSide=3; break;
+ case 3: pSide=4; break;
+ }
+ */
+ pSide=(l==0||l==2)?0:8;
+
+ //ほかのブロックの設置
+ ArrayList<BlockPos> pos=getBlocks(world, x,y,z);
+ for(BlockPos bp : pos){
+ if(bp.getBlock(world)==this) world.setBlockMetadataWithNotify(bp.x, bp.y, bp.z, bp.meta|pSide, 2);
+ else world.setBlock(bp.x, bp.y, bp.z, this, bp.meta|pSide, 2);
+ }
+ }
+
+ @Override
+ public boolean canPlaceBlockAt(World world, int x, int y, int z) {
+ /*
+ int meta=world.getBlockMetadata(x,y,z);
+
+ ArrayList<BlockPos> pos=getBlocks(world, x-X_SHIFT[meta], y, z-Z_SHIFT[meta]);
+ for(BlockPos bp : pos){
+ if(!bp.getBlock(world).isReplaceable(world, bp.x, bp.y, bp.z)) return false;
+ }
+ */
+
+ return true;
+ }
+
+ @Override
+ public void breakBlock(World par1World, int x, int y, int z, Block block, int par6){
+ TileEntity tileentity = par1World.getTileEntity(x, y, z);
+
+ if(!breakFlag){
+ breakFlag=true;
+
+ par6=(par6&7);
+ ArrayList<BlockPos> pos=getBlocks(par1World, x-X_SHIFT[par6], y, z-Z_SHIFT[par6]);
+ for(BlockPos bp : pos){
+ if(bp.getBlock(par1World)==this) par1World.func_147480_a(bp.x, bp.y, bp.z, false);
+ }
+ breakFlag=false;
+ return;
+ }
+
+ if(tileentity==null){
+ super.breakBlock(par1World, x, y, z, block, par6);
+ return;
+ }
+
+ if(tileentity instanceof TileEntityAlchemyCauldron){
+ TileEntityAlchemyCauldron inv=(TileEntityAlchemyCauldron)tileentity;
+ for (ItemStack itemstack : inv.inputMaterial){
+
+ if (itemstack != null){
+ float f = this.rand.nextFloat() * 0.8F + 0.1F;
+ float f1 = this.rand.nextFloat() * 0.8F + 0.1F;
+ float f2 = this.rand.nextFloat() * 0.8F + 0.1F;
+
+ while (itemstack.stackSize > 0){
+ int k1 = this.rand.nextInt(21) + 10;
+
+ if (k1 > itemstack.stackSize){
+ k1 = itemstack.stackSize;
+ }
+
+ itemstack.stackSize -= k1;
+ EntityItem entityitem = new EntityItem(par1World, (double)((float)x + f), (double)((float)y + f1), (double)((float)z + f2), new ItemStack(itemstack.getItem(), k1, itemstack.getItemDamage()));
+
+ if (itemstack.hasTagCompound()){
+ entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy());
+ }
+
+ float f3 = 0.05F;
+ entityitem.motionX = (double)((float)this.rand.nextGaussian() * f3);
+ entityitem.motionY = (double)((float)this.rand.nextGaussian() * f3 + 0.2F);
+ entityitem.motionZ = (double)((float)this.rand.nextGaussian() * f3);
+ par1World.spawnEntityInWorld(entityitem);
+ }
+ }
+ }
+ //par1World.func_96440_m(x, y, z, block);
+ }
+
+ super.breakBlock(par1World, x, y, z, block, par6);
+ }
+
+ @Override
+ public int getRenderType(){
+ return FBS.renderAlchemyCauldronId;
+ }
+ @Override
+ public boolean renderAsNormalBlock(){
+ return false;
+ }
+
+ @Override
+ public boolean isOpaqueCube() {
+ return false;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public boolean shouldSideBeRendered(IBlockAccess p_149646_1_, int p_149646_2_, int p_149646_3_, int p_149646_4_, int p_149646_5_) {
+ return true;
+ }
+
+ public static class BlockPos{
+ public int x,y,z;
+ public int meta;
+ public BlockPos(int x, int y, int z, int meta){
+ this.x=x;
+ this.y=y;
+ this.z=z;
+ this.meta=meta;
+ }
+ public Block getBlock(World w){
+ return w.getBlock(x,y,z);
+ }
+ public TileEntity getTE(World w){
+ return w.getTileEntity(x, y, z);
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/block/BlockBarrier.class b/src/main/java/jp/plusplus/fbs/block/BlockBarrier.class Binary files differnew file mode 100644 index 0000000..1a65aa1 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/BlockBarrier.class diff --git a/src/main/java/jp/plusplus/fbs/block/BlockBarrier.java b/src/main/java/jp/plusplus/fbs/block/BlockBarrier.java new file mode 100644 index 0000000..73f4c2f --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/BlockBarrier.java @@ -0,0 +1,99 @@ +package jp.plusplus.fbs.block;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.alchemy.AlchemyRegistry;
+import net.minecraft.block.Block;
+import net.minecraft.block.BlockGlass;
+import net.minecraft.block.BlockLeaves;
+import net.minecraft.block.BlockLiquid;
+import net.minecraft.block.material.Material;
+import net.minecraft.item.Item;
+import net.minecraft.world.IBlockAccess;
+import net.minecraft.world.World;
+import net.minecraftforge.common.util.ForgeDirection;
+
+import java.util.Random;
+
+/**
+ * Created by plusplus_F on 2015/09/27.
+ */
+public class BlockBarrier extends BlockBase {
+ public BlockBarrier() {
+ super(Material.glass);
+ setBlockName("barrier");
+ setBlockTextureName("barrier");
+ setHardness(5.0f);
+ setResistance(1000.0f);
+ setTickRandomly(true);
+ setStepSound(soundTypeGlass);
+ setCreativeTab(FBS.tabBook);
+ }
+
+ @Override
+ public int tickRate(World w) {
+ return 5;
+ }
+
+ @Override
+ public void updateTick(World w, int x, int y, int z, Random rand) {
+ if (!w.isRemote) {
+ int meta = w.getBlockMetadata(x, y, z)-2;
+
+ if(meta>0) w.setBlockMetadataWithNotify(x, y, z, meta, 2);
+ else w.func_147480_a(x, y, z, false);
+ }
+ }
+
+ @Override
+ public int quantityDropped(int meta, int fortune, Random random) {
+ return 0;
+ }
+
+ @Override
+ public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) {
+ return null;
+ }
+
+ @Override
+ public void onBlockAdded(World p_149726_1_, int p_149726_2_, int p_149726_3_, int p_149726_4_) {
+ int meta = p_149726_1_.getBlockMetadata(p_149726_2_, p_149726_3_, p_149726_4_);
+ if (meta == 0) {
+ meta = AlchemyRegistry.getRandom().nextInt(4);
+ p_149726_1_.setBlockMetadataWithNotify(p_149726_2_, p_149726_3_, p_149726_4_, meta, 2);
+ }
+ }
+
+ public boolean renderAsNormalBlock() {
+ return false;
+ }
+
+ protected boolean canSilkHarvest() {
+ return false;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public boolean shouldSideBeRendered(IBlockAccess p_149646_1_, int p_149646_2_, int p_149646_3_, int p_149646_4_, int p_149646_5_) {
+ /*
+ ForgeDirection dir=ForgeDirection.getOrientation(p_149646_5_);
+ Block b=p_149646_1_.getBlock(p_149646_2_+dir.offsetX, p_149646_3_+dir.offsetY, p_149646_4_+dir.offsetZ);
+
+ if(b==null || b.getMaterial()==Material.air) return true;
+ return b!=this;
+ */
+ return p_149646_1_.getBlock(p_149646_2_, p_149646_3_, p_149646_4_)!=this;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public int getRenderBlockPass()
+ {
+ return 1;
+ }
+
+ public boolean isOpaqueCube()
+ {
+ return false;
+ }
+
+}
diff --git a/src/main/java/jp/plusplus/fbs/block/BlockBase.class b/src/main/java/jp/plusplus/fbs/block/BlockBase.class Binary files differnew file mode 100644 index 0000000..a907758 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/BlockBase.class diff --git a/src/main/java/jp/plusplus/fbs/block/BlockBase.java b/src/main/java/jp/plusplus/fbs/block/BlockBase.java new file mode 100644 index 0000000..33e1a20 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/BlockBase.java @@ -0,0 +1,98 @@ +package jp.plusplus.fbs.block;
+
+import jp.plusplus.fbs.FBS;
+import net.minecraft.block.Block;
+import net.minecraft.block.material.Material;
+import net.minecraft.client.resources.I18n;
+import net.minecraft.entity.item.EntityItem;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.inventory.ISidedInventory;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.StatCollector;
+import net.minecraft.world.World;
+
+import java.util.List;
+import java.util.Random;
+
+/**
+ * Createdby pluslus_Fon 2015/06/13.
+ */
+public class BlockBase extends Block {
+ protected String infoName="";
+ protected int infoRow=0;
+ protected Random rand=new Random();
+
+ public BlockBase(Material mat) {
+ super(mat);
+ setCreativeTab(FBS.tab);
+ }
+
+ public Block setBlockName(String s){
+ super.setBlockName("fbs."+s);
+ return this;
+ }
+ public Block setBlockTextureName(String s){
+ super.setBlockTextureName(FBS.MODID+":"+s);
+ return this;
+ }
+
+ public void addBlockInformation(ItemStack item, EntityPlayer p_77624_2_, List list, boolean flag){
+ if(infoName.length()>0 && FBS.enableDescription){
+ for(int i=0;i<infoRow;i++){
+ list.add(I18n.format("info.fbs."+infoName+"."+i));
+ }
+ }
+ }
+
+ @Override
+ public void breakBlock(World par1World, int x, int y, int z, Block block, int par6){
+ TileEntity tileentity = par1World.getTileEntity(x, y, z);
+
+ if(tileentity==null){
+ super.breakBlock(par1World, x, y, z, block, par6);
+ return;
+ }
+
+ if(tileentity instanceof IInventory){
+ IInventory inv=(IInventory)tileentity;
+
+ for (int j1 = 0; j1 < inv.getSizeInventory(); j1++){
+ ItemStack itemstack = inv.getStackInSlot(j1);
+
+ if (itemstack != null){
+ float f = this.rand.nextFloat() * 0.8F + 0.1F;
+ float f1 = this.rand.nextFloat() * 0.8F + 0.1F;
+ float f2 = this.rand.nextFloat() * 0.8F + 0.1F;
+
+ while (itemstack.stackSize > 0){
+ int k1 = this.rand.nextInt(21) + 10;
+
+ if (k1 > itemstack.stackSize){
+ k1 = itemstack.stackSize;
+ }
+
+ itemstack.stackSize -= k1;
+ EntityItem entityitem = new EntityItem(par1World, (double)((float)x + f), (double)((float)y + f1), (double)((float)z + f2), new ItemStack(itemstack.getItem(), k1, itemstack.getItemDamage()));
+
+ if (itemstack.hasTagCompound()){
+ entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy());
+ }
+
+ float f3 = 0.05F;
+ entityitem.motionX = (double)((float)this.rand.nextGaussian() * f3);
+ entityitem.motionY = (double)((float)this.rand.nextGaussian() * f3 + 0.2F);
+ entityitem.motionZ = (double)((float)this.rand.nextGaussian() * f3);
+ par1World.spawnEntityInWorld(entityitem);
+ }
+ }
+ }
+ //par1World.func_96440_m(x, y, z, block);
+ }
+
+ super.breakBlock(par1World, x, y, z, block, par6);
+ }
+
+}
diff --git a/src/main/java/jp/plusplus/fbs/block/BlockBlock.class b/src/main/java/jp/plusplus/fbs/block/BlockBlock.class Binary files differnew file mode 100644 index 0000000..f62f0c1 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/BlockBlock.class diff --git a/src/main/java/jp/plusplus/fbs/block/BlockBlock.java b/src/main/java/jp/plusplus/fbs/block/BlockBlock.java new file mode 100644 index 0000000..78053ab --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/BlockBlock.java @@ -0,0 +1,59 @@ +package jp.plusplus.fbs.block;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.item.ItemCore;
+import net.minecraft.block.Block;
+import net.minecraft.block.material.Material;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.IIcon;
+import net.minecraft.util.MathHelper;
+import net.minecraft.world.IBlockAccess;
+import net.minecraft.world.World;
+
+import java.util.List;
+import java.util.Random;
+
+/**
+ * Created by pluslus_F on 2015/06/23.
+ */
+public class BlockBlock extends BlockBase {
+ public static String[] NAMES={"Ruby","Sapphire","Amethyst"};
+ public IIcon[] icons;
+
+ public BlockBlock(String name) {
+ super(Material.rock);
+ setHarvestLevel("pickaxe", 2);
+ setBlockName(name);
+ setBlockTextureName(name);
+ }
+
+ @Override
+ public int damageDropped(int par1){
+ return par1;
+ }
+ @Override
+ public void getSubBlocks(Item item, CreativeTabs par2CreativeTabs, List par3List) {
+ for (int i = 0; i < NAMES.length; i++) {
+ par3List.add(new ItemStack(item, 1, i));
+ }
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void registerBlockIcons(IIconRegister iconRegister) {
+ icons=new IIcon[NAMES.length];
+ for(int i=0;i<NAMES.length;i++){
+ icons[i]=iconRegister.registerIcon(getTextureName()+NAMES[i]);
+ }
+ }
+ @Override
+ @SideOnly(Side.CLIENT)
+ public IIcon getIcon(int side, int meta) {
+ return icons[meta];
+ }
+
+}
diff --git a/src/main/java/jp/plusplus/fbs/block/BlockBonfire.class b/src/main/java/jp/plusplus/fbs/block/BlockBonfire.class Binary files differnew file mode 100644 index 0000000..3767ee7 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/BlockBonfire.class diff --git a/src/main/java/jp/plusplus/fbs/block/BlockBonfire.java b/src/main/java/jp/plusplus/fbs/block/BlockBonfire.java new file mode 100644 index 0000000..e5e5074 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/BlockBonfire.java @@ -0,0 +1,241 @@ +package jp.plusplus.fbs.block;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.AchievementRegistry;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.Registry;
+import jp.plusplus.fbs.tileentity.TileEntityForRender;
+import jp.plusplus.fbs.tileentity.TileEntityMagicCore;
+import net.minecraft.block.*;
+import net.minecraft.block.material.Material;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.Blocks;
+import net.minecraft.init.Items;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.AxisAlignedBB;
+import net.minecraft.world.IBlockAccess;
+import net.minecraft.world.World;
+
+import java.util.Random;
+
+import static net.minecraftforge.common.util.ForgeDirection.*;
+import static net.minecraftforge.common.util.ForgeDirection.DOWN;
+import static net.minecraftforge.common.util.ForgeDirection.NORTH;
+
+/**
+ * Created by plusplus_F on 2015/10/19.
+ * 焚き火ブロック
+ */
+public class BlockBonfire extends BlockBase implements ITileEntityProvider {
+ public BlockBonfire() {
+ super(Material.rock);
+ setBlockName("bonfire");
+ setTickRandomly(true);
+ setHardness(0.8f);
+ setResistance(1.5f);
+ setBlockTextureName("planks_oak");
+ }
+
+ @Override
+ public int getLightValue(IBlockAccess world, int x, int y, int z) {
+ return world.getBlockMetadata(x,y,z)>0?15:0;
+ }
+
+ @Override
+ public Block setBlockTextureName(String p_149658_1_) {
+ this.textureName = p_149658_1_;
+ return this;
+ }
+
+ @Override
+ public int getRenderType(){
+ return FBS.renderDecorationId;
+ }
+ @Override
+ public boolean renderAsNormalBlock(){
+ return false;
+ }
+
+ @Override
+ public boolean isOpaqueCube() {
+ return false;
+ }
+
+ @Override
+ public int tickRate(World w) {
+ return 30;
+ }
+
+ @Override
+ public int quantityDropped(int meta, int fortune, Random random) {
+ return 0;
+ }
+
+ @Override
+ public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) {
+ return null;
+ }
+
+ @Override
+ public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) {
+ int meta = world.getBlockMetadata(x, y, z);
+
+ if (meta > 0) {
+ //火がついている場合、GUIひらく
+ player.openGui(FBS.instance, -1, world, x,y,z);
+ return true;
+ } else {
+ //持ち物が火打石と打ち金かどうか判定
+ ItemStack current = player.getCurrentEquippedItem();
+ if (current == null || current.getItem() != Items.flint_and_steel) return false;
+
+ //火をつける
+ meta = 5 + world.rand.nextInt(4);
+ world.setBlockMetadataWithNotify(x, y, z, meta, 2);
+
+ //damage flint
+ if (!player.capabilities.isCreativeMode) current.damageItem(1, player);
+ player.inventory.markDirty();
+ if (!world.isRemote){
+ world.playSoundEffect((double) x + 0.5D, (double) y + 0.5D, (double) z + 0.5D, "fire.ignite", 1.0F, world.rand.nextFloat() * 0.4F + 0.8F);
+ player.triggerAchievement(AchievementRegistry.bonfire);
+ }
+
+ return true;
+ }
+ }
+
+ @Override
+ public void updateTick(World w, int x, int y, int z, Random rand) {
+ if (!w.isRemote) {
+ int meta = w.getBlockMetadata(x, y, z);
+ if (meta == 0) return;
+
+ //雨が降っているとはやく消える
+ if(w.isRaining() && w.getBiomeGenForCoords(x,z).getIntRainfall()>0 && w.getHeightValue(x,z)==y){
+ meta -= 2*(1+rand.nextInt(3));
+ }
+ else{
+ meta -= 1 + rand.nextInt(3);
+ }
+
+ if (meta > 0) w.setBlockMetadataWithNotify(x, y, z, meta, 2);
+ else{
+ w.setBlockMetadataWithNotify(x, y, z, meta, 2);
+ }
+ }
+ }
+
+ @Override
+ public boolean canPlaceBlockAt(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_) {
+ return World.doesBlockHaveSolidTopSurface(p_149742_1_, p_149742_2_, p_149742_3_ - 1, p_149742_4_);
+ }
+
+ @Override
+ public void onNeighborBlockChange(World p_149695_1_, int p_149695_2_, int p_149695_3_, int p_149695_4_, Block p_149695_5_) {
+ if (!World.doesBlockHaveSolidTopSurface(p_149695_1_, p_149695_2_, p_149695_3_ - 1, p_149695_4_)) {
+ p_149695_1_.func_147480_a(p_149695_2_, p_149695_3_, p_149695_4_, false);
+ }
+ }
+
+ @Override
+ public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) {
+ if(!entity.isBurning() && world.getBlockMetadata(x,y,z)>0){
+ entity.setFire(20*5);
+ }
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void randomDisplayTick(World p_149734_1_, int p_149734_2_, int p_149734_3_, int p_149734_4_, Random p_149734_5_) {
+ int meta=p_149734_1_.getBlockMetadata(p_149734_2_, p_149734_3_, p_149734_4_);
+ if(meta==0) return;
+
+ if (p_149734_5_.nextInt(24) == 0) {
+ p_149734_1_.playSound((double) ((float) p_149734_2_ + 0.5F), (double) ((float) p_149734_3_ + 0.5F), (double) ((float) p_149734_4_ + 0.5F), "fire.fire", 1.0F + p_149734_5_.nextFloat(), p_149734_5_.nextFloat() * 0.7F + 0.3F, false);
+ }
+
+ int l;
+ float f;
+ float f1;
+ float f2;
+
+ if(p_149734_5_.nextInt(4)==0) return;
+
+ if (!World.doesBlockHaveSolidTopSurface(p_149734_1_, p_149734_2_, p_149734_3_ - 1, p_149734_4_) && !Blocks.fire.canCatchFire(p_149734_1_, p_149734_2_, p_149734_3_ - 1, p_149734_4_, UP)) {
+ if (Blocks.fire.canCatchFire(p_149734_1_, p_149734_2_ - 1, p_149734_3_, p_149734_4_, EAST)) {
+ for (l = 0; l < 2; ++l) {
+ f = (float) p_149734_2_ + p_149734_5_.nextFloat() * 0.1F;
+ f1 = (float) p_149734_3_ + p_149734_5_.nextFloat();
+ f2 = (float) p_149734_4_ + p_149734_5_.nextFloat();
+ p_149734_1_.spawnParticle("largesmoke", (double) f, (double) f1, (double) f2, 0.0D, 0.0D, 0.0D);
+ }
+ }
+
+ if (Blocks.fire.canCatchFire(p_149734_1_, p_149734_2_ + 1, p_149734_3_, p_149734_4_, WEST)) {
+ for (l = 0; l < 2; ++l) {
+ f = (float) (p_149734_2_ + 1) - p_149734_5_.nextFloat() * 0.1F;
+ f1 = (float) p_149734_3_ + p_149734_5_.nextFloat();
+ f2 = (float) p_149734_4_ + p_149734_5_.nextFloat();
+ p_149734_1_.spawnParticle("largesmoke", (double) f, (double) f1, (double) f2, 0.0D, 0.0D, 0.0D);
+ }
+ }
+
+ if (Blocks.fire.canCatchFire(p_149734_1_, p_149734_2_, p_149734_3_, p_149734_4_ - 1, SOUTH)) {
+ for (l = 0; l < 2; ++l) {
+ f = (float) p_149734_2_ + p_149734_5_.nextFloat();
+ f1 = (float) p_149734_3_ + p_149734_5_.nextFloat();
+ f2 = (float) p_149734_4_ + p_149734_5_.nextFloat() * 0.1F;
+ p_149734_1_.spawnParticle("largesmoke", (double) f, (double) f1, (double) f2, 0.0D, 0.0D, 0.0D);
+ }
+ }
+
+ if (Blocks.fire.canCatchFire(p_149734_1_, p_149734_2_, p_149734_3_, p_149734_4_ + 1, NORTH)) {
+ for (l = 0; l < 2; ++l) {
+ f = (float) p_149734_2_ + p_149734_5_.nextFloat();
+ f1 = (float) p_149734_3_ + p_149734_5_.nextFloat();
+ f2 = (float) (p_149734_4_ + 1) - p_149734_5_.nextFloat() * 0.1F;
+ p_149734_1_.spawnParticle("largesmoke", (double) f, (double) f1, (double) f2, 0.0D, 0.0D, 0.0D);
+ }
+ }
+
+ if (Blocks.fire.canCatchFire(p_149734_1_, p_149734_2_, p_149734_3_ + 1, p_149734_4_, DOWN)) {
+ for (l = 0; l < 2; ++l) {
+ f = (float) p_149734_2_ + p_149734_5_.nextFloat();
+ f1 = (float) (p_149734_3_ + 1) - p_149734_5_.nextFloat() * 0.1F;
+ f2 = (float) p_149734_4_ + p_149734_5_.nextFloat();
+ p_149734_1_.spawnParticle("largesmoke", (double) f, (double) f1, (double) f2, 0.0D, 0.0D, 0.0D);
+ }
+ }
+ } else {
+ for (l = 0; l < 3; ++l) {
+ f = (float) p_149734_2_ + p_149734_5_.nextFloat();
+ f1 = (float) p_149734_3_ + p_149734_5_.nextFloat() * 0.5F + 0.5F;
+ f2 = (float) p_149734_4_ + p_149734_5_.nextFloat();
+ p_149734_1_.spawnParticle("largesmoke", (double) f, (double) f1, (double) f2, 0.0D, 0.0D, 0.0D);
+ }
+ }
+ }
+
+ @Override
+ public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
+ setBlockBounds(0,0,0,1,0.25f,1);
+ }
+ @Override
+ public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
+ return AxisAlignedBB.getBoundingBox(x,y,z,x+1,y+0.25,z+1);
+ }
+
+ @SideOnly(Side.CLIENT)
+ public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int x, int y, int z) {
+ return AxisAlignedBB.getBoundingBox(x,y,z,x+1,y+0.25,z+1);
+ }
+
+ @Override
+ public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
+ return new TileEntityForRender();
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/block/BlockBookshelfDark.class b/src/main/java/jp/plusplus/fbs/block/BlockBookshelfDark.class Binary files differnew file mode 100644 index 0000000..3ad1453 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/BlockBookshelfDark.class diff --git a/src/main/java/jp/plusplus/fbs/block/BlockBookshelfDark.java b/src/main/java/jp/plusplus/fbs/block/BlockBookshelfDark.java new file mode 100644 index 0000000..8a131b3 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/BlockBookshelfDark.java @@ -0,0 +1,136 @@ +package jp.plusplus.fbs.block;
+
+import cpw.mods.fml.client.FMLClientHandler;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.Registry;
+import jp.plusplus.fbs.exprop.FBSEntityProperties;
+import jp.plusplus.fbs.item.ItemMonocle;
+import jp.plusplus.fbs.particle.EntityGlowFX;
+import net.minecraft.block.Block;
+import net.minecraft.block.material.Material;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.Items;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.IIcon;
+import net.minecraft.world.World;
+
+import java.util.Random;
+
+/**
+ * Createdby pluslus_Fon 2015/06/06.
+ */
+public class BlockBookshelfDark extends BlockBase {
+ IIcon iconSide;
+
+ public BlockBookshelfDark() {
+ super(Material.wood);
+ setBlockName("bookshelf");
+ setBlockTextureName("bookshelf");
+ setStepSound(Block.soundTypeWood);
+ setCreativeTab(FBS.tabBook);
+ setHardness(2.0F);
+ setResistance(5.0F);
+ }
+
+ @Override
+ public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) {
+ int meta = world.getBlockMetadata(x, y, z);
+ if (meta == 0) return false;
+
+ ItemStack monocle=ItemMonocle.findMonocle(player);
+ if(monocle==null) return false;
+
+ /*
+ ItemStack helm = player.getCurrentArmor(3);
+ if (helm == null || !(helm.getItem() instanceof ItemMonocle)) return false;
+ */
+
+ if (world.isRemote) return true;
+
+ if(!player.capabilities.isCreativeMode){
+ ItemMonocle.damageMonocle(player, monocle);
+ /*
+ helm.damageItem(1, player);
+ if (helm.stackSize <= 0) {
+ player.setCurrentItemOrArmor(4, null);
+ }
+ */
+ }
+
+ FBSEntityProperties prop = FBSEntityProperties.get(player);
+ if (prop == null) return true;
+
+ ItemStack get = Registry.GetRandomBook(prop.getMagicLevel());
+ if (get != null) {
+ player.entityDropItem(get, player.getEyeHeight());
+ meta--;
+ world.setBlockMetadataWithNotify(x, y, z, meta, 3);
+ player.inventory.markDirty();
+ }
+ return true;
+ }
+
+ @Override
+ public int onBlockPlaced(World world, int x, int y, int z, int side, float p_149660_6_, float p_149660_7_, float p_149660_8_, int meta) {
+ //world.setBlockMetadataWithNotify(x, y, z, 3, 3);
+ return 0;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void registerBlockIcons(IIconRegister p_149651_1_) {
+ blockIcon = p_149651_1_.registerIcon(FBS.MODID + ":bookshelfTop");
+ iconSide = p_149651_1_.registerIcon(FBS.MODID + ":bookshelfSide");
+ }
+
+ @SideOnly(Side.CLIENT)
+ public IIcon getIcon(int side, int meta) {
+ return (side == 1 || side == 0) ? blockIcon : iconSide;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void randomDisplayTick(World world, int x, int y, int z, Random rand) {
+ if (world.getBlockMetadata(x, y, z) == 0) return;
+
+ EntityPlayer ep = FBS.proxy.getEntityPlayerInstance();
+ if (ep == null) return;
+
+ if(ItemMonocle.findMonocle(ep)==null) return;
+
+ /*
+ ItemStack helm = ep.getCurrentArmor(3);
+ if (helm == null || !(helm.getItem() instanceof ItemMonocle)) return;
+ */
+
+ float f = (float) x + 0.5F;
+ float f1 = (float) y + 0.0F + rand.nextFloat() * 6.0F / 16.0F;
+ float f2 = (float) z + 0.5F;
+ float f3 = 0.6F;
+ float f4 = rand.nextFloat() * 0.6F - 0.3F;
+ float f5 =rand.nextFloat()*0.75f;
+ //float f4=0.6f;
+
+ spawnParticle(world, (double) (f - f3), (double) (f1+f5), (double) (f2 + f4));
+ spawnParticle(world, (double) (f + f3), (double) (f1+f5), (double) (f2 + f4));
+ spawnParticle(world, (double) (f + f4), (double) (f1+f5), (double) (f2 - f3));
+ spawnParticle(world, (double) (f + f4), (double) (f1+f5), (double) (f2 + f3));
+ }
+
+ @Override
+ public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_){
+ return Items.book;
+ }
+ @Override
+ public int quantityDropped(int meta, int fortune, Random random){
+ return 3;
+ }
+
+ @SideOnly(Side.CLIENT)
+ protected void spawnParticle(World world, double x, double y, double z){
+ EntityGlowFX e=new EntityGlowFX(world, x,y,z);
+ FMLClientHandler.instance().getClient().effectRenderer.addEffect(e);
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/block/BlockCharm.class b/src/main/java/jp/plusplus/fbs/block/BlockCharm.class Binary files differnew file mode 100644 index 0000000..55ff17f --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/BlockCharm.class diff --git a/src/main/java/jp/plusplus/fbs/block/BlockCharm.java b/src/main/java/jp/plusplus/fbs/block/BlockCharm.java new file mode 100644 index 0000000..16b8f70 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/BlockCharm.java @@ -0,0 +1,93 @@ +package jp.plusplus.fbs.block;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.item.ItemCharm;
+import jp.plusplus.fbs.item.ItemCore;
+import net.minecraft.block.Block;
+import net.minecraft.block.BlockRedstoneWire;
+import net.minecraft.block.material.Material;
+import net.minecraft.init.Blocks;
+import net.minecraft.init.Items;
+import net.minecraft.item.Item;
+import net.minecraft.util.AxisAlignedBB;
+import net.minecraft.world.IBlockAccess;
+import net.minecraft.world.World;
+
+import java.util.Random;
+
+/**
+ * Created by pluslus_F on 2015/06/17.
+ */
+public class BlockCharm extends BlockBase {
+ public BlockCharm() {
+ super(Material.circuits);
+ setBlockName("charm");
+ setBlockTextureName("charm");
+ setCreativeTab(null);
+ this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.0625F, 1.0F);
+ //BlockRedstoneWire
+ }
+
+ @Override
+ public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_) {
+ return null;
+ }
+
+ @Override
+ public boolean isOpaqueCube() {
+ return false;
+ }
+
+ @Override
+ public boolean renderAsNormalBlock() {
+ return false;
+ }
+
+ @Override
+ public int getRenderType() {
+ return FBS.renderCharmId;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public int colorMultiplier(IBlockAccess p_149720_1_, int p_149720_2_, int p_149720_3_, int p_149720_4_) {
+ int meta = p_149720_1_.getBlockMetadata(p_149720_2_, p_149720_3_, p_149720_4_);
+ return ItemCharm.COLOR_VALUE[meta ^ 15];
+ }
+
+ @Override
+ public boolean canPlaceBlockAt(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_) {
+ return p_149742_1_.isBlockNormalCubeDefault(p_149742_2_, p_149742_3_ - 1, p_149742_4_, true);
+ }
+
+ @Override
+ public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) {
+ return ItemCore.charm;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public Item getItem(World p_149694_1_, int p_149694_2_, int p_149694_3_, int p_149694_4_) {
+ return ItemCore.charm;
+ }
+
+ @Override
+ public int damageDropped(int p_149692_1_) {
+ return p_149692_1_ ^ 15;
+ }
+
+ @Override
+ public void onNeighborBlockChange(World p_149695_1_, int p_149695_2_, int p_149695_3_, int p_149695_4_, Block p_149695_5_) {
+ if (!p_149695_1_.isRemote) {
+ boolean flag = this.canPlaceBlockAt(p_149695_1_, p_149695_2_, p_149695_3_, p_149695_4_);
+
+ if (!flag){
+ this.dropBlockAsItem(p_149695_1_, p_149695_2_, p_149695_3_, p_149695_4_, p_149695_1_.getBlockMetadata(p_149695_2_, p_149695_3_, p_149695_4_), 0);
+ p_149695_1_.setBlockToAir(p_149695_2_, p_149695_3_, p_149695_4_);
+ }
+
+ super.onNeighborBlockChange(p_149695_1_, p_149695_2_, p_149695_3_, p_149695_4_, p_149695_5_);
+ }
+ }
+
+}
diff --git a/src/main/java/jp/plusplus/fbs/block/BlockCore.class b/src/main/java/jp/plusplus/fbs/block/BlockCore.class Binary files differnew file mode 100644 index 0000000..eda0f41 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/BlockCore.class diff --git a/src/main/java/jp/plusplus/fbs/block/BlockCore.java b/src/main/java/jp/plusplus/fbs/block/BlockCore.java new file mode 100644 index 0000000..d25da4b --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/BlockCore.java @@ -0,0 +1,145 @@ +package jp.plusplus.fbs.block;
+
+import cpw.mods.fml.common.registry.GameRegistry;
+import jp.plusplus.fbs.item.*;
+import jp.plusplus.fbs.pottery.*;
+import jp.plusplus.fbs.storage.BlockMealCrystal;
+import jp.plusplus.fbs.storage.BlockMealInlet;
+import jp.plusplus.fbs.storage.BlockMealOutletSingle;
+import jp.plusplus.fbs.storage.BlockMealTerminal;
+import net.minecraft.block.Block;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidRegistry;
+
+/**
+ * Createdby pluslus_Fon 2015/06/06.
+ */
+public class BlockCore {
+ public static Fluid mana;
+
+ public static Block ore;
+ public static Block block;
+
+ public static Block cropLavender;
+ public static Block cropRedLily;
+ public static Block harvestableHerb;
+ public static Block harvestableMushroom;
+ public static Block harvestableGrass;
+
+ public static Block fallenLeaves;
+ public static Block leaves;
+ public static Block plank;
+ public static Block bookshelf;
+ public static Block charm;
+ public static Block magicCore;
+
+ public static Block extractingFurnace;
+ public static Block extractingFurnaceActive;
+ public static Block fillingTable;
+ public static Block workbench;
+ public static Block mirror;
+ public static Block pottersWheel;
+ public static Block kiln;
+ public static Block kilnActive;
+ public static Block bonfire;
+
+ public static Block barrier;
+ public static Block portal1;
+ public static Block portal2;
+
+ public static BlockPotteryBase pot;
+ public static BlockPotteryBase jar;
+
+ public static Block tableAlchemist;
+ public static Block alchemyCauldron;
+
+ public static Block schoolTable;
+
+ public static Block mealCrystal;
+ public static Block mealInlet;
+ public static Block mealOutletSingle;
+ public static Block mealOutlet;
+ public static Block mealTerminal;
+
+ public static void Init(){
+ mana=new Fluid("fbs.mana").setUnlocalizedName("fbs.mana").setLuminosity(15);
+ FluidRegistry.registerFluid(mana);
+
+ ore=new BlockOre().setHardness(3.5f).setResistance(5.0f);
+ block=new BlockBlock("block").setHardness(5.0f).setResistance(10.0f);
+ GameRegistry.registerBlock(ore, ItemOre.class,"ore");
+ GameRegistry.registerBlock(block, ItemOre.class, "block");
+
+ cropLavender=new BlockCropLavender();
+ cropRedLily=new BlockCropRedLily();
+ harvestableHerb=new BlockHerb();
+ harvestableMushroom=new BlockMushroom();
+ harvestableGrass=new BlockGrass();
+ GameRegistry.registerBlock(cropLavender, "cropLavender");
+ GameRegistry.registerBlock(cropRedLily, "cropRedLily");
+ GameRegistry.registerBlock(harvestableHerb, ItemBlockMeta.class, "harvestableHerb");
+ GameRegistry.registerBlock(harvestableMushroom, ItemBlockMeta.class, "harvestableMushroom");
+ GameRegistry.registerBlock(harvestableGrass, ItemBlockMeta.class, "harvestableGrass");
+
+ fallenLeaves=new BlockFallenLeaves();
+ leaves=new BlockFBSLeaves();
+ plank =new BlockFBSWood();
+ bookshelf=new BlockBookshelfDark();
+ charm=new BlockCharm();
+ magicCore=new BlockMagicCore();
+ GameRegistry.registerBlock(fallenLeaves, "fallenLeaves");
+ GameRegistry.registerBlock(leaves, ItemBlockMeta.class, "leaves");
+ GameRegistry.registerBlock(plank, "plank");
+ GameRegistry.registerBlock(bookshelf, "bookshelf");
+ GameRegistry.registerBlock(charm, "blockCharm");
+ GameRegistry.registerBlock(magicCore, ItemMagicCore.class, "magicCore");
+
+ extractingFurnace=new BlockExtractingFurnace(false);
+ extractingFurnaceActive=new BlockExtractingFurnace(true).setCreativeTab(null).setLightLevel(1.0f);
+ fillingTable=new BlockFillingTable();
+ workbench=new BlockFBSWorkbench();
+ mirror=new BlockMirror();
+ pottersWheel=new BlockPottersWheel();
+ kiln=new BlockKiln(false);
+ kilnActive=new BlockKiln(true).setCreativeTab(null).setLightLevel(1.0f);
+ bonfire=new BlockBonfire();
+ GameRegistry.registerBlock(extractingFurnace, ItemBlockBase.class, "extractingFurnace");
+ GameRegistry.registerBlock(extractingFurnaceActive, ItemBlockBase.class, "extractingFurnaceActive");
+ GameRegistry.registerBlock(fillingTable, ItemBlockBase.class, "fillingTable");
+ GameRegistry.registerBlock(workbench, ItemBlockBase.class, "workbench");
+ GameRegistry.registerBlock(mirror, ItemBlockBase.class, "mirror");
+ GameRegistry.registerBlock(pottersWheel, ItemBlockBase.class, "pottersWheel");
+ GameRegistry.registerBlock(kiln, ItemBlockBase.class, "kiln");
+ GameRegistry.registerBlock(kilnActive, ItemBlockBase.class, "kilnActive");
+ GameRegistry.registerBlock(bonfire, "bonfire");
+
+ barrier=new BlockBarrier();
+ portal1=new BlockPortalWarp();
+ portal2=new BlockPortalAutumn();
+ GameRegistry.registerBlock(barrier, "barrier");
+ GameRegistry.registerBlock(portal1, "portal1");
+ GameRegistry.registerBlock(portal2, "portal2");
+
+ pot =new BlockPot(350);
+ //jar =new BlockJar(350);
+ GameRegistry.registerBlock(pot, ItemBlockPottery.class, "pot");
+ //GameRegistry.registerBlock(jar, ItemBlockPottery.class, "jar");
+
+ tableAlchemist=new BlockAlchemistTable();
+ alchemyCauldron=new BlockAlchemyCauldron();
+ GameRegistry.registerBlock(tableAlchemist, ItemAlchemyTable.class, "tableAlchemist");
+ GameRegistry.registerBlock(alchemyCauldron, ItemAlchemyCauldron.class, "alchemyCauldron");
+
+ schoolTable=new BlockSchoolTable();
+ GameRegistry.registerBlock(schoolTable, "schoolTable");
+
+ mealCrystal=new BlockMealCrystal();
+ mealInlet=new BlockMealInlet();
+ mealOutletSingle=new BlockMealOutletSingle();
+ mealTerminal=new BlockMealTerminal();
+ GameRegistry.registerBlock(mealCrystal, ItemBlockBase.class, "mealCrystal");
+ GameRegistry.registerBlock(mealInlet, ItemBlockBase.class, "mealInlet");
+ GameRegistry.registerBlock(mealOutletSingle, ItemBlockBase.class, "mealOutletSingle");
+ GameRegistry.registerBlock(mealTerminal, ItemBlockBase.class, "mealTerminal");
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/block/BlockCropLavender.class b/src/main/java/jp/plusplus/fbs/block/BlockCropLavender.class Binary files differnew file mode 100644 index 0000000..bd44033 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/BlockCropLavender.class diff --git a/src/main/java/jp/plusplus/fbs/block/BlockCropLavender.java b/src/main/java/jp/plusplus/fbs/block/BlockCropLavender.java new file mode 100644 index 0000000..62f9f84 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/BlockCropLavender.java @@ -0,0 +1,51 @@ +package jp.plusplus.fbs.block;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.item.ItemCore;
+import net.minecraft.block.BlockCrops;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.init.Items;
+import net.minecraft.item.Item;
+import net.minecraft.util.IIcon;
+
+/**
+ * Createdby pluslus_Fon 2015/06/13.
+ */
+public class BlockCropLavender extends BlockCrops {
+ private IIcon[] icons = new IIcon[6];
+
+ public BlockCropLavender() {
+ setBlockName("fbs.lavender");
+ setBlockTextureName(FBS.MODID + ":lavender");
+ }
+
+ protected Item func_149866_i()
+ {
+ return ItemCore.seedLavender;
+ }
+
+ protected Item func_149865_P()
+ {
+ return ItemCore.lavender;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void registerBlockIcons(IIconRegister p_149651_1_) {
+ for (int i = 0; i < icons.length; ++i) {
+ icons[i] = p_149651_1_.registerIcon(this.getTextureName() + "_stage_" + i);
+ }
+ }
+
+ @SideOnly(Side.CLIENT)
+ public IIcon getIcon(int p_149691_1_, int p_149691_2_) {
+ if (p_149691_2_ < 0 || p_149691_2_ > 7) {
+ p_149691_2_ = 7;
+ }
+
+ int i = 5 * p_149691_2_ / 7;
+ if (i > 5) i = 5;
+ return icons[i];
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/block/BlockCropRedLily.class b/src/main/java/jp/plusplus/fbs/block/BlockCropRedLily.class Binary files differnew file mode 100644 index 0000000..e356522 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/BlockCropRedLily.class diff --git a/src/main/java/jp/plusplus/fbs/block/BlockCropRedLily.java b/src/main/java/jp/plusplus/fbs/block/BlockCropRedLily.java new file mode 100644 index 0000000..a7fb1d4 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/BlockCropRedLily.java @@ -0,0 +1,103 @@ +package jp.plusplus.fbs.block;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.Registry;
+import jp.plusplus.fbs.item.ItemCore;
+import net.minecraft.block.Block;
+import net.minecraft.block.BlockBush;
+import net.minecraft.block.BlockCrops;
+import net.minecraft.block.material.Material;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.init.Blocks;
+import net.minecraft.init.Items;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.IIcon;
+import net.minecraft.world.IBlockAccess;
+import net.minecraft.world.World;
+import net.minecraft.world.biome.BiomeGenBase;
+import net.minecraftforge.common.EnumPlantType;
+import net.minecraftforge.common.IPlantable;
+import net.minecraftforge.common.util.ForgeDirection;
+
+import java.util.ArrayList;
+
+import static net.minecraftforge.common.util.ForgeDirection.UP;
+
+/**
+ * Createdby pluslus_Fon 2015/088/13.
+ */
+public class BlockCropRedLily extends BlockCrops {
+ private IIcon[] icons = new IIcon[4];
+
+ public BlockCropRedLily() {
+ setBlockName("fbs.redLily");
+ setBlockTextureName(FBS.MODID + ":redLily");
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void registerBlockIcons(IIconRegister p_149651_1_) {
+ for (int i = 0; i < icons.length; ++i) {
+ icons[i] = p_149651_1_.registerIcon(this.getTextureName() + "_stage_" + i);
+ }
+ }
+
+ @SideOnly(Side.CLIENT)
+ public IIcon getIcon(int side, int meta) {
+ if (meta < 0 || meta > 7) {
+ meta = 7;
+ }
+
+ if(meta==7) return icons[3];
+
+ int i = 3 * meta / 7;
+ if (i > 2) i = 2;
+ return icons[i];
+ }
+
+ protected boolean canPlaceBlockOn(Block p_149854_1_) {
+ return p_149854_1_ == Blocks.grass || p_149854_1_ == Blocks.dirt || p_149854_1_ == Blocks.farmland || p_149854_1_ == BlockCore.fallenLeaves;
+ }
+
+
+ @Override
+ public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
+ //ArrayList<ItemStack> ret = super.getDrops(world, x, y, z, metadata, fortune);
+ ArrayList<ItemStack> ret=new ArrayList<ItemStack>();
+ Item drop=null;
+
+ if(metadata<7){
+ //ヒガンバナの種のドロップ
+ drop=ItemCore.seedRedLily;
+ }
+ else{
+ //ヒガンバナのドロップ
+ BiomeGenBase bgb= world.getBiomeGenForCoords(x,z);
+ if(bgb== Registry.biomeAutumn){
+ drop=ItemCore.redLilyDirty;
+ }
+ else{
+ drop=ItemCore.redLily;
+ }
+ }
+
+ ret.add(new ItemStack(drop));
+ return ret;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public Item getItem(World p_149694_1_, int p_149694_2_, int p_149694_3_, int p_149694_4_) {
+ return ItemCore.seedRedLily;
+ }
+ protected Item func_149866_i()
+ {
+ return ItemCore.seedRedLily;
+ }
+
+ protected Item func_149865_P()
+ {
+ return ItemCore.redLily;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/block/BlockExtractingFurnace.class b/src/main/java/jp/plusplus/fbs/block/BlockExtractingFurnace.class Binary files differnew file mode 100644 index 0000000..e35dc6b --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/BlockExtractingFurnace.class diff --git a/src/main/java/jp/plusplus/fbs/block/BlockExtractingFurnace.java b/src/main/java/jp/plusplus/fbs/block/BlockExtractingFurnace.java new file mode 100644 index 0000000..67303d6 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/BlockExtractingFurnace.java @@ -0,0 +1,225 @@ +package jp.plusplus.fbs.block;
+
+import cpw.mods.fml.client.FMLClientHandler;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.particle.EntityGlowFX;
+import jp.plusplus.fbs.tileentity.TileEntityExtractingFurnace;
+import net.minecraft.block.*;
+import net.minecraft.block.material.Material;
+import net.minecraft.client.particle.EffectRenderer;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.item.EntityItem;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.Blocks;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.inventory.ISidedInventory;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.tileentity.TileEntityFurnace;
+import net.minecraft.util.AxisAlignedBB;
+import net.minecraft.util.IIcon;
+import net.minecraft.util.MathHelper;
+import net.minecraft.world.IBlockAccess;
+import net.minecraft.world.World;
+import net.minecraftforge.common.util.ForgeDirection;
+
+import java.util.List;
+import java.util.Random;
+
+/**
+ * Createdby pluslus_Fon 2015/06/08.
+ */
+public class BlockExtractingFurnace extends BlockBase implements ITileEntityProvider{
+ private IIcon iconFTop;
+ private IIcon iconFBottom;
+ private IIcon iconFSide;
+ private boolean isActive;
+ private static boolean dontDrop;
+
+ public BlockExtractingFurnace(boolean flag) {
+ super(Material.rock);
+ isActive=flag;
+ setBlockName("extractingFurnace");
+ setBlockTextureName("extractingFurnaceFront" + (isActive ? "On" : "Off"));
+ setHardness(3.5F);
+ setStepSound(soundTypePiston);
+ infoName="extractingFurnace";
+ infoRow=1;
+ }
+
+ @Override
+ public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
+ return new TileEntityExtractingFurnace();
+ }
+ @Override
+ public boolean canPlaceTorchOnTop(World par1World, int par2, int par3, int par4){
+ return false;
+ }
+
+ @Override
+ public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
+ TileEntity e=par1World.getTileEntity(par2, par3, par4);
+ if(!par1World.isRemote && e instanceof TileEntityExtractingFurnace){
+ par5EntityPlayer.openGui(FBS.instance, -1, par1World, par2, par3, par4);
+ }
+ return true;
+ }
+ public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack item) {
+ int l = MathHelper.floor_double((double) (entity.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
+
+ if (l == 0) {
+ world.setBlockMetadataWithNotify(x, y, z, 2, 2);
+ }
+
+ if (l == 1) {
+ world.setBlockMetadataWithNotify(x, y, z, 5, 2);
+ }
+
+ if (l == 2) {
+ world.setBlockMetadataWithNotify(x, y, z, 3, 2);
+ }
+
+ if (l == 3) {
+ world.setBlockMetadataWithNotify(x, y, z, 4, 2);
+ }
+ }
+
+ @Override
+ public void breakBlock(World world, int x, int y, int z, Block block, int par6) {
+ if (!dontDrop) {
+ TileEntity tileentity = world.getTileEntity(x, y, z);
+
+ if(tileentity==null){
+ super.breakBlock(world, x, y, z, block, par6);
+ return;
+ }
+
+ if(tileentity instanceof IInventory){
+ IInventory inv=(IInventory)tileentity;
+
+ for (int j1 = 0; j1 < inv.getSizeInventory(); j1++){
+ ItemStack itemstack = inv.getStackInSlot(j1);
+
+ if (itemstack != null){
+ float f = this.rand.nextFloat() * 0.8F + 0.1F;
+ float f1 = this.rand.nextFloat() * 0.8F + 0.1F;
+ float f2 = this.rand.nextFloat() * 0.8F + 0.1F;
+
+ while (itemstack.stackSize > 0){
+ int k1 = this.rand.nextInt(21) + 10;
+
+ if (k1 > itemstack.stackSize){
+ k1 = itemstack.stackSize;
+ }
+
+ itemstack.stackSize -= k1;
+ EntityItem entityitem = new EntityItem(world, (double)((float)x + f), (double)((float)y + f1), (double)((float)z + f2), new ItemStack(itemstack.getItem(), k1, itemstack.getItemDamage()));
+
+ if (itemstack.hasTagCompound()){
+ entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy());
+ }
+
+ float f3 = 0.05F;
+ entityitem.motionX = (double)((float)this.rand.nextGaussian() * f3);
+ entityitem.motionY = (double)((float)this.rand.nextGaussian() * f3 + 0.2F);
+ entityitem.motionZ = (double)((float)this.rand.nextGaussian() * f3);
+ world.spawnEntityInWorld(entityitem);
+ }
+ }
+ }
+ //par1World.func_96440_m(x, y, z, block);
+ }
+ }
+
+ if (hasTileEntity(par6)){
+ world.removeTileEntity(x,y,z);
+ }
+ }
+
+ public static void updateFurnaceBlockState(boolean s, World world, int x, int y, int z) {
+ int l = world.getBlockMetadata(x, y, z);
+ TileEntity tileentity = world.getTileEntity(x, y, z);
+ dontDrop = true;
+
+ if (s) {
+ world.setBlock(x, y, z, BlockCore.extractingFurnaceActive);
+ } else {
+ world.setBlock(x, y, z, BlockCore.extractingFurnace);
+ }
+
+ dontDrop = false;
+ world.setBlockMetadataWithNotify(x, y, z, l, 2);
+
+ if (tileentity != null) {
+ tileentity.validate();
+ world.setTileEntity(x, y, z, tileentity);
+ }
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void randomDisplayTick(World world, int x, int y, int z, Random p_149734_5_) {
+ if (isActive) {
+ int l = world.getBlockMetadata(x, y, z);
+ float f = (float) x + 0.5F;
+ float f1 = (float) y + 0.0F + p_149734_5_.nextFloat() * 6.0F / 16.0F;
+ float f2 = (float) z + 0.5F;
+ float f3 = 0.52F;
+ float f4 = p_149734_5_.nextFloat() * 0.6F - 0.3F;
+
+
+ EffectRenderer er= FMLClientHandler.instance().getClient().effectRenderer;
+ if (l == 4) {
+ world.spawnParticle("smoke", (double) (f - f3), (double) f1, (double) (f2 + f4), 0.0D, 0.0D, 0.0D);
+ er.addEffect(new EntityGlowFX(world, (double) (f - f3), (double) f1, (double) (f2 + f4)));
+ } else if (l == 5) {
+ world.spawnParticle("smoke", (double) (f + f3), (double) f1, (double) (f2 + f4), 0.0D, 0.0D, 0.0D);
+ er.addEffect(new EntityGlowFX(world, (double) (f + f3), (double) f1, (double) (f2 + f4)));
+ } else if (l == 2) {
+ world.spawnParticle("smoke", (double) (f + f4), (double) f1, (double) (f2 - f3), 0.0D, 0.0D, 0.0D);
+ er.addEffect(new EntityGlowFX(world, (double) (f + f4), (double) f1, (double) (f2 - f3)));
+ } else if (l == 3) {
+ world.spawnParticle("smoke", (double) (f + f4), (double) f1, (double) (f2 + f3), 0.0D, 0.0D, 0.0D);
+ er.addEffect(new EntityGlowFX(world, (double) (f + f4), (double) f1, (double) (f2 + f3)));
+ }
+ }
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void registerBlockIcons(IIconRegister p_149651_1_) {
+ super.registerBlockIcons(p_149651_1_);
+ iconFTop = p_149651_1_.registerIcon("furnace_top");
+ iconFBottom = p_149651_1_.registerIcon("furnace_top");
+ iconFSide = p_149651_1_.registerIcon(FBS.MODID+":fillingTableSide");
+ }
+ @Override
+ public IIcon getIcon(int side, int meta){
+ if(side==0) return iconFBottom;
+ if(side==1) return iconFTop;
+ if(side==meta) return blockIcon;
+ return iconFSide;
+ }
+
+ @Override
+ public int getRenderType(){
+ return FBS.renderDirectionalId;
+ }
+ @Override
+ public boolean renderAsNormalBlock(){
+ return false;
+ }
+
+ public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_){
+ return Item.getItemFromBlock(BlockCore.extractingFurnace);
+ }
+
+ @SideOnly(Side.CLIENT)
+ public Item getItem(World p_149694_1_, int p_149694_2_, int p_149694_3_, int p_149694_4_) {
+ return Item.getItemFromBlock(BlockCore.extractingFurnace);
+ }
+}
\ No newline at end of file diff --git a/src/main/java/jp/plusplus/fbs/block/BlockFBSLeaves.class b/src/main/java/jp/plusplus/fbs/block/BlockFBSLeaves.class Binary files differnew file mode 100644 index 0000000..514be08 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/BlockFBSLeaves.class diff --git a/src/main/java/jp/plusplus/fbs/block/BlockFBSLeaves.java b/src/main/java/jp/plusplus/fbs/block/BlockFBSLeaves.java new file mode 100644 index 0000000..2fc5378 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/BlockFBSLeaves.java @@ -0,0 +1,121 @@ +package jp.plusplus.fbs.block;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.FBS;
+import net.minecraft.block.Block;
+import net.minecraft.block.BlockLeaves;
+import net.minecraft.block.BlockNewLeaf;
+import net.minecraft.block.BlockOldLeaf;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.init.Items;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.IIcon;
+import net.minecraft.world.ColorizerFoliage;
+import net.minecraft.world.IBlockAccess;
+import net.minecraft.world.World;
+
+import java.util.List;
+
+/**
+ * Created by plusplus_F on 2015/08/20.
+ */
+public class BlockFBSLeaves extends BlockLeaves {
+ public static final String[][] field_150130_N = new String[][]{{"leaves_oak", "leaves_birch"}, {"leaves_oak_opaque", "leaves_birch_opaque"}};
+ public static final String[] field_150131_O = new String[]{"oak", "birch"};
+
+ public BlockFBSLeaves() {
+ setBlockName("leaves");
+ setBlockTextureName("leaves");
+ setCreativeTab(FBS.tab);
+ }
+
+ /**
+ * Returns the color this block should be rendered. Used by leaves.
+ */
+ @SideOnly(Side.CLIENT)
+ public int getRenderColor(int meta) {
+ meta = (meta & 3);
+
+ if (meta == 0) return 0xff0000;
+ else return 0xffff00;
+ //return (meta & 3) == 1 ? ColorizerFoliage.getFoliageColorPine() : ((meta & 3) == 2 ? ColorizerFoliage.getFoliageColorBirch() : super.getRenderColor(meta));
+ }
+
+ /**
+ * Returns a integer with hex for 0xrrggbb with this color multiplied against the blocks color. Note only called
+ * when first determining what to render.
+ */
+ @SideOnly(Side.CLIENT)
+ public int colorMultiplier(IBlockAccess w, int x, int y, int z) {
+ int meta = (w.getBlockMetadata(x, y, z) & 3);
+
+ if (meta == 0) return 0xff0000;
+ else return 0xffff00;
+ //return (meta & 3) == 1 ? ColorizerFoliage.getFoliageColorPine() : ((meta & 3) == 2 ? ColorizerFoliage.getFoliageColorBirch() : super.colorMultiplier(w, x, y, z));
+ }
+
+ protected void func_150124_c(World p_150124_1_, int p_150124_2_, int p_150124_3_, int p_150124_4_, int p_150124_5_, int p_150124_6_) {
+ if ((p_150124_5_ & 3) == 0 && p_150124_1_.rand.nextInt(p_150124_6_) == 0) {
+ this.dropBlockAsItem(p_150124_1_, p_150124_2_, p_150124_3_, p_150124_4_, new ItemStack(Items.apple, 1, 0));
+ }
+ }
+
+ public int damageDropped(int p_149692_1_) {
+ return (p_149692_1_&3)==0?0:2;
+ }
+ /*
+ protected int func_150123_b(int p_150123_1_) {
+ int j = super.func_150123_b(p_150123_1_);
+
+ if ((p_150123_1_ & 3) == 3) {
+ j = 40;
+ }
+
+ return j;
+ }
+ */
+
+ /**
+ * Gets the block's texture. Args: side, meta
+ */
+ @SideOnly(Side.CLIENT)
+ public IIcon getIcon(int side, int meta) {
+ meta = (meta & 3);
+ if (meta >= field_150129_M.length) meta = 0;
+ return field_150129_M[field_150127_b][meta];
+ //return (meta & 3) == 1 ? this.field_150129_M[this.field_150127_b][1] : ((meta & 3) == 3 ? this.field_150129_M[this.field_150127_b][3] : ((meta & 3) == 2 ? this.field_150129_M[this.field_150127_b][2] : this.field_150129_M[this.field_150127_b][0]));
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void getSubBlocks(Item p_149666_1_, CreativeTabs p_149666_2_, List p_149666_3_) {
+ for (int i = 0; i < field_150131_O.length; i++) p_149666_3_.add(new ItemStack(p_149666_1_, 1, i));
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void registerBlockIcons(IIconRegister p_149651_1_) {
+ for (int i = 0; i < field_150130_N.length; ++i) {
+ this.field_150129_M[i] = new IIcon[field_150130_N[i].length];
+
+ for (int j = 0; j < field_150130_N[i].length; ++j) {
+ this.field_150129_M[i][j] = p_149651_1_.registerIcon(field_150130_N[i][j]);
+ }
+ }
+ }
+
+ public String[] func_150125_e() {
+ return field_150131_O;
+ }
+
+ public boolean isOpaqueCube()
+ {
+ return false;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public boolean shouldSideBeRendered(IBlockAccess p_149646_1_, int p_149646_2_, int p_149646_3_, int p_149646_4_, int p_149646_5_) {
+ return true;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/block/BlockFBSWood.class b/src/main/java/jp/plusplus/fbs/block/BlockFBSWood.class Binary files differnew file mode 100644 index 0000000..c7262b7 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/BlockFBSWood.class diff --git a/src/main/java/jp/plusplus/fbs/block/BlockFBSWood.java b/src/main/java/jp/plusplus/fbs/block/BlockFBSWood.java new file mode 100644 index 0000000..460c4d6 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/BlockFBSWood.java @@ -0,0 +1,19 @@ +package jp.plusplus.fbs.block;
+
+import jp.plusplus.fbs.FBS;
+import net.minecraft.block.Block;
+import net.minecraft.block.material.Material;
+
+/**
+ * Createdby pluslus_Fon 2015/06/06.
+ */
+public class BlockFBSWood extends BlockBase {
+ public BlockFBSWood() {
+ super(Material.wood);
+ setBlockName("plank");
+ setBlockTextureName("bookshelfTop");
+ setStepSound(Block.soundTypeWood);
+ setHardness(2.0F);
+ setResistance(5.0F);
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/block/BlockFBSWorkbench.class b/src/main/java/jp/plusplus/fbs/block/BlockFBSWorkbench.class Binary files differnew file mode 100644 index 0000000..49aca75 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/BlockFBSWorkbench.class diff --git a/src/main/java/jp/plusplus/fbs/block/BlockFBSWorkbench.java b/src/main/java/jp/plusplus/fbs/block/BlockFBSWorkbench.java new file mode 100644 index 0000000..65ab0d5 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/BlockFBSWorkbench.java @@ -0,0 +1,134 @@ +package jp.plusplus.fbs.block;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.tileentity.TileEntityExtractingFurnace;
+import jp.plusplus.fbs.tileentity.TileEntityFBSWorkbench;
+import net.minecraft.block.Block;
+import net.minecraft.block.ITileEntityProvider;
+import net.minecraft.block.material.Material;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.item.EntityItem;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.IIcon;
+import net.minecraft.util.MathHelper;
+import net.minecraft.world.World;
+
+/**
+ * Createdby pluslus_Fon 2015/06/14.
+ */
+public class BlockFBSWorkbench extends BlockBase implements ITileEntityProvider {
+ private IIcon iconFTop;
+ private IIcon iconFBottom;
+
+ public BlockFBSWorkbench() {
+ super(Material.rock);
+ setBlockName("workbench");
+ setBlockTextureName("workbench");
+ setHardness(3.5F);
+ setStepSound(soundTypeWood);
+ infoName = "workbench";
+ infoRow = 1;
+ }
+
+ @Override
+ public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
+ return new TileEntityFBSWorkbench();
+ }
+
+ @Override
+ public boolean canPlaceTorchOnTop(World par1World, int par2, int par3, int par4) {
+ return false;
+ }
+
+ @Override
+ public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
+ TileEntity e = par1World.getTileEntity(par2, par3, par4);
+ if (!par1World.isRemote) {
+ par5EntityPlayer.openGui(FBS.instance, -1, par1World, par2, par3, par4);
+ }
+ return true;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void registerBlockIcons(IIconRegister p_149651_1_) {
+ blockIcon = p_149651_1_.registerIcon(FBS.MODID + ":workbenchSide");
+ iconFTop = p_149651_1_.registerIcon(FBS.MODID + ":workbenchTop");
+ iconFBottom = p_149651_1_.registerIcon(FBS.MODID + ":bookshelfTop");
+ }
+
+ @Override
+ public IIcon getIcon(int side, int meta) {
+ if (side == 0) return iconFBottom;
+ if (side == 1) return iconFTop;
+ return blockIcon;
+ }
+
+ @Override
+ public int getRenderType() {
+ return FBS.renderDirectionalId;
+ }
+
+ @Override
+ public boolean renderAsNormalBlock() {
+ return false;
+ }
+
+ @Override
+ public void breakBlock(World world, int x, int y, int z, Block block, int par6) {
+ TileEntity tileentity = world.getTileEntity(x, y, z);
+
+ if (tileentity == null) {
+ super.breakBlock(world, x, y, z, block, par6);
+ return;
+ }
+
+ if (tileentity instanceof IInventory) {
+ IInventory inv = (IInventory) tileentity;
+
+ for (int j1 = 0; j1 < inv.getSizeInventory(); j1++) {
+ if(j1==9) continue;
+
+ ItemStack itemstack = inv.getStackInSlot(j1);
+
+ if (itemstack != null) {
+ float f = this.rand.nextFloat() * 0.8F + 0.1F;
+ float f1 = this.rand.nextFloat() * 0.8F + 0.1F;
+ float f2 = this.rand.nextFloat() * 0.8F + 0.1F;
+
+ while (itemstack.stackSize > 0) {
+ int k1 = this.rand.nextInt(21) + 10;
+
+ if (k1 > itemstack.stackSize) {
+ k1 = itemstack.stackSize;
+ }
+
+ itemstack.stackSize -= k1;
+ EntityItem entityitem = new EntityItem(world, (double) ((float) x + f), (double) ((float) y + f1), (double) ((float) z + f2), new ItemStack(itemstack.getItem(), k1, itemstack.getItemDamage()));
+
+ if (itemstack.hasTagCompound()) {
+ entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy());
+ }
+
+ float f3 = 0.05F;
+ entityitem.motionX = (double) ((float) this.rand.nextGaussian() * f3);
+ entityitem.motionY = (double) ((float) this.rand.nextGaussian() * f3 + 0.2F);
+ entityitem.motionZ = (double) ((float) this.rand.nextGaussian() * f3);
+ world.spawnEntityInWorld(entityitem);
+ }
+ }
+ }
+ //par1World.func_96440_m(x, y, z, block);
+ }
+
+ if (hasTileEntity(par6)){
+ world.removeTileEntity(x, y, z);
+ }
+ }
+}
\ No newline at end of file diff --git a/src/main/java/jp/plusplus/fbs/block/BlockFallenLeaves.class b/src/main/java/jp/plusplus/fbs/block/BlockFallenLeaves.class Binary files differnew file mode 100644 index 0000000..75add4f --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/BlockFallenLeaves.class diff --git a/src/main/java/jp/plusplus/fbs/block/BlockFallenLeaves.java b/src/main/java/jp/plusplus/fbs/block/BlockFallenLeaves.java new file mode 100644 index 0000000..56c6ff7 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/BlockFallenLeaves.java @@ -0,0 +1,57 @@ +package jp.plusplus.fbs.block;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import net.minecraft.block.Block;
+import net.minecraft.block.material.Material;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.Item;
+import net.minecraft.util.IIcon;
+import net.minecraft.world.IBlockAccess;
+import net.minecraft.world.World;
+import net.minecraftforge.common.EnumPlantType;
+import net.minecraftforge.common.IPlantable;
+import net.minecraftforge.common.util.ForgeDirection;
+
+import java.util.Random;
+
+/**
+ * Created by plusplus_F on 2015/08/24.
+ * 落ち葉
+ */
+public class BlockFallenLeaves extends BlockBase {
+ IIcon icon;
+
+ public BlockFallenLeaves() {
+ super(Material.ground);
+ setBlockTextureName("fallenLeaves");
+ setBlockName("fallenLeaves");
+ setHardness(0.2F);
+ setLightOpacity(1);
+ setStepSound(Block.soundTypeGrass);
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void registerBlockIcons(IIconRegister register) {
+ blockIcon = register.registerIcon(getTextureName()+"Top");
+ icon=register.registerIcon(getTextureName()+"Side");
+ }
+
+ @SideOnly(Side.CLIENT)
+ public IIcon getIcon(int side, int meta) {
+ if(side==0) return Blocks.dirt.getIcon(0,0);
+ if(side==1) return blockIcon;
+ return icon;
+ }
+
+ @Override
+ public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) {
+ return Item.getItemFromBlock(Blocks.dirt);
+ }
+
+ @Override
+ public boolean canSustainPlant(IBlockAccess world, int x, int y, int z, ForgeDirection direction, IPlantable plantable) {
+ return plantable.getPlantType(world, x,y+1,z)== EnumPlantType.Plains;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/block/BlockFillingTable.class b/src/main/java/jp/plusplus/fbs/block/BlockFillingTable.class Binary files differnew file mode 100644 index 0000000..70a09a0 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/BlockFillingTable.class diff --git a/src/main/java/jp/plusplus/fbs/block/BlockFillingTable.java b/src/main/java/jp/plusplus/fbs/block/BlockFillingTable.java new file mode 100644 index 0000000..f311022 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/BlockFillingTable.java @@ -0,0 +1,105 @@ +package jp.plusplus.fbs.block;
+
+import cpw.mods.fml.client.FMLClientHandler;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.item.ItemMonocle;
+import jp.plusplus.fbs.particle.EntityGlowFX;
+import jp.plusplus.fbs.tileentity.TileEntityExtractingFurnace;
+import jp.plusplus.fbs.tileentity.TileEntityFillingTable;
+import net.minecraft.block.ITileEntityProvider;
+import net.minecraft.block.material.Material;
+import net.minecraft.client.particle.EffectRenderer;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.IIcon;
+import net.minecraft.world.World;
+
+import java.util.Random;
+
+/**
+ * Createdby pluslus_Fon 2015/06/14.
+ */
+public class BlockFillingTable extends BlockBase implements ITileEntityProvider {
+ private IIcon iconFTop;
+ private IIcon iconFBottom;
+
+ public BlockFillingTable() {
+ super(Material.rock);
+ setBlockName("fillingTable");
+ setBlockTextureName("fillingTable");
+ setHardness(3.5F);
+ setStepSound(soundTypePiston);
+ setCreativeTab(FBS.tabBook);
+ infoName="fillingTable";
+ infoRow=3;
+ }
+
+ @Override
+ public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
+ return new TileEntityFillingTable();
+ }
+ @Override
+ public boolean canPlaceTorchOnTop(World par1World, int par2, int par3, int par4){
+ return false;
+ }
+
+ @Override
+ public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
+ TileEntity e=par1World.getTileEntity(par2, par3, par4);
+ if(!par1World.isRemote && e instanceof TileEntityFillingTable){
+ par5EntityPlayer.openGui(FBS.instance, -1, par1World, par2, par3, par4);
+ }
+ return true;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void randomDisplayTick(World world, int x, int y, int z, Random rand) {
+ TileEntity te=world.getTileEntity(x,y,z);
+ if (!(te instanceof TileEntityFillingTable) || ((TileEntityFillingTable)te).progress==0) return;
+
+ EntityPlayer ep = FBS.proxy.getEntityPlayerInstance();
+ if (ep == null) return;
+ ItemStack helm = ep.getCurrentArmor(3);
+ if (helm == null || !(helm.getItem() instanceof ItemMonocle)) return;
+
+ float f = (float) x + 0.5F;
+ float f1 = (float) y + 0.0F + rand.nextFloat() * 6.0F / 16.0F;
+ float f2 = (float) z + 0.5F;
+ float f3 = 0.6F;
+ float f4 = rand.nextFloat() * 0.6F - 0.3F;
+ float f5 =rand.nextFloat()*0.75f;
+ //float f4=0.6f;
+
+ EffectRenderer er=FMLClientHandler.instance().getClient().effectRenderer;
+ er.addEffect(new EntityGlowFX(world, (double) (f - f3), (double) (f1+f5), (double) (f2 + f4)));
+ er.addEffect(new EntityGlowFX(world, (double) (f + f3), (double) (f1+f5), (double) (f2 + f4)));
+ er.addEffect(new EntityGlowFX(world, (double) (f + f4), (double) (f1+f5), (double) (f2 - f3)));
+ er.addEffect(new EntityGlowFX(world, (double) (f + f4), (double) (f1+f5), (double) (f2 + f3)));
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void registerBlockIcons(IIconRegister p_149651_1_) {
+ blockIcon = p_149651_1_.registerIcon(FBS.MODID+":fillingTableSide");
+ iconFTop = p_149651_1_.registerIcon(FBS.MODID+":fillingTableTop");
+ iconFBottom = p_149651_1_.registerIcon("furnace_top");
+ }
+ @Override
+ public IIcon getIcon(int side, int meta){
+ if(side==0) return iconFBottom;
+ if(side==1) return iconFTop;
+ return blockIcon;
+ }
+
+ @Override
+ public int getRenderType(){
+ return FBS.renderDirectionalId;
+ }
+ @Override
+ public boolean renderAsNormalBlock(){
+ return false;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/block/BlockGrass.class b/src/main/java/jp/plusplus/fbs/block/BlockGrass.class Binary files differnew file mode 100644 index 0000000..2ec878c --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/BlockGrass.class diff --git a/src/main/java/jp/plusplus/fbs/block/BlockGrass.java b/src/main/java/jp/plusplus/fbs/block/BlockGrass.java new file mode 100644 index 0000000..e5a1805 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/BlockGrass.java @@ -0,0 +1,106 @@ +package jp.plusplus.fbs.block;
+
+import codechicken.lib.render.BlockRenderer;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.Registry;
+import jp.plusplus.fbs.alchemy.AlchemyRegistry;
+import jp.plusplus.fbs.alchemy.ItemAlchemyMaterial;
+import jp.plusplus.fbs.item.ItemCore;
+import jp.plusplus.fbs.tileentity.TileEntityHavestable;
+import jp.plusplus.fbs.tileentity.TileEntityHavestableGrass;
+import net.minecraft.block.material.Material;
+import net.minecraft.client.renderer.RenderBlocks;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.IIcon;
+import net.minecraft.world.IBlockAccess;
+import net.minecraft.world.World;
+import net.minecraft.world.biome.BiomeGenBase;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Random;
+
+/**
+ * Created by plusplus_F on 2016/02/23.
+ */
+public class BlockGrass extends BlockHerb {
+ protected IIcon[] icons;
+
+ public BlockGrass() {
+ setBlockName("grass");
+ setBlockTextureName("grass");
+ setHardness(0.5f);
+ setResistance(0.1f);
+ setCreativeTab(FBS.tabAlchemy);
+ setStepSound(soundTypeGrass);
+ }
+
+ @Override
+ public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
+ return new TileEntityHavestableGrass(60, 0);
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void registerBlockIcons(IIconRegister p_149651_1_) {
+ icons=new IIcon[2];
+ for(int i=0;i<2;i++){
+ icons[i]=p_149651_1_.registerIcon(FBS.MODID+":harvestableGrass"+i);
+ }
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
+ return icons[getTE(world,x,y,z).canHarvest()?1:0];
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public IIcon getIcon(int a, int b) {
+ return icons[1];
+ }
+
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void getSubBlocks(Item p_149666_1_, CreativeTabs p_149666_2_, List p_149666_3_) {
+ p_149666_3_.add(new ItemStack(p_149666_1_, 1, 0));
+ }
+
+ @Override
+ public ArrayList<ItemStack> getHarvestItems(World world, int x, int y, int z) {
+ ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
+
+ for(int i=9;i<18;i++) ret.add(AlchemyRegistry.getItemStack(ItemCore.alchemyMaterial, 1, i));
+ for(int i=30;i<36;i++) ret.add(AlchemyRegistry.getItemStack(ItemCore.alchemyMaterial, 1, i));
+ for(int i=4;i<7;i++) ret.add(AlchemyRegistry.getItemStack(ItemCore.alchemyMaterialEatable, 1, i));
+
+ return ret;
+ }
+
+ @Override
+ public ArrayList<ItemStack> harvest(World world, int x, int y, int z, Random rand) {
+ ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
+ ArrayList<ItemStack> list = getHarvestItems(world, x, y, z);
+ int num = 2 + rand.nextInt(2);
+
+ for (int i = 0; i < num; i++) {
+ ret.add(list.get(rand.nextInt(list.size()-1)).copy());
+ }
+
+ getTE(world, x, y, z).onHarvest();
+ return ret;
+ }
+
+ @Override
+ public String getUnlocalizedName(int meta) {
+ return "tile.fbs.grass";
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/block/BlockHerb.class b/src/main/java/jp/plusplus/fbs/block/BlockHerb.class Binary files differnew file mode 100644 index 0000000..ec52984 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/BlockHerb.class diff --git a/src/main/java/jp/plusplus/fbs/block/BlockHerb.java b/src/main/java/jp/plusplus/fbs/block/BlockHerb.java new file mode 100644 index 0000000..d9f28cc --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/BlockHerb.java @@ -0,0 +1,213 @@ +package jp.plusplus.fbs.block;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.Registry;
+import jp.plusplus.fbs.alchemy.AlchemyRegistry;
+import jp.plusplus.fbs.alchemy.ItemAlchemyMaterial;
+import jp.plusplus.fbs.api.IHarvestable;
+import jp.plusplus.fbs.item.ItemCore;
+import jp.plusplus.fbs.tileentity.TileEntityHavestable;
+import net.minecraft.block.Block;
+import net.minecraft.block.BlockBreakable;
+import net.minecraft.block.BlockGlass;
+import net.minecraft.block.ITileEntityProvider;
+import net.minecraft.block.material.Material;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.AxisAlignedBB;
+import net.minecraft.world.IBlockAccess;
+import net.minecraft.world.World;
+import net.minecraft.world.biome.BiomeGenBase;
+import net.minecraft.world.gen.feature.WorldGenFlowers;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Random;
+
+/**
+ * Created by plusplus_F on 2015/11/09.
+ */
+public class BlockHerb extends BlockBase implements ITileEntityProvider,IHarvestable,IMeta {
+ public BlockHerb() {
+ super(Material.grass);
+ setBlockName("herb");
+ setBlockTextureName("herb");
+ setHardness(0.5f);
+ setResistance(0.1f);
+ setCreativeTab(FBS.tabAlchemy);
+ setStepSound(soundTypeGrass);
+ }
+
+ public TileEntityHavestable getTE(IBlockAccess world, int x, int y, int z) {
+ TileEntity te = world.getTileEntity(x, y, z);
+ return te instanceof TileEntityHavestable ? (TileEntityHavestable) te : null;
+ }
+
+ //---------------------------------------------------------------------------------------
+
+ @Override
+ protected boolean canSilkHarvest() {
+ return true;
+ }
+
+ @Override
+ public int quantityDropped(Random p_149745_1_) {
+ return 0;
+ }
+
+ @Override
+ public int damageDropped(int par1) {
+ return par1;
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void getSubBlocks(Item p_149666_1_, CreativeTabs p_149666_2_, List p_149666_3_) {
+ for (int i = 0; i < 9; i++) p_149666_3_.add(new ItemStack(p_149666_1_, 1, i));
+ }
+
+ @Override
+ public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_) {
+ if (canHarvest(world, x, y, z)) {
+ ArrayList<ItemStack> get = harvest(world, x, y, z, world.rand, player);
+ if(!world.isRemote){
+ for (ItemStack is : get) {
+ player.entityDropItem(is, player.getEyeHeight());
+ }
+ }
+ player.inventory.markDirty();
+ }
+ return true;
+ }
+
+ @Override
+ public boolean canPlaceBlockAt(World world, int x, int y, int z) {
+ if (y == 0) return false;
+ Block b = world.getBlock(x, y, z);
+ if (b != this && !b.isReplaceable(world, x, y, z)) return false;
+ b = world.getBlock(x, y - 1, z);
+
+ return b == Blocks.stone || b == Blocks.dirt || b == Blocks.grass || b == BlockCore.fallenLeaves || b == Blocks.mossy_cobblestone || b == Blocks.cobblestone || b==Blocks.end_stone || b==Blocks.netherrack;
+ }
+
+ @Override
+ public void onNeighborBlockChange(World world, int x, int y, int z, Block p_149695_5_) {
+ if (!canPlaceBlockAt(world, x, y, z)) {
+ world.func_147480_a(x, y, z, false);
+ world.notifyBlockOfNeighborChange(x, y, z, this);
+ }
+ }
+
+ @Override
+ public int getRenderType() {
+ return FBS.renderHerbId;
+ }
+
+ @Override
+ public boolean renderAsNormalBlock() {
+ return false;
+ }
+
+ @Override
+ public boolean isOpaqueCube() {
+ return false;
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public boolean shouldSideBeRendered(IBlockAccess p_149646_1_, int p_149646_2_, int p_149646_3_, int p_149646_4_, int p_149646_5_) {
+ return true;
+ }
+
+ @Override
+ public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_) {
+ return null;
+ }
+
+ @Override
+ public void setBlockBoundsBasedOnState(IBlockAccess p_149719_1_, int p_149719_2_, int p_149719_3_, int p_149719_4_) {
+ }
+
+ //---------------------------------------------------------------------------------------
+ @Override
+ public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
+ return new TileEntityHavestable(60, p_149915_2_);
+ }
+
+ //---------------------------------------------------------------------------------------
+ @Override
+ public boolean canHarvest(World world, int x, int y, int z) {
+ return getTE(world, x, y, z).canHarvest();
+ }
+
+ @Override
+ public void glow(World world, int x, int y, int z, Random rand) {
+ getTE(world, x, y, z).glow(rand);
+ }
+
+ @Override
+ public ArrayList<ItemStack> getHarvestItems(World world, int x, int y, int z) {
+ ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
+ int meta = world.getBlockMetadata(x, y, z);
+
+ if (meta < 6) {
+ ret.add(AlchemyRegistry.getItemStack(ItemCore.alchemyMaterial, 1, 18 + meta));
+ } else if (meta < 9) {
+ ret.add(AlchemyRegistry.getItemStack(ItemCore.alchemyMaterial, 1, 36 + meta - 6));
+ }
+ if(meta==5) ret.add(AlchemyRegistry.getItemStack(ItemCore.alchemyMaterial, 1, 24));
+ ret.add(AlchemyRegistry.getItemStack(ItemCore.alchemyMaterial, 1, 39));
+
+ return ret;
+ }
+
+ @Override
+ public ArrayList<ItemStack> harvest(World world, int x, int y, int z, Random rand, EntityPlayer player) {
+ return harvest(world, x, y, z, rand);
+ }
+
+ @Override
+ public ArrayList<ItemStack> harvest(World world, int x, int y, int z, Random rand) {
+ ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
+ ArrayList<ItemStack> list = getHarvestItems(world, x, y, z);
+ int num = 1 + rand.nextInt(2);
+
+ for (int i = 0; i < num; i++) {
+ boolean flag = false;
+
+ //不浄なハーブとかの判定
+ if (list.size()>1 && (rand.nextInt(32) == 0 || (world.getBiomeGenForCoords(x, z) == Registry.biomeAutumn))) {
+ if (rand.nextInt(32) == 0) {
+ flag = true;
+ } else {
+ BiomeGenBase bgb = world.getBiomeGenForCoords(x, z);
+ if (bgb == Registry.biomeAutumn || bgb == Registry.biomeCrack) {
+ flag = rand.nextInt(8) == 0;
+ }
+ }
+ }
+ if (flag) ret.add(list.get(list.size()-1).copy());
+ else ret.add(list.get(rand.nextInt(list.size()-1)).copy());
+ }
+
+ getTE(world, x, y, z).onHarvest();
+ return ret;
+ }
+
+ @Override
+ public String getUnlocalizedName(int meta) {
+ String name = "tile.fbs.";
+ if (meta < 6) {
+ name += ItemAlchemyMaterial.NAMES[18 + meta];
+ } else if (meta < 9) {
+ name += ItemAlchemyMaterial.NAMES[36 + meta - 6];
+ }
+ return name;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/block/BlockMagicCore.class b/src/main/java/jp/plusplus/fbs/block/BlockMagicCore.class Binary files differnew file mode 100644 index 0000000..520969f --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/BlockMagicCore.class diff --git a/src/main/java/jp/plusplus/fbs/block/BlockMagicCore.java b/src/main/java/jp/plusplus/fbs/block/BlockMagicCore.java new file mode 100644 index 0000000..9286f2e --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/BlockMagicCore.java @@ -0,0 +1,151 @@ +package jp.plusplus.fbs.block;
+
+import cpw.mods.fml.client.FMLClientHandler;
+import cpw.mods.fml.common.FMLLog;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.AchievementRegistry;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.Registry;
+import jp.plusplus.fbs.item.ItemCharm;
+import jp.plusplus.fbs.item.ItemCore;
+import jp.plusplus.fbs.particle.EntityGlowFX;
+import jp.plusplus.fbs.tileentity.TileEntityExtractingFurnace;
+import jp.plusplus.fbs.tileentity.TileEntityMagicCore;
+import net.minecraft.block.Block;
+import net.minecraft.block.ITileEntityProvider;
+import net.minecraft.block.material.Material;
+import net.minecraft.client.particle.EffectRenderer;
+import net.minecraft.entity.item.EntityItem;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.Items;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.AxisAlignedBB;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.world.IBlockAccess;
+import net.minecraft.world.World;
+
+import java.util.Random;
+
+/**
+ * Created by pluslus_F on 2015/06/17.
+ */
+public class BlockMagicCore extends BlockBase implements ITileEntityProvider{
+
+ public BlockMagicCore() {
+ super(Material.circuits);
+ setBlockName("magicCore");
+ setBlockTextureName("magicCore");
+ this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.0625F, 1.0F);
+ //BlockRedstoneWire
+ }
+
+ @Override
+ public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_) {
+ return null;
+ }
+
+ @Override
+ public boolean isOpaqueCube() {
+ return false;
+ }
+
+ @Override
+ public boolean renderAsNormalBlock() {
+ return false;
+ }
+
+ @Override
+ public int getRenderType() {
+ return FBS.renderCharmId;
+ }
+
+ @Override
+ public boolean canPlaceBlockAt(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_) {
+ return p_149742_1_.isBlockNormalCubeDefault(p_149742_2_, p_149742_3_ - 1, p_149742_4_, true);
+ }
+
+ @Override
+ public void onNeighborBlockChange(World p_149695_1_, int p_149695_2_, int p_149695_3_, int p_149695_4_, Block p_149695_5_) {
+ if (!p_149695_1_.isRemote) {
+ boolean flag = this.canPlaceBlockAt(p_149695_1_, p_149695_2_, p_149695_3_, p_149695_4_);
+
+ if (!flag){
+ this.dropBlockAsItem(p_149695_1_, p_149695_2_, p_149695_3_, p_149695_4_, p_149695_1_.getBlockMetadata(p_149695_2_, p_149695_3_, p_149695_4_), 0);
+ p_149695_1_.setBlockToAir(p_149695_2_, p_149695_3_, p_149695_4_);
+ }
+
+ super.onNeighborBlockChange(p_149695_1_, p_149695_2_, p_149695_3_, p_149695_4_, p_149695_5_);
+ }
+ }
+
+ @Override
+ public void breakBlock(World world, int x, int y, int z, Block block, int par6) {
+ if (hasTileEntity(par6)){
+ world.removeTileEntity(x, y, z);
+ }
+ }
+
+ @Override
+ public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
+ return new TileEntityMagicCore();
+ }
+
+ @Override
+ public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) {
+ ItemStack current=player.getCurrentEquippedItem();
+ if(current==null || current.getItem()!=Items.flint_and_steel) return false;
+
+ //
+ TileEntity e=world.getTileEntity(x, y, z);
+ if(!(e instanceof TileEntityMagicCore)) return true;
+ if(!((TileEntityMagicCore) e).getCircleName().equals("null")) return true;
+
+ //check size
+ int r=0;
+ for(int i=1;i<5;i++){
+ Block b=world.getBlock(x+i,y,z);
+ if(b==BlockCore.charm) r=i;
+ }
+ if(r==0){
+ return true;
+ }
+
+ //check magic circle
+ String mc= Registry.FindMatchingMagicCircle(world, x, y, z, r);
+ if(mc==null){
+ return true;
+ }
+
+ //damage flint
+ if(!player.capabilities.isCreativeMode) current.damageItem(1, player);
+ player.inventory.markDirty();
+ if(!world.isRemote){
+ world.playSoundEffect((double) x + 0.5D, (double) y + 0.5D, (double) z + 0.5D, "fire.ignite", 1.0F, world.rand.nextFloat() * 0.4F + 0.8F);
+ player.triggerAchievement(AchievementRegistry.circle);
+ }
+
+ ((TileEntityMagicCore) e).setMagicCircle(mc, r);
+ ((TileEntityMagicCore) e).clearCharms();
+ return true;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void randomDisplayTick(World world, int x, int y, int z, Random rand) {
+ TileEntity e=world.getTileEntity(x,y,z);
+ if(!(e instanceof TileEntityMagicCore)) return;
+
+ if (!((TileEntityMagicCore) e).getCircleName().equals("null")) {
+ double cr=((TileEntityMagicCore) e).getCircleRadius()+0.5;
+ double dx=x+0.5+cr*(rand.nextFloat()- rand.nextFloat());
+ double dz=z+0.5+cr*(rand.nextFloat()- rand.nextFloat());
+
+ EffectRenderer er= FMLClientHandler.instance().getClient().effectRenderer;
+ er.addEffect(new EntityGlowFX(world, dx, y+0.0625f, dz));
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/block/BlockMirror.class b/src/main/java/jp/plusplus/fbs/block/BlockMirror.class Binary files differnew file mode 100644 index 0000000..240b39c --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/BlockMirror.class diff --git a/src/main/java/jp/plusplus/fbs/block/BlockMirror.java b/src/main/java/jp/plusplus/fbs/block/BlockMirror.java new file mode 100644 index 0000000..731c0b9 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/BlockMirror.java @@ -0,0 +1,134 @@ +package jp.plusplus.fbs.block;
+
+import cpw.mods.fml.client.FMLClientHandler;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.Registry;
+import jp.plusplus.fbs.particle.EntityGlowFX;
+import jp.plusplus.fbs.tileentity.TileEntityExtractingFurnace;
+import jp.plusplus.fbs.tileentity.TileEntityMirror;
+import net.minecraft.block.Block;
+import net.minecraft.block.BlockContainer;
+import net.minecraft.block.ITileEntityProvider;
+import net.minecraft.block.material.Material;
+import net.minecraft.client.particle.EffectRenderer;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.item.EntityItem;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.Blocks;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.IIcon;
+import net.minecraft.util.MathHelper;
+import net.minecraft.world.IBlockAccess;
+import net.minecraft.world.World;
+import shift.mceconomy2.api.MCEconomyAPI;
+import shift.sextiarysector.block.BlockMonitor;
+
+import java.util.ArrayList;
+import java.util.Random;
+
+import static net.minecraftforge.common.util.ForgeDirection.UP;
+
+/**
+ * Createdby pluslus_Fon 2015/06/24.
+ */
+public class BlockMirror extends BlockBase implements ITileEntityProvider{
+
+ public BlockMirror() {
+ super(Material.rock);
+ setBlockName("mirror");
+ setBlockTextureName("mirror");
+ setHardness(3.5F);
+ setStepSound(soundTypeGlass);
+ infoName="mirror";
+ infoRow=1;
+ }
+
+ @Override
+ public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
+ return new TileEntityMirror();
+ }
+ @Override
+ public boolean canPlaceTorchOnTop(World par1World, int par2, int par3, int par4){
+ return false;
+ }
+
+ @Override
+ public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
+ MCEconomyAPI.openShopGui(Registry.shopMCE2Id, par5EntityPlayer, par1World, par2, par3, par4);
+ return true;
+ }
+ @Override
+ public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack item) {
+ int l = MathHelper.floor_double((double) (entity.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
+
+ if (l == 0) {
+ world.setBlockMetadataWithNotify(x, y, z, 2, 2);
+ world.setBlock(x, y + 1, z, BlockCore.mirror);
+ world.setBlockMetadataWithNotify(x, y + 1, z, 2 | 8, 2);
+ }
+
+ if (l == 1) {
+ world.setBlockMetadataWithNotify(x, y, z, 5, 2);
+ world.setBlock(x,y+1,z, BlockCore.mirror);
+ world.setBlockMetadataWithNotify(x, y+1, z, 5|8, 2);
+ }
+
+ if (l == 2) {
+ world.setBlockMetadataWithNotify(x, y, z, 3, 2);
+ world.setBlock(x,y+1,z, BlockCore.mirror);
+ world.setBlockMetadataWithNotify(x, y+1, z, 3|8, 2);
+ }
+
+ if (l == 3) {
+ world.setBlockMetadataWithNotify(x, y, z, 4, 2);
+ world.setBlock(x,y+1,z, BlockCore.mirror);
+ world.setBlockMetadataWithNotify(x, y+1, z, 4|8, 2);
+ }
+ }
+
+ @Override
+ public void onBlockAdded(World world, int x, int y, int z) {
+ super.onBlockAdded(world, x,y,z);
+
+ }
+ public void breakBlock(World world, int x, int y, int z, Block p_149749_5_, int meta) {
+ world.removeTileEntity(x,y,z);
+ if((meta&8)!=0 && world.getBlock(x,y-1,z)==BlockCore.mirror) world.func_147480_a(x,y-1,z, true);
+ else if(world.getBlock(x,y+1,z)==BlockCore.mirror) world.func_147480_a(x,y+1,z, false);
+ }
+
+ public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune){
+ if((metadata&8)!=0) return new ArrayList<ItemStack>();
+ return super.getDrops(world, x,y,z,metadata,fortune);
+ }
+
+ public boolean canPlaceBlockAt(World world, int x, int y, int z) {
+ return world.getBlock(x, y, z).isReplaceable(world, x, y, z) && world.getBlock(x, y+1, z).isReplaceable(world, x, y+1, z);
+ }
+
+ @Override
+ public int getRenderType(){
+ return FBS.renderMirrorId;
+ }
+ @Override
+ public boolean renderAsNormalBlock(){
+ return false;
+ }
+
+ @Override
+ public boolean isOpaqueCube() {
+ return false;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public boolean shouldSideBeRendered(IBlockAccess p_149646_1_, int p_149646_2_, int p_149646_3_, int p_149646_4_, int p_149646_5_) {
+ return true;
+ }
+}
\ No newline at end of file diff --git a/src/main/java/jp/plusplus/fbs/block/BlockMushroom.class b/src/main/java/jp/plusplus/fbs/block/BlockMushroom.class Binary files differnew file mode 100644 index 0000000..6cb3ace --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/BlockMushroom.class diff --git a/src/main/java/jp/plusplus/fbs/block/BlockMushroom.java b/src/main/java/jp/plusplus/fbs/block/BlockMushroom.java new file mode 100644 index 0000000..2023174 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/BlockMushroom.java @@ -0,0 +1,103 @@ +package jp.plusplus.fbs.block;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.Registry;
+import jp.plusplus.fbs.alchemy.AlchemyRegistry;
+import jp.plusplus.fbs.alchemy.ItemAlchemyMaterial;
+import jp.plusplus.fbs.item.ItemCore;
+import jp.plusplus.fbs.tileentity.TileEntityHavestable;
+import jp.plusplus.fbs.tileentity.TileEntityHavestableMushroom;
+import net.minecraft.block.material.Material;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.world.World;
+import net.minecraft.world.biome.BiomeGenBase;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Random;
+
+/**
+ * Created by plusplus_F on 2016/02/23.
+ */
+public class BlockMushroom extends BlockHerb {
+ public BlockMushroom() {
+ setBlockName("mushroom");
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void getSubBlocks(Item p_149666_1_, CreativeTabs p_149666_2_, List p_149666_3_) {
+ for (int i = 0; i < 3; i++) p_149666_3_.add(new ItemStack(p_149666_1_, 1, i));
+ }
+
+ @Override
+ public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
+ return new TileEntityHavestableMushroom(60, p_149915_2_);
+ }
+
+ @Override
+ public String getUnlocalizedName(int meta) {
+ return "tile.fbs.mushroom"+meta;
+ }
+
+ @Override
+ public ArrayList<ItemStack> getHarvestItems(World world, int x, int y, int z) {
+ ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
+ int meta = world.getBlockMetadata(x, y, z);
+
+ switch (meta){
+ case 0:
+ ret.add(AlchemyRegistry.getItemStack(ItemCore.alchemyMaterial, 1, 25));
+ ret.add(AlchemyRegistry.getItemStack(ItemCore.alchemyMaterial, 1, 26));
+ ret.add(AlchemyRegistry.getItemStack(ItemCore.alchemyMaterial, 1, 27));
+ ret.add(AlchemyRegistry.getItemStack(ItemCore.alchemyMaterial, 1, 29));
+ ret.add(AlchemyRegistry.getItemStack(ItemCore.alchemyMaterial, 1, 41));
+ ret.add(AlchemyRegistry.getItemStack(ItemCore.alchemyMaterialEatable, 1, 0));
+ ret.add(AlchemyRegistry.getItemStack(ItemCore.alchemyMaterialEatable, 1, 2));
+ ret.add(AlchemyRegistry.getItemStack(ItemCore.alchemyMaterialEatable, 1, 3));
+ break;
+
+ case 1:
+ ret.add(AlchemyRegistry.getItemStack(ItemCore.alchemyMaterial, 1, 25));
+ ret.add(AlchemyRegistry.getItemStack(ItemCore.alchemyMaterial, 1, 26));
+ ret.add(AlchemyRegistry.getItemStack(ItemCore.alchemyMaterial, 1, 27));
+ ret.add(AlchemyRegistry.getItemStack(ItemCore.alchemyMaterial, 1, 28));
+ ret.add(AlchemyRegistry.getItemStack(ItemCore.alchemyMaterial, 1, 29));
+ ret.add(AlchemyRegistry.getItemStack(ItemCore.alchemyMaterial, 1, 41));
+ ret.add(AlchemyRegistry.getItemStack(ItemCore.alchemyMaterialEatable, 1, 1));
+ ret.add(AlchemyRegistry.getItemStack(ItemCore.alchemyMaterialEatable, 1, 2));
+ break;
+
+ case 2:
+ ret.add(AlchemyRegistry.getItemStack(ItemCore.alchemyMaterial, 1, 42));
+ ret.add(AlchemyRegistry.getItemStack(ItemCore.alchemyMaterial, 1, 43));
+ ret.add(AlchemyRegistry.getItemStack(ItemCore.alchemyMaterial, 1, 44));
+ ret.add(AlchemyRegistry.getItemStack(ItemCore.alchemyMaterial, 1, 45));
+ ret.add(AlchemyRegistry.getItemStack(ItemCore.alchemyMaterialEatable, 1, 1));
+ break;
+
+ }
+
+ return ret;
+ }
+
+ @Override
+ public ArrayList<ItemStack> harvest(World world, int x, int y, int z, Random rand) {
+ ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
+ ArrayList<ItemStack> list = getHarvestItems(world, x, y, z);
+ int num = 1 + rand.nextInt(2);
+ int index=rand.nextInt(list.size()-1);
+
+ for (int i = 0; i < num; i++) {
+ ret.add(list.get(index).copy());
+ }
+
+ getTE(world, x, y, z).onHarvest();
+ return ret;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/block/BlockOre.class b/src/main/java/jp/plusplus/fbs/block/BlockOre.class Binary files differnew file mode 100644 index 0000000..d3d2d16 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/BlockOre.class diff --git a/src/main/java/jp/plusplus/fbs/block/BlockOre.java b/src/main/java/jp/plusplus/fbs/block/BlockOre.java new file mode 100644 index 0000000..1461dba --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/BlockOre.java @@ -0,0 +1,47 @@ +package jp.plusplus.fbs.block;
+
+import jp.plusplus.fbs.item.ItemCore;
+import net.minecraft.item.Item;
+import net.minecraft.util.MathHelper;
+import net.minecraft.world.IBlockAccess;
+import net.minecraft.world.World;
+
+import java.util.Random;
+
+/**
+ * Created by pluslus_F on 2015/06/23.
+ */
+public class BlockOre extends BlockBlock {
+ public BlockOre() {
+ super("ore");
+ }
+
+ @Override
+ public Item getItemDropped(int meta, Random p_149650_2_, int p_149650_3_){
+ return ItemCore.gem;
+ }
+
+ @Override
+ public int quantityDropped(Random p_149745_1_) {
+ return 1;
+ }
+ @Override
+ public int quantityDroppedWithBonus(int p_149679_1_, Random p_149679_2_) {
+ int j = p_149679_2_.nextInt(p_149679_1_ + 2) - 1;
+ if (j < 0) {
+ j = 0;
+ }
+
+ return this.quantityDropped(p_149679_2_) * (j + 1);
+ }
+
+ @Override
+ public void dropBlockAsItemWithChance(World p_149690_1_, int p_149690_2_, int p_149690_3_, int p_149690_4_, int p_149690_5_, float p_149690_6_, int p_149690_7_) {
+ super.dropBlockAsItemWithChance(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, p_149690_5_, p_149690_6_, p_149690_7_);
+ }
+
+ @Override
+ public int getExpDrop(IBlockAccess p_149690_1_, int p_149690_5_, int p_149690_7_) {
+ return MathHelper.getRandomIntegerInRange(this.rand, 3, 4);
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/block/BlockPortalAutumn.class b/src/main/java/jp/plusplus/fbs/block/BlockPortalAutumn.class Binary files differnew file mode 100644 index 0000000..360affc --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/BlockPortalAutumn.class diff --git a/src/main/java/jp/plusplus/fbs/block/BlockPortalAutumn.java b/src/main/java/jp/plusplus/fbs/block/BlockPortalAutumn.java new file mode 100644 index 0000000..dcaf7a3 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/BlockPortalAutumn.java @@ -0,0 +1,96 @@ +package jp.plusplus.fbs.block;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.AchievementRegistry;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.world.autumn.TeleporterAutumn;
+import net.minecraft.block.Block;
+import net.minecraft.block.BlockEndPortal;
+import net.minecraft.block.BlockPortal;
+import net.minecraft.block.material.Material;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.EntityPlayerMP;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemMonsterPlacer;
+import net.minecraft.server.management.ServerConfigurationManager;
+import net.minecraft.util.AxisAlignedBB;
+import net.minecraft.util.IIcon;
+import net.minecraft.world.IBlockAccess;
+import net.minecraft.world.World;
+import net.minecraft.world.WorldServer;
+
+import java.util.Random;
+
+/**
+ * Created by plusplus_F on 2015/11/07.
+ */
+public class BlockPortalAutumn extends BlockBase {
+ private IIcon iconSide;
+
+ protected BlockPortalAutumn() {
+ super(Material.wood);
+ setBlockName("butterfly");
+ setBlockTextureName("butterfly");
+ setHardness(1.5f);
+ setResistance(5.0f);
+ setHarvestLevel("axe", 0);
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void registerBlockIcons(IIconRegister p_149651_1_) {
+ blockIcon = p_149651_1_.registerIcon(this.getTextureName()+"Top");
+ iconSide = p_149651_1_.registerIcon(this.getTextureName()+"Side");
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public IIcon getIcon(int p_149691_1_, int p_149691_2_) {
+ return p_149691_1_==1?this.blockIcon:iconSide;
+ }
+
+
+ public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entity, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_) {
+ if (entity.ridingEntity == null && entity.riddenByEntity == null && entity.timeUntilPortal==0) {
+ // 現在地が独自ディメンション以外
+ if (world.provider.dimensionId != FBS.dimensionAutumnId) {
+ if (entity instanceof EntityPlayerMP) {
+ // 1行で書くと長過ぎるので一旦ローカル変数に格納
+ EntityPlayerMP entityPlayerMP = (EntityPlayerMP) entity;
+ ServerConfigurationManager serverConfigurationManager = entityPlayerMP.mcServer.getConfigurationManager();
+ WorldServer worldServer = entityPlayerMP.mcServer.worldServerForDimension(FBS.dimensionAutumnId);
+
+ // 移動後にネザーポータルが作成されるので即座に再送還されないように
+ entityPlayerMP.timeUntilPortal = 20;
+ entityPlayerMP.setInPortal();
+
+ // 独自ディメンションに移動する
+ serverConfigurationManager.transferPlayerToDimension(entityPlayerMP, FBS.dimensionAutumnId, new TeleporterAutumn(worldServer));
+ entityPlayerMP.triggerAchievement(AchievementRegistry.eternalAutumn);
+ return true;
+ }
+ }
+ // 現在地が独自ディメンション
+ else {
+ if (entity instanceof EntityPlayerMP) {
+ // 1行で書くと長過ぎるので一旦ローカル変数に格納
+ EntityPlayerMP entityPlayerMP = (EntityPlayerMP) entity;
+ ServerConfigurationManager serverConfigurationManager = entityPlayerMP.mcServer.getConfigurationManager();
+ WorldServer worldServer = entityPlayerMP.mcServer.worldServerForDimension(0);
+
+ entityPlayerMP.timeUntilPortal = 20;
+ entityPlayerMP.setInPortal();
+
+ // 独自ディメンションからはオーバーワールドに移動
+ serverConfigurationManager.transferPlayerToDimension(entityPlayerMP, 0, new TeleporterAutumn(worldServer));
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/block/BlockPortalWarp.class b/src/main/java/jp/plusplus/fbs/block/BlockPortalWarp.class Binary files differnew file mode 100644 index 0000000..1cc3567 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/BlockPortalWarp.class diff --git a/src/main/java/jp/plusplus/fbs/block/BlockPortalWarp.java b/src/main/java/jp/plusplus/fbs/block/BlockPortalWarp.java new file mode 100644 index 0000000..6d99149 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/BlockPortalWarp.java @@ -0,0 +1,210 @@ +package jp.plusplus.fbs.block;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.exprop.FBSEntityProperties;
+import jp.plusplus.fbs.tileentity.TileEntityPortalWarp;
+import jp.plusplus.fbs.world.TeleporterWarp;
+import jp.plusplus.fbs.world.crack.TeleporterToCrack;
+import net.minecraft.block.Block;
+import net.minecraft.block.ITileEntityProvider;
+import net.minecraft.block.material.Material;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.player.EntityPlayerMP;
+import net.minecraft.item.Item;
+import net.minecraft.server.management.ServerConfigurationManager;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.AxisAlignedBB;
+import net.minecraft.util.ChunkCoordinates;
+import net.minecraft.util.IIcon;
+import net.minecraft.util.MathHelper;
+import net.minecraft.world.*;
+import net.minecraft.world.chunk.Chunk;
+
+import java.util.Random;
+
+/**
+ * Created by plusplus_F on 2015/10/23.
+ * meta: 8...向き, 4...狭間生成フラグ, 1...上下
+ */
+public class BlockPortalWarp extends BlockBase implements ITileEntityProvider {
+ protected IIcon[] icons;
+
+ public BlockPortalWarp() {
+ super(Material.portal);
+ this.setTickRandomly(true);
+ setCreativeTab(null);
+ setBlockName("portalWarp");
+ setHardness(0.5f);
+ setResistance(1.f);
+ setStepSound(Block.soundTypeGlass);
+ }
+
+ @Override
+ public int tickRate(World w) {
+ return 30;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void registerBlockIcons(IIconRegister p_149651_1_) {
+ icons = new IIcon[2];
+ icons[0] = p_149651_1_.registerIcon(FBS.MODID + ":portalWarpUp");
+ icons[1] = p_149651_1_.registerIcon(FBS.MODID + ":portalWarpDown");
+ }
+
+ @SideOnly(Side.CLIENT)
+ public IIcon getIcon(int p_149691_1_, int p_149691_2_) {
+ return (p_149691_2_ & 1) == 0 ? icons[1] : icons[0];
+ }
+
+ @Override
+ public void updateTick(World w, int x, int y, int z, Random rand) {
+ if (!w.isRemote) {
+ int meta = w.getBlockMetadata(x, y, z);
+ if ((meta & 1) != 0 || rand.nextInt(10) != 0) return;
+ w.func_147480_a(x, y, z, false);
+ }
+ }
+
+ @Override
+ public int quantityDropped(int meta, int fortune, Random random) {
+ return 0;
+ }
+
+ @Override
+ public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) {
+ return null;
+ }
+
+ @Override
+ public boolean isOpaqueCube() {
+ return false;
+ }
+
+ @Override
+ protected boolean canSilkHarvest() {
+ return false;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public Item getItem(World p_149694_1_, int p_149694_2_, int p_149694_3_, int p_149694_4_) {
+ return Item.getItemById(0);
+ }
+
+ @Override
+ public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_) {
+ return null;
+ //return super.getCollisionBoundingBoxFromPool(p_149668_1_, p_149668_2_, p_149668_3_, p_149668_4_);
+ }
+
+ @Override
+ public void setBlockBoundsBasedOnState(IBlockAccess p_149719_1_, int p_149719_2_, int p_149719_3_, int p_149719_4_) {
+ int l = p_149719_1_.getBlockMetadata(p_149719_2_, p_149719_3_, p_149719_4_) & 8;
+ if(l==0) setBlockBounds(0,0,0.5f,1,1,0.5f);
+ else setBlockBounds(0.5f,0,0,0.5f,1,1);
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public AxisAlignedBB getSelectedBoundingBoxFromPool(World p_149633_1_, int p_149633_2_, int p_149633_3_, int p_149633_4_) {
+ return super.getCollisionBoundingBoxFromPool(p_149633_1_, p_149633_2_, p_149633_3_, p_149633_4_);
+ }
+
+ @Override
+ public void onEntityCollidedWithBlock(World w, int x, int y, int z, Entity e) {
+ //FBS.logger.info("collided:"+(e.getClass().toString()));
+ if (e instanceof EntityPlayerMP && !w.isRemote) {
+ int meta=w.getBlockMetadata(x,y,z);
+ if((meta&4)!=0){
+ //狭間を生成して移動
+ EntityPlayerMP entityPlayerMP = (EntityPlayerMP) e;
+ ServerConfigurationManager serverConfigurationManager = entityPlayerMP.mcServer.getConfigurationManager();
+ WorldServer worldServer = entityPlayerMP.mcServer.worldServerForDimension(FBS.dimensionCrackId);
+
+ //基準座標を得る
+ ChunkCoordinates cc=WorldProvider.getProviderForDimension(FBS.dimensionCrackId).getEntrancePortalLocation();
+
+ //基準座標からテキトーに回ると多分地面があるはず
+ boolean found=false;
+ for(int r=1;r<30 && !found;r++){
+ for(int aa=0;aa<8;aa++){
+ float angle=(float)Math.PI/8.f*aa;
+ int bx=MathHelper.floor_float(cc.posX+5*r*MathHelper.cos(angle));
+ int bz=MathHelper.floor_float(cc.posZ+5*r*MathHelper.sin(angle));
+
+ int cx=bx%16;
+ int cz=bz%16;
+ if(cx<0) cx+=16;
+ if(cz<0) cz+=16;
+
+ Chunk c=worldServer.getChunkProvider().provideChunk(bx%16, bz%16);
+ int h=c.getHeightValue(cx, cz);
+ if(h>0){
+ cc.posX=bx;
+ cc.posY=h+10;
+ cc.posZ=bz;
+ found=true;
+ break;
+ }
+ }
+ }
+
+
+ entityPlayerMP.setPositionAndUpdate(cc.posX + 0.5, cc.posY, cc.posZ + 0.5);
+ serverConfigurationManager.transferPlayerToDimension(entityPlayerMP, FBS.dimensionCrackId, new TeleporterWarp(worldServer));
+ }
+ else{
+ //通常のワープ処理
+ EntityPlayerMP playerMP = (EntityPlayerMP) e;
+ TileEntity te = w.getTileEntity(x, y, z);
+ if (!(te instanceof TileEntityPortalWarp)) return;
+ FBSEntityProperties.WarpPosition dest = ((TileEntityPortalWarp) te).destination;
+ if (dest == null) return;
+
+ playerMP.setPositionAndUpdate(dest.x + 0.5, dest.y+3, dest.z + 0.5);
+ if (playerMP.dimension != dest.dimId) {
+ //playerMP.travelToDimension(dest.dimId);
+ EntityPlayerMP entityPlayerMP = (EntityPlayerMP) e;
+ ServerConfigurationManager serverConfigurationManager = entityPlayerMP.mcServer.getConfigurationManager();
+ WorldServer worldServer = entityPlayerMP.mcServer.worldServerForDimension(dest.dimId);
+
+ serverConfigurationManager.transferPlayerToDimension(entityPlayerMP, dest.dimId, new TeleporterWarp(worldServer));
+ }
+ }
+ }
+ }
+
+ @Override
+ public int getRenderType() {
+ return FBS.renderPortalWarpId;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public int getRenderBlockPass() {
+ return 1;
+ }
+
+ @Override
+ public boolean renderAsNormalBlock() {
+ return false;
+ }
+
+ @Override
+ public void onNeighborBlockChange(World w, int x, int y, int z, Block block) {
+ int meta = w.getBlockMetadata(x, y, z);
+ Block b;
+ if ((meta & 1) == 0) b = w.getBlock(x, y + 1, z);
+ else b = w.getBlock(x, y - 1, z);
+
+ if (b != this) {
+ w.func_147480_a(x, y, z, false);
+ }
+ }
+
+ @Override
+ public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
+ return new TileEntityPortalWarp();
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/block/BlockSchoolTable.class b/src/main/java/jp/plusplus/fbs/block/BlockSchoolTable.class Binary files differnew file mode 100644 index 0000000..da9273b --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/BlockSchoolTable.class diff --git a/src/main/java/jp/plusplus/fbs/block/BlockSchoolTable.java b/src/main/java/jp/plusplus/fbs/block/BlockSchoolTable.java new file mode 100644 index 0000000..c2f9ec3 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/BlockSchoolTable.java @@ -0,0 +1,54 @@ +package jp.plusplus.fbs.block;
+
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.tileentity.TileEntityForRender;
+import net.minecraft.block.ITileEntityProvider;
+import net.minecraft.block.material.Material;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.item.ItemStack;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.MathHelper;
+import net.minecraft.world.World;
+
+/**
+ * Created by plusplus_F on 2015/09/25.
+ */
+public class BlockSchoolTable extends BlockBase implements ITileEntityProvider {
+ public BlockSchoolTable() {
+ super(Material.wood);
+ setBlockName("schoolTable");
+ setBlockTextureName("bookshelfTop");
+ setHardness(1.0f);
+ setResistance(15.f);
+ }
+
+ @Override
+ public boolean isOpaqueCube() {
+ return false;
+ }
+
+ @Override
+ public boolean renderAsNormalBlock() {
+ return false;
+ }
+
+ @Override
+ public int getRenderType() {
+ return FBS.renderDecorationId;
+ }
+
+
+ public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack item) {
+ int l = MathHelper.floor_double((double) (entity.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
+
+ if (l == 0) world.setBlockMetadataWithNotify(x, y, z, 2, 2);
+ if (l == 1) world.setBlockMetadataWithNotify(x, y, z, 5, 2);
+ if (l == 2) world.setBlockMetadataWithNotify(x, y, z, 3, 2);
+ if (l == 3) world.setBlockMetadataWithNotify(x, y, z, 4, 2);
+ }
+
+ @Override
+ public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
+ return new TileEntityForRender();
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/block/IMeta.class b/src/main/java/jp/plusplus/fbs/block/IMeta.class Binary files differnew file mode 100644 index 0000000..e3d0758 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/IMeta.class diff --git a/src/main/java/jp/plusplus/fbs/block/IMeta.java b/src/main/java/jp/plusplus/fbs/block/IMeta.java new file mode 100644 index 0000000..36720e5 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/IMeta.java @@ -0,0 +1,8 @@ +package jp.plusplus.fbs.block;
+
+/**
+ * Created by plusplus_F on 2015/11/15.
+ */
+public interface IMeta {
+ public String getUnlocalizedName(int meta);
+}
diff --git a/src/main/java/jp/plusplus/fbs/block/model/ModelAlchemyCauldron.class b/src/main/java/jp/plusplus/fbs/block/model/ModelAlchemyCauldron.class Binary files differnew file mode 100644 index 0000000..d9da65c --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/model/ModelAlchemyCauldron.class diff --git a/src/main/java/jp/plusplus/fbs/block/model/ModelAlchemyCauldron.java b/src/main/java/jp/plusplus/fbs/block/model/ModelAlchemyCauldron.java new file mode 100644 index 0000000..4fa6c6a --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/model/ModelAlchemyCauldron.java @@ -0,0 +1,157 @@ +// Date: 2015/08/19 8:45:36 +// Template version 1.1 +// Java generated by Techne +// Keep in mind that you still need to fill in some blanks +// - ZeuX + + +package jp.plusplus.fbs.block.model; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +public class ModelAlchemyCauldron extends ModelBase { + //fields + ModelRenderer Shape1; + ModelRenderer Shape2; + ModelRenderer Shape3; + ModelRenderer Shape4; + ModelRenderer Shape5; + ModelRenderer Shape6; + ModelRenderer Shape7; + ModelRenderer Shape8; + ModelRenderer Shape9; + ModelRenderer Shape10; + ModelRenderer Shape11; + ModelRenderer Shape12; + ModelRenderer Shape13; + ModelRenderer Shape14; + ModelRenderer Shape15; + + public ModelAlchemyCauldron() { + textureWidth = 128; + textureHeight = 64; + + Shape1 = new ModelRenderer(this, 0, 0); + Shape1.addBox(-2F, -2F, -2F, 20, 2, 20); + Shape1.setRotationPoint(0F, 0F, 0F); + Shape1.setTextureSize(128, 64); + Shape1.mirror = true; + setRotation(Shape1, 0F, 0F, 0F); + Shape2 = new ModelRenderer(this, 60, 0); + Shape2.addBox(-3F, -5F, -3F, 22, 3, 1); + Shape2.setRotationPoint(0F, 0F, 0F); + Shape2.setTextureSize(128, 64); + Shape2.mirror = true; + setRotation(Shape2, 0F, 0F, 0F); + Shape3 = new ModelRenderer(this, 60, 0); + Shape3.addBox(-3F, -5F, 18F, 22, 3, 1); + Shape3.setRotationPoint(0F, 0F, 0F); + Shape3.setTextureSize(128, 64); + Shape3.mirror = true; + setRotation(Shape3, 0F, 0F, 0F); + Shape4 = new ModelRenderer(this, 0, 22); + Shape4.addBox(-3F, -5F, -2F, 1, 3, 20); + Shape4.setRotationPoint(0F, 0F, 0F); + Shape4.setTextureSize(128, 64); + Shape4.mirror = true; + setRotation(Shape4, 0F, 0F, 0F); + Shape5 = new ModelRenderer(this, 0, 22); + Shape5.addBox(18F, -5F, -2F, 1, 3, 20); + Shape5.setRotationPoint(0F, 0F, 0F); + Shape5.setTextureSize(128, 64); + Shape5.mirror = true; + setRotation(Shape5, 0F, 0F, 0F); + Shape6 = new ModelRenderer(this, 60, 4); + Shape6.addBox(-4F, -7F, -4F, 24, 2, 1); + Shape6.setRotationPoint(0F, 0F, 0F); + Shape6.setTextureSize(128, 64); + Shape6.mirror = true; + setRotation(Shape6, 0F, 0F, 0F); + Shape7 = new ModelRenderer(this, 60, 4); + Shape7.addBox(-4F, -7F, 19F, 24, 2, 1); + Shape7.setRotationPoint(0F, 0F, 0F); + Shape7.setTextureSize(128, 64); + Shape7.mirror = true; + setRotation(Shape7, 0F, 0F, 0F); + Shape8 = new ModelRenderer(this, 42, 22); + Shape8.addBox(-4F, -7F, -3F, 1, 2, 22); + Shape8.setRotationPoint(0F, 0F, 0F); + Shape8.setTextureSize(128, 64); + Shape8.mirror = true; + setRotation(Shape8, 0F, 0F, 0F); + Shape9 = new ModelRenderer(this, 42, 22); + Shape9.addBox(19F, -7F, -3F, 1, 2, 22); + Shape9.setRotationPoint(0F, 0F, 0F); + Shape9.setTextureSize(128, 64); + Shape9.mirror = true; + setRotation(Shape9, 0F, 0F, 0F); + Shape10 = new ModelRenderer(this, 0, 0); + Shape10.addBox(20F, -7F, 4F, 3, 1, 2); + Shape10.setRotationPoint(0F, 0F, 0F); + Shape10.setTextureSize(128, 64); + Shape10.mirror = true; + setRotation(Shape10, 0F, 0F, 0F); + Shape11 = new ModelRenderer(this, 0, 0); + Shape11.addBox(20F, -7F, 10F, 3, 1, 2); + Shape11.setRotationPoint(0F, 0F, 0F); + Shape11.setTextureSize(128, 64); + Shape11.mirror = true; + setRotation(Shape11, 0F, 0F, 0F); + Shape12 = new ModelRenderer(this, 0, 3); + Shape12.addBox(23F, -7F, 4F, 2, 2, 8); + Shape12.setRotationPoint(0F, 0F, 0F); + Shape12.setTextureSize(128, 64); + Shape12.mirror = true; + setRotation(Shape12, 0F, 0F, 0F); + Shape13 = new ModelRenderer(this, 0, 0); + Shape13.addBox(-7F, -7F, 10F, 3, 1, 2); + Shape13.setRotationPoint(0F, 0F, 0F); + Shape13.setTextureSize(128, 64); + Shape13.mirror = true; + setRotation(Shape13, 0F, 0F, 0F); + Shape14 = new ModelRenderer(this, 0, 0); + Shape14.addBox(-7F, -7F, 4F, 3, 1, 2); + Shape14.setRotationPoint(0F, 0F, 0F); + Shape14.setTextureSize(128, 64); + Shape14.mirror = true; + setRotation(Shape14, 0F, 0F, 0F); + Shape15 = new ModelRenderer(this, 0, 3); + Shape15.addBox(-9F, -7F, 4F, 2, 2, 8); + Shape15.setRotationPoint(0F, 0F, 0F); + Shape15.setTextureSize(128, 64); + Shape15.mirror = true; + setRotation(Shape15, 0F, 0F, 0F); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + setRotationAngles(f, f1, f2, f3, f4, f5); + Shape1.render(f5); + Shape2.render(f5); + Shape3.render(f5); + Shape4.render(f5); + Shape5.render(f5); + Shape6.render(f5); + Shape7.render(f5); + Shape8.render(f5); + Shape9.render(f5); + Shape10.render(f5); + Shape11.render(f5); + Shape12.render(f5); + Shape13.render(f5); + Shape14.render(f5); + Shape15.render(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + + public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5) { + super.setRotationAngles(f, f1, f2, f3, f4, f5, null); + } +} diff --git a/src/main/java/jp/plusplus/fbs/block/model/ModelAlchemyTable.class b/src/main/java/jp/plusplus/fbs/block/model/ModelAlchemyTable.class Binary files differnew file mode 100644 index 0000000..ca14176 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/model/ModelAlchemyTable.class diff --git a/src/main/java/jp/plusplus/fbs/block/model/ModelAlchemyTable.java b/src/main/java/jp/plusplus/fbs/block/model/ModelAlchemyTable.java new file mode 100644 index 0000000..8244ba8 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/model/ModelAlchemyTable.java @@ -0,0 +1,210 @@ +// Date: 2015/09/25 14:00:36 +// Template version 1.1 +// Java generated by Techne +// Keep in mind that you still need to fill in some blanks +// - ZeuX + + + + + + +package jp.plusplus.fbs.block.model; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +public class ModelAlchemyTable extends ModelBase { + //fields + ModelRenderer Shape1; + ModelRenderer Shape2; + ModelRenderer Shape3; + ModelRenderer Shape4; + ModelRenderer Shape5; + ModelRenderer Shape6; + ModelRenderer Shape7; + ModelRenderer Shape7b; + ModelRenderer Shape8; + ModelRenderer Shape8b; + ModelRenderer Shape9; + ModelRenderer Shape10; + ModelRenderer Shape11; + ModelRenderer Shape12; + ModelRenderer Shape13; + ModelRenderer Shape14; + ModelRenderer Shape15; + ModelRenderer Shape16; + ModelRenderer Shape17; + ModelRenderer Shape18; + ModelRenderer Shape19; + + public ModelAlchemyTable() { + textureWidth = 128; + textureHeight = 64; + + Shape1 = new ModelRenderer(this, 0, 4); + Shape1.addBox(-8F, -8F, -8F, 32, 1, 14); + Shape1.setRotationPoint(0F, 0F, 0F); + Shape1.setTextureSize(128, 64); + Shape1.mirror = true; + setRotation(Shape1, 0F, 0F, 0F); + Shape2 = new ModelRenderer(this, 0, 19); + Shape2.addBox(-5F, -7F, -7F, 26, 3, 12); + Shape2.setRotationPoint(0F, 0F, 0F); + Shape2.setTextureSize(128, 64); + Shape2.mirror = true; + setRotation(Shape2, 0F, 0F, 0F); + Shape3 = new ModelRenderer(this, 0, 0); + Shape3.addBox(-7F, -7F, -7F, 2, 15, 2); + Shape3.setRotationPoint(0F, 0F, 0F); + Shape3.setTextureSize(128, 64); + Shape3.mirror = true; + setRotation(Shape3, 0F, 0F, 0F); + Shape4 = new ModelRenderer(this, 0, 0); + Shape4.addBox(-7F, -7F, 3F, 2, 15, 2); + Shape4.setRotationPoint(0F, 0F, 0F); + Shape4.setTextureSize(128, 64); + Shape4.mirror = true; + setRotation(Shape4, 0F, 0F, 0F); + Shape5 = new ModelRenderer(this, 0, 0); + Shape5.addBox(21F, -7F, -7F, 2, 15, 2); + Shape5.setRotationPoint(0F, 0F, 0F); + Shape5.setTextureSize(128, 64); + Shape5.mirror = true; + setRotation(Shape5, 0F, 0F, 0F); + Shape6 = new ModelRenderer(this, 0, 0); + Shape6.addBox(21F, -7F, 3F, 2, 15, 2); + Shape6.setRotationPoint(0F, 0F, 0F); + Shape6.setTextureSize(128, 64); + Shape6.mirror = true; + setRotation(Shape6, 0F, 0F, 0F); + Shape7 = new ModelRenderer(this, 78, 0); + Shape7.addBox(-7F, -7F, -5F, 2, 2, 8); + Shape7.setRotationPoint(0F, 0F, 0F); + Shape7.setTextureSize(128, 64); + Shape7.mirror = true; + setRotation(Shape7, 0F, 0F, 0F); + Shape7b = new ModelRenderer(this, 78, 0); + Shape7b.addBox(-7F, 4F, -5F, 2, 2, 8); + Shape7b.setRotationPoint(0F, 0F, 0F); + Shape7b.setTextureSize(128, 64); + Shape7b.mirror = true; + setRotation(Shape7b, 0F, 0F, 0F); + Shape8 = new ModelRenderer(this, 78, 0); + Shape8.addBox(21F, -7F, -5F, 2, 2, 8); + Shape8.setRotationPoint(0F, 0F, 0F); + Shape8.setTextureSize(128, 64); + Shape8.mirror = true; + setRotation(Shape8, 0F, 0F, 0F); + Shape8b = new ModelRenderer(this, 78, 0); + Shape8b.addBox(21F, 4F, -5F, 2, 2, 8); + Shape8b.setRotationPoint(0F, 0F, 0F); + Shape8b.setTextureSize(128, 64); + Shape8b.mirror = true; + setRotation(Shape8b, 0F, 0F, 0F); + Shape9 = new ModelRenderer(this, 0, 26); + Shape9.addBox(0F, 0F, 0F, 1, 1, 4); + Shape9.setRotationPoint(9F, -9F, -5F); + Shape9.setTextureSize(128, 64); + Shape9.mirror = true; + setRotation(Shape9, 0F, 0.2617994F, 0F); + Shape10 = new ModelRenderer(this, 0, 24); + Shape10.addBox(-1F, 0F, 4F, 3, 1, 1); + Shape10.setRotationPoint(9F, -9F, -5F); + Shape10.setTextureSize(128, 64); + Shape10.mirror = true; + setRotation(Shape10, 0F, 0.2617994F, 0F); + Shape11 = new ModelRenderer(this, 0, 24); + Shape11.addBox(-1F, 0F, 6F, 3, 1, 1); + Shape11.setRotationPoint(9F, -9F, -5F); + Shape11.setTextureSize(128, 64); + Shape11.mirror = true; + setRotation(Shape11, 0F, 0.2617994F, 0F); + Shape12 = new ModelRenderer(this, 8, 0); + Shape12.addBox(-1F, 0F, 5F, 1, 1, 1); + Shape12.setRotationPoint(9F, -9F, -5F); + Shape12.setTextureSize(128, 64); + Shape12.mirror = true; + setRotation(Shape12, 0F, 0.2617994F, 0F); + Shape13 = new ModelRenderer(this, 8, 0); + Shape13.addBox(1F, 0F, 5F, 1, 1, 1); + Shape13.setRotationPoint(9F, -9F, -5F); + Shape13.setTextureSize(128, 64); + Shape13.mirror = true; + setRotation(Shape13, 0F, 0.2617994F, 0F); + Shape14 = new ModelRenderer(this, 0, 34); + Shape14.addBox(-2.5F, 0F, -3.5F, 5, 1, 7); + Shape14.setRotationPoint(3F, -9F, -3F); + Shape14.setTextureSize(128, 64); + Shape14.mirror = true; + setRotation(Shape14, 0F, 0F, 0F); + Shape15 = new ModelRenderer(this, 24, 34); + Shape15.addBox(-2.5F, 0F, -3.5F, 5, 1, 7); + Shape15.setRotationPoint(-4F, -9F, 1F); + Shape15.setTextureSize(128, 64); + Shape15.mirror = true; + setRotation(Shape15, 0F, 0.3141593F, 0F); + Shape16 = new ModelRenderer(this, 48, 34); + Shape16.addBox(-2.5F, 0F, -3.5F, 5, 1, 7); + Shape16.setRotationPoint(-4F, -10F, 1F); + Shape16.setTextureSize(128, 64); + Shape16.mirror = true; + setRotation(Shape16, 0F, 0.0872665F, 0F); + Shape17 = new ModelRenderer(this, 48, 34); + Shape17.addBox(-2.5F, 0F, -3.5F, 5, 1, 7); + Shape17.setRotationPoint(18F, -9F, 0F); + Shape17.setTextureSize(128, 64); + Shape17.mirror = true; + setRotation(Shape17, 0F, 2.670354F, 0F); + Shape18 = new ModelRenderer(this, 0, 34); + Shape18.addBox(-2.5F, 0F, -3.5F, 5, 1, 7); + Shape18.setRotationPoint(18F, -10F, 1F); + Shape18.setTextureSize(128, 64); + Shape18.mirror = true; + setRotation(Shape18, 0F, 2.094395F, 0F); + Shape19 = new ModelRenderer(this, 72, 34); + Shape19.addBox(-2.5F, 0F, -3.5F, 5, 1, 7); + Shape19.setRotationPoint(19F, -11F, 1F); + Shape19.setTextureSize(128, 64); + Shape19.mirror = true; + setRotation(Shape19, 0F, 2.617994F, 0F); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + setRotationAngles(f, f1, f2, f3, f4, f5); + Shape1.render(f5); + Shape2.render(f5); + Shape3.render(f5); + Shape4.render(f5); + Shape5.render(f5); + Shape6.render(f5); + Shape7.render(f5); + Shape7b.render(f5); + Shape8.render(f5); + Shape8b.render(f5); + Shape9.render(f5); + Shape10.render(f5); + Shape11.render(f5); + Shape12.render(f5); + Shape13.render(f5); + Shape14.render(f5); + Shape15.render(f5); + Shape16.render(f5); + Shape17.render(f5); + Shape18.render(f5); + Shape19.render(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + + public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5) { + super.setRotationAngles(f, f1, f2, f3, f4, f5, null); + } + +} diff --git a/src/main/java/jp/plusplus/fbs/block/model/ModelBonfire.class b/src/main/java/jp/plusplus/fbs/block/model/ModelBonfire.class Binary files differnew file mode 100644 index 0000000..a888006 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/model/ModelBonfire.class diff --git a/src/main/java/jp/plusplus/fbs/block/model/ModelBonfire.java b/src/main/java/jp/plusplus/fbs/block/model/ModelBonfire.java new file mode 100644 index 0000000..488d463 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/model/ModelBonfire.java @@ -0,0 +1,98 @@ +// Date: 2015/10/20 7:29:06 +// Template version 1.1 +// Java generated by Techne +// Keep in mind that you still need to fill in some blanks +// - ZeuX + + + + + + +package jp.plusplus.fbs.block.model; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +public class ModelBonfire extends ModelBase { + //fields + ModelRenderer Shape1; + ModelRenderer Shape2; + ModelRenderer Shape3; + ModelRenderer Shape4; + ModelRenderer Shape5; + ModelRenderer Shape6; + ModelRenderer Shape7; + + public ModelBonfire() { + textureWidth = 64; + textureHeight = 32; + + Shape1 = new ModelRenderer(this, 0, 0); + Shape1.addBox(-1F, -1F, -6F, 2, 2, 8); + Shape1.setRotationPoint(0F, 21F, -2F); + Shape1.setTextureSize(64, 32); + Shape1.mirror = true; + setRotation(Shape1, 0.3346075F, 0F, 0F); + Shape2 = new ModelRenderer(this, 0, 0); + Shape2.addBox(-1F, -1F, -6F, 2, 2, 8); + Shape2.setRotationPoint(-1.466667F, 23F, -1.133333F); + Shape2.setTextureSize(64, 32); + Shape2.mirror = true; + setRotation(Shape2, 0F, 1.003822F, 0F); + Shape3 = new ModelRenderer(this, 20, 0); + Shape3.addBox(-1F, -1F, -5F, 2, 2, 7); + Shape3.setRotationPoint(4.666667F, 23F, 4.266667F); + Shape3.setTextureSize(64, 32); + Shape3.mirror = true; + setRotation(Shape3, 0F, 0.8551081F, 0F); + Shape4 = new ModelRenderer(this, 38, 0); + Shape4.addBox(-1F, -1F, -3F, 2, 2, 6); + Shape4.setRotationPoint(-2.866667F, 23F, 3.733333F); + Shape4.setTextureSize(64, 32); + Shape4.mirror = true; + setRotation(Shape4, 0F, -0.669215F, 0F); + Shape5 = new ModelRenderer(this, 0, 0); + Shape5.addBox(-1F, -1F, -4F, 2, 2, 8); + Shape5.setRotationPoint(-3.6F, 21.26667F, -0.2666667F); + Shape5.setTextureSize(64, 32); + Shape5.mirror = true; + setRotation(Shape5, 0.4833219F, 1.283798F, 0F); + Shape6 = new ModelRenderer(this, 20, 0); + Shape6.addBox(-1F, -1F, -3.4F, 2, 2, 7); + Shape6.setRotationPoint(3.8F, 21.86667F, -1.866667F); + Shape6.setTextureSize(64, 32); + Shape6.mirror = true; + setRotation(Shape6, -0.3346075F, 2.193538F, 0F); + Shape7 = new ModelRenderer(this, 0, 0); + Shape7.addBox(-1F, -1F, -5.4F, 2, 2, 8); + Shape7.setRotationPoint(0.7333333F, 22.2F, 5.2F); + Shape7.setTextureSize(64, 32); + Shape7.mirror = true; + setRotation(Shape7, -0.3346075F, 0.1115358F, 0F); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + setRotationAngles(f, f1, f2, f3, f4, f5); + Shape1.render(f5); + Shape2.render(f5); + Shape3.render(f5); + Shape4.render(f5); + Shape5.render(f5); + Shape6.render(f5); + Shape7.render(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + + public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5) { + super.setRotationAngles(f, f1, f2, f3, f4, f5, null); + } + +} diff --git a/src/main/java/jp/plusplus/fbs/block/model/ModelFork.class b/src/main/java/jp/plusplus/fbs/block/model/ModelFork.class Binary files differnew file mode 100644 index 0000000..9d55e23 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/model/ModelFork.class diff --git a/src/main/java/jp/plusplus/fbs/block/model/ModelFork.java b/src/main/java/jp/plusplus/fbs/block/model/ModelFork.java new file mode 100644 index 0000000..364c34d --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/model/ModelFork.java @@ -0,0 +1,82 @@ +// Date: 2015/11/06 14:30:42 +// Template version 1.1 +// Java generated by Techne +// Keep in mind that you still need to fill in some blanks +// - ZeuX + + + + + + +package jp.plusplus.fbs.block.model; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +public class ModelFork extends ModelBase { + //fields + ModelRenderer Shape1; + ModelRenderer Shape2; + ModelRenderer Shape5; + ModelRenderer Shape6; + ModelRenderer Shape7; + + public ModelFork() { + textureWidth = 64; + textureHeight = 32; + + Shape1 = new ModelRenderer(this, 0, 0); + Shape1.addBox(-1F, -0.5F, -11F, 2, 1, 14); + Shape1.setRotationPoint(0F, 0F, 0F); + Shape1.setTextureSize(64, 32); + Shape1.mirror = true; + setRotation(Shape1, 0F, 0F, 0F); + Shape2 = new ModelRenderer(this, 0, 0); + Shape2.addBox(-2F, 0F, 3F, 4, 1, 1); + Shape2.setRotationPoint(0F, 0F, 0F); + Shape2.setTextureSize(64, 32); + Shape2.mirror = true; + setRotation(Shape2, 0F, 0F, 0F); + Shape5 = new ModelRenderer(this, 35, 17); + Shape5.addBox(-2F, 0.5F, 4F, 1, 1, 6); + Shape5.setRotationPoint(0F, 0F, 0F); + Shape5.setTextureSize(64, 32); + Shape5.mirror = true; + setRotation(Shape5, 0F, 0F, 0F); + Shape6 = new ModelRenderer(this, 35, 1); + Shape6.addBox(1F, 0.5F, 4F, 1, 1, 6); + Shape6.setRotationPoint(0F, 0F, 0F); + Shape6.setTextureSize(64, 32); + Shape6.mirror = true; + setRotation(Shape6, 0F, 0F, 0F); + Shape7 = new ModelRenderer(this, 35, 9); + Shape7.addBox(-0.5F, 0.5F, 4F, 1, 1, 6); + Shape7.setRotationPoint(0F, 0F, 0F); + Shape7.setTextureSize(64, 32); + Shape7.mirror = true; + setRotation(Shape7, 0F, 0F, 0F); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + setRotationAngles(f, f1, f2, f3, f4, f5); + Shape1.render(f5); + Shape2.render(f5); + Shape5.render(f5); + Shape6.render(f5); + Shape7.render(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + + public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5) { + super.setRotationAngles(f, f1, f2, f3, f4, f5, null); + } + +} diff --git a/src/main/java/jp/plusplus/fbs/block/model/ModelHerb.class b/src/main/java/jp/plusplus/fbs/block/model/ModelHerb.class Binary files differnew file mode 100644 index 0000000..2c77717 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/model/ModelHerb.class diff --git a/src/main/java/jp/plusplus/fbs/block/model/ModelHerb.java b/src/main/java/jp/plusplus/fbs/block/model/ModelHerb.java new file mode 100644 index 0000000..43e8153 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/model/ModelHerb.java @@ -0,0 +1,124 @@ +// Date: 2015/11/15 17:51:17 +// Template version 1.1 +// Java generated by Techne +// Keep in mind that you still need to fill in some blanks +// - ZeuX + + + + + + +package jp.plusplus.fbs.block.model; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +public class ModelHerb extends ModelBase { + //fields + ModelRenderer Shape1; + ModelRenderer Shape2; + ModelRenderer Shape3; + ModelRenderer Shape4; + ModelRenderer Shape5; + ModelRenderer Shape6; + ModelRenderer Shape7; + ModelRenderer Shape8; + ModelRenderer Shape9; + ModelRenderer Shape10; + + public ModelHerb(int meta) { + textureWidth = 64; + textureHeight = 32; + + Shape1 = new ModelRenderer(this, 0, 0); + Shape1.addBox(-4F, 7F, -3F, 2, 1, 2); + Shape1.setRotationPoint(0F, 16F, 0F); + Shape1.setTextureSize(64, 32); + Shape1.mirror = true; + setRotation(Shape1, 0F, 0F, 0F); + Shape2 = new ModelRenderer(this, 8, 0); + Shape2.addBox(3F, 7F, 3F, 2, 1, 1); + Shape2.setRotationPoint(0F, 16F, 0F); + Shape2.setTextureSize(64, 32); + Shape2.mirror = true; + setRotation(Shape2, 0F, 0F, 0F); + Shape3 = new ModelRenderer(this, 8, 0); + Shape3.addBox(3F, 7F, 2F, 2, 1, 1); + Shape3.setRotationPoint(0F, 16F, 0F); + Shape3.setTextureSize(64, 32); + Shape3.mirror = true; + setRotation(Shape3, 0F, 1.570796F, 0F); + Shape4 = new ModelRenderer(this, 0, 0); + Shape4.addBox(-2F, 7F, 2F, 2, 1, 2); + Shape4.setRotationPoint(0F, 16F, 0F); + Shape4.setTextureSize(64, 32); + Shape4.mirror = true; + setRotation(Shape4, 0F, 0F, 0F); + + Shape5 = new ModelRenderer(this, 8*(meta%8), 3+15*(meta/8)); + Shape5.addBox(-2F, -4F, -4F, 4, 12, 0); + Shape5.setRotationPoint(0F, 16F, 0F); + Shape5.setTextureSize(64, 32); + Shape5.mirror = true; + setRotation(Shape5, 0F, 0F, 0F); + Shape6 = new ModelRenderer(this, 8*(meta%8), 3+15*(meta/8)); + Shape6.addBox(2F, -4F, 0F, 4, 12, 0); + Shape6.setRotationPoint(0F, 16F, 0F); + Shape6.setTextureSize(64, 32); + Shape6.mirror = true; + setRotation(Shape6, 0F, 1.570796F, 0F); + Shape7 = new ModelRenderer(this, 8*(meta%8), 3+15*(meta/8)); + Shape7.addBox(0F, -4F, 3F, 4, 12, 0); + Shape7.setRotationPoint(0F, 16F, 0F); + Shape7.setTextureSize(64, 32); + Shape7.mirror = true; + setRotation(Shape7, 0F, 0F, 0F); + Shape8 = new ModelRenderer(this, 8*(meta%8), 3+15*(meta/8)); + Shape8.addBox(-5F, -4F, 2F, 4, 12, 0); + Shape8.setRotationPoint(0F, 16F, 0F); + Shape8.setTextureSize(64, 32); + Shape8.mirror = true; + setRotation(Shape8, 0F, 1.570796F, 0F); + Shape9 = new ModelRenderer(this, 8*(meta%8), 3+15*(meta/8)); + Shape9.addBox(-3F, -4F, -4F, 4, 12, 0); + Shape9.setRotationPoint(0F, 16F, 0F); + Shape9.setTextureSize(64, 32); + Shape9.mirror = true; + setRotation(Shape9, 0F, 1.570796F, 0F); + Shape10 = new ModelRenderer(this, 8*(meta%8), 3+15*(meta/8)); + Shape10.addBox(-6F, -4F, 1F, 4, 12, 0); + Shape10.setRotationPoint(0F, 16F, 0F); + Shape10.setTextureSize(64, 32); + Shape10.mirror = true; + setRotation(Shape10, 0F, 0F, 0F); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + setRotationAngles(f, f1, f2, f3, f4, f5); + Shape1.render(f5); + Shape2.render(f5); + Shape3.render(f5); + Shape4.render(f5); + } + public void renderHerbs(float f5){ + Shape5.render(f5); + Shape6.render(f5); + Shape7.render(f5); + Shape8.render(f5); + Shape9.render(f5); + Shape10.render(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + + public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5) { + super.setRotationAngles(f, f1, f2, f3, f4, f5, null); + } +} diff --git a/src/main/java/jp/plusplus/fbs/block/model/ModelKnife.class b/src/main/java/jp/plusplus/fbs/block/model/ModelKnife.class Binary files differnew file mode 100644 index 0000000..b86ec1f --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/model/ModelKnife.class diff --git a/src/main/java/jp/plusplus/fbs/block/model/ModelKnife.java b/src/main/java/jp/plusplus/fbs/block/model/ModelKnife.java new file mode 100644 index 0000000..e20aaec --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/model/ModelKnife.java @@ -0,0 +1,74 @@ +// Date: 2015/11/06 14:29:36 +// Template version 1.1 +// Java generated by Techne +// Keep in mind that you still need to fill in some blanks +// - ZeuX + + + + + + +package jp.plusplus.fbs.block.model; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +public class ModelKnife extends ModelBase { + //fields + ModelRenderer Shape1; + ModelRenderer Shape2; + ModelRenderer Shape3; + ModelRenderer Shape4; + + public ModelKnife() { + textureWidth = 64; + textureHeight = 32; + + Shape1 = new ModelRenderer(this, 0, 0); + Shape1.addBox(-1F, -0.5F, -11F, 2, 1, 14); + Shape1.setRotationPoint(0F, 0F, 0F); + Shape1.setTextureSize(64, 32); + Shape1.mirror = true; + setRotation(Shape1, 0F, 0F, 0F); + Shape2 = new ModelRenderer(this, 2, 17); + Shape2.addBox(-2F, -0.5F, 3F, 3, 1, 7); + Shape2.setRotationPoint(0F, 0F, 0F); + Shape2.setTextureSize(64, 32); + Shape2.mirror = true; + setRotation(Shape2, 0F, 0F, 0F); + Shape3 = new ModelRenderer(this, 0, 0); + Shape3.addBox(-1F, -0.5F, 10F, 2, 1, 1); + Shape3.setRotationPoint(0F, 0F, 0F); + Shape3.setTextureSize(64, 32); + Shape3.mirror = true; + setRotation(Shape3, 0F, 0F, 0F); + Shape4 = new ModelRenderer(this, 0, 0); + Shape4.addBox(0F, -0.5F, 11F, 1, 1, 1); + Shape4.setRotationPoint(0F, 0F, 0F); + Shape4.setTextureSize(64, 32); + Shape4.mirror = true; + setRotation(Shape4, 0F, 0F, 0F); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + setRotationAngles(f, f1, f2, f3, f4, f5); + Shape1.render(f5); + Shape2.render(f5); + Shape3.render(f5); + Shape4.render(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + + public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5) { + super.setRotationAngles(f, f1, f2, f3, f4, f5, null); + } + +} diff --git a/src/main/java/jp/plusplus/fbs/block/model/ModelMushroom.class b/src/main/java/jp/plusplus/fbs/block/model/ModelMushroom.class Binary files differnew file mode 100644 index 0000000..68a1172 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/model/ModelMushroom.class diff --git a/src/main/java/jp/plusplus/fbs/block/model/ModelMushroom.java b/src/main/java/jp/plusplus/fbs/block/model/ModelMushroom.java new file mode 100644 index 0000000..4d5d667 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/model/ModelMushroom.java @@ -0,0 +1,96 @@ +// Date: 2016/02/23 14:02:41 +// Template version 1.1 +// Java generated by Techne +// Keep in mind that you still need to fill in some blanks +// - ZeuX + +package jp.plusplus.fbs.block.model; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +public class ModelMushroom extends ModelBase { + //fields + ModelRenderer Shape1; + ModelRenderer Shape2; + ModelRenderer Shape3; + ModelRenderer Shape4; + ModelRenderer Shape5; + ModelRenderer Shape6; + ModelRenderer Shape7; + + public ModelMushroom(int color) { + textureWidth = 64; + textureHeight = 32; + + Shape1 = new ModelRenderer(this, 18, 0); + Shape1.addBox(-4F, 6F, -4F, 2, 2, 2); + Shape1.setRotationPoint(0F, 16F, 0F); + Shape1.setTextureSize(64, 32); + Shape1.mirror = true; + setRotation(Shape1, 0F, 0F, 0F); + Shape2 = new ModelRenderer(this, 0+color*20, 19); + Shape2.addBox(0F, 6F, 1F, 5, 1, 5); + Shape2.setRotationPoint(0F, 16F, 0F); + Shape2.setTextureSize(64, 32); + Shape2.mirror = true; + setRotation(Shape2, 0F, 0F, 0F); + Shape3 = new ModelRenderer(this, 0, 0); + Shape3.addBox(2F, 7F, 3F, 1, 1, 1); + Shape3.setRotationPoint(0F, 16F, 0F); + Shape3.setTextureSize(64, 32); + Shape3.mirror = true; + setRotation(Shape3, 0F, 0F, 0F); + Shape4 = new ModelRenderer(this, 0+(color%2)*24, 0+(color/2)*7); + Shape4.addBox(-6F, 5F, -6F, 6, 1, 6); + Shape4.setRotationPoint(0F, 16F, 0F); + Shape4.setTextureSize(64, 32); + Shape4.mirror = true; + setRotation(Shape4, 0F, 0F, 0F); + Shape5 = new ModelRenderer(this, 0+color*20, 14); + Shape5.addBox(-5F, 4F, -5F, 4, 1, 4); + Shape5.setRotationPoint(0F, 16F, 0F); + Shape5.setTextureSize(64, 32); + Shape5.mirror = true; + setRotation(Shape5, 0F, 0F, 0F); + Shape6 = new ModelRenderer(this, 0, 2); + Shape6.addBox(3F, 7F, -3F, 2, 1, 1); + Shape6.setRotationPoint(0F, 16F, 0F); + Shape6.setTextureSize(64, 32); + Shape6.mirror = true; + setRotation(Shape6, 0F, 0F, 0F); + Shape7 = new ModelRenderer(this, 0, 4); + Shape7.addBox(-3F, 7F, 3F, 1, 1, 1); + Shape7.setRotationPoint(0F, 16F, 0F); + Shape7.setTextureSize(64, 32); + Shape7.mirror = true; + setRotation(Shape7, 0F, 0F, 0F); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + setRotationAngles(f, f1, f2, f3, f4, f5); + Shape6.render(f5); + Shape7.render(f5); + } + + public void renderMush(float f5) { + Shape1.render(f5); + Shape2.render(f5); + Shape3.render(f5); + Shape4.render(f5); + Shape5.render(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + + public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5) { + super.setRotationAngles(f, f1, f2, f3, f4, f5, null); + } + +} diff --git a/src/main/java/jp/plusplus/fbs/block/model/ModelSchoolTable.class b/src/main/java/jp/plusplus/fbs/block/model/ModelSchoolTable.class Binary files differnew file mode 100644 index 0000000..4b121db --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/model/ModelSchoolTable.class diff --git a/src/main/java/jp/plusplus/fbs/block/model/ModelSchoolTable.java b/src/main/java/jp/plusplus/fbs/block/model/ModelSchoolTable.java new file mode 100644 index 0000000..20e797a --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/model/ModelSchoolTable.java @@ -0,0 +1,133 @@ +// Date: 2015/09/25 11:01:28 +// Template version 1.1 +// Java generated by Techne +// Keep in mind that you still need to fill in some blanks +// - ZeuX + +package jp.plusplus.fbs.block.model; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +public class ModelSchoolTable extends ModelBase { + //fields + ModelRenderer Shape1; + ModelRenderer Shape2; + ModelRenderer Shape3; + ModelRenderer Shape4; + ModelRenderer Shape5; + ModelRenderer Shape6; + ModelRenderer Shape7; + ModelRenderer Shape8; + ModelRenderer Shape9; + ModelRenderer Shape10; + ModelRenderer Shape11; + ModelRenderer Shape12; + + public ModelSchoolTable() { + textureWidth = 64; + textureHeight = 32; + + Shape1 = new ModelRenderer(this, 0, 0); + Shape1.addBox(-7F, -7F, 4F, 1, 15, 1); + Shape1.setRotationPoint(0F, 0F, 0F); + Shape1.setTextureSize(64, 32); + Shape1.mirror = true; + setRotation(Shape1, 0F, 0F, 0F); + Shape2 = new ModelRenderer(this, 0, 0); + Shape2.addBox(6F, -7F, -5F, 1, 15, 1); + Shape2.setRotationPoint(0F, 0F, 0F); + Shape2.setTextureSize(64, 32); + Shape2.mirror = true; + setRotation(Shape2, 0F, 0F, 0F); + Shape3 = new ModelRenderer(this, 0, 0); + Shape3.addBox(-7F, -7F, -5F, 1, 15, 1); + Shape3.setRotationPoint(0F, 0F, 0F); + Shape3.setTextureSize(64, 32); + Shape3.mirror = true; + setRotation(Shape3, 0F, 0F, 0F); + Shape4 = new ModelRenderer(this, 0, 0); + Shape4.addBox(6F, -7F, 4F, 1, 15, 1); + Shape4.setRotationPoint(0F, 0F, 0F); + Shape4.setTextureSize(64, 32); + Shape4.mirror = true; + setRotation(Shape4, 0F, 0F, 0F); + Shape5 = new ModelRenderer(this, 0, 4); + Shape5.addBox(-8F, -8F, -6F, 16, 1, 12); + Shape5.setRotationPoint(0F, 0F, 0F); + Shape5.setTextureSize(64, 32); + Shape5.mirror = true; + setRotation(Shape5, 0F, 0F, 0F); + Shape6 = new ModelRenderer(this, 44, 0); + Shape6.addBox(-7F, -7F, -4F, 1, 1, 8); + Shape6.setRotationPoint(0F, 0F, 0F); + Shape6.setTextureSize(64, 32); + Shape6.mirror = true; + setRotation(Shape6, 0F, 0F, 0F); + Shape7 = new ModelRenderer(this, 44, 0); + Shape7.addBox(6F, -7F, -4F, 1, 1, 8); + Shape7.setRotationPoint(0F, 0F, 0F); + Shape7.setTextureSize(64, 32); + Shape7.mirror = true; + setRotation(Shape7, 0F, 0F, 0F); + Shape8 = new ModelRenderer(this, 44, 0); + Shape8.addBox(-7F, 4F, -4F, 1, 1, 8); + Shape8.setRotationPoint(0F, 0F, 0F); + Shape8.setTextureSize(64, 32); + Shape8.mirror = true; + setRotation(Shape8, 0F, 0F, 0F); + Shape9 = new ModelRenderer(this, 44, 0); + Shape9.addBox(6F, 4F, -4F, 1, 1, 8); + Shape9.setRotationPoint(0F, 0F, 0F); + Shape9.setTextureSize(64, 32); + Shape9.mirror = true; + setRotation(Shape9, 0F, 0F, 0F); + Shape10 = new ModelRenderer(this, 0, 17); + Shape10.addBox(-6F, -6F, -5F, 12, 1, 9); + Shape10.setRotationPoint(0F, 0F, 0F); + Shape10.setTextureSize(64, 32); + Shape10.mirror = true; + setRotation(Shape10, 0F, 0F, 0F); + Shape11 = new ModelRenderer(this, 4, 2); + Shape11.addBox(-6F, -7F, 4F, 12, 1, 1); + Shape11.setRotationPoint(0F, 0F, 0F); + Shape11.setTextureSize(64, 32); + Shape11.mirror = true; + setRotation(Shape11, 0F, 0F, 0F); + Shape12 = new ModelRenderer(this, 4, 0); + Shape12.addBox(-6F, 4F, 4F, 12, 1, 1); + Shape12.setRotationPoint(0F, 0F, 0F); + Shape12.setTextureSize(64, 32); + Shape12.mirror = true; + setRotation(Shape12, 0F, 0F, 0F); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + setRotationAngles(f, f1, f2, f3, f4, f5); + Shape1.render(f5); + Shape2.render(f5); + Shape3.render(f5); + Shape4.render(f5); + Shape5.render(f5); + Shape6.render(f5); + Shape7.render(f5); + Shape8.render(f5); + Shape9.render(f5); + Shape10.render(f5); + Shape11.render(f5); + Shape12.render(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + + public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5) { + super.setRotationAngles(f, f1, f2, f3, f4, f5, null); + } + +} diff --git a/src/main/java/jp/plusplus/fbs/block/model/ModelSpoon.class b/src/main/java/jp/plusplus/fbs/block/model/ModelSpoon.class Binary files differnew file mode 100644 index 0000000..aff3268 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/model/ModelSpoon.class diff --git a/src/main/java/jp/plusplus/fbs/block/model/ModelSpoon.java b/src/main/java/jp/plusplus/fbs/block/model/ModelSpoon.java new file mode 100644 index 0000000..893a54e --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/model/ModelSpoon.java @@ -0,0 +1,98 @@ +// Date: 2015/11/06 12:50:16 +// Template version 1.1 +// Java generated by Techne +// Keep in mind that you still need to fill in some blanks +// - ZeuX + + + + + + +package jp.plusplus.fbs.block.model; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +public class ModelSpoon extends ModelBase { + //fields + ModelRenderer Shape1; + ModelRenderer Shape2; + ModelRenderer Shape3; + ModelRenderer Shape4; + ModelRenderer Shape5; + ModelRenderer Shape6; + ModelRenderer Shape7; + + public ModelSpoon() { + textureWidth = 64; + textureHeight = 32; + + Shape1 = new ModelRenderer(this, 0, 0); + Shape1.addBox(-1F, -0.5F, -11F, 2, 1, 14); + Shape1.setRotationPoint(0F, 0F, 0F); + Shape1.setTextureSize(64, 32); + Shape1.mirror = true; + setRotation(Shape1, 0F, 0F, 0F); + Shape2 = new ModelRenderer(this, 0, 0); + Shape2.addBox(-2F, 0F, 3F, 4, 1, 1); + Shape2.setRotationPoint(0F, 0F, 0F); + Shape2.setTextureSize(64, 32); + Shape2.mirror = true; + setRotation(Shape2, 0F, 0F, 0F); + Shape3 = new ModelRenderer(this, 18, 5); + Shape3.addBox(-3F, 0.5F, 4F, 6, 1, 1); + Shape3.setRotationPoint(0F, 0F, 0F); + Shape3.setTextureSize(64, 32); + Shape3.mirror = true; + setRotation(Shape3, 0F, 0F, 0F); + Shape4 = new ModelRenderer(this, 18, 0); + Shape4.addBox(-2F, 1.5F, 5F, 4, 1, 4); + Shape4.setRotationPoint(0F, 0F, 0F); + Shape4.setTextureSize(64, 32); + Shape4.mirror = true; + setRotation(Shape4, 0F, 0F, 0F); + Shape5 = new ModelRenderer(this, 0, 2); + Shape5.addBox(-3F, 0.5F, 5F, 1, 1, 5); + Shape5.setRotationPoint(0F, 0F, 0F); + Shape5.setTextureSize(64, 32); + Shape5.mirror = true; + setRotation(Shape5, 0F, 0F, 0F); + Shape6 = new ModelRenderer(this, 0, 2); + Shape6.addBox(2F, 0.5F, 5F, 1, 1, 5); + Shape6.setRotationPoint(0F, 0F, 0F); + Shape6.setTextureSize(64, 32); + Shape6.mirror = true; + setRotation(Shape6, 0F, 0F, 0F); + Shape7 = new ModelRenderer(this, 0, 8); + Shape7.addBox(-2F, 0.5F, 9F, 4, 1, 2); + Shape7.setRotationPoint(0F, 0F, 0F); + Shape7.setTextureSize(64, 32); + Shape7.mirror = true; + setRotation(Shape7, 0F, 0F, 0F); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + setRotationAngles(f, f1, f2, f3, f4, f5); + Shape1.render(f5); + Shape2.render(f5); + Shape3.render(f5); + Shape4.render(f5); + Shape5.render(f5); + Shape6.render(f5); + Shape7.render(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + + public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5) { + super.setRotationAngles(f, f1, f2, f3, f4, f5, null); + } + +} diff --git a/src/main/java/jp/plusplus/fbs/block/render/RenderAlchemyCauldron.class b/src/main/java/jp/plusplus/fbs/block/render/RenderAlchemyCauldron.class Binary files differnew file mode 100644 index 0000000..99a999b --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/render/RenderAlchemyCauldron.class diff --git a/src/main/java/jp/plusplus/fbs/block/render/RenderAlchemyCauldron.java b/src/main/java/jp/plusplus/fbs/block/render/RenderAlchemyCauldron.java new file mode 100644 index 0000000..9c8fd60 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/render/RenderAlchemyCauldron.java @@ -0,0 +1,188 @@ +package jp.plusplus.fbs.block.render;
+
+import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.block.BlockCore;
+import jp.plusplus.fbs.block.model.ModelAlchemyCauldron;
+import jp.plusplus.fbs.model.ModelMirror;
+import mods.defeatedcrow.common.fluid.BlockCamOilFluid;
+import net.minecraft.block.Block;
+import net.minecraft.client.renderer.RenderBlocks;
+import net.minecraft.client.renderer.Tessellator;
+import net.minecraft.client.renderer.texture.TextureMap;
+import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
+import net.minecraft.init.Blocks;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.IIcon;
+import net.minecraft.util.ResourceLocation;
+import net.minecraft.world.IBlockAccess;
+import org.lwjgl.opengl.GL11;
+import org.lwjgl.opengl.GL12;
+
+/**
+ * Created by pluslus_F on 2015/09/24.
+ */
+public class RenderAlchemyCauldron extends TileEntitySpecialRenderer implements ISimpleBlockRenderingHandler {
+ public static ResourceLocation rl = new ResourceLocation(FBS.MODID + ":textures/models/AlchemyCauldron.png");
+ protected ModelAlchemyCauldron model = new ModelAlchemyCauldron();
+ float f4 = 4.0f / 16.0f;
+ float f5 = 5.0f / 16.0f;
+ float f9 = 9.0f / 16.0f;
+ float f11 = 11.0f / 16.0f;
+ float f12 = 12.0f / 16.0f;
+
+ @Override
+ public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
+ GL11.glPushMatrix();
+ GL11.glTranslatef(0.5f, 0.5f, 0.5f);
+ GL11.glRotatef(180, 0, 0, 1);
+ GL11.glRotatef(90, 0, -1, 0);
+
+ float scale = 0.0625f*0.8f;
+ GL11.glScalef(scale, scale, scale);
+
+ bindTexture(rl);
+ model.render(null, 0, 0, 0, 0, 0, 1.0f);
+ bindTexture(TextureMap.locationBlocksTexture);
+
+ GL11.glScalef(1f, 1f, 1f);
+ GL11.glPopMatrix();
+ }
+
+ @Override
+ public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
+ if (modelId == this.getRenderId()) {
+ int meta = world.getBlockMetadata(x, y, z)&7;
+
+ renderer.setOverrideBlockTexture(Blocks.brick_block.getIcon(0, 0));
+
+
+ if (meta == 0) {
+ renderer.setRenderBounds(f5, 0, f5, 1, f5, 1);
+ renderer.renderStandardBlock(block, x, y, z);
+ renderer.setRenderBounds(f5, f5, f5, f12, f9, f12);
+ renderer.renderStandardBlock(block, x, y, z);
+ } else if (meta == 1) {
+ renderer.setRenderBounds(0, 0, f5, f11, f5, 1);
+ renderer.renderStandardBlock(block, x, y, z);
+ renderer.setRenderBounds(f4, f5, f5, f11, f9, f12);
+ renderer.renderStandardBlock(block, x, y, z);
+ } else if (meta == 2) {
+ renderer.setRenderBounds(f5, 0, 0, 1, f5, f11);
+ renderer.renderStandardBlock(block, x, y, z);
+ renderer.setRenderBounds(f5, f5, f5, f12, f9, f11);
+ renderer.renderStandardBlock(block, x, y, z);
+ } else if (meta == 3) {
+ renderer.setRenderBounds(0, 0, 0, f11, f5, f11);
+ renderer.renderStandardBlock(block, x, y, z);
+ renderer.setRenderBounds(f4, f5, f5, f11, f9, f11);
+ renderer.renderStandardBlock(block, x, y, z);
+ }
+
+ renderer.setRenderBounds(0, 0, 0, 1, 1, 1);
+ renderer.clearOverrideBlockTexture();
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public boolean shouldRender3DInInventory(int modelId) {
+ return true;
+ }
+
+ @Override
+ public int getRenderId() {
+ return FBS.renderAlchemyCauldronId;
+ }
+
+ @Override
+ public void renderTileEntityAt(TileEntity te, double x, double y, double z, float p_147500_8_) {
+ int meta = te.getWorldObj().getBlockMetadata(te.xCoord, te.yCoord, te.zCoord);
+ if ((meta&7) != 0) return;
+
+ GL11.glPushMatrix();
+
+ if((meta&8)!=0){
+ GL11.glTranslatef((float) x + 0.5f, (float) y + (16.0f - 7.0f) / 16.0f, (float) z + 0.5f);
+ GL11.glRotatef(90.0f, 0, 1, 0);
+ }
+ else{
+ GL11.glTranslatef((float) x + 0.5f + 1.f, (float) y + (16.0f - 7.0f) / 16.0f, (float) z + 0.5f);
+ }
+
+ GL11.glRotatef(180.0f, 0, 0, 1);
+ float scale = 0.0625f;
+ GL11.glScalef(scale, scale, scale);
+ GL11.glEnable(GL12.GL_RESCALE_NORMAL);
+
+ this.bindTexture(rl);
+ model.render(null, 0, 0, 0, 0, 0, 1.0f);
+ GL11.glDisable(GL12.GL_RESCALE_NORMAL);
+ GL11.glPopMatrix();
+
+
+ //溜まった水の描画
+ IIcon icon = BlockCore.mana.getIcon();
+ if (icon == null) return;
+ float minU=icon.getInterpolatedU(16 * 0);
+ float maxU=icon.getInterpolatedU(16 * 1);
+ float minV=icon.getInterpolatedV(16 * 0);
+ float maxV=icon.getInterpolatedV(16 * 1);
+
+ bindTexture(TextureMap.locationBlocksTexture);
+ GL11.glPushMatrix();
+ GL11.glEnable(GL12.GL_RESCALE_NORMAL);
+ GL11.glEnable(GL11.GL_BLEND);
+ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
+ GL11.glColor4f(2.0F, 2.0F, 2.0F, 0.75F);
+ GL11.glTranslatef((float) x, (float) y, (float) z);
+ GL11.glRotatef(0.0F, 0.0F, 1.0F, 0.0F);
+
+ float height = 15.0f/16.0f;
+ Tessellator tessellator=Tessellator.instance;
+
+ //0
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(0.0f, 1.0f, 0.0f);
+ tessellator.addVertexWithUV(f5, height, f5, minU, minV);
+ tessellator.addVertexWithUV(f5, height, 1, minU, maxV);
+ tessellator.addVertexWithUV(1, height, 1, maxU, maxV);
+ tessellator.addVertexWithUV(1, height, f5, maxU, minV);
+ tessellator.draw();
+
+ //1
+ GL11.glTranslatef(1.0f, 0, 0);
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(0.0f, 1.0f, 0.0f);
+ tessellator.addVertexWithUV(0, height, f5, minU, minV);
+ tessellator.addVertexWithUV(0, height, 1, minU, maxV);
+ tessellator.addVertexWithUV(f11, height, 1, maxU, maxV);
+ tessellator.addVertexWithUV(f11, height, f5, maxU, minV);
+ tessellator.draw();
+
+ //2
+ GL11.glTranslatef(-1.0f, 0, 1);
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(0.0f, 1.0f, 0.0f);
+ tessellator.addVertexWithUV(f5, height, 0, minU, minV);
+ tessellator.addVertexWithUV(f5, height, f11, minU, maxV);
+ tessellator.addVertexWithUV(1, height, f11, maxU, maxV);
+ tessellator.addVertexWithUV(1, height, 0, maxU, minV);
+ tessellator.draw();
+
+ //3
+ GL11.glTranslatef(1.0f, 0, 0);
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(0.0f, 1.0f, 0.0f);
+ tessellator.addVertexWithUV(0, height, 0, minU, minV);
+ tessellator.addVertexWithUV(0, height, f11, minU, maxV);
+ tessellator.addVertexWithUV(f11, height, f11, maxU, maxV);
+ tessellator.addVertexWithUV(f11, height, 0, maxU, minV);
+ tessellator.draw();
+
+ GL11.glDisable(GL12.GL_RESCALE_NORMAL);
+ GL11.glDisable(GL11.GL_BLEND);
+ GL11.glPopMatrix();
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/block/render/RenderAlchemyTable.class b/src/main/java/jp/plusplus/fbs/block/render/RenderAlchemyTable.class Binary files differnew file mode 100644 index 0000000..c53632d --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/render/RenderAlchemyTable.class diff --git a/src/main/java/jp/plusplus/fbs/block/render/RenderAlchemyTable.java b/src/main/java/jp/plusplus/fbs/block/render/RenderAlchemyTable.java new file mode 100644 index 0000000..0527eb7 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/render/RenderAlchemyTable.java @@ -0,0 +1,93 @@ +package jp.plusplus.fbs.block.render;
+
+import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.block.BlockCore;
+import jp.plusplus.fbs.block.model.ModelAlchemyCauldron;
+import jp.plusplus.fbs.block.model.ModelAlchemyTable;
+import net.minecraft.block.Block;
+import net.minecraft.client.renderer.RenderBlocks;
+import net.minecraft.client.renderer.Tessellator;
+import net.minecraft.client.renderer.texture.TextureMap;
+import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
+import net.minecraft.init.Blocks;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.IIcon;
+import net.minecraft.util.ResourceLocation;
+import net.minecraft.world.IBlockAccess;
+import org.lwjgl.opengl.GL11;
+import org.lwjgl.opengl.GL12;
+
+/**
+ * Created by pluslus_F on 2015/09/25.
+ */
+public class RenderAlchemyTable extends TileEntitySpecialRenderer implements ISimpleBlockRenderingHandler {
+ public static ResourceLocation rl = new ResourceLocation(FBS.MODID + ":textures/models/AlchemyTable.png");
+ protected ModelAlchemyTable model = new ModelAlchemyTable();
+ float f4 = 4.0f / 16.0f;
+ float f5 = 5.0f / 16.0f;
+ float f9 = 9.0f / 16.0f;
+ float f11 = 11.0f / 16.0f;
+ float f12 = 12.0f / 16.0f;
+
+ @Override
+ public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
+ GL11.glPushMatrix();
+ GL11.glTranslatef(0.5f, 0.5f, 0.5f);
+ GL11.glRotatef(180, 0, 0, 1);
+ GL11.glRotatef(90, 0, -1, 0);
+
+ float scale = 0.0625f*0.8f;
+ GL11.glScalef(scale, scale, scale);
+
+ bindTexture(rl);
+ model.render(null, 0, 0, 0, 0, 0, 1.0f);
+ bindTexture(TextureMap.locationBlocksTexture);
+
+ GL11.glScalef(1f, 1f, 1f);
+ GL11.glPopMatrix();
+ }
+
+ @Override
+ public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
+ if (modelId == this.getRenderId()) {
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public boolean shouldRender3DInInventory(int modelId) {
+ return true;
+ }
+
+ @Override
+ public int getRenderId() {
+ return FBS.renderAlchemyTableId;
+ }
+
+ @Override
+ public void renderTileEntityAt(TileEntity te, double x, double y, double z, float p_147500_8_) {
+ int meta = te.getWorldObj().getBlockMetadata(te.xCoord, te.yCoord, te.zCoord);
+ if ((meta&8) != 0) return;
+
+ GL11.glPushMatrix();
+ GL11.glTranslatef((float) x + 0.5f + 1.f, (float) y + 0.5f, (float) z + 0.5f);
+ GL11.glRotatef(180.0f, 0, 0, 1);
+ float scale = 0.0625f;
+ GL11.glScalef(scale, scale, scale);
+ GL11.glEnable(GL12.GL_RESCALE_NORMAL);
+
+ switch(meta){
+ case 4: GL11.glRotatef(90, 0, -1, 0); break;
+ case 5: GL11.glRotatef(90, 0, 1, 0); break;
+ case 3: GL11.glRotatef(180, 0, -1, 0); break;
+ default: break;
+ }
+
+ this.bindTexture(rl);
+ model.render(null, 0, 0, 0, 0, 0, 1.0f);
+ GL11.glDisable(GL12.GL_RESCALE_NORMAL);
+ GL11.glPopMatrix();
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/block/render/RenderBarrier.class b/src/main/java/jp/plusplus/fbs/block/render/RenderBarrier.class Binary files differnew file mode 100644 index 0000000..1ec59e5 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/render/RenderBarrier.class diff --git a/src/main/java/jp/plusplus/fbs/block/render/RenderBarrier.java b/src/main/java/jp/plusplus/fbs/block/render/RenderBarrier.java new file mode 100644 index 0000000..9ca1dbd --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/render/RenderBarrier.java @@ -0,0 +1,106 @@ +package jp.plusplus.fbs.block.render;
+
+import codechicken.lib.render.BlockRenderer;
+import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
+import jp.plusplus.fbs.FBS;
+import net.minecraft.block.Block;
+import net.minecraft.client.renderer.RenderBlocks;
+import net.minecraft.client.renderer.Tessellator;
+import net.minecraft.util.IIcon;
+import net.minecraft.world.IBlockAccess;
+import org.lwjgl.opengl.GL11;
+import org.lwjgl.opengl.GL12;
+
+/**
+ * Created by plusplus_F on 2015/09/27.
+ */
+public class RenderBarrier implements ISimpleBlockRenderingHandler {
+ @Override
+ public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
+
+
+ if (modelId == this.getRenderId()){
+ IIcon icon=block.getIcon(0,0);
+
+ GL11.glPushMatrix();
+ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
+ GL11.glColor4f(2.0F, 2.0F, 2.0F, 0.75F);
+
+ Tessellator tessellator = Tessellator.instance;
+ block.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
+ renderer.setRenderBoundsFromBlock(block);
+ GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
+ renderer.setRenderBoundsFromBlock(block);
+
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(0.0F, -1F, 0.0F);
+ renderer.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, icon);
+ tessellator.draw();
+
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(0.0F, 1.0F, 0.0F);
+ renderer.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, icon);
+ tessellator.draw();
+
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(0.0F, 0.0F, -1F);
+ renderer.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, icon);
+ tessellator.draw();
+
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(0.0F, 0.0F, 1.0F);
+ renderer.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, icon);
+ tessellator.draw();
+
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(-1F, 0.0F, 0.0F);
+ renderer.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, icon);
+ tessellator.draw();
+
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(1.0F, 0.0F, 0.0F);
+ renderer.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, icon);
+ tessellator.draw();
+
+ GL11.glTranslatef(0.5F, 0.5F, 0.5F);
+ block.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
+ renderer.setRenderBoundsFromBlock(block);
+ GL11.glPopMatrix();
+ }
+
+ }
+
+ @Override
+ public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
+ if(modelId==getRenderId()){
+
+
+ GL11.glPushMatrix();
+ GL11.glEnable(GL12.GL_RESCALE_NORMAL);
+ GL11.glEnable(GL11.GL_BLEND);
+ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
+ GL11.glColor4f(2.0F, 2.0F, 2.0F, 0.75F);
+
+ block.setBlockBounds(0, 0, 0, 1, 1, 1);
+ renderer.setRenderBoundsFromBlock(block);
+ renderer.renderStandardBlock(block, x, y, z);
+
+ GL11.glDisable(GL12.GL_RESCALE_NORMAL);
+ GL11.glDisable(GL11.GL_BLEND);
+ GL11.glPopMatrix();
+
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public boolean shouldRender3DInInventory(int modelId) {
+ return false;
+ }
+
+ @Override
+ public int getRenderId() {
+ return FBS.renderBarrierId;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/block/render/RenderCharm.class b/src/main/java/jp/plusplus/fbs/block/render/RenderCharm.class Binary files differnew file mode 100644 index 0000000..321f200 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/render/RenderCharm.class diff --git a/src/main/java/jp/plusplus/fbs/block/render/RenderCharm.java b/src/main/java/jp/plusplus/fbs/block/render/RenderCharm.java new file mode 100644 index 0000000..2a94b0e --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/render/RenderCharm.java @@ -0,0 +1,52 @@ +package jp.plusplus.fbs.block.render;
+
+import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.block.BlockCore;
+import jp.plusplus.fbs.tileentity.TileEntityMagicCore;
+import net.minecraft.block.Block;
+import net.minecraft.client.renderer.RenderBlocks;
+import net.minecraft.client.renderer.Tessellator;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.IIcon;
+import net.minecraft.world.IBlockAccess;
+
+/**
+ * Created by pluslus_F on 2015/06/17.
+ */
+public class RenderCharm implements ISimpleBlockRenderingHandler {
+ @Override
+ public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
+
+ }
+
+ @Override
+ public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
+ if (modelId == this.getRenderId()){
+
+ if(block== BlockCore.magicCore){
+ TileEntity te=world.getTileEntity(x,y,z);
+ if(te instanceof TileEntityMagicCore){
+ if(!((TileEntityMagicCore) te).getCircleName().equals("null")) return true;
+ }
+ }
+
+ block.setBlockBounds(0, 0, 0, 1, 0.0625f, 1);
+ renderer.renderMaxY=0.01f;
+ renderer.renderStandardBlock(block, x, y, z);
+
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public boolean shouldRender3DInInventory(int modelId) {
+ return false;
+ }
+
+ @Override
+ public int getRenderId() {
+ return FBS.renderCharmId;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/block/render/RenderDecorations.class b/src/main/java/jp/plusplus/fbs/block/render/RenderDecorations.class Binary files differnew file mode 100644 index 0000000..02e79b8 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/render/RenderDecorations.class diff --git a/src/main/java/jp/plusplus/fbs/block/render/RenderDecorations.java b/src/main/java/jp/plusplus/fbs/block/render/RenderDecorations.java new file mode 100644 index 0000000..98574c2 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/render/RenderDecorations.java @@ -0,0 +1,198 @@ +package jp.plusplus.fbs.block.render;
+
+import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.block.BlockCore;
+import jp.plusplus.fbs.block.model.ModelAlchemyTable;
+import jp.plusplus.fbs.block.model.ModelBonfire;
+import jp.plusplus.fbs.block.model.ModelSchoolTable;
+import jp.plusplus.fbs.render.TessellatorWrapper;
+import net.minecraft.block.Block;
+import net.minecraft.block.BlockFire;
+import net.minecraft.client.renderer.RenderBlocks;
+import net.minecraft.client.renderer.texture.TextureMap;
+import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
+import net.minecraft.init.Blocks;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.IIcon;
+import net.minecraft.util.ResourceLocation;
+import net.minecraft.world.IBlockAccess;
+import org.lwjgl.opengl.GL11;
+import org.lwjgl.opengl.GL12;
+
+/**
+ * Created by plusplus_F on 2015/09/25.
+ */
+public class RenderDecorations extends TileEntitySpecialRenderer implements ISimpleBlockRenderingHandler {
+ public static final ResourceLocation rl0=new ResourceLocation(FBS.MODID+":textures/models/SchoolTable.png");
+ public ModelSchoolTable md0=new ModelSchoolTable();
+
+ public static final ResourceLocation rl1 = new ResourceLocation(FBS.MODID + ":textures/models/AlchemyTable.png");
+ public ModelAlchemyTable md1 = new ModelAlchemyTable();
+
+ public static final ResourceLocation rl2=new ResourceLocation(FBS.MODID+":textures/models/Bonfire.png");
+ public ModelBonfire md2=new ModelBonfire();
+
+ @Override
+ public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
+ if(getRenderId()!=modelId) return;
+ int type=getRenderType(block, metadata);
+
+ GL11.glPushMatrix();
+ GL11.glTranslatef(0.5f, 0.5f, 0.5f);
+ GL11.glRotatef(180, 0, 0, 1);
+ if(type==0) GL11.glRotatef(90, 0, 1, 0);
+ float scale = 0.0625f;
+ GL11.glScalef(scale, scale, scale);
+
+ if(type==0){
+ GL11.glTranslatef(0, 2f, 0);
+ bindTexture(rl0);
+ md0.render(null,0,0,0,0,0,1.0f);
+ }
+ else if(type==1){
+ GL11.glTranslatef(-5, 4f, 0);
+ scale=0.8f;
+ GL11.glScalef(scale, scale, scale);
+ bindTexture(rl1);
+ md1.render(null, 0, 0, 0, 0, 0, 1.0f);
+ }
+ else if(type==2){
+ //GL11.glTranslatef(-5, 4f, 0);
+ bindTexture(rl2);
+ GL11.glTranslatef(0, -16f, 0);
+ md2.render(null, 0, 0, 0, 0, 0, 1.0f);
+ }
+
+ GL11.glScalef(1f, 1f, 1f);
+ GL11.glPopMatrix();
+
+ bindTexture(TextureMap.locationBlocksTexture);
+ }
+
+ @Override
+ public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
+ if(getRenderId()==modelId){
+
+ int meta=world.getBlockMetadata(x,y,z);
+ int type=getRenderType(block, meta);
+ if(type==2 && meta>0){
+ /*
+ renderer.setOverrideBlockTexture(Blocks.fire.getIcon(0,0));
+
+ renderer.renderMinY=0;
+ renderer.renderMaxY=1;
+
+ GL11.glPushMatrix();
+
+ renderer.renderMinZ=0;
+ renderer.renderMaxZ=1;
+ renderer.renderMinX=renderer.renderMaxX=0.25;
+ renderer.renderStandardBlock(block, x, y, z);
+ renderer.renderMinX=renderer.renderMaxX=0.75;
+ renderer.renderStandardBlock(block, x, y, z);
+
+ renderer.renderMinX=0;
+ renderer.renderMaxX=1;
+ renderer.renderMinZ=renderer.renderMaxZ=0.25;
+ renderer.renderStandardBlock(block, x, y, z);
+ renderer.renderMinZ=renderer.renderMaxZ=0.75;
+ renderer.renderStandardBlock(block, x, y, z);
+
+ renderer.clearOverrideBlockTexture();
+ */
+ }
+
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public boolean shouldRender3DInInventory(int modelId) {
+ return true;
+ }
+
+ @Override
+ public int getRenderId() {
+ return FBS.renderDecorationId;
+ }
+
+ @Override
+ public void renderTileEntityAt(TileEntity te, double x, double y, double z, float p_147500_8_) {
+ int meta=te.getWorldObj().getBlockMetadata(te.xCoord, te.yCoord, te.zCoord);
+ int type=getRenderType(te.getBlockType(), meta);
+
+ GL11.glPushMatrix();
+ GL11.glTranslatef((float) x + 0.5f, (float) y + 0.5f, (float) z + 0.5f);
+ GL11.glRotatef(180.0f, 0, 0, 1);
+ float scale = 0.0625f;
+ GL11.glScalef(scale, scale, scale);
+ GL11.glEnable(GL12.GL_RESCALE_NORMAL);
+
+ if(type==0){
+ switch(meta){
+ case 4: GL11.glRotatef(90, 0, -1, 0); break;
+ case 5: GL11.glRotatef(90, 0, 1, 0); break;
+ case 3: GL11.glRotatef(180, 0, -1, 0); break;
+ default: break;
+ }
+
+ bindTexture(rl0);
+ md0.render(null, 0,0,0,0,0,1.f);
+ }
+ else if(type==1){
+ if((meta&8)==0){
+ switch(meta){
+ case 4: GL11.glRotatef(90, 0, -1, 0); break;
+ case 5: GL11.glRotatef(90, 0, 1, 0); break;
+ case 3: GL11.glRotatef(180, 0, -1, 0); break;
+ default: break;
+ }
+
+ this.bindTexture(rl1);
+ md1.render(null, 0, 0, 0, 0, 0, 1.0f);
+ }
+ }
+ else if(type==2){
+ GL11.glTranslatef(0, -16.f, 0);
+ bindTexture(rl2);
+ md2.render(null, 0,0,0,0,0,1.f);
+
+ //焔の描画
+ if(meta>0) {
+ bindTexture(TextureMap.locationBlocksTexture);
+ IIcon icon = Blocks.fire.getIcon(0, 0);
+
+ GL11.glPushMatrix();
+ GL11.glTranslatef(-4f, 16.f-3f, -4f);
+ //GL11.glScalef(0.5f, 0.5f, 0.5f);
+ float ssc=9f;
+ GL11.glScalef(ssc, ssc, ssc);
+
+ TessellatorWrapper.SetBlockRender(false);
+ TessellatorWrapper.DrawXNeg(0.25f, 0.f, 0.f, 1.f, 1.f, icon);
+ TessellatorWrapper.DrawXPos(0.25f, 0.f, 0.f, 1.f, 1.f, icon);
+ TessellatorWrapper.DrawXNeg(0.75f, 0.f, 0.f, 1.f, 1.f, icon);
+ TessellatorWrapper.DrawXPos(0.75f, 0.f, 0.f, 1.f, 1.f, icon);
+
+ TessellatorWrapper.DrawZNeg(0.f, 0.f, 0.25f, 1.f, 1.f, icon);
+ TessellatorWrapper.DrawZPos(0.f, 0.f, 0.25f, 1.f, 1.f, icon);
+ TessellatorWrapper.DrawZNeg(0.f, 0.f, 0.75f, 1.f, 1.f, icon);
+ TessellatorWrapper.DrawZPos(0.f, 0.f, 0.75f, 1.f, 1.f, icon);
+
+ GL11.glPopMatrix();
+ }
+ }
+
+ GL11.glDisable(GL12.GL_RESCALE_NORMAL);
+ GL11.glPopMatrix();
+ }
+
+ public int getRenderType(Block block, int meta){
+ if(block==BlockCore.schoolTable) return 0;
+ if(block==BlockCore.tableAlchemist) return 1;
+ if(block==BlockCore.bonfire) return 2;
+ return 0;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/block/render/RenderDirectional.class b/src/main/java/jp/plusplus/fbs/block/render/RenderDirectional.class Binary files differnew file mode 100644 index 0000000..ca922cc --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/render/RenderDirectional.class diff --git a/src/main/java/jp/plusplus/fbs/block/render/RenderDirectional.java b/src/main/java/jp/plusplus/fbs/block/render/RenderDirectional.java new file mode 100644 index 0000000..ecc5df7 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/render/RenderDirectional.java @@ -0,0 +1,99 @@ +package jp.plusplus.fbs.block.render;
+
+import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
+import jp.plusplus.fbs.FBS;
+import net.minecraft.block.Block;
+import net.minecraft.client.renderer.RenderBlocks;
+import net.minecraft.client.renderer.Tessellator;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.IIcon;
+import net.minecraft.world.IBlockAccess;
+import org.lwjgl.opengl.GL11;
+
+/**
+ * Createdby pluslus_Fon 2015/06/13.
+ */
+public class RenderDirectional implements ISimpleBlockRenderingHandler {
+
+ @Override
+ public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
+ IIcon tFront;
+ IIcon tSide;
+ IIcon tTop;
+ IIcon tBottom;
+
+ if (modelID == this.getRenderId()){
+ tFront=block.getIcon(2, 2);
+ tSide=block.getIcon(2,0);
+ tTop=block.getIcon(1,0);
+ tBottom=block.getIcon(0,0);
+
+ Tessellator tessellator = Tessellator.instance;
+ block.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
+ renderer.setRenderBoundsFromBlock(block);
+ GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
+ renderer.setRenderBoundsFromBlock(block);
+
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(0.0F, -1F, 0.0F);
+ renderer.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, tBottom);
+ tessellator.draw();
+
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(0.0F, 1.0F, 0.0F);
+ renderer.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, tTop);
+ tessellator.draw();
+
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(0.0F, 0.0F, -1F);
+ renderer.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, tFront);
+ tessellator.draw();
+
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(0.0F, 0.0F, 1.0F);
+ renderer.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, tSide);
+ tessellator.draw();
+
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(-1F, 0.0F, 0.0F);
+ renderer.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, tSide);
+ tessellator.draw();
+
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(1.0F, 0.0F, 0.0F);
+ renderer.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, tSide);
+ tessellator.draw();
+
+ GL11.glTranslatef(0.5F, 0.5F, 0.5F);
+ block.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
+ renderer.setRenderBoundsFromBlock(block);
+ }
+ }
+ @Override
+ public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
+ if (modelId == this.getRenderId()) {
+ /*
+ TileEntity te=world.getTileEntity(x,y,z);
+ if(!(te instanceof IDirectional)) return false;
+ byte side=((IDirectional)te).getSide();
+ */
+
+ block.setBlockBounds(0, 0, 0, 1, 1, 1);
+ renderer.setRenderBoundsFromBlock(block);
+ renderer.renderStandardBlock(block, x, y, z);
+
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public boolean shouldRender3DInInventory(int i) {
+ return true;
+ }
+
+ @Override
+ public int getRenderId() {
+ return FBS.renderDirectionalId;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/block/render/RenderHarvestable.class b/src/main/java/jp/plusplus/fbs/block/render/RenderHarvestable.class Binary files differnew file mode 100644 index 0000000..cf3a6be --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/render/RenderHarvestable.class diff --git a/src/main/java/jp/plusplus/fbs/block/render/RenderHarvestable.java b/src/main/java/jp/plusplus/fbs/block/render/RenderHarvestable.java new file mode 100644 index 0000000..3afccc8 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/render/RenderHarvestable.java @@ -0,0 +1,191 @@ +package jp.plusplus.fbs.block.render;
+
+import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.api.IPottery;
+import jp.plusplus.fbs.block.BlockCore;
+import jp.plusplus.fbs.block.model.ModelHerb;
+import jp.plusplus.fbs.block.model.ModelMushroom;
+import jp.plusplus.fbs.tileentity.TileEntityHavestable;
+import net.minecraft.block.Block;
+import net.minecraft.client.renderer.EntityRenderer;
+import net.minecraft.client.renderer.RenderBlocks;
+import net.minecraft.client.renderer.Tessellator;
+import net.minecraft.client.renderer.texture.TextureMap;
+import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
+import net.minecraft.init.Blocks;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.IIcon;
+import net.minecraft.util.ResourceLocation;
+import net.minecraft.world.IBlockAccess;
+import org.lwjgl.opengl.GL11;
+import org.lwjgl.opengl.GL12;
+
+/**
+ * Created by plusplus_F on 2015/11/15.
+ */
+public class RenderHarvestable extends TileEntitySpecialRenderer implements ISimpleBlockRenderingHandler {
+ public static ResourceLocation rlHerb = new ResourceLocation(FBS.MODID + ":textures/models/Herb.png");
+ protected ModelHerb[] herbs;
+
+ public static ResourceLocation rlMushroom=new ResourceLocation(FBS.MODID + ":textures/models/Mushroom.png");
+ protected ModelMushroom[] mushes;
+
+ public RenderHarvestable(){
+ herbs=new ModelHerb[9];
+ for(int i=0;i<herbs.length;i++) herbs[i]=new ModelHerb(i);
+
+ mushes=new ModelMushroom[3];
+ for(int i=0;i<mushes.length;i++) mushes[i]=new ModelMushroom(i);
+ }
+
+ @Override
+ public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
+ if(modelId!=getRenderId()) return;
+
+ GL11.glPushMatrix();
+ GL11.glTranslatef(0.5f, 1.75f, 0.5f);
+ GL11.glRotatef(180, 0, 0, 1);
+
+ float scale = 0.0625f;
+ scale*=1.25f;
+ GL11.glScalef(scale, scale, scale);
+
+ if(block==BlockCore.harvestableHerb){
+ bindTexture(rlHerb);
+ herbs[metadata].render(null, 0, 0, 0, 0, 0, 1.0f);
+ herbs[metadata].renderHerbs(1.0f);
+ }
+ else if(block==BlockCore.harvestableMushroom){
+ bindTexture(rlMushroom);
+ mushes[metadata].render(null, 0, 0, 0, 0, 0, 1.0f);
+ mushes[metadata].renderMush(1.0f);
+ }
+ else if(block==BlockCore.harvestableGrass){
+ GL11.glPopMatrix();
+ GL11.glPushMatrix();
+ Tessellator tessellator = Tessellator.instance;
+ IIcon p_147765_1_=block.getIcon(0, 0);
+
+ double p_147765_8_=0.8;
+ double d3 = (double)p_147765_1_.getMinU();
+ double d4 = (double)p_147765_1_.getMinV();
+ double d5 = (double)p_147765_1_.getMaxU();
+ double d6 = (double)p_147765_1_.getMaxV();
+ double d7 = 0.45D * (double)p_147765_8_;
+ double d8 = 0 + 0.5D - d7;
+ double d9 = 0 + 0.5D + d7;
+ double d10 = 0 + 0.5D - d7;
+ double d11 = 0 + 0.5D + d7;
+ tessellator.startDrawingQuads();
+ tessellator.addVertexWithUV(d8, (double)p_147765_8_, d10, d3, d4);
+ tessellator.addVertexWithUV(d8, 0.0D, d10, d3, d6);
+ tessellator.addVertexWithUV(d9, 0.0D, d11, d5, d6);
+ tessellator.addVertexWithUV(d9, (double)p_147765_8_, d11, d5, d4);
+ tessellator.addVertexWithUV(d9, (double)p_147765_8_, d11, d3, d4);
+ tessellator.addVertexWithUV(d9, 0.0D, d11, d3, d6);
+ tessellator.addVertexWithUV(d8, 0.0D, d10, d5, d6);
+ tessellator.addVertexWithUV(d8, (double)p_147765_8_, d10, d5, d4);
+ tessellator.addVertexWithUV(d8, (double)p_147765_8_, d11, d3, d4);
+ tessellator.addVertexWithUV(d8, 0.0D, d11, d3, d6);
+ tessellator.addVertexWithUV(d9, 0.0D, d10, d5, d6);
+ tessellator.addVertexWithUV(d9, (double)p_147765_8_, d10, d5, d4);
+ tessellator.addVertexWithUV(d9, (double)p_147765_8_, d10, d3, d4);
+ tessellator.addVertexWithUV(d9, 0.0D, d10, d3, d6);
+ tessellator.addVertexWithUV(d8, 0.0D, d11, d5, d6);
+ tessellator.addVertexWithUV(d8, (double)p_147765_8_, d11, d5, d4);
+ tessellator.draw();
+ }
+ bindTexture(TextureMap.locationBlocksTexture);
+
+ GL11.glScalef(1f, 1f, 1f);
+ GL11.glPopMatrix();
+ }
+
+ @Override
+ public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
+
+ if(modelId==getRenderId()){
+ if(block==BlockCore.harvestableGrass) {
+ Tessellator tessellator = Tessellator.instance;
+ tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z));
+ int l = block.colorMultiplier(world, x, y, z);
+ float f = (float) (l >> 16 & 255) / 255.0F;
+ float f1 = (float) (l >> 8 & 255) / 255.0F;
+ float f2 = (float) (l & 255) / 255.0F;
+
+ if (EntityRenderer.anaglyphEnable) {
+ float f3 = (f * 30.0F + f1 * 59.0F + f2 * 11.0F) / 100.0F;
+ float f4 = (f * 30.0F + f1 * 70.0F) / 100.0F;
+ float f5 = (f * 30.0F + f2 * 70.0F) / 100.0F;
+ f = f3;
+ f1 = f4;
+ f2 = f5;
+ }
+
+ tessellator.setColorOpaque_F(f, f1, f2);
+ double d1 = (double) x;
+ double d2 = (double) y;
+ double d0 = (double) z;
+ long i1;
+
+ i1 = (long) (x * 3129871) ^ (long) y * 116129781L ^ (long) z;
+ i1 = i1 * i1 * 42317861L + i1 * 11L;
+ d1 += ((double) ((float) (i1 >> 16 & 15L) / 15.0F) - 0.5D) * 0.5D;
+ d2 += ((double) ((float) (i1 >> 20 & 15L) / 15.0F) - 1.0D) * 0.2D;
+ d0 += ((double) ((float) (i1 >> 24 & 15L) / 15.0F) - 0.5D) * 0.5D;
+
+ IIcon iicon = block.getIcon(world, x, y, z, 0);
+ RenderBlocks.getInstance().drawCrossedSquares(iicon, d1, d2, d0, 1.0F);
+ }
+ return true;
+ }
+
+ return false;
+ }
+
+ @Override
+ public boolean shouldRender3DInInventory(int modelId) {
+ return true;
+ }
+
+ @Override
+ public int getRenderId() {
+ return FBS.renderHerbId;
+ }
+
+ @Override
+ public void renderTileEntityAt(TileEntity te, double x, double y, double z, float p_147500_8_) {
+ int meta = te.getWorldObj().getBlockMetadata(te.xCoord, te.yCoord, te.zCoord);
+ GL11.glPushMatrix();
+ GL11.glTranslatef((float) x + 0.5f, (float) y + 1+0.5f, (float) z + 0.5f);
+
+ GL11.glRotatef(180.0f, 0, 0, 1);
+ float scale = 0.0625f;
+ GL11.glScalef(scale, scale, scale);
+ GL11.glEnable(GL12.GL_RESCALE_NORMAL);
+
+ if(te instanceof TileEntityHavestable){
+ Block b=te.getBlockType();
+ TileEntityHavestable teh=(TileEntityHavestable) te;
+
+ if(b==BlockCore.harvestableHerb){
+ this.bindTexture(rlHerb);
+ herbs[meta].render(null, 0, 0, 0, 0, 0, 1.0f);
+ if(teh.canHarvest()){
+ herbs[meta].renderHerbs(1.0f);
+ }
+ }
+ else if(b==BlockCore.harvestableMushroom){
+ this.bindTexture(rlMushroom);
+ mushes[meta].render(null, 0, 0, 0, 0, 0, 1.0f);
+ if(teh.canHarvest()){
+ mushes[meta].renderMush(1.0f);
+ }
+ }
+ }
+
+ GL11.glDisable(GL12.GL_RESCALE_NORMAL);
+ GL11.glPopMatrix();
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/block/render/RenderMirror.class b/src/main/java/jp/plusplus/fbs/block/render/RenderMirror.class Binary files differnew file mode 100644 index 0000000..ae647d1 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/render/RenderMirror.class diff --git a/src/main/java/jp/plusplus/fbs/block/render/RenderMirror.java b/src/main/java/jp/plusplus/fbs/block/render/RenderMirror.java new file mode 100644 index 0000000..bbab4ab --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/render/RenderMirror.java @@ -0,0 +1,76 @@ +package jp.plusplus.fbs.block.render;
+
+import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.model.ModelMirror;
+import net.minecraft.block.Block;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.renderer.RenderBlocks;
+import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.ResourceLocation;
+import net.minecraft.world.IBlockAccess;
+import net.minecraftforge.common.util.ForgeDirection;
+import org.lwjgl.opengl.GL11;
+import shift.sextiarysector.renderer.model.ModelWindmill;
+import shift.sextiarysector.tileentity.TileEntityWindmill;
+
+/**
+ * Created by pluslus_F on 2015/06/24.
+ */
+public class RenderMirror extends TileEntitySpecialRenderer implements ISimpleBlockRenderingHandler {
+ public static ResourceLocation rl=new ResourceLocation(FBS.MODID+":textures/entity/mirror.png");
+ protected ModelMirror model=new ModelMirror();
+
+ @Override
+ public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
+
+ }
+
+ @Override
+ public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
+ if (modelId == this.getRenderId()){
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public boolean shouldRender3DInInventory(int modelId) {
+ return false;
+ }
+
+ @Override
+ public int getRenderId() {
+ return FBS.renderMirrorId;
+ }
+
+ @Override
+ public void renderTileEntityAt(TileEntity te, double x, double y, double z, float p_147500_8_) {
+ int dir=te.getBlockMetadata();
+ if((dir&8)!=0) return;
+
+ GL11.glPushMatrix();
+ GL11.glTranslatef((float)x+0.5f, (float)y, (float)z+0.5f);
+ float scale = 0.0625f;
+ GL11.glScalef(scale,scale,scale);
+
+ switch(dir){
+ case 5:
+ GL11.glRotatef(90, 0, 1, 0);
+ break;
+ case 4:
+ GL11.glRotatef(90, 0, -1, 0);
+ break;
+ case 2:
+ GL11.glRotatef(180, 0, 1, 0);
+ break;
+ default:
+ break;
+ }
+
+ this.bindTexture(rl);
+ model.render(null, 0,0,0, 0,0, 1.0f);
+ GL11.glPopMatrix();
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/block/render/RenderPortalWarp.class b/src/main/java/jp/plusplus/fbs/block/render/RenderPortalWarp.class Binary files differnew file mode 100644 index 0000000..8bec72d --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/render/RenderPortalWarp.class diff --git a/src/main/java/jp/plusplus/fbs/block/render/RenderPortalWarp.java b/src/main/java/jp/plusplus/fbs/block/render/RenderPortalWarp.java new file mode 100644 index 0000000..160a554 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/block/render/RenderPortalWarp.java @@ -0,0 +1,46 @@ +package jp.plusplus.fbs.block.render;
+
+import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
+import jp.plusplus.fbs.FBS;
+import net.minecraft.block.Block;
+import net.minecraft.client.renderer.RenderBlocks;
+import net.minecraft.world.IBlockAccess;
+
+/**
+ * Created by plusplus_F on 2015/10/28.
+ */
+public class RenderPortalWarp implements ISimpleBlockRenderingHandler {
+ @Override
+ public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
+
+ }
+
+ @Override
+ public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
+ if(modelId==getRenderId()){
+ int meta=world.getBlockMetadata(x,y,z);
+ if((meta&8)!=0){
+ renderer.setRenderBounds(0.5,0,0,0.5,1,1);
+ }
+ else{
+ renderer.setRenderBounds(0,0,0.5,1,1,0.5);
+ }
+
+ renderer.renderStandardBlock(block, x,y,z);
+
+ renderer.setRenderBounds(0,0,0,1,1,1);
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public boolean shouldRender3DInInventory(int modelId) {
+ return false;
+ }
+
+ @Override
+ public int getRenderId() {
+ return FBS.renderPortalWarpId;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/command/CommandGetBook.class b/src/main/java/jp/plusplus/fbs/command/CommandGetBook.class Binary files differnew file mode 100644 index 0000000..8dcc11c --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/command/CommandGetBook.class diff --git a/src/main/java/jp/plusplus/fbs/command/CommandGetBook.java b/src/main/java/jp/plusplus/fbs/command/CommandGetBook.java new file mode 100644 index 0000000..e45875d --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/command/CommandGetBook.java @@ -0,0 +1,49 @@ +package jp.plusplus.fbs.command;
+
+import jp.plusplus.fbs.Registry;
+import jp.plusplus.fbs.api.FBSEntityPropertiesAPI;
+import net.minecraft.command.CommandBase;
+import net.minecraft.command.CommandException;
+import net.minecraft.command.ICommandSender;
+import net.minecraft.command.WrongUsageException;
+import net.minecraft.entity.item.EntityItem;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.world.World;
+
+/**
+ * Created by plusplus_F on 2016/03/01.
+ */
+public class CommandGetBook extends CommandBase {
+ @Override
+ public String getCommandName() {
+ return "givebook";
+ }
+
+ @Override
+ public String getCommandUsage(ICommandSender p_71518_1_) {
+ return "commands.fbs.getbook.usage";
+ }
+
+ @Override
+ public void processCommand(ICommandSender p_71515_1_, String[] p_71515_2_) {
+ if (p_71515_2_.length >= 2) {
+ World w = p_71515_1_.getEntityWorld();
+ EntityPlayer ep = w.getPlayerEntityByName(p_71515_2_[0]);
+ if (ep == null) new CommandException("commands.generic.player.notFound", new Object[1]);
+
+ String name=p_71515_2_[1];
+ ItemStack itemStack= Registry.GetBookItemStack(name);
+ if(itemStack==null){
+ new CommandException("commands.fbs.getbook.notFound", new Object[1]);
+ }
+
+ EntityItem entityitem = ep.dropPlayerItemWithRandomChoice(itemStack, false);
+ entityitem.delayBeforeCanPickup = 0;
+ entityitem.func_145797_a(ep.getCommandSenderName());
+ func_152373_a(p_71515_1_, this, "commands.give.success", new Object[] {itemStack.func_151000_E(), 1, ep.getCommandSenderName()});
+ } else {
+ throw new WrongUsageException("commands.fbs.getbook.usage", new Object[0]);
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/command/CommandGetSpirit.class b/src/main/java/jp/plusplus/fbs/command/CommandGetSpirit.class Binary files differnew file mode 100644 index 0000000..a65e9c8 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/command/CommandGetSpirit.class diff --git a/src/main/java/jp/plusplus/fbs/command/CommandGetSpirit.java b/src/main/java/jp/plusplus/fbs/command/CommandGetSpirit.java new file mode 100644 index 0000000..65d7df0 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/command/CommandGetSpirit.java @@ -0,0 +1,65 @@ +package jp.plusplus.fbs.command;
+
+import jp.plusplus.fbs.Registry;
+import jp.plusplus.fbs.spirit.SpiritManager;
+import jp.plusplus.fbs.spirit.SpiritStatus;
+import net.minecraft.command.*;
+import net.minecraft.entity.item.EntityItem;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.world.World;
+
+/**
+ * Created by plusplus_F on 2016/03/01.
+ */
+public class CommandGetSpirit extends CommandBase {
+ @Override
+ public String getCommandName() {
+ return "givespirit";
+ }
+
+ @Override
+ public String getCommandUsage(ICommandSender p_71518_1_) {
+ return "commands.fbs.getspirit.usage";
+ }
+
+ @Override
+ public void processCommand(ICommandSender p_71515_1_, String[] p_71515_2_) {
+ if (p_71515_2_.length >= 3) {
+ World w = p_71515_1_.getEntityWorld();
+ EntityPlayer ep = w.getPlayerEntityByName(p_71515_2_[0]);
+ if (ep == null) new CommandException("commands.generic.player.notFound", new Object[1]);
+
+ Item item=(Item)Item.itemRegistry.getObject(p_71515_2_[1]);
+ if(item==null){
+ throw new CommandException("commands.fbs.getspirit.notFound", new Object[1]);
+ }
+
+ SpiritManager.ToolEntry te=SpiritManager.getTool(item);
+ if(te==null){
+ throw new CommandException("commands.fbs.getspirit.notFound2", new Object[1]);
+ }
+
+ boolean male=ep.worldObj.rand.nextBoolean();
+ if(p_71515_2_.length>=4){
+ if(p_71515_2_[3].equals("male")) male=true;
+ else if(p_71515_2_[3].equals("female")) male=false;
+ else throw new WrongUsageException("commands.fbs.getspirit.usage", new Object[0]);
+ }
+
+ ItemStack itemStack=te.getSpiritToolStack(male, SpiritManager.getRandomCharacter(male), p_71515_2_[2], ep, new ItemStack(item));
+ if(itemStack!=null){
+ EntityItem entityitem = ep.dropPlayerItemWithRandomChoice(itemStack, false);
+ entityitem.delayBeforeCanPickup = 0;
+ entityitem.func_145797_a(ep.getCommandSenderName());
+ func_152373_a(p_71515_1_, this, "commands.give.success", new Object[] {itemStack.func_151000_E(), 1, ep.getCommandSenderName()});
+
+ SpiritStatus status=SpiritStatus.readFromNBT(itemStack.getTagCompound());
+ SpiritManager.talk(ep, status.getCharacter(), "first", itemStack);
+ }
+ } else {
+ throw new WrongUsageException("commands.fbs.getspirit.usage", new Object[0]);
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/command/CommandMagicExp.class b/src/main/java/jp/plusplus/fbs/command/CommandMagicExp.class Binary files differnew file mode 100644 index 0000000..7e87e36 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/command/CommandMagicExp.class diff --git a/src/main/java/jp/plusplus/fbs/command/CommandMagicExp.java b/src/main/java/jp/plusplus/fbs/command/CommandMagicExp.java new file mode 100644 index 0000000..af38ea8 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/command/CommandMagicExp.java @@ -0,0 +1,47 @@ +package jp.plusplus.fbs.command;
+
+import jp.plusplus.fbs.api.FBSEntityPropertiesAPI;
+import net.minecraft.command.CommandBase;
+import net.minecraft.command.CommandException;
+import net.minecraft.command.ICommandSender;
+import net.minecraft.command.WrongUsageException;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.world.World;
+
+/**
+ * Created by plusplus_F on 2016/03/01.
+ */
+public class CommandMagicExp extends CommandBase {
+ @Override
+ public String getCommandName() {
+ return "mexp";
+ }
+
+ @Override
+ public String getCommandUsage(ICommandSender p_71518_1_) {
+ return "commands.fbs.mexp.usage";
+ }
+
+ @Override
+ public void processCommand(ICommandSender p_71515_1_, String[] p_71515_2_) {
+ if (p_71515_2_.length >= 3) {
+ World w = p_71515_1_.getEntityWorld();
+ EntityPlayer ep = w.getPlayerEntityByName(p_71515_2_[0]);
+ if (ep == null) new CommandException("commands.generic.player.notFound", new Object[1]);
+
+ double t = 0;
+
+ try {
+ t = Double.parseDouble(p_71515_2_[1]);
+ } catch (Exception e) {
+ throw new CommandException("commands.generic.num.invalid", new Object[]{t});
+ }
+ if (t < 1) throw new CommandException("commands.generic.double.tooSmall", new Object[]{t, 1});
+
+ FBSEntityPropertiesAPI.AddExp(ep, t, true);
+
+ } else {
+ throw new WrongUsageException("commands.fbs.mexp.usage", new Object[0]);
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/command/CommandMagicLevel.class b/src/main/java/jp/plusplus/fbs/command/CommandMagicLevel.class Binary files differnew file mode 100644 index 0000000..b80a0ed --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/command/CommandMagicLevel.class diff --git a/src/main/java/jp/plusplus/fbs/command/CommandMagicLevel.java b/src/main/java/jp/plusplus/fbs/command/CommandMagicLevel.java new file mode 100644 index 0000000..0976982 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/command/CommandMagicLevel.java @@ -0,0 +1,50 @@ +package jp.plusplus.fbs.command;
+
+import jp.plusplus.fbs.api.FBSEntityPropertiesAPI;
+import net.minecraft.command.CommandBase;
+import net.minecraft.command.CommandException;
+import net.minecraft.command.ICommandSender;
+import net.minecraft.command.WrongUsageException;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.world.World;
+
+/**
+ * Created by plusplus_F on 2016/03/01.
+ */
+public class CommandMagicLevel extends CommandBase {
+ @Override
+ public String getCommandName() {
+ return "mlevel";
+ }
+
+ @Override
+ public String getCommandUsage(ICommandSender p_71518_1_) {
+ return "commands.fbs.mlevel.usage";
+ }
+
+ @Override
+ public void processCommand(ICommandSender p_71515_1_, String[] p_71515_2_) {
+ if (p_71515_2_.length >= 3) {
+ World w = p_71515_1_.getEntityWorld();
+ EntityPlayer ep = w.getPlayerEntityByName(p_71515_2_[1]);
+ if (ep == null) new CommandException("commands.generic.player.notFound", new Object[1]);
+
+ String mode = p_71515_2_[0];
+ int t = 0;
+
+ try {
+ t = Integer.parseInt(p_71515_2_[2]);
+ } catch (Exception e) {
+ throw new CommandException("commands.generic.num.invalid", new Object[]{t});
+ }
+ if (t < 1) throw new CommandException("commands.generic.num.tooSmall", new Object[]{t, 1});
+
+ if (mode.equals("set")) FBSEntityPropertiesAPI.SetMagicLevel(ep, t);
+ else if (mode.equals("add")) FBSEntityPropertiesAPI.SetMagicLevel(ep, FBSEntityPropertiesAPI.GetMagicLevelRaw(ep)+t);
+ else new WrongUsageException("commands.fbs.mlevel.usage", new Object[0]);
+
+ } else {
+ throw new WrongUsageException("commands.fbs.mlevel.usage", new Object[0]);
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/command/CommandSanityPoint.class b/src/main/java/jp/plusplus/fbs/command/CommandSanityPoint.class Binary files differnew file mode 100644 index 0000000..88c5568 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/command/CommandSanityPoint.class diff --git a/src/main/java/jp/plusplus/fbs/command/CommandSanityPoint.java b/src/main/java/jp/plusplus/fbs/command/CommandSanityPoint.java new file mode 100644 index 0000000..3922d60 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/command/CommandSanityPoint.java @@ -0,0 +1,54 @@ +package jp.plusplus.fbs.command;
+
+import jp.plusplus.fbs.api.FBSEntityPropertiesAPI;
+import net.minecraft.command.*;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.world.World;
+
+/**
+ * Created by plusplus_F on 2016/03/01.
+ */
+public class CommandSanityPoint extends CommandBase {
+ @Override
+ public String getCommandName() {
+ return "sanity";
+ }
+
+ @Override
+ public String getCommandUsage(ICommandSender p_71518_1_) {
+ return "commands.fbs.sanity.usage";
+ }
+
+ @Override
+ public void processCommand(ICommandSender p_71515_1_, String[] p_71515_2_) {
+ if (p_71515_2_.length >= 4) {
+ World w = p_71515_1_.getEntityWorld();
+ EntityPlayer ep = w.getPlayerEntityByName(p_71515_2_[1]);
+ if(ep==null) new CommandException("commands.generic.player.notFound", new Object[0]);
+
+ String mode = p_71515_2_[0];
+ int t = 0, m = 0;
+
+ try {
+ t = Integer.parseInt(p_71515_2_[2]);
+ }catch (Exception e) {
+ throw new CommandException("commands.generic.num.invalid", new Object[]{t});
+ }
+ try {
+ m = Integer.parseInt(p_71515_2_[3]);
+ } catch (Exception e) {
+ throw new CommandException("commands.generic.num.invalid", new Object[]{m});
+ }
+
+ if (t <= 0) throw new CommandException("commands.generic.num.tooSmall", new Object[]{t, 1});
+ if (m <= 0) throw new CommandException("commands.generic.num.tooSmall", new Object[]{m, 1});
+
+ if (mode.equals("lose")) FBSEntityPropertiesAPI.LoseSanity(ep, t, m, true);
+ else if (mode.equals("add")) FBSEntityPropertiesAPI.LoseSanity(ep, t, m, true);
+ else new WrongUsageException("commands.fbs.sanity.usage", new Object[0]);
+
+ } else {
+ throw new WrongUsageException("commands.fbs.sanity.usage", new Object[0]);
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/command/CommandWish.class b/src/main/java/jp/plusplus/fbs/command/CommandWish.class Binary files differnew file mode 100644 index 0000000..1f6c6f4 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/command/CommandWish.class diff --git a/src/main/java/jp/plusplus/fbs/command/CommandWish.java b/src/main/java/jp/plusplus/fbs/command/CommandWish.java new file mode 100644 index 0000000..846f5ed --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/command/CommandWish.java @@ -0,0 +1,50 @@ +package jp.plusplus.fbs.command;
+
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.event.wish.WishHandler;
+import jp.plusplus.fbs.spirit.SpiritManager;
+import jp.plusplus.fbs.spirit.SpiritStatus;
+import net.minecraft.command.CommandBase;
+import net.minecraft.command.CommandException;
+import net.minecraft.command.ICommandSender;
+import net.minecraft.command.WrongUsageException;
+import net.minecraft.entity.item.EntityItem;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.MathHelper;
+import net.minecraft.world.World;
+
+/**
+ * Created by plusplus_F on 2016/03/31.
+ */
+public class CommandWish extends CommandBase {
+ @Override
+ public String getCommandName() {
+ return "wish";
+ }
+
+ @Override
+ public String getCommandUsage(ICommandSender p_71518_1_) {
+ return "commands.fbs.wish.usage";
+ }
+
+ @Override
+ public void processCommand(ICommandSender p_71515_1_, String[] p_71515_2_) {
+ World w = p_71515_1_.getEntityWorld();
+
+ if (p_71515_2_.length >= 2) {
+ EntityPlayer ep = w.getPlayerEntityByName(p_71515_2_[0]);
+ if (ep == null) new CommandException("commands.generic.player.notFound", new Object[1]);
+ WishHandler.handleWish(ep, p_71515_2_[1]);
+ }
+ else if (p_71515_2_.length == 1){
+ EntityPlayer ep = w.getPlayerEntityByName(p_71515_2_[0]);
+ if (ep == null) new CommandException("commands.generic.player.notFound", new Object[1]);
+ ep.openGui(FBS.instance, FBS.GUI_WISH_ID, w, MathHelper.floor_double(ep.posX), MathHelper.floor_double(ep.posY), MathHelper.floor_double(ep.posZ));
+ }
+ else {
+ throw new WrongUsageException("commands.fbs.wish.usage", new Object[0]);
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/container/ContainerAlchemyCauldron.class b/src/main/java/jp/plusplus/fbs/container/ContainerAlchemyCauldron.class Binary files differnew file mode 100644 index 0000000..5ff1439 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/ContainerAlchemyCauldron.class diff --git a/src/main/java/jp/plusplus/fbs/container/ContainerAlchemyCauldron.java b/src/main/java/jp/plusplus/fbs/container/ContainerAlchemyCauldron.java new file mode 100644 index 0000000..af7e083 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/ContainerAlchemyCauldron.java @@ -0,0 +1,68 @@ +package jp.plusplus.fbs.container;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.container.slot.SlotTakeOnlyWithMagicEXP;
+import jp.plusplus.fbs.tileentity.TileEntityAlchemyCauldron;
+import jp.plusplus.fbs.tileentity.TileEntityExtractingFurnace;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.Container;
+import net.minecraft.inventory.ICrafting;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.fluids.FluidStack;
+
+/**
+ * Createdby pluslus_Fon 2015/06/08.
+ */
+public class ContainerAlchemyCauldron extends Container {
+ public TileEntityAlchemyCauldron entity;
+ public EntityPlayer player;
+
+ public ContainerAlchemyCauldron(EntityPlayer player, TileEntityAlchemyCauldron tileEntity) {
+ this.entity = tileEntity;
+ this.player=player;
+
+ //inventory's inventory
+ this.addSlotToContainer(new Slot(this.entity, 0, 26, 19));
+ this.addSlotToContainer(new SlotTakeOnlyWithMagicEXP(player, this.entity, 1, 134, 39, 1));
+ this.addSlotToContainer(new Slot(this.entity, 2, 8, 19));
+
+ //player inventory
+ for (int i = 0; i < 3; i++) {
+ for (int j = 0; j < 9; j++) {
+ this.addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 119 + i * 18));
+ }
+ }
+
+ //player slots
+ for (int i = 0; i < 9; i++) {
+ this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 177));
+ }
+ }
+
+ @Override
+ public void addCraftingToCrafters(ICrafting par1ICrafting) {
+ super.addCraftingToCrafters(par1ICrafting);
+ }
+ @Override
+ public void detectAndSendChanges() {
+ super.detectAndSendChanges();
+ }
+
+ @Override
+ public boolean canInteractWith(EntityPlayer entityPlayer) {
+ return entity.isUseableByPlayer(entityPlayer);
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void updateProgressBar(int par1, int par2) {}
+
+ @Override
+ public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) {
+ ItemStack itemStack = null;
+ Slot slot = (Slot) this.inventorySlots.get(par2);
+ return itemStack;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/container/ContainerBasket.class b/src/main/java/jp/plusplus/fbs/container/ContainerBasket.class Binary files differnew file mode 100644 index 0000000..741d884 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/ContainerBasket.class diff --git a/src/main/java/jp/plusplus/fbs/container/ContainerBasket.java b/src/main/java/jp/plusplus/fbs/container/ContainerBasket.java new file mode 100644 index 0000000..86b38f1 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/ContainerBasket.java @@ -0,0 +1,93 @@ +package jp.plusplus.fbs.container;
+
+import jp.plusplus.fbs.container.inventory.InventoryBasket;
+import jp.plusplus.fbs.container.slot.SlotInventory;
+import jp.plusplus.fbs.container.slot.SlotShowOnly;
+import jp.plusplus.fbs.item.ItemCore;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.inventory.Container;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+
+/**
+ * Created by plusplus_F on 2015/11/11.
+ */
+public class ContainerBasket extends Container {
+ private InventoryBasket inventory;
+
+ public ContainerBasket(InventoryPlayer inventoryPlayer) {
+ inventory = new InventoryBasket(inventoryPlayer);
+ inventory.openInventory();
+
+ for (int i = 0; i < inventory.getSizeInventory(); i++) {
+ this.addSlotToContainer(new SlotInventory(inventory, i, 8 + (i % 9) * 18, 18 + (i / 9) * 18, 3));
+ }
+
+ //player inventory
+ for (int i = 0; i < 3; i++) {
+ for (int j = 0; j < 9; j++) {
+ ItemStack item = inventoryPlayer.getStackInSlot(j + i * 9 + 9);
+ if (item != null && item.getItem() == ItemCore.basket) {
+ this.addSlotToContainer(new SlotShowOnly(inventoryPlayer, j + i * 9 + 9, 8 + j * 18, 140 + i * 18));
+ } else {
+ this.addSlotToContainer(new Slot(inventoryPlayer, j + i * 9 + 9, 8 + j * 18, 140 + i * 18));
+ }
+ }
+ }
+
+ //player slots
+ for (int i = 0; i < 9; i++) {
+ ItemStack item = inventoryPlayer.getStackInSlot(i);
+ if (item != null && item.getItem() == ItemCore.basket) {
+ this.addSlotToContainer(new SlotShowOnly(inventoryPlayer, i, 8 + i * 18, 198));
+ } else {
+ this.addSlotToContainer(new Slot(inventoryPlayer, i, 8 + i * 18, 198));
+ }
+ }
+ }
+
+ @Override
+ public boolean canInteractWith(EntityPlayer p_75145_1_) {
+ return true;
+ }
+
+ @Override
+ public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int p_82846_2_) {
+ ItemStack itemstack = null;
+ Slot slot = (Slot) this.inventorySlots.get(p_82846_2_);
+
+ if (slot != null && slot.getHasStack()) {
+ ItemStack itemstack1 = slot.getStack();
+ itemstack = itemstack1.copy();
+
+ if(slot.getStack()==null || slot.getStack().getItem() == ItemCore.basket){
+ return null;
+ }
+ else if (p_82846_2_ < this.inventory.getSizeInventory()) {
+ if (!this.mergeItemStack(itemstack1, this.inventory.getSizeInventory(), this.inventorySlots.size(), true)) {
+ return null;
+ }
+ }
+ else if(!inventory.isItemValidForSlot(p_82846_2_, itemstack)){
+ return null;
+ }
+ else if (!this.mergeItemStack(itemstack1, 0, this.inventory.getSizeInventory(), false)) {
+ return null;
+ }
+ if (itemstack1.stackSize == 0) {
+ slot.putStack((ItemStack) null);
+ } else {
+ slot.onSlotChanged();
+ }
+ }
+
+ return itemstack;
+ }
+
+ @Override
+ public void onContainerClosed(EntityPlayer p_75134_1_) {
+ super.onContainerClosed(p_75134_1_);
+ this.inventory.closeInventory();
+ }
+}
\ No newline at end of file diff --git a/src/main/java/jp/plusplus/fbs/container/ContainerBonfire.class b/src/main/java/jp/plusplus/fbs/container/ContainerBonfire.class Binary files differnew file mode 100644 index 0000000..3c78925 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/ContainerBonfire.class diff --git a/src/main/java/jp/plusplus/fbs/container/ContainerBonfire.java b/src/main/java/jp/plusplus/fbs/container/ContainerBonfire.java new file mode 100644 index 0000000..076187a --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/ContainerBonfire.java @@ -0,0 +1,56 @@ +package jp.plusplus.fbs.container;
+
+import jp.plusplus.fbs.container.inventory.InventoryBonfire;
+import jp.plusplus.fbs.container.slot.SlotBonfire;
+import jp.plusplus.fbs.container.slot.SlotInventory;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.Container;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+
+/**
+ * Created by plusplus_F on 2015/10/19.
+ */
+public class ContainerBonfire extends Container {
+ public InventoryBonfire inventory;
+
+ public ContainerBonfire(int x, int y, int z, EntityPlayer player){
+ inventory=new InventoryBonfire(x,y,z,player);
+ inventory.openInventory();
+
+ addSlotToContainer(new SlotBonfire(inventory, 0, 80, 21, 0));
+ for(int i=0;i<3;i++){
+ addSlotToContainer(new SlotBonfire(inventory, i+1, 62+18*i, 43, 1));
+ }
+
+ //player's inv
+ for (int j = 0; j < 3; ++j) {
+ for (int k = 0; k < 9; ++k) {
+ this.addSlotToContainer(new SlotInventory(player.inventory, k + j * 9 + 9, 8 + k * 18, 84 + j * 18, 2));
+ }
+ }
+
+ for (int j = 0; j < 9; ++j) {
+ this.addSlotToContainer(new SlotInventory(player.inventory, j, 8 + j * 18, 142, 2));
+ }
+ }
+
+ @Override
+ public boolean canInteractWith(EntityPlayer p_75145_1_) {
+ return inventory.isUseableByPlayer(p_75145_1_);
+ }
+
+ @Override
+ public void onContainerClosed(EntityPlayer p_75134_1_) {
+ super.onContainerClosed(p_75134_1_);
+ this.inventory.closeInventory();
+ }
+
+
+ @Override
+ public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int p_82846_2_) {
+ ItemStack itemstack = null;
+ return itemstack;
+ }
+
+}
diff --git a/src/main/java/jp/plusplus/fbs/container/ContainerContract.class b/src/main/java/jp/plusplus/fbs/container/ContainerContract.class Binary files differnew file mode 100644 index 0000000..a8f98cc --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/ContainerContract.class diff --git a/src/main/java/jp/plusplus/fbs/container/ContainerContract.java b/src/main/java/jp/plusplus/fbs/container/ContainerContract.java new file mode 100644 index 0000000..56a431b --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/ContainerContract.java @@ -0,0 +1,91 @@ +package jp.plusplus.fbs.container;
+
+import jp.plusplus.fbs.AchievementRegistry;
+import jp.plusplus.fbs.Registry;
+import jp.plusplus.fbs.container.inventory.InventoryContract;
+import jp.plusplus.fbs.container.slot.SlotBonfire;
+import jp.plusplus.fbs.container.slot.SlotContract;
+import jp.plusplus.fbs.container.slot.SlotInventory;
+import jp.plusplus.fbs.container.slot.SlotTakeOnly;
+import jp.plusplus.fbs.item.ItemBookSorcery;
+import jp.plusplus.fbs.item.ItemStoneSpirit;
+import jp.plusplus.fbs.spirit.SpiritManager;
+import jp.plusplus.fbs.spirit.SpiritStatus;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.Container;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+
+/**
+ * Created by plusplus_F on 2015/11/14.
+ */
+public class ContainerContract extends Container {
+ public EntityPlayer player;
+ public InventoryContract inventory;
+
+ public ContainerContract(EntityPlayer player){
+ inventory=new InventoryContract(player);
+ inventory.openInventory();
+
+ for(int i=0;i<2;i++){
+ addSlotToContainer(new SlotContract(inventory, i, 26+18*i, 46, i));
+ }
+ addSlotToContainer(new SlotContract(inventory, 2, 98, 23, 2));
+ addSlotToContainer(new SlotTakeOnly(inventory, 3, 133, 40));
+
+ //player's inv
+ for (int j = 0; j < 3; ++j) {
+ for (int k = 0; k < 9; ++k) {
+ this.addSlotToContainer(new SlotInventory(player.inventory, k + j * 9 + 9, 8 + k * 18, 84 + j * 18, 2));
+ }
+ }
+
+ for (int j = 0; j < 9; ++j) {
+ this.addSlotToContainer(new SlotInventory(player.inventory, j, 8 + j * 18, 142, 2));
+ }
+ }
+
+ @Override
+ public boolean canInteractWith(EntityPlayer p_75145_1_) {
+ return true;
+ }
+
+ @Override
+ public void onContainerClosed(EntityPlayer p_75134_1_) {
+ super.onContainerClosed(p_75134_1_);
+ this.inventory.closeInventory();
+ }
+
+ public boolean canContract(){
+ if(inventory.itemStacks[0]==null || !SpiritManager.isTool(inventory.itemStacks[0].getItem())) return false;
+ if(inventory.itemStacks[1]==null || !(inventory.itemStacks[1].getItem() instanceof ItemStoneSpirit)) return false;
+ if(inventory.itemStacks[2]==null) return false;
+ Registry.BookData bd=Registry.GetBookDataFromItemStack(inventory.itemStacks[2]);
+ return bd!=null && bd.title.equals("fbs.contract") && ItemBookSorcery.getMagicMaxUse(inventory.itemStacks[2])>0 && inventory.itemStacks[3]==null;
+ }
+
+ public String contract(String name, EntityPlayer player){
+ if(!canContract()) return null;
+ SpiritManager.ToolEntry te=SpiritManager.getTool(inventory.itemStacks[0].getItem());
+ if(te!=null){
+ boolean m=((ItemStoneSpirit)inventory.itemStacks[1].getItem()).getSex();
+ inventory.setInventorySlotContents(3, te.getSpiritToolStack(m, SpiritManager.getRandomCharacter(m), name, player, inventory.itemStacks[0]));
+ inventory.setInventorySlotContents(0, null);
+ inventory.setInventorySlotContents(1, null);
+ ItemBookSorcery.reduceMagicMaxUse(inventory.itemStacks[2]);
+
+ if(!player.worldObj.isRemote) player.triggerAchievement(AchievementRegistry.contract);
+
+ SpiritStatus status=SpiritStatus.readFromNBT(inventory.itemStacks[3].getTagCompound());
+ SpiritManager.talk(player, status.getCharacter(), "first", inventory.itemStacks[3]);
+ return status.getCharacter();
+ }
+ return null;
+ }
+
+ @Override
+ public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) {
+ ItemStack itemStack = null;
+ return itemStack;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/container/ContainerDummy.class b/src/main/java/jp/plusplus/fbs/container/ContainerDummy.class Binary files differnew file mode 100644 index 0000000..cdc7ba3 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/ContainerDummy.class diff --git a/src/main/java/jp/plusplus/fbs/container/ContainerDummy.java b/src/main/java/jp/plusplus/fbs/container/ContainerDummy.java new file mode 100644 index 0000000..ed92fc7 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/ContainerDummy.java @@ -0,0 +1,14 @@ +package jp.plusplus.fbs.container;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.Container;
+
+/**
+ * Createdby pluslus_Fon 2015/06/14.
+ */
+public class ContainerDummy extends Container {
+ @Override
+ public boolean canInteractWith(EntityPlayer entityPlayer) {
+ return false;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/container/ContainerExtractingFurnace.class b/src/main/java/jp/plusplus/fbs/container/ContainerExtractingFurnace.class Binary files differnew file mode 100644 index 0000000..24ede45 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/ContainerExtractingFurnace.class diff --git a/src/main/java/jp/plusplus/fbs/container/ContainerExtractingFurnace.java b/src/main/java/jp/plusplus/fbs/container/ContainerExtractingFurnace.java new file mode 100644 index 0000000..a5c5e90 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/ContainerExtractingFurnace.java @@ -0,0 +1,148 @@ +package jp.plusplus.fbs.container;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.block.BlockCore;
+import jp.plusplus.fbs.container.slot.SlotTakeOnly;
+import jp.plusplus.fbs.tileentity.TileEntityExtractingFurnace;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.Container;
+import net.minecraft.inventory.ICrafting;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.fluids.FluidStack;
+
+/**
+ * Createdby pluslus_Fon 2015/06/08.
+ */
+public class ContainerExtractingFurnace extends Container {
+ public int lastProgress;
+ public int lastAmount;
+
+ private TileEntityExtractingFurnace entity;
+
+ public ContainerExtractingFurnace(EntityPlayer player, TileEntityExtractingFurnace tileEntity) {
+ this.entity = tileEntity;
+
+ //inventory's inventory
+ this.addSlotToContainer(new Slot(this.entity, 0, 134, 17));
+ this.addSlotToContainer(new SlotTakeOnly(this.entity, 1, 134, 53));
+ this.addSlotToContainer(new Slot(this.entity, 2, 44, 35));
+
+ //player inventory
+ for (int i = 0; i < 3; i++) {
+ for (int j = 0; j < 9; j++) {
+ this.addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
+ }
+ }
+
+ //player slots
+ for (int i = 0; i < 9; i++) {
+ this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142));
+ }
+ }
+
+ @Override
+ public void addCraftingToCrafters(ICrafting par1ICrafting) {
+ super.addCraftingToCrafters(par1ICrafting);
+ par1ICrafting.sendProgressBarUpdate(this, 0, entity.tank.getFluidAmount());
+ par1ICrafting.sendProgressBarUpdate(this, 1, entity.progress);
+ }
+ @Override
+ public void detectAndSendChanges() {
+ super.detectAndSendChanges();
+ for (int i = 0; i < this.crafters.size(); i++) {
+ ICrafting icrafting = (ICrafting) this.crafters.get(i);
+ if (lastAmount != entity.tank.getFluidAmount()) {
+ icrafting.sendProgressBarUpdate(this, 0, entity.tank.getFluidAmount());
+ }
+ if (lastProgress != entity.progress) {
+ icrafting.sendProgressBarUpdate(this, 1, entity.progress);
+ }
+ }
+ lastAmount=entity.tank.getFluidAmount();
+ lastProgress = entity.progress;
+ }
+
+ @Override
+ public boolean canInteractWith(EntityPlayer entityPlayer) {
+ return entity.isUseableByPlayer(entityPlayer);
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void updateProgressBar(int par1, int par2) {
+ if(par1==0) {
+ for (int i = 0; i < this.crafters.size(); i++) {
+ ICrafting icrafting = (ICrafting) this.crafters.get(i);
+ if (lastAmount != entity.tank.getFluidAmount()) {
+ icrafting.sendProgressBarUpdate(this, 0, entity.tank.getFluidAmount());
+ }
+ }
+ if(par2>0){
+ if(entity.tank.getFluid()==null) entity.tank.setFluid(new FluidStack(BlockCore.mana, par2));
+ else entity.tank.setAmount(par2);
+ }
+ else{
+ entity.tank.setFluid(null);
+ }
+ }
+ else{
+ for (int i = 0; i < this.crafters.size(); i++) {
+ ICrafting icrafting = (ICrafting) this.crafters.get(i);
+ if (lastProgress != entity.progress) {
+ icrafting.sendProgressBarUpdate(this, 1, entity.progress);
+ }
+ }
+ entity.progress=(short)par2;
+ }
+ }
+
+ @Override
+ public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) {
+ ItemStack itemStack = null;
+ Slot slot = (Slot) this.inventorySlots.get(par2);
+
+ if (slot != null && slot.getHasStack()) {
+ ItemStack stack = slot.getStack();
+ itemStack = stack.copy();
+
+ if (par2 >=0 && par2<=2) {
+ if (!this.mergeItemStack(stack, 3, 39, true)) {
+ return null;
+ }
+ slot.onSlotChange(stack, itemStack);
+ } else {
+ if (entity.isItemValidForSlot(0, stack)) {
+ if (!this.mergeItemStack(stack, 0, 1, false)) {
+ return null;
+ }
+ }
+ else if (entity.isItemValidForSlot(2, stack)) {
+ if (!this.mergeItemStack(stack, 2, 3, false)) {
+ return null;
+ }
+ } else if (par2 >= 3 && par2 < 30) {
+ if (!this.mergeItemStack(stack, 30, 39, false)) {
+ return null;
+ }
+ } else if (par2 >= 30 && par2 < 39 && !this.mergeItemStack(stack, 3, 30, false)) {
+ return null;
+ }
+ }
+
+ if (stack.stackSize == 0) {
+ slot.putStack((ItemStack) null);
+ } else {
+ slot.onSlotChanged();
+ }
+
+ if (stack.stackSize == itemStack.stackSize) {
+ return null;
+ }
+ slot.onPickupFromSlot(par1EntityPlayer, stack);
+ }
+
+ return itemStack;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/container/ContainerFBSWorkbench.class b/src/main/java/jp/plusplus/fbs/container/ContainerFBSWorkbench.class Binary files differnew file mode 100644 index 0000000..c9dbb32 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/ContainerFBSWorkbench.class diff --git a/src/main/java/jp/plusplus/fbs/container/ContainerFBSWorkbench.java b/src/main/java/jp/plusplus/fbs/container/ContainerFBSWorkbench.java new file mode 100644 index 0000000..8a8e335 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/ContainerFBSWorkbench.java @@ -0,0 +1,136 @@ +package jp.plusplus.fbs.container;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.block.BlockCore;
+import jp.plusplus.fbs.container.slot.SlotCrafting;
+import jp.plusplus.fbs.container.slot.SlotTakeOnly;
+import jp.plusplus.fbs.tileentity.TileEntityFBSWorkbench;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.Container;
+import net.minecraft.inventory.ICrafting;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.fluids.FluidStack;
+
+/**
+ * Createdby pluslus_Fon 2015/06/14.
+ */
+public class ContainerFBSWorkbench extends Container {
+ protected TileEntityFBSWorkbench entity;
+ public int lastAmount;
+
+ public ContainerFBSWorkbench(EntityPlayer player, TileEntityFBSWorkbench tileEntity) {
+ this.entity = tileEntity;
+
+ //inventory's inventory
+ for(int i=0;i<9;i++) {
+ this.addSlotToContainer(new Slot(this.entity, i, 30 + (i % 3) * 18, 17 + (i / 3) * 18));
+ }
+ this.addSlotToContainer(new SlotCrafting(player, this.entity, 9, 124, 35));
+
+ this.addSlotToContainer(new Slot(this.entity, 10, 66, 71));
+ this.addSlotToContainer(new SlotTakeOnly(this.entity, 11, 30, 71));
+
+ //player inventory
+ for (int i = 0; i < 3; i++) {
+ for (int j = 0; j < 9; j++) {
+ this.addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 103 + i * 18));
+ }
+ }
+
+ //player slots
+ for (int i = 0; i < 9; i++) {
+ this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 161));
+ }
+ }
+
+ @Override
+ public void addCraftingToCrafters(ICrafting par1ICrafting) {
+ super.addCraftingToCrafters(par1ICrafting);
+ par1ICrafting.sendProgressBarUpdate(this, 0, entity.tank.getFluidAmount());
+ }
+ @Override
+ public void detectAndSendChanges() {
+ super.detectAndSendChanges();
+ for (int i = 0; i < this.crafters.size(); i++) {
+ ICrafting icrafting = (ICrafting) this.crafters.get(i);
+ if (lastAmount != entity.tank.getFluidAmount()) {
+ icrafting.sendProgressBarUpdate(this, 0, entity.tank.getFluidAmount());
+ }
+ }
+ lastAmount = entity.tank.getFluidAmount();
+ }
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void updateProgressBar(int par1, int par2) {
+ if (par1 == 0) {
+ for (int i = 0; i < this.crafters.size(); i++) {
+ ICrafting icrafting = (ICrafting) this.crafters.get(i);
+ if (lastAmount != entity.tank.getFluidAmount()) {
+ icrafting.sendProgressBarUpdate(this, 0, entity.tank.getFluidAmount());
+ }
+ }
+ if (par2 > 0) {
+ if (entity.tank.getFluid() == null) entity.tank.setFluid(new FluidStack(BlockCore.mana, par2));
+ else entity.tank.setAmount(par2);
+ } else {
+ entity.tank.setFluid(null);
+ }
+ }
+ }
+
+
+ @Override
+ public boolean canInteractWith(EntityPlayer entityPlayer) {
+ return entity.isUseableByPlayer(entityPlayer);
+ }
+
+ @Override
+ public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) {
+ ItemStack itemStack = null;
+ Slot slot = (Slot) this.inventorySlots.get(par2);
+
+ if (slot != null && slot.getHasStack()) {
+ ItemStack stack = slot.getStack();
+ itemStack = stack.copy();
+
+ if (par2 >= 0 && par2 <= 11) {
+ if(par2==9){
+ if(entity.product!=null){
+ entity.tank.drain(entity.product.mana*stack.stackSize, true);
+ }
+ }
+ if (!this.mergeItemStack(stack, 12, 48, true)) {
+ return null;
+ }
+ slot.onSlotChange(stack, itemStack);
+ } else {
+ if (entity.isItemValidForSlot(10, stack)) {
+ if (!this.mergeItemStack(stack, 10, 11, false)) {
+ return null;
+ }
+ } else if (par2 >= 12 && par2 < 39) {
+ if (!this.mergeItemStack(stack, 39, 48, false)) {
+ return null;
+ }
+ } else if (par2 >= 39 && par2 < 48 && !this.mergeItemStack(stack, 12, 39, false)) {
+ return null;
+ }
+ }
+
+ if (stack.stackSize == 0) {
+ slot.putStack((ItemStack) null);
+ } else {
+ slot.onSlotChanged();
+ }
+
+ if (stack.stackSize == itemStack.stackSize) {
+ return null;
+ }
+ slot.onPickupFromSlot(par1EntityPlayer, stack);
+ }
+
+ return itemStack;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/container/ContainerFillingTable.class b/src/main/java/jp/plusplus/fbs/container/ContainerFillingTable.class Binary files differnew file mode 100644 index 0000000..57995f3 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/ContainerFillingTable.class diff --git a/src/main/java/jp/plusplus/fbs/container/ContainerFillingTable.java b/src/main/java/jp/plusplus/fbs/container/ContainerFillingTable.java new file mode 100644 index 0000000..dfabcfd --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/ContainerFillingTable.java @@ -0,0 +1,146 @@ +package jp.plusplus.fbs.container;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.block.BlockCore;
+import jp.plusplus.fbs.container.slot.SlotTakeOnly;
+import jp.plusplus.fbs.tileentity.TileEntityFillingTable;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.Container;
+import net.minecraft.inventory.ICrafting;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.fluids.FluidStack;
+
+/**
+ * Createdby pluslus_Fon 2015/06/14.
+ */
+public class ContainerFillingTable extends Container {
+ public int lastProgress;
+ public int lastAmount;
+
+ private TileEntityFillingTable entity;
+
+ public ContainerFillingTable(EntityPlayer player, TileEntityFillingTable tileEntity) {
+ this.entity = tileEntity;
+
+ //inventory's inventory
+ this.addSlotToContainer(new Slot(this.entity, 0, 116, 35));
+ this.addSlotToContainer(new Slot(this.entity, 1, 44, 17));
+ this.addSlotToContainer(new SlotTakeOnly(this.entity, 2, 44, 53));
+
+ //player inventory
+ for (int i = 0; i < 3; i++) {
+ for (int j = 0; j < 9; j++) {
+ this.addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
+ }
+ }
+
+ //player slots
+ for (int i = 0; i < 9; i++) {
+ this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142));
+ }
+ }
+
+ @Override
+ public void addCraftingToCrafters(ICrafting par1ICrafting) {
+ super.addCraftingToCrafters(par1ICrafting);
+ par1ICrafting.sendProgressBarUpdate(this, 0, entity.tank.getFluidAmount());
+ par1ICrafting.sendProgressBarUpdate(this, 1, entity.progress);
+ }
+
+ @Override
+ public void detectAndSendChanges() {
+ super.detectAndSendChanges();
+ for (int i = 0; i < this.crafters.size(); i++) {
+ ICrafting icrafting = (ICrafting) this.crafters.get(i);
+ if (lastAmount != entity.tank.getFluidAmount()) {
+ icrafting.sendProgressBarUpdate(this, 0, entity.tank.getFluidAmount());
+ }
+ if (lastProgress != entity.progress) {
+ icrafting.sendProgressBarUpdate(this, 1, entity.progress);
+ }
+ }
+ lastAmount = entity.tank.getFluidAmount();
+ lastProgress = entity.progress;
+ }
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void updateProgressBar(int par1, int par2) {
+ if (par1 == 0) {
+ for (int i = 0; i < this.crafters.size(); i++) {
+ ICrafting icrafting = (ICrafting) this.crafters.get(i);
+ if (lastAmount != entity.tank.getFluidAmount()) {
+ icrafting.sendProgressBarUpdate(this, 0, entity.tank.getFluidAmount());
+ }
+ }
+ if (par2 > 0) {
+ if (entity.tank.getFluid() == null) entity.tank.setFluid(new FluidStack(BlockCore.mana, par2));
+ else entity.tank.setAmount(par2);
+ } else {
+ entity.tank.setFluid(null);
+ }
+ } else {
+ for (int i = 0; i < this.crafters.size(); i++) {
+ ICrafting icrafting = (ICrafting) this.crafters.get(i);
+ if (lastProgress != entity.progress) {
+ icrafting.sendProgressBarUpdate(this, 1, entity.progress);
+ }
+ }
+ entity.progress = (short) par2;
+ }
+ }
+
+ @Override
+ public boolean canInteractWith(EntityPlayer entityPlayer) {
+ return entity.isUseableByPlayer(entityPlayer);
+ }
+
+
+ @Override
+ public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) {
+ ItemStack itemStack = null;
+ Slot slot = (Slot) this.inventorySlots.get(par2);
+
+ if (slot != null && slot.getHasStack()) {
+ ItemStack stack = slot.getStack();
+ itemStack = stack.copy();
+
+ if (par2 >= 0 && par2 <= 2) {
+ if (!this.mergeItemStack(stack, 3, 39, true)) {
+ return null;
+ }
+ slot.onSlotChange(stack, itemStack);
+ } else {
+ if (entity.isItemValidForSlot(0, stack)) {
+ if (!this.mergeItemStack(stack, 0, 1, false)) {
+ return null;
+ }
+ } else if (entity.isItemValidForSlot(1, stack)) {
+ if (!this.mergeItemStack(stack, 1, 2, false)) {
+ return null;
+ }
+ } else if (par2 >= 3 && par2 < 30) {
+ if (!this.mergeItemStack(stack, 30, 39, false)) {
+ return null;
+ }
+ } else if (par2 >= 30 && par2 < 39 && !this.mergeItemStack(stack, 3, 30, false)) {
+ return null;
+ }
+ }
+
+ if (stack.stackSize == 0) {
+ slot.putStack((ItemStack) null);
+ } else {
+ slot.onSlotChanged();
+ }
+
+ if (stack.stackSize == itemStack.stackSize) {
+ return null;
+ }
+ slot.onPickupFromSlot(par1EntityPlayer, stack);
+ }
+
+ return itemStack;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/container/ContainerKiln.class b/src/main/java/jp/plusplus/fbs/container/ContainerKiln.class Binary files differnew file mode 100644 index 0000000..04311f7 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/ContainerKiln.class diff --git a/src/main/java/jp/plusplus/fbs/container/ContainerKiln.java b/src/main/java/jp/plusplus/fbs/container/ContainerKiln.java new file mode 100644 index 0000000..9ce9698 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/ContainerKiln.java @@ -0,0 +1,114 @@ +package jp.plusplus.fbs.container;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.container.slot.SlotTakeOnly;
+import jp.plusplus.fbs.pottery.TileEntityKiln;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.Container;
+import net.minecraft.inventory.ICrafting;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+
+/**
+ * Created by plusplus_F on 2015/08/27.
+ */
+public class ContainerKiln extends Container {
+ public int lastFurnaceBurn;
+ public int lastItemBurn;
+ public int[] lastProgress=new int[9];
+ public TileEntityKiln entity;
+
+
+ public ContainerKiln(EntityPlayer player, TileEntityKiln tileEntity) {
+ this.entity = tileEntity;
+
+ //inventory's inventory
+ for(int i=0;i<9;i++) addSlotToContainer(new Slot(entity, i, 8+i*18, 58));
+ this.addSlotToContainer(new Slot(this.entity, 9, 80, 93));
+ for(int i=0;i<9;i++) addSlotToContainer(new SlotTakeOnly(entity, 10+i, 8+i*18, 23, 1));
+
+ //player inventory
+ for (int i = 0; i < 3; i++) {
+ for (int j = 0; j < 9; j++) {
+ this.addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 115 + i * 18));
+ }
+ }
+
+ //player slots
+ for (int i = 0; i < 9; i++) {
+ this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 173));
+ }
+ }
+
+ @Override
+ public boolean canInteractWith(EntityPlayer entityPlayer) {
+ return entity.isUseableByPlayer(entityPlayer);
+ }
+
+ @Override
+ public void addCraftingToCrafters(ICrafting par1ICrafting) {
+ super.addCraftingToCrafters(par1ICrafting);
+ par1ICrafting.sendProgressBarUpdate(this, 0, entity.furnaceBurnTime);
+ par1ICrafting.sendProgressBarUpdate(this, 1, entity.currentItemBurnTime);
+ for(int i=0;i<9;i++) par1ICrafting.sendProgressBarUpdate(this, 2+i, entity.progress[i]);
+ }
+
+ @Override
+ public void detectAndSendChanges() {
+ super.detectAndSendChanges();
+ for (int i = 0; i < this.crafters.size(); i++) {
+ ICrafting icrafting = (ICrafting) this.crafters.get(i);
+ if(lastFurnaceBurn!=entity.furnaceBurnTime) icrafting.sendProgressBarUpdate(this, 0, entity.furnaceBurnTime);
+ if(lastItemBurn!=entity.currentItemBurnTime) icrafting.sendProgressBarUpdate(this, 1, entity.currentItemBurnTime);
+ for(int k=0;k<9;k++){
+ if (lastProgress[k] != entity.progress[k]) icrafting.sendProgressBarUpdate(this, 2+k, entity.progress[k]);
+ }
+ }
+ lastFurnaceBurn=entity.furnaceBurnTime;
+ lastItemBurn=entity.currentItemBurnTime;
+ for(int k=0;k<9;k++) lastProgress[k] = entity.progress[k];
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void updateProgressBar(int par1, int par2) {
+ if (par1 == 0) {
+ for (int i = 0; i < this.crafters.size(); i++) {
+ ICrafting icrafting = (ICrafting) this.crafters.get(i);
+ if (lastFurnaceBurn != entity.furnaceBurnTime) {
+ icrafting.sendProgressBarUpdate(this, 0, entity.furnaceBurnTime);
+ }
+ }
+ entity.furnaceBurnTime=par2;
+ }
+ else if(par1==1){
+ for (int i = 0; i < this.crafters.size(); i++) {
+ ICrafting icrafting = (ICrafting) this.crafters.get(i);
+ if (lastItemBurn != entity.currentItemBurnTime) {
+ icrafting.sendProgressBarUpdate(this, 0, entity.currentItemBurnTime);
+ }
+ }
+ entity.currentItemBurnTime=par2;
+ }
+ else {
+ int k = par1 - 2;
+ if (k < 0 || k >= 9) return;
+
+ for (int i = 0; i < this.crafters.size(); i++) {
+ ICrafting icrafting = (ICrafting) this.crafters.get(i);
+ if (lastProgress != entity.progress) {
+ icrafting.sendProgressBarUpdate(this, 1, entity.progress[k]);
+ }
+ }
+ entity.progress[k] = (short) par2;
+ }
+ }
+
+
+ @Override
+ public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) {
+ ItemStack itemStack = null;
+ return itemStack;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/container/ContainerMagic.class b/src/main/java/jp/plusplus/fbs/container/ContainerMagic.class Binary files differnew file mode 100644 index 0000000..8e0c99f --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/ContainerMagic.class diff --git a/src/main/java/jp/plusplus/fbs/container/ContainerMagic.java b/src/main/java/jp/plusplus/fbs/container/ContainerMagic.java new file mode 100644 index 0000000..73f81be --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/ContainerMagic.java @@ -0,0 +1,101 @@ +package jp.plusplus.fbs.container;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.block.BlockCore;
+import jp.plusplus.fbs.container.slot.SlotInventory;
+import jp.plusplus.fbs.container.inventory.InventoryMagic;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.inventory.Container;
+import net.minecraft.inventory.ICrafting;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.fluids.FluidStack;
+
+/**
+ * Created by pluslus_F on 2015/06/18.
+ */
+public class ContainerMagic extends Container {
+ public InventoryMagic inventory;
+ private int lastProgress;
+
+ public ContainerMagic(InventoryPlayer invP, InventoryMagic invM){
+ inventory=invM;
+ invM.openInventory();
+
+ //player's inv
+ for (int j = 0; j < 3; ++j) {
+ for (int k = 0; k < 9; ++k) {
+ this.addSlotToContainer(new SlotInventory(invP, k + j * 9 + 9, 8 + k * 18, 84 + j * 18, 2));
+ }
+ }
+
+ for (int j = 0; j < 9; ++j) {
+ this.addSlotToContainer(new SlotInventory(invP, j, 8 + j * 18, 142, 2));
+ }
+
+ invM.addSlotToContainer(this);
+ }
+
+ @Override
+ public boolean canInteractWith(EntityPlayer p_75145_1_) {
+ return true;
+ }
+
+ @Override
+ public void onContainerClosed(EntityPlayer p_75134_1_) {
+ super.onContainerClosed(p_75134_1_);
+ this.inventory.closeInventory();
+ }
+
+
+ @Override
+ public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int p_82846_2_) {
+ ItemStack itemstack = null;
+ return itemstack;
+ }
+
+
+ public Slot addSlotToContainer(Slot p_75146_1_){
+ return super.addSlotToContainer(p_75146_1_);
+ }
+
+
+ @Override
+ public void addCraftingToCrafters(ICrafting par1ICrafting) {
+ super.addCraftingToCrafters(par1ICrafting);
+ if(inventory.magicCore!=null){
+ par1ICrafting.sendProgressBarUpdate(this, 0, inventory.magicCore.progress);
+ }
+
+ }
+ @Override
+ public void detectAndSendChanges() {
+ super.detectAndSendChanges();
+ if(inventory.magicCore==null) return;
+
+ for (int i = 0; i < this.crafters.size(); i++) {
+ ICrafting icrafting = (ICrafting) this.crafters.get(i);
+ if (lastProgress != inventory.magicCore.progress) {
+ icrafting.sendProgressBarUpdate(this, 0, inventory.magicCore.progress);
+ }
+ }
+ lastProgress = inventory.magicCore.progress;
+ }
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void updateProgressBar(int par1, int par2) {
+ if(par1==0) {
+ for (int i = 0; i < this.crafters.size(); i++) {
+ ICrafting icrafting = (ICrafting) this.crafters.get(i);
+ if (inventory.magicCore!=null && lastProgress != inventory.magicCore.progress) {
+ icrafting.sendProgressBarUpdate(this, 0, inventory.magicCore.progress);
+ }
+ }
+ if(inventory.magicCore!=null){
+ inventory.magicCore.progress=par2;
+ }
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/container/ContainerPottersWheel.class b/src/main/java/jp/plusplus/fbs/container/ContainerPottersWheel.class Binary files differnew file mode 100644 index 0000000..b4e535c --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/ContainerPottersWheel.class diff --git a/src/main/java/jp/plusplus/fbs/container/ContainerPottersWheel.java b/src/main/java/jp/plusplus/fbs/container/ContainerPottersWheel.java new file mode 100644 index 0000000..3aea02e --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/ContainerPottersWheel.java @@ -0,0 +1,85 @@ +package jp.plusplus.fbs.container;
+
+import jp.plusplus.fbs.container.slot.SlotCraftingPottery;
+import jp.plusplus.fbs.pottery.TileEntityPottersWheel;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.Container;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+
+/**
+ * Created by pluslus_F on 2015/08/29.
+ */
+public class ContainerPottersWheel extends Container {
+ protected TileEntityPottersWheel entity;
+
+ public ContainerPottersWheel(EntityPlayer player, TileEntityPottersWheel tileEntity) {
+ this.entity = tileEntity;
+
+ //inventory's inventory
+ for(int i=0;i<25;i++) {
+ this.addSlotToContainer(new Slot(this.entity, i, 8 + (i % 5) * 18, 17 + (i / 5) * 18));
+ }
+ this.addSlotToContainer(new SlotCraftingPottery(player, this.entity, 25, 140, 54));
+
+ //player inventory
+ for (int i = 0; i < 3; i++) {
+ for (int j = 0; j < 9; j++) {
+ this.addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 120 + i * 18));
+ }
+ }
+
+ //player slots
+ for (int i = 0; i < 9; i++) {
+ this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 178));
+ }
+ }
+
+ @Override
+ public boolean canInteractWith(EntityPlayer entityPlayer) {
+ return entity.isUseableByPlayer(entityPlayer);
+ }
+
+ @Override
+ public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) {
+ ItemStack itemStack = null;
+ Slot slot = (Slot) this.inventorySlots.get(par2);
+
+ if (slot != null && slot.getHasStack()) {
+ ItemStack stack = slot.getStack();
+ itemStack = stack.copy();
+
+ if(par2==25){
+ if(!this.mergeItemStack(stack, 26+24, 26+24+9, true)){
+ return null;
+ }
+ slot.onSlotChange(stack, itemStack);
+ }
+ else if(par2>=26){
+ if(par2<26+24){
+ if(!this.mergeItemStack(stack, 26+24, 26+24+9, false)){
+ return null;
+ }
+ }
+ else{
+ if(!this.mergeItemStack(stack, 26, 26+24, false)){
+ return null;
+ }
+ }
+ }
+
+ if (stack.stackSize == 0) {
+ slot.putStack((ItemStack) null);
+ } else {
+ slot.onSlotChanged();
+ }
+
+ if (stack.stackSize == itemStack.stackSize) {
+ return null;
+ }
+ slot.onPickupFromSlot(par1EntityPlayer, stack);
+ }
+
+ return itemStack;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/container/ContainerShopAuthor.class b/src/main/java/jp/plusplus/fbs/container/ContainerShopAuthor.class Binary files differnew file mode 100644 index 0000000..8194621 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/ContainerShopAuthor.class diff --git a/src/main/java/jp/plusplus/fbs/container/ContainerShopAuthor.java b/src/main/java/jp/plusplus/fbs/container/ContainerShopAuthor.java new file mode 100644 index 0000000..b34c78a --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/ContainerShopAuthor.java @@ -0,0 +1,32 @@ +package jp.plusplus.fbs.container;
+
+import jp.plusplus.fbs.entity.EntityMagicAuthor;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.ContainerMerchant;
+import net.minecraft.world.World;
+import shift.mceconomy2.api.shop.IShop;
+import shift.mceconomy2.gui.ContainerShop;
+
+/**
+ * Created by plusplus_F on 2016/02/24.
+ */
+public class ContainerShopAuthor extends ContainerShop {
+ protected EntityMagicAuthor author;
+
+ public ContainerShopAuthor(EntityPlayer entityPlayer, IShop par2IProductList, World par3World, EntityMagicAuthor author) {
+ super(entityPlayer, par2IProductList, par3World);
+ this.author=author;
+ }
+
+ @Override
+ public void onContainerClosed(EntityPlayer player){
+ if(author!=null){
+ author.setCustomer(null);
+ }
+ }
+
+ @Override
+ public boolean canInteractWith(EntityPlayer entityplayer) {
+ return author==null || author.getCustomer() == entityplayer;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/container/ContainerStaff.class b/src/main/java/jp/plusplus/fbs/container/ContainerStaff.class Binary files differnew file mode 100644 index 0000000..6c379fc --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/ContainerStaff.class diff --git a/src/main/java/jp/plusplus/fbs/container/ContainerStaff.java b/src/main/java/jp/plusplus/fbs/container/ContainerStaff.java new file mode 100644 index 0000000..0fdba49 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/ContainerStaff.java @@ -0,0 +1,59 @@ +package jp.plusplus.fbs.container;
+
+import jp.plusplus.fbs.container.slot.SlotInventory;
+import jp.plusplus.fbs.container.inventory.InventoryStaff;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.inventory.Container;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+
+/**
+ * Createdby pluslus_Fon 2015/06/15.
+ */
+public class ContainerStaff extends Container {
+ public InventoryStaff inventory;
+
+ public ContainerStaff(InventoryPlayer invP) {
+ inventory = new InventoryStaff(invP);
+ inventory.openInventory();
+
+ //player's inv
+ for (int j = 0; j < 3; ++j) {
+ for (int k = 0; k < 9; ++k) {
+ this.addSlotToContainer(new SlotInventory(invP, k + j * 9 + 9, 8 + k * 18, 84 + j * 18, 2));
+ }
+ }
+
+ for (int j = 0; j < 9; ++j) {
+ this.addSlotToContainer(new SlotInventory(invP, j, 8 + j * 18, 142, 2));
+ }
+
+ //staff
+ if(inventory.bookNum==1) addSlotToContainer(new SlotInventory(inventory, 0, 80, 25, 0));
+ if(inventory.bookNum==2){
+ addSlotToContainer(new SlotInventory(inventory, 0, 67, 25, 0));
+ addSlotToContainer(new SlotInventory(inventory, 1, 93, 25, 0));
+ }
+ for (int i = 0; i < inventory.gemNum; i++)
+ addSlotToContainer(new SlotInventory(inventory, inventory.bookNum + i, 44 + i * 18, 53, 1));
+ }
+
+ @Override
+ public boolean canInteractWith(EntityPlayer p_75145_1_) {
+ return true;
+ }
+
+ @Override
+ public void onContainerClosed(EntityPlayer p_75134_1_) {
+ super.onContainerClosed(p_75134_1_);
+ inventory.closeInventory();
+ }
+
+ @Override
+ public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int p_82846_2_) {
+ ItemStack itemstack = null;
+ Slot slot = (Slot) this.inventorySlots.get(p_82846_2_);
+ return itemstack;
+ }
+}
\ No newline at end of file diff --git a/src/main/java/jp/plusplus/fbs/container/ContainerTFKEnchantment.class b/src/main/java/jp/plusplus/fbs/container/ContainerTFKEnchantment.class Binary files differnew file mode 100644 index 0000000..f7c8f44 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/ContainerTFKEnchantment.class diff --git a/src/main/java/jp/plusplus/fbs/container/ContainerTFKEnchantment.java b/src/main/java/jp/plusplus/fbs/container/ContainerTFKEnchantment.java new file mode 100644 index 0000000..b8f6785 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/ContainerTFKEnchantment.java @@ -0,0 +1,148 @@ +package jp.plusplus.fbs.container;
+
+import jp.plusplus.fbs.AchievementRegistry;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.api.FBSEntityPropertiesAPI;
+import jp.plusplus.fbs.container.inventory.InventoryEnchantment;
+import jp.plusplus.fbs.container.slot.SlotInventory;
+import jp.plusplus.fbs.container.slot.SlotTakeOnly;
+import jp.plusplus.fbs.exprop.FBSEntityProperties;
+import jp.plusplus.fbs.item.ItemEnchantScroll;
+import net.minecraft.enchantment.EnchantmentHelper;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.Container;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.MathHelper;
+
+import java.util.Map;
+import java.util.Random;
+
+/**
+ * Created by plusplus_F on 2015/10/21.
+ */
+public class ContainerTFKEnchantment extends Container {
+ public boolean enchanted;
+ public InventoryEnchantment inventory;
+ public EntityPlayer player;
+
+ public ContainerTFKEnchantment(EntityPlayer player){
+ this.player=player;
+ inventory=new InventoryEnchantment(player);
+
+ addSlotToContainer(new Slot(inventory, 0, 44, 31));
+ addSlotToContainer(new Slot(inventory, 1, 62, 31));
+ addSlotToContainer(new SlotTakeOnly(inventory, 2, 120, 31));
+
+ //player's inv
+ for (int j = 0; j < 3; ++j) {
+ for (int k = 0; k < 9; ++k) {
+ this.addSlotToContainer(new SlotInventory(player.inventory, k + j * 9 + 9, 8 + k * 18, 84 + j * 18, 2));
+ }
+ }
+ for (int j = 0; j < 9; ++j) {
+ this.addSlotToContainer(new SlotInventory(player.inventory, j, 8 + j * 18, 142, 2));
+ }
+ }
+
+ public double getEnchantExp(int enchLv){
+ return 100 * enchLv;
+ }
+ public float getEnchantProbability(){
+ ItemStack es=inventory.getStackInSlot(1);
+ if(es==null) return 0;
+ Map ench=EnchantmentHelper.getEnchantments(es);
+ Map.Entry e=(Map.Entry)ench.entrySet().iterator().next();
+ return getEnchantProbability((Integer)e.getValue());
+ }
+ public float getEnchantProbability(int enchLv){
+ float p=0.5f;
+ p-=0.1f*(enchLv-1);
+ p+=0.01f*FBSEntityPropertiesAPI.GetMagicLevel(player);
+ return p;
+ }
+ public boolean canEnchant(){
+ ItemStack itemStack=inventory.getStackInSlot(0);
+ if(itemStack==null || !itemStack.getItem().isItemTool(itemStack)){
+ return false;
+ }
+
+ ItemStack es=inventory.getStackInSlot(1);
+ if(es==null || !(es.getItem() instanceof ItemEnchantScroll) || !es.isItemEnchanted()){
+ return false;
+ }
+
+ return true;
+ }
+ public void tryEnchant(){
+ if(!canEnchant()) return;
+
+ Random rand=new Random();
+ ItemStack itemStack=inventory.getStackInSlot(0);
+ ItemStack es=inventory.getStackInSlot(1);
+
+ Map ench=EnchantmentHelper.getEnchantments(es);
+ Map.Entry e=(Map.Entry)ench.entrySet().iterator().next();
+ int eLv=(Integer)e.getValue();
+
+ if(rand.nextFloat()<getEnchantProbability(eLv)){
+ //成功
+ player.triggerAchievement(AchievementRegistry.enchant);
+
+ //経験値
+ FBSEntityPropertiesAPI.AddExp(player, getEnchantExp(eLv), true);
+
+ //エンチャント重複判定,重複している場合は新しいもので上書きする
+ Map itemEnchantmentList=EnchantmentHelper.getEnchantments(itemStack);
+ if(itemEnchantmentList.containsKey(e.getKey())) {
+ //重複してる場合は削除
+ itemEnchantmentList.remove(e.getKey());
+ }
+
+ //エンチャント付与
+ itemEnchantmentList.put(e.getKey(), e.getValue());
+ EnchantmentHelper.setEnchantments(itemEnchantmentList, itemStack);
+
+ //スロット操作
+ inventory.setInventorySlotContents(0, null);
+ inventory.setInventorySlotContents(1, null);
+ inventory.setInventorySlotContents(2, itemStack);
+ }
+ else{
+ //失敗e
+
+ //経験値
+ FBSEntityPropertiesAPI.AddExp(player, 0.2*getEnchantExp(eLv), true);
+
+ //アイテムの耐久減らす
+ float d=(0.1f+(0.1f+0.1f*(eLv-1))*rand.nextFloat())*itemStack.getMaxDamage();
+ itemStack.setItemDamage(itemStack.getItemDamage() + MathHelper.floor_float(d));
+ inventory.setInventorySlotContents(0, null);
+ if(itemStack.getItemDamage()<itemStack.getMaxDamage()) inventory.setInventorySlotContents(2, itemStack);
+
+ //ESの耐久減らす
+ int mLv=FBSEntityPropertiesAPI.GetMagicLevel(player);
+ float dMin=0.1f+0.4f*(1.0f-(float)mLv/FBSEntityProperties.MAGIC_LEVEL_MAX);
+ d=dMin*es.getMaxDamage();
+ es.setItemDamage(es.getItemDamage()+ MathHelper.floor_float(d));
+ if(es.getItemDamage()>=es.getMaxDamage()) inventory.setInventorySlotContents(1, null);
+ }
+ }
+
+ @Override
+ public boolean canInteractWith(EntityPlayer p_75145_1_) {
+ return true;
+ }
+
+ @Override
+ public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int p_82846_2_) {
+ ItemStack itemstack = null;
+ return itemstack;
+ }
+ @Override
+ public void onContainerClosed(EntityPlayer p_75134_1_) {
+ super.onContainerClosed(p_75134_1_);
+ this.inventory.closeInventory();
+ }
+
+}
diff --git a/src/main/java/jp/plusplus/fbs/container/ContainerWarp.class b/src/main/java/jp/plusplus/fbs/container/ContainerWarp.class Binary files differnew file mode 100644 index 0000000..6855e6b --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/ContainerWarp.class diff --git a/src/main/java/jp/plusplus/fbs/container/ContainerWarp.java b/src/main/java/jp/plusplus/fbs/container/ContainerWarp.java new file mode 100644 index 0000000..a379af4 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/ContainerWarp.java @@ -0,0 +1,37 @@ +package jp.plusplus.fbs.container;
+
+import jp.plusplus.fbs.Registry;
+import jp.plusplus.fbs.item.ItemBookNoDecoded;
+import jp.plusplus.fbs.item.ItemBookSorcery;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.Container;
+import net.minecraft.item.ItemStack;
+
+/**
+ * Created by plusplus_F on 2015/10/22.
+ */
+public class ContainerWarp extends Container {
+ public EntityPlayer player;
+ public boolean close;
+
+ public ContainerWarp(EntityPlayer ep){
+ player=ep;
+ close=false;
+ }
+
+ @Override
+ public boolean canInteractWith(EntityPlayer p_75145_1_) {
+ if(close) return false;
+
+ ItemStack item=p_75145_1_.getCurrentEquippedItem();
+ if(item==null) return false;
+ if(!(item.getItem() instanceof ItemBookSorcery)) return false;
+
+ Registry.BookData bd=Registry.GetBookDataFromItemStack(item);
+ if(bd==null) return false;
+
+ if(!bd.title.equals("fbs.warp")) return false;
+
+ return ItemBookSorcery.getMagicMaxUse(item)>0;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/container/inventory/InventoryBasket.class b/src/main/java/jp/plusplus/fbs/container/inventory/InventoryBasket.class Binary files differnew file mode 100644 index 0000000..bae5992 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/inventory/InventoryBasket.class diff --git a/src/main/java/jp/plusplus/fbs/container/inventory/InventoryBasket.java b/src/main/java/jp/plusplus/fbs/container/inventory/InventoryBasket.java new file mode 100644 index 0000000..9db5485 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/inventory/InventoryBasket.java @@ -0,0 +1,162 @@ +package jp.plusplus.fbs.container.inventory;
+
+import jp.plusplus.fbs.alchemy.AlchemyRegistry;
+import jp.plusplus.fbs.alchemy.IAlchemyMaterial;
+import jp.plusplus.fbs.alchemy.IAlchemyProduct;
+import jp.plusplus.fbs.item.ItemCharm;
+import jp.plusplus.fbs.item.ItemCore;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.nbt.NBTTagList;
+import net.minecraft.util.StatCollector;
+
+/**
+ * Created by plusplus_F on 2015/11/11.
+ */
+public class InventoryBasket implements IInventory {
+ private InventoryPlayer inventoryPlayer;
+ private ItemStack currentItem;
+ private ItemStack[] items;
+ private int currentIndex;
+
+ public InventoryBasket(InventoryPlayer inventory) {
+ inventoryPlayer = inventory;
+ currentItem = inventoryPlayer.getCurrentItem();
+ currentIndex=inventory.currentItem;
+ items = new ItemStack[54];
+ }
+ public InventoryBasket(InventoryPlayer inventory, int index) {
+ inventoryPlayer = inventory;
+ this.currentItem = inventory.getStackInSlot(index);
+ currentIndex=index;
+ items = new ItemStack[54];
+ }
+
+ @Override
+ public int getSizeInventory() {
+ return items.length;
+ }
+
+ @Override
+ public ItemStack getStackInSlot(int slot) {
+ return items[slot];
+ }
+
+ @Override
+ public ItemStack decrStackSize(int i, int size) {
+ if (this.items[i] != null) {
+ ItemStack itemstack;
+
+ if (this.items[i].stackSize <= size) {
+ itemstack = this.items[i];
+ this.items[i] = null;
+ this.markDirty();
+ return itemstack;
+ } else {
+ itemstack = this.items[i].splitStack(size);
+
+ if (this.items[i].stackSize == 0) {
+ this.items[i] = null;
+ }
+
+ this.markDirty();
+ return itemstack;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public ItemStack getStackInSlotOnClosing(int i) {
+ if (this.items[i] != null) {
+ ItemStack itemstack = this.items[i];
+ this.items[i] = null;
+ return itemstack;
+ }
+ return null;
+ }
+
+ @Override
+ public void setInventorySlotContents(int i, ItemStack item) {
+ this.items[i] = item;
+
+ if (item != null && item.stackSize > this.getInventoryStackLimit()) {
+ item.stackSize = this.getInventoryStackLimit();
+ }
+
+ this.markDirty();
+ }
+
+ @Override
+ public String getInventoryName() {
+ return StatCollector.translateToLocal(ItemCore.basket.getUnlocalizedName() + ".name");
+ }
+
+ @Override
+ public boolean hasCustomInventoryName() {
+ return false;
+ }
+
+ @Override
+ public int getInventoryStackLimit() {
+ return 64;
+ }
+
+ @Override
+ public void markDirty() {
+ }
+
+ @Override
+ public boolean isUseableByPlayer(EntityPlayer p_70300_1_) {
+ return true;
+ }
+
+ @Override
+ public void openInventory() {
+ if (!currentItem.hasTagCompound()) {
+ currentItem.setTagCompound(new NBTTagCompound());
+ currentItem.getTagCompound().setTag("Items", new NBTTagList());
+ }
+ else if(!currentItem.getTagCompound().hasKey("Items")){
+ currentItem.getTagCompound().setTag("Items", new NBTTagList());
+ }
+
+ NBTTagList tags = (NBTTagList) currentItem.getTagCompound().getTag("Items");
+ for (int i = 0; i < tags.tagCount(); i++) {
+ NBTTagCompound tagCompound = tags.getCompoundTagAt(i);
+ int slot = tagCompound.getByte("Slot");
+ if (slot >= 0 && slot < items.length) {
+ items[slot] = ItemStack.loadItemStackFromNBT(tagCompound);
+ }
+ }
+ }
+
+ @Override
+ public void closeInventory() {
+ NBTTagList tagList = new NBTTagList();
+ for (int i = 0; i < items.length; i++) {
+ if (items[i] != null) {
+ NBTTagCompound compound = new NBTTagCompound();
+ compound.setByte("Slot", (byte) i);
+ items[i].writeToNBT(compound);
+ tagList.appendTag(compound);
+ }
+ }
+ ItemStack result = new ItemStack(currentItem.getItem(), 1, currentItem.getItemDamage());
+ result.setTagCompound(new NBTTagCompound());;
+ result.getTagCompound().setTag("Items", tagList);
+ result.getTagCompound().setInteger("Color", currentItem.getTagCompound().getInteger("Color"));
+
+ inventoryPlayer.mainInventory[currentIndex] = result;
+ }
+
+ @Override
+ public boolean isItemValidForSlot(int i, ItemStack item) {
+ Item it=item.getItem();
+ return it instanceof IAlchemyMaterial || it instanceof IAlchemyProduct || AlchemyRegistry.isBasketItem(item);
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/container/inventory/InventoryBonfire$EnchantmentPair.class b/src/main/java/jp/plusplus/fbs/container/inventory/InventoryBonfire$EnchantmentPair.class Binary files differnew file mode 100644 index 0000000..9443dba --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/inventory/InventoryBonfire$EnchantmentPair.class diff --git a/src/main/java/jp/plusplus/fbs/container/inventory/InventoryBonfire.class b/src/main/java/jp/plusplus/fbs/container/inventory/InventoryBonfire.class Binary files differnew file mode 100644 index 0000000..a51ef15 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/inventory/InventoryBonfire.class diff --git a/src/main/java/jp/plusplus/fbs/container/inventory/InventoryBonfire.java b/src/main/java/jp/plusplus/fbs/container/inventory/InventoryBonfire.java new file mode 100644 index 0000000..692dcaf --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/inventory/InventoryBonfire.java @@ -0,0 +1,288 @@ +package jp.plusplus.fbs.container.inventory;
+
+import jp.plusplus.fbs.AchievementRegistry;
+import jp.plusplus.fbs.alchemy.AlchemyRegistry;
+import jp.plusplus.fbs.alchemy.IAlchemyMaterial;
+import jp.plusplus.fbs.api.FBSEntityPropertiesAPI;
+import jp.plusplus.fbs.block.BlockCore;
+import jp.plusplus.fbs.exprop.FBSEntityProperties;
+import jp.plusplus.fbs.exprop.SanityManager;
+import jp.plusplus.fbs.item.ItemCore;
+import net.minecraft.enchantment.Enchantment;
+import net.minecraft.enchantment.EnchantmentHelper;
+import net.minecraft.entity.item.EntityItem;
+import net.minecraft.entity.item.EntityXPOrb;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.Items;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.inventory.SlotFurnace;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntityFurnace;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.MathHelper;
+import net.minecraft.util.StatCollector;
+import shift.mceconomy2.MCEconomy2;
+import shift.mceconomy2.api.MCEconomyAPI;
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Random;
+
+/**
+ * Created by plusplus_F on 2015/10/19.
+ */
+public class InventoryBonfire implements IInventory {
+ public ItemStack[] itemStacks=new ItemStack[4];
+ public Random rand=new Random();
+ public EntityPlayer player;
+
+ private int x,y,z;
+
+ public InventoryBonfire(int x, int y, int z, EntityPlayer player){
+ this.x=x;
+ this.y=y;
+ this.z=z;
+ this.player=player;
+ }
+
+ public float getExtractProb(EnchantmentPair ench, int mLv){
+ float p=0.5f;
+ p-=0.15f*(ench.lv-1);
+ p+=0.025f*mLv;
+ return p;
+ }
+
+ @Override
+ public int getSizeInventory() {
+ return itemStacks.length;
+ }
+
+ @Override
+ public ItemStack getStackInSlot(int p_70301_1_) {
+ return itemStacks[p_70301_1_];
+ }
+
+ @Override
+ public ItemStack decrStackSize(int p_70298_1_, int p_70298_2_) {
+ if (this.itemStacks[p_70298_1_] != null) {
+ ItemStack itemstack;
+
+ if (this.itemStacks[p_70298_1_].stackSize <= p_70298_2_) {
+ itemstack = this.itemStacks[p_70298_1_];
+ this.itemStacks[p_70298_1_] = null;
+ this.markDirty();
+ return itemstack;
+ } else {
+ itemstack = this.itemStacks[p_70298_1_].splitStack(p_70298_2_);
+
+ if (this.itemStacks[p_70298_1_].stackSize == 0) {
+ this.itemStacks[p_70298_1_] = null;
+ }
+
+ this.markDirty();
+ return itemstack;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public ItemStack getStackInSlotOnClosing(int p_70304_1_) {
+ if (this.itemStacks[p_70304_1_] != null) {
+ ItemStack itemstack = this.itemStacks[p_70304_1_];
+ this.itemStacks[p_70304_1_] = null;
+ return itemstack;
+ }
+ return null;
+ }
+
+ @Override
+ public void setInventorySlotContents(int p_70299_1_, ItemStack p_70299_2_) {
+ this.itemStacks[p_70299_1_] = p_70299_2_;
+ if (p_70299_2_ != null && p_70299_2_.stackSize > this.getInventoryStackLimit()) {
+ p_70299_2_.stackSize = this.getInventoryStackLimit();
+ }
+ this.markDirty();
+ }
+
+ @Override
+ public String getInventoryName() {
+ return BlockCore.bonfire.getLocalizedName();
+ }
+
+ @Override
+ public boolean hasCustomInventoryName() {
+ return false;
+ }
+
+ @Override
+ public int getInventoryStackLimit() {
+ return 64;
+ }
+
+ @Override
+ public void markDirty() {
+ //焼却スロットにアイテムがある場合
+ if(itemStacks[0]!=null){
+ if(!player.worldObj.isRemote) {
+ //--------------------------------焼却経験値の生成------------------------------------------
+ float rate;
+ int size = itemStacks[0].stackSize;
+ int tmp;
+
+ //レートの決定
+ float value;
+ if(itemStacks[0].isItemStackDamageable()){
+ ItemStack is=itemStacks[0].copy();
+ is.setItemDamage(0);
+ value=MCEconomyAPI.getPurchase(is)*(1.f-(float)itemStacks[0].getItemDamage()/(float)itemStacks[0].getMaxDamage());
+ }
+ else{
+ value=MCEconomyAPI.getPurchase(itemStacks[0]);
+ }
+ rate=0.001f*value;
+ if(rate<0.02f) rate=0.02f;
+ if(rate>1.f) rate=1.f;
+
+ //経験値の決定
+ if(rate<1.f){
+ tmp = MathHelper.floor_float(size * rate);
+ if (tmp < MathHelper.ceiling_float_int(size * rate) && (float) Math.random() < size * rate - (float) tmp) {
+ tmp++;
+ }
+ size = tmp;
+ }
+
+ while (size > 0) {
+ tmp = EntityXPOrb.getXPSplit(size);
+ size -= tmp;
+ player.worldObj.spawnEntityInWorld(new EntityXPOrb(player.worldObj, player.posX, player.posY + 0.5D, player.posZ + 0.5D, tmp));
+ }
+
+ //焼却アイテムがエンチャントされてあり、かつハーブスロットにハーブが存在する場合
+ //--------------------------------ESの生成------------------------------------------
+ if (itemStacks[0].isItemEnchanted() || itemStacks[0].getItem()==Items.enchanted_book) {
+ int herb = 0;
+ for (int i = 1; i < 4; i++) {
+ if (itemStacks[i] == null) continue;
+ if (!(itemStacks[i].getItem() instanceof IAlchemyMaterial)) continue;
+
+ if (AlchemyRegistry.IsMatching("herb", itemStacks[i])) {
+ herb++;
+ }
+ }
+
+ if (herb > 0) {
+ //エンチャントの抽出
+ ArrayList<EnchantmentPair> list = new ArrayList<EnchantmentPair>();
+ Map enchantments = EnchantmentHelper.getEnchantments(itemStacks[0]);
+ for (Object obj : enchantments.entrySet()) {
+ Map.Entry e = (Map.Entry) obj;
+ list.add(new EnchantmentPair((Integer) e.getKey(), (Integer) e.getValue()));
+ }
+
+ int mLv=FBSEntityPropertiesAPI.GetMagicLevel(player);
+
+ //ハーブの数だけ繰り返す
+ for (; herb > 0 && !list.isEmpty(); herb--) {
+ int index = rand.nextInt(list.size());
+ EnchantmentPair ep = list.get(index);
+ if (!player.capabilities.isCreativeMode && rand.nextFloat() >= getExtractProb(ep, mLv)){
+ String str=String.format(StatCollector.translateToLocal("info.fbs.enchant.extFailure"), Enchantment.enchantmentsList[ep.id].getTranslatedName(ep.lv));
+ player.addChatComponentMessage(new ChatComponentText(str));
+ continue; //確率で失敗
+ }
+
+ //経験値
+ double exp=100 * ep.lv;
+ FBSEntityPropertiesAPI.AddExp(player, exp, true);
+
+ String str=String.format(StatCollector.translateToLocal("info.fbs.enchant.extSuccess"), Enchantment.enchantmentsList[ep.id].getTranslatedName(ep.lv));
+ str=str+String.format("(EXP+%.2f)", exp);
+ player.addChatComponentMessage(new ChatComponentText(str));
+
+ //ESの生成
+ ItemStack es = new ItemStack(ItemCore.enchantScroll);
+ LinkedHashMap ench = new LinkedHashMap();
+ ench.put(ep.id, ep.lv);
+ EnchantmentHelper.setEnchantments(ench, es);
+
+ player.entityDropItem(es, 0);
+ list.remove(index);
+
+ player.triggerAchievement(AchievementRegistry.extract);
+ }
+ }
+ }
+ }
+
+ for(int i=0;i<itemStacks.length;i++){
+ itemStacks[i]=null;
+ }
+ }
+ }
+
+ @Override
+ public boolean isUseableByPlayer(EntityPlayer p_70300_1_) {
+ return p_70300_1_.worldObj.getBlockMetadata(x,y,z)>0;
+ }
+
+ @Override
+ public void openInventory() {
+
+ }
+
+ @Override
+ public void closeInventory() {
+ if(player.worldObj.isRemote) return;
+
+ for(int i=0;i<itemStacks.length;i++){
+ ItemStack itemstack = this.getStackInSlot(i);
+
+ if (itemstack != null){
+ float f = this.rand.nextFloat() * 0.8F + 0.1F;
+ float f1 = this.rand.nextFloat() * 0.8F + 0.1F;
+ float f2 = this.rand.nextFloat() * 0.8F + 0.1F;
+
+ while (itemstack.stackSize > 0){
+ int k1 = this.rand.nextInt(21) + 10;
+
+ if (k1 > itemstack.stackSize){
+ k1 = itemstack.stackSize;
+ }
+
+ itemstack.stackSize -= k1;
+ double x=player.posX+f;
+ double y=player.posY+f1+player.getEyeHeight();
+ double z=player.posZ+f2;
+ EntityItem entityitem = new EntityItem(player.worldObj, x, y, z, new ItemStack(itemstack.getItem(), k1, itemstack.getItemDamage()));
+
+ if (itemstack.hasTagCompound()){
+ entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy());
+ }
+
+ float f3 = 0.05F;
+ entityitem.motionX = (double)((float)this.rand.nextGaussian() * f3);
+ entityitem.motionY = (double)((float)this.rand.nextGaussian() * f3 + 0.2F);
+ entityitem.motionZ = (double)((float)this.rand.nextGaussian() * f3);
+ player.worldObj.spawnEntityInWorld(entityitem);
+ }
+ }
+ }
+ }
+
+ @Override
+ public boolean isItemValidForSlot(int p_94041_1_, ItemStack p_94041_2_) {
+ return true;
+ }
+
+ public static class EnchantmentPair{
+ int id, lv;
+ public EnchantmentPair(int id, int lv){
+ this.id=id;
+ this.lv=lv;
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/container/inventory/InventoryContract.class b/src/main/java/jp/plusplus/fbs/container/inventory/InventoryContract.class Binary files differnew file mode 100644 index 0000000..32eb9da --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/inventory/InventoryContract.class diff --git a/src/main/java/jp/plusplus/fbs/container/inventory/InventoryContract.java b/src/main/java/jp/plusplus/fbs/container/inventory/InventoryContract.java new file mode 100644 index 0000000..000df7f --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/inventory/InventoryContract.java @@ -0,0 +1,150 @@ +package jp.plusplus.fbs.container.inventory;
+
+import net.minecraft.entity.item.EntityItem;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.StatCollector;
+
+import java.util.Random;
+
+/**
+ * Created by plusplus_F on 2015/11/04.
+ */
+public class InventoryContract implements IInventory {
+ public EntityPlayer player;
+ public ItemStack[] itemStacks=new ItemStack[4];
+ protected Random rand=new Random();
+
+ public InventoryContract(EntityPlayer player){
+ this.player=player;
+ }
+
+ @Override
+ public int getSizeInventory() {
+ return itemStacks.length;
+ }
+
+ @Override
+ public ItemStack getStackInSlot(int p_70301_1_) {
+ return itemStacks[p_70301_1_];
+ }
+
+ @Override
+ public ItemStack decrStackSize(int p_70298_1_, int p_70298_2_) {
+ if (this.itemStacks[p_70298_1_] != null) {
+ ItemStack itemstack;
+
+ if (this.itemStacks[p_70298_1_].stackSize <= p_70298_2_) {
+ itemstack = this.itemStacks[p_70298_1_];
+ this.itemStacks[p_70298_1_] = null;
+ this.markDirty();
+ return itemstack;
+ } else {
+ itemstack = this.itemStacks[p_70298_1_].splitStack(p_70298_2_);
+
+ if (this.itemStacks[p_70298_1_].stackSize == 0) {
+ this.itemStacks[p_70298_1_] = null;
+ }
+
+ this.markDirty();
+ return itemstack;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public ItemStack getStackInSlotOnClosing(int p_70304_1_) {
+ if (this.itemStacks[p_70304_1_] != null) {
+ ItemStack itemstack = this.itemStacks[p_70304_1_];
+ this.itemStacks[p_70304_1_] = null;
+ return itemstack;
+ }
+ return null;
+ }
+
+ @Override
+ public void setInventorySlotContents(int p_70299_1_, ItemStack p_70299_2_) {
+ this.itemStacks[p_70299_1_] = p_70299_2_;
+ if (p_70299_2_ != null && p_70299_2_.stackSize > this.getInventoryStackLimit()) {
+ p_70299_2_.stackSize = this.getInventoryStackLimit();
+ }
+ this.markDirty();
+ }
+
+ @Override
+ public String getInventoryName() {
+ return StatCollector.translateToLocal("book.fbs.contract.title");
+ }
+
+ @Override
+ public boolean hasCustomInventoryName() {
+ return false;
+ }
+
+ @Override
+ public int getInventoryStackLimit() {
+ return 64;
+ }
+
+ @Override
+ public void markDirty() {
+
+ }
+
+ @Override
+ public boolean isUseableByPlayer(EntityPlayer p_70300_1_) {
+ return true;
+ }
+
+ @Override
+ public void openInventory() {
+
+ }
+
+ @Override
+ public void closeInventory() {
+ if(player.worldObj.isRemote) return;
+
+ for(int i=0;i<itemStacks.length;i++){
+ ItemStack itemstack = this.getStackInSlot(i);
+
+ if (itemstack != null){
+ float f = this.rand.nextFloat() * 0.8F + 0.1F;
+ float f1 = this.rand.nextFloat() * 0.8F + 0.1F;
+ float f2 = this.rand.nextFloat() * 0.8F + 0.1F;
+
+ while (itemstack.stackSize > 0){
+ int k1 = this.rand.nextInt(21) + 10;
+
+ if (k1 > itemstack.stackSize){
+ k1 = itemstack.stackSize;
+ }
+
+ itemstack.stackSize -= k1;
+ double x=player.posX+f;
+ double y=player.posY+f1+player.getEyeHeight();
+ double z=player.posZ+f2;
+ EntityItem entityitem = new EntityItem(player.worldObj, x, y, z, new ItemStack(itemstack.getItem(), k1, itemstack.getItemDamage()));
+
+ if (itemstack.hasTagCompound()){
+ entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy());
+ }
+
+ float f3 = 0.05F;
+ entityitem.motionX = (double)((float)this.rand.nextGaussian() * f3);
+ entityitem.motionY = (double)((float)this.rand.nextGaussian() * f3 + 0.2F);
+ entityitem.motionZ = (double)((float)this.rand.nextGaussian() * f3);
+ player.worldObj.spawnEntityInWorld(entityitem);
+ }
+ }
+ }
+ }
+
+ @Override
+ public boolean isItemValidForSlot(int p_94041_1_, ItemStack p_94041_2_) {
+ return true;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/container/inventory/InventoryEnchantment.class b/src/main/java/jp/plusplus/fbs/container/inventory/InventoryEnchantment.class Binary files differnew file mode 100644 index 0000000..8f4bd1a --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/inventory/InventoryEnchantment.class diff --git a/src/main/java/jp/plusplus/fbs/container/inventory/InventoryEnchantment.java b/src/main/java/jp/plusplus/fbs/container/inventory/InventoryEnchantment.java new file mode 100644 index 0000000..a66e844 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/inventory/InventoryEnchantment.java @@ -0,0 +1,158 @@ +package jp.plusplus.fbs.container.inventory;
+
+import jp.plusplus.fbs.block.BlockCore;
+import jp.plusplus.fbs.item.ItemCore;
+import net.minecraft.enchantment.EnchantmentHelper;
+import net.minecraft.entity.item.EntityItem;
+import net.minecraft.entity.item.EntityXPOrb;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.MathHelper;
+import net.minecraft.util.StatCollector;
+import shift.mceconomy2.api.MCEconomyAPI;
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Random;
+
+/**
+ * Created by plusplus_F on 2015/10/21.
+ */
+public class InventoryEnchantment implements IInventory {
+ public EntityPlayer player;
+ public ItemStack[] itemStacks=new ItemStack[3];
+ protected Random rand=new Random();
+
+ public InventoryEnchantment(EntityPlayer ep){
+ player=ep;
+ }
+
+ @Override
+ public int getSizeInventory() {
+ return itemStacks.length;
+ }
+
+ @Override
+ public ItemStack getStackInSlot(int p_70301_1_) {
+ return itemStacks[p_70301_1_];
+ }
+
+ @Override
+ public ItemStack decrStackSize(int p_70298_1_, int p_70298_2_) {
+ if (this.itemStacks[p_70298_1_] != null) {
+ ItemStack itemstack;
+
+ if (this.itemStacks[p_70298_1_].stackSize <= p_70298_2_) {
+ itemstack = this.itemStacks[p_70298_1_];
+ this.itemStacks[p_70298_1_] = null;
+ this.markDirty();
+ return itemstack;
+ } else {
+ itemstack = this.itemStacks[p_70298_1_].splitStack(p_70298_2_);
+
+ if (this.itemStacks[p_70298_1_].stackSize == 0) {
+ this.itemStacks[p_70298_1_] = null;
+ }
+
+ this.markDirty();
+ return itemstack;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public ItemStack getStackInSlotOnClosing(int p_70304_1_) {
+ if (this.itemStacks[p_70304_1_] != null) {
+ ItemStack itemstack = this.itemStacks[p_70304_1_];
+ this.itemStacks[p_70304_1_] = null;
+ return itemstack;
+ }
+ return null;
+ }
+
+ @Override
+ public void setInventorySlotContents(int p_70299_1_, ItemStack p_70299_2_) {
+ this.itemStacks[p_70299_1_] = p_70299_2_;
+ if (p_70299_2_ != null && p_70299_2_.stackSize > this.getInventoryStackLimit()) {
+ p_70299_2_.stackSize = this.getInventoryStackLimit();
+ }
+ this.markDirty();
+ }
+
+ @Override
+ public String getInventoryName() {
+ return StatCollector.translateToLocal(ItemCore.enchantScroll.getUnlocalizedName()+".name");
+ }
+
+ @Override
+ public boolean hasCustomInventoryName() {
+ return false;
+ }
+
+ @Override
+ public int getInventoryStackLimit() {
+ return 64;
+ }
+
+ @Override
+ public void markDirty() {
+
+ }
+
+ @Override
+ public boolean isUseableByPlayer(EntityPlayer p_70300_1_) {
+ return true;
+ }
+
+ @Override
+ public void openInventory() {
+
+ }
+
+ @Override
+ public void closeInventory() {
+ if(player.worldObj.isRemote) return;
+
+ for(int i=0;i<itemStacks.length;i++){
+ ItemStack itemstack = this.getStackInSlot(i);
+
+ if (itemstack != null){
+ float f = this.rand.nextFloat() * 0.8F + 0.1F;
+ float f1 = this.rand.nextFloat() * 0.8F + 0.1F;
+ float f2 = this.rand.nextFloat() * 0.8F + 0.1F;
+
+ while (itemstack.stackSize > 0){
+ int k1 = this.rand.nextInt(21) + 10;
+
+ if (k1 > itemstack.stackSize){
+ k1 = itemstack.stackSize;
+ }
+
+ itemstack.stackSize -= k1;
+ double x=player.posX+f;
+ double y=player.posY+f1+player.getEyeHeight();
+ double z=player.posZ+f2;
+ EntityItem entityitem = new EntityItem(player.worldObj, x, y, z, new ItemStack(itemstack.getItem(), k1, itemstack.getItemDamage()));
+
+ if (itemstack.hasTagCompound()){
+ entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy());
+ }
+
+ float f3 = 0.05F;
+ entityitem.motionX = (double)((float)this.rand.nextGaussian() * f3);
+ entityitem.motionY = (double)((float)this.rand.nextGaussian() * f3 + 0.2F);
+ entityitem.motionZ = (double)((float)this.rand.nextGaussian() * f3);
+ player.worldObj.spawnEntityInWorld(entityitem);
+ }
+ }
+ }
+ }
+
+ public boolean isItemValidForSlot(int p_94041_1_, ItemStack p_94041_2_) {
+ return true;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/container/inventory/InventoryMagic.class b/src/main/java/jp/plusplus/fbs/container/inventory/InventoryMagic.class Binary files differnew file mode 100644 index 0000000..caca4b1 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/inventory/InventoryMagic.class diff --git a/src/main/java/jp/plusplus/fbs/container/inventory/InventoryMagic.java b/src/main/java/jp/plusplus/fbs/container/inventory/InventoryMagic.java new file mode 100644 index 0000000..7cdb62a --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/inventory/InventoryMagic.java @@ -0,0 +1,179 @@ +package jp.plusplus.fbs.container.inventory;
+
+import cpw.mods.fml.common.FMLLog;
+import jp.plusplus.fbs.container.ContainerMagic;
+import jp.plusplus.fbs.tileentity.TileEntityMagicCore;
+import net.minecraft.entity.item.EntityItem;
+import net.minecraft.entity.item.EntityXPOrb;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.inventory.Slot;
+import net.minecraft.inventory.SlotFurnace;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.MathHelper;
+import net.minecraft.util.ResourceLocation;
+
+import java.util.Random;
+
+/**
+ * Created by pluslus_F on 2015/06/18.
+ */
+public abstract class InventoryMagic implements IInventory {
+ public ItemStack[] itemStacks;
+ public TileEntityMagicCore magicCore;
+ public Random rand=new Random();
+ public EntityPlayer player;
+
+ public InventoryMagic(int size, TileEntityMagicCore te, EntityPlayer player){
+ itemStacks=new ItemStack[size];
+ magicCore=te;
+ this.player=player;
+ }
+
+ public abstract void work();
+ public abstract void onInventoryChanged(int index);
+ public abstract void addSlotToContainer(ContainerMagic cm);
+
+ public int getProgressScaled(int sc){
+ if(magicCore==null) return 0;
+ if(magicCore.progressMax==0) return 0;
+ return sc*magicCore.progress/magicCore.progressMax;
+ }
+
+ public abstract ResourceLocation getResource();
+ public int getProgressX(){ return 68;}
+ public int getProgressY(){ return 36;}
+
+ @Override
+ public int getSizeInventory() {
+ return itemStacks.length;
+ }
+
+ @Override
+ public ItemStack getStackInSlot(int p_70301_1_) {
+ return itemStacks[p_70301_1_];
+ }
+
+ @Override
+ public ItemStack decrStackSize(int p_70298_1_, int p_70298_2_) {
+ if (this.itemStacks[p_70298_1_] != null) {
+ ItemStack itemstack;
+
+ if (this.itemStacks[p_70298_1_].stackSize <= p_70298_2_) {
+ itemstack = this.itemStacks[p_70298_1_];
+ this.itemStacks[p_70298_1_] = null;
+ this.markDirty();
+ return itemstack;
+ } else {
+ itemstack = this.itemStacks[p_70298_1_].splitStack(p_70298_2_);
+
+ if (this.itemStacks[p_70298_1_].stackSize == 0) {
+ this.itemStacks[p_70298_1_] = null;
+ }
+
+ this.markDirty();
+ return itemstack;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public ItemStack getStackInSlotOnClosing(int p_70304_1_) {
+ if (this.itemStacks[p_70304_1_] != null) {
+ ItemStack itemstack = this.itemStacks[p_70304_1_];
+ this.itemStacks[p_70304_1_] = null;
+ return itemstack;
+ }
+ return null;
+ }
+
+ @Override
+ public void setInventorySlotContents(int p_70299_1_, ItemStack p_70299_2_) {
+ this.itemStacks[p_70299_1_] = p_70299_2_;
+ if (p_70299_2_ != null && p_70299_2_.stackSize > this.getInventoryStackLimit()) {
+ p_70299_2_.stackSize = this.getInventoryStackLimit();
+ }
+ this.markDirty();
+ }
+
+ @Override
+ public abstract String getInventoryName();
+
+ @Override
+ public boolean hasCustomInventoryName() {
+ return false;
+ }
+
+ @Override
+ public int getInventoryStackLimit() {
+ return 64;
+ }
+
+ @Override
+ public void markDirty() {
+
+ }
+
+ @Override
+ public boolean isUseableByPlayer(EntityPlayer p_70300_1_) {
+ return true;
+ }
+
+ @Override
+ public void openInventory() {
+ if(magicCore!=null){
+ magicCore.setInventory(this);
+ //FMLLog.info("registered inventory");
+ }
+ }
+
+ @Override
+ public void closeInventory() {
+ if(magicCore!=null){
+ magicCore.removeInventory();
+ }
+
+ if(player.worldObj.isRemote) return;
+
+ for(int i=0;i<itemStacks.length;i++){
+ ItemStack itemstack = this.getStackInSlot(i);
+
+ if (itemstack != null){
+ float f = this.rand.nextFloat() * 0.8F + 0.1F;
+ float f1 = this.rand.nextFloat() * 0.8F + 0.1F;
+ float f2 = this.rand.nextFloat() * 0.8F + 0.1F;
+
+ while (itemstack.stackSize > 0){
+ int k1 = this.rand.nextInt(21) + 10;
+
+ if (k1 > itemstack.stackSize){
+ k1 = itemstack.stackSize;
+ }
+
+ itemstack.stackSize -= k1;
+ double x=player.posX+f;
+ double y=player.posY+f1+player.getEyeHeight();
+ double z=player.posZ+f2;
+ EntityItem entityitem = new EntityItem(player.worldObj, x, y, z, new ItemStack(itemstack.getItem(), k1, itemstack.getItemDamage()));
+
+ if (itemstack.hasTagCompound()){
+ entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy());
+ }
+
+ float f3 = 0.05F;
+ entityitem.motionX = (double)((float)this.rand.nextGaussian() * f3);
+ entityitem.motionY = (double)((float)this.rand.nextGaussian() * f3 + 0.2F);
+ entityitem.motionZ = (double)((float)this.rand.nextGaussian() * f3);
+ player.worldObj.spawnEntityInWorld(entityitem);
+ }
+ }
+ }
+ }
+
+ @Override
+ public boolean isItemValidForSlot(int p_94041_1_, ItemStack p_94041_2_) {
+ return true;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/container/inventory/InventoryMagicCopy.class b/src/main/java/jp/plusplus/fbs/container/inventory/InventoryMagicCopy.class Binary files differnew file mode 100644 index 0000000..0c75b21 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/inventory/InventoryMagicCopy.class diff --git a/src/main/java/jp/plusplus/fbs/container/inventory/InventoryMagicCopy.java b/src/main/java/jp/plusplus/fbs/container/inventory/InventoryMagicCopy.java new file mode 100644 index 0000000..482ffc6 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/inventory/InventoryMagicCopy.java @@ -0,0 +1,108 @@ +package jp.plusplus.fbs.container.inventory;
+
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.Registry;
+import jp.plusplus.fbs.container.ContainerMagic;
+import jp.plusplus.fbs.container.slot.SlotMagic;
+import jp.plusplus.fbs.container.slot.SlotMagicCopy;
+import jp.plusplus.fbs.container.slot.SlotMagicTakeOnly;
+import jp.plusplus.fbs.exprop.SanityManager;
+import jp.plusplus.fbs.item.ItemBookSorcery;
+import jp.plusplus.fbs.api.MagicBase;
+import jp.plusplus.fbs.tileentity.TileEntityMagicCore;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.util.ResourceLocation;
+
+/**
+ * Created by pluslus_F on 2015/06/18.
+ */
+public class InventoryMagicCopy extends InventoryMagic {
+ public static final ResourceLocation rl=new ResourceLocation(FBS.MODID, "textures/gui/magicCopy.png");
+
+ public InventoryMagicCopy(TileEntityMagicCore te, EntityPlayer player) {
+ super(4, te, player);
+ }
+
+ @Override
+ public void work() {
+ if(itemStacks[0]==null) return;
+
+ //コピー魔法が無かったら
+ MagicBase mb=Registry.GetMagic("fbs.copy").getMagic(this.player.worldObj, this.player, true);
+ if(mb==null) return;
+
+ boolean crm=player.capabilities.isCreativeMode;
+
+ if(crm || mb.checkSuccess()){
+ //クリエイティブか、魔法に成功すると
+ for(int i=1;i<3;i++){
+ if(itemStacks[i]==null){
+ itemStacks[i]=itemStacks[0].copy();
+ }
+ else if(itemStacks[i].isItemEqual(itemStacks[0])){
+ itemStacks[i].stackSize++;
+ }
+ }
+ }
+ else {
+ SanityManager.loseSanity(player, 2, 10, true);
+ if(itemStacks[1]==null) itemStacks[1]=itemStacks[0];
+ else if(itemStacks[1].isItemEqual(itemStacks[0])) itemStacks[1].stackSize++;
+ }
+
+ //魔導書の回数を減らす
+ if(itemStacks[3]!=null && !crm) ItemBookSorcery.reduceMagicMaxUse(itemStacks[3]);
+
+ itemStacks[0]=null;
+ onInventoryChanged(0);
+ }
+
+ @Override
+ public void onInventoryChanged(int index) {
+ //FMLLog.info("changed");
+
+ //増やしたいアイテムが無い場合、魔導書が無い場合進捗を無に帰す
+ if (itemStacks[0] == null || itemStacks[3] == null) {
+ magicCore.resetProgress();
+ //FMLLog.info("item null");
+ return;
+ }
+
+ //本がおかしくても進捗を無に帰す
+ Registry.BookData bd = Registry.GetBookDataFromItemStack(itemStacks[3]);
+ if (bd == null || !bd.title.equals("fbs.copy") || ItemBookSorcery.getMagicMaxUse(itemStacks[3]) <= 0) {
+ magicCore.resetProgress();
+ return;
+ }
+
+ //増やせそうにない場合も進捗を無に帰す
+ for (int i = 1; i < 3; i++) {
+ if (itemStacks[i] == null) continue;
+ if (!itemStacks[i].isItemEqual(itemStacks[0]) || itemStacks[i].stackSize + 1 > itemStacks[i].getMaxStackSize()) {
+ magicCore.resetProgress();
+ return;
+ }
+ }
+
+ //進捗の最大値を設定する
+ magicCore.setProgressMax(20 * 10);
+ }
+
+ @Override
+ public void addSlotToContainer(ContainerMagic cm) {
+ cm.addSlotToContainer(new SlotMagicCopy(this, 0, 44, 36));
+ cm.addSlotToContainer(new SlotMagicTakeOnly(this, 1, 103, 36));
+ cm.addSlotToContainer(new SlotMagicTakeOnly(this, 2, 129, 36));
+ cm.addSlotToContainer(new SlotMagic(this, 3, 72, 17));
+ }
+
+ @Override
+ public ResourceLocation getResource() {
+ return rl;
+ }
+
+ @Override
+ public String getInventoryName() {
+ return Registry.GetLocalizedBookTitle("fbs.copy");
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/container/inventory/InventoryMagicTimeTrace.class b/src/main/java/jp/plusplus/fbs/container/inventory/InventoryMagicTimeTrace.class Binary files differnew file mode 100644 index 0000000..3022a92 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/inventory/InventoryMagicTimeTrace.class diff --git a/src/main/java/jp/plusplus/fbs/container/inventory/InventoryMagicTimeTrace.java b/src/main/java/jp/plusplus/fbs/container/inventory/InventoryMagicTimeTrace.java new file mode 100644 index 0000000..352dcfb --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/inventory/InventoryMagicTimeTrace.java @@ -0,0 +1,135 @@ +package jp.plusplus.fbs.container.inventory;
+
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.Registry;
+import jp.plusplus.fbs.api.MagicBase;
+import jp.plusplus.fbs.container.ContainerMagic;
+import jp.plusplus.fbs.container.slot.SlotMagic;
+import jp.plusplus.fbs.container.slot.SlotMagicCopy;
+import jp.plusplus.fbs.container.slot.SlotMagicTakeOnly;
+import jp.plusplus.fbs.container.slot.SlotMagicTimeTrace;
+import jp.plusplus.fbs.exprop.SanityManager;
+import jp.plusplus.fbs.item.ItemBookSorcery;
+import jp.plusplus.fbs.mod.ForIR3;
+import jp.plusplus.fbs.mod.ForSS2;
+import jp.plusplus.fbs.tileentity.TileEntityMagicCore;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.ResourceLocation;
+
+/**
+ * Created by plusplus_F on 2016/02/28.
+ */
+public class InventoryMagicTimeTrace extends InventoryMagic {
+ public static final ResourceLocation rl=new ResourceLocation(FBS.MODID, "textures/gui/magicProcessing.png");
+
+ public InventoryMagicTimeTrace(TileEntityMagicCore te, EntityPlayer player) {
+ super(4, te, player);
+ }
+
+ public float getRepairPercent(){
+ return 0.5f*rand.nextFloat();
+ }
+
+ @Override
+ public void work() {
+ if(itemStacks[0]==null) return;
+
+ //魔法が無かったら
+ MagicBase mb=Registry.GetMagic("fbs.timeTrace").getMagic(this.player.worldObj, this.player, true);
+ if(mb==null) return;
+
+ boolean crm=player.capabilities.isCreativeMode;
+ if(crm || mb.checkSuccess()){
+ //クリエイティブか、魔法に成功すると
+ SanityManager.loseSanity(player, 1, 10, true);
+
+ ItemStack itemStack=itemStacks[0].copy();
+ if(FBS.cooperatesIR3 && ForIR3.isCrystalUnit(itemStack)){
+ ForIR3.repairCrystalUnit(itemStack, getRepairPercent());
+ }
+ else if(FBS.cooperatesSS2 && ForSS2.canTimeTrace(itemStack)){
+ itemStack=ForSS2.getTimeTraced(itemStack);
+ }
+ else if(itemStack.getItem().isItemTool(itemStack)){
+ int d=itemStack.getItemDamage();
+ d=Math.max(0, d-(int)(itemStack.getMaxDamage()*getRepairPercent()));
+ itemStack.setItemDamage(d);
+ }
+
+ if(itemStacks[1]==null){
+ itemStacks[1]=itemStack;
+ }
+ else if(itemStacks[1].isItemEqual(itemStack) && itemStacks[1].stackSize+itemStack.stackSize<=itemStack.getMaxStackSize()){
+ itemStacks[1].stackSize+=itemStack.stackSize;
+ }
+ }
+ else {
+ SanityManager.loseSanity(player, 1, 10, true);
+ if(itemStacks[1]==null) itemStacks[1]=itemStacks[0];
+ else if(itemStacks[1].isItemEqual(itemStacks[0])) itemStacks[1].stackSize++;
+ }
+
+ //魔導書の回数を減らす
+ if(itemStacks[2]!=null && !crm) ItemBookSorcery.reduceMagicMaxUse(itemStacks[2]);
+
+ itemStacks[0]=null;
+ onInventoryChanged(0);
+ }
+
+ @Override
+ public void onInventoryChanged(int index) {
+ //増やしたいアイテムが無い場合、魔導書が無い場合進捗を無に帰す
+ if (itemStacks[0] == null || itemStacks[2] == null) {
+ magicCore.resetProgress();
+ //FMLLog.info("item null");
+ return;
+ }
+
+ //本がおかしくても進捗を無に帰す
+ Registry.BookData bd = Registry.GetBookDataFromItemStack(itemStacks[2]);
+ if (bd == null || !bd.title.equals("fbs.timeTrace") || ItemBookSorcery.getMagicMaxUse(itemStacks[2]) <= 0) {
+ magicCore.resetProgress();
+ return;
+ }
+
+ //処理できそうにない場合も進捗を無に帰す
+ ItemStack get=null;
+ ItemStack itemStack=itemStacks[0].copy();
+ if(FBS.cooperatesIR3 && ForIR3.isCrystalUnit(itemStack)){
+ get=itemStack;
+ }
+ else if(FBS.cooperatesSS2 && ForSS2.canTimeTrace(itemStack)){
+ get=ForSS2.getTimeTraced(itemStack);
+ }
+ else if(itemStack.getItem().isItemTool(itemStack)){
+ get=itemStack;
+ }
+
+ //変換できない・完成品スロットのアイテムが違う・完成品スロットのスタック数がmaxのとき、失敗
+ if(get==null || (itemStacks[1]!=null && (!itemStacks[1].isItemEqual(get) || itemStacks[1].stackSize+get.stackSize>itemStacks[1].getMaxStackSize()))){
+ magicCore.resetProgress();
+ return;
+ }
+
+ //進捗の最大値を設定する
+ magicCore.setProgressMax(20 * 3);
+ }
+
+ @Override
+ public void addSlotToContainer(ContainerMagic cm) {
+ cm.addSlotToContainer(new SlotMagicTimeTrace(this, 0, 44, 36));
+ cm.addSlotToContainer(new SlotMagicTakeOnly(this, 1, 103, 36));
+ cm.addSlotToContainer(new SlotMagic(this, 2, 72, 17));
+ }
+
+ @Override
+ public ResourceLocation getResource() {
+ return rl;
+ }
+
+ @Override
+ public String getInventoryName() {
+ return Registry.GetLocalizedBookTitle("fbs.timeTrace");
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/container/inventory/InventoryStaff.class b/src/main/java/jp/plusplus/fbs/container/inventory/InventoryStaff.class Binary files differnew file mode 100644 index 0000000..c20b0d3 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/inventory/InventoryStaff.class diff --git a/src/main/java/jp/plusplus/fbs/container/inventory/InventoryStaff.java b/src/main/java/jp/plusplus/fbs/container/inventory/InventoryStaff.java new file mode 100644 index 0000000..35e6515 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/inventory/InventoryStaff.java @@ -0,0 +1,189 @@ +package jp.plusplus.fbs.container.inventory;
+
+import jp.plusplus.fbs.AchievementRegistry;
+import jp.plusplus.fbs.Registry;
+import jp.plusplus.fbs.item.ItemCore;
+import jp.plusplus.fbs.item.ItemStaff;
+import jp.plusplus.fbs.api.IResonance;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.ChatComponentTranslation;
+
+/**
+ * Createdby pluslus_Fon 2015/06/15.
+ */
+public class InventoryStaff implements IInventory {
+ public ItemStack[] itemStacks;
+
+
+ protected InventoryPlayer inventoryPlayer;
+ protected ItemStack currentItem;
+ protected ItemStack[] items;
+ public int gemNum;
+ public int bookNum;
+
+ public InventoryStaff(InventoryPlayer inventory) {
+ inventoryPlayer = inventory;
+ currentItem = inventoryPlayer.getCurrentItem();
+
+ if (currentItem != null && currentItem.getItem() instanceof ItemStaff) {
+ gemNum = ((ItemStaff) currentItem.getItem()).gemNum;
+ }
+
+ //InventorySize
+ bookNum=((ItemStaff)currentItem.getItem()).bookNum;
+ items = new ItemStack[gemNum+bookNum];
+ }
+
+ @Override
+ public int getSizeInventory() {
+ return items.length;
+ }
+
+ @Override
+ public ItemStack getStackInSlot(int slot) {
+ return items[slot];
+ }
+
+ @Override
+ public ItemStack decrStackSize(int p_70298_1_, int p_70298_2_) {
+ if (this.items[p_70298_1_] != null) {
+ ItemStack itemstack;
+
+ if (this.items[p_70298_1_].stackSize <= p_70298_2_) {
+ itemstack = this.items[p_70298_1_];
+ this.items[p_70298_1_] = null;
+ this.markDirty();
+ return itemstack;
+ } else {
+ itemstack = this.items[p_70298_1_].splitStack(p_70298_2_);
+
+ if (this.items[p_70298_1_].stackSize == 0) {
+ this.items[p_70298_1_] = null;
+ }
+
+ this.markDirty();
+ return itemstack;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public ItemStack getStackInSlotOnClosing(int p_70304_1_) {
+ if (this.items[p_70304_1_] != null) {
+ ItemStack itemstack = this.items[p_70304_1_];
+ this.items[p_70304_1_] = null;
+ return itemstack;
+ }
+ return null;
+ }
+
+ @Override
+ public void setInventorySlotContents(int p_70299_1_, ItemStack p_70299_2_) {
+ this.items[p_70299_1_] = p_70299_2_;
+ if (p_70299_2_ != null && p_70299_2_.stackSize > this.getInventoryStackLimit()) {
+ p_70299_2_.stackSize = this.getInventoryStackLimit();
+ }
+ this.markDirty();
+ }
+
+ @Override
+ public String getInventoryName() {
+ return currentItem.getDisplayName();
+ }
+
+ @Override
+ public boolean hasCustomInventoryName() {
+ return false;
+ }
+
+ @Override
+ public int getInventoryStackLimit() {
+ return 1;
+ }
+
+ @Override
+ public void markDirty() {
+ }
+
+ @Override
+ public boolean isUseableByPlayer(EntityPlayer p_70300_1_) {
+ return true;
+ }
+
+ /*
+ Containerが開かれたタイミングでItemStackの持っているNBTからアイテムを読み込んでいる
+ */
+ @Override
+ public void openInventory() {
+ items=ItemStaff.loadInventory(currentItem);
+ }
+
+ /*
+ Containerを閉じるときに保存
+ */
+ @Override
+ public void closeInventory() {
+ ItemStack result = new ItemStack(currentItem.getItem(), 1, currentItem.getItemDamage());
+ ItemStaff.saveInventory(result, items);
+
+ //ItemStackをセットする。NBTは右クリック等のタイミングでしか保存されないため再セットで保存している。
+ inventoryPlayer.mainInventory[inventoryPlayer.currentItem] = result;
+
+ EntityPlayer p=inventoryPlayer.player;
+ if(!p.worldObj.isRemote) {
+ String n = result.getTagCompound().getString("MagicName");
+ if (n.equals("fbs.failure")){
+ p.addChatComponentMessage(new ChatComponentTranslation("info.fbs.magic.resona.failure"));
+ }
+ else if (Registry.IsResonance(n)){
+ p.addChatComponentMessage(new ChatComponentTranslation("info.fbs.magic.resona.success"));
+ p.triggerAchievement(AchievementRegistry.resonance);
+ }
+
+
+ if(bookNum>1) {
+ IResonance r=Registry.GetResonance(n);
+ if(r==null) return;
+
+ String[] books=new String[bookNum];
+ for(int i=0;i<bookNum;i++){
+ if(items[i]==null) continue;
+ books[i]=Registry.GetUnlocalizedBookTitleFromItemStack(items[i]);
+ }
+
+ String s = "";
+ int i = 0;
+ boolean find = false, find1=false;
+ for (; i < bookNum; i++) {
+ if (items[i] != null && items[i].getItem() == ItemCore.bookSorcery) {
+ s = ItemCore.bookNoDecoded.getLocalizedBookTitle(items[i]);
+ find = true;
+ break;
+ }
+ }
+ for (i++; i < bookNum; i++) {
+ if (items[i] != null && items[i].getItem() == ItemCore.bookSorcery) {
+ s += " + " + ItemCore.bookNoDecoded.getLocalizedBookTitle(items[i]);
+ find1 = true;
+ break;
+ }
+ }
+ if (find && find1) {
+ s += " -> " + r.getDisplayMagicName(books);
+ p.addChatComponentMessage(new ChatComponentText(s));
+ }
+ }
+ }
+ }
+
+ @Override
+ public boolean isItemValidForSlot(int i, ItemStack item) {
+ if(item==null) return false;
+ return item.getItem()==ItemCore.bookSorcery;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/container/slot/SlotBonfire.class b/src/main/java/jp/plusplus/fbs/container/slot/SlotBonfire.class Binary files differnew file mode 100644 index 0000000..55fb95a --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/slot/SlotBonfire.class diff --git a/src/main/java/jp/plusplus/fbs/container/slot/SlotBonfire.java b/src/main/java/jp/plusplus/fbs/container/slot/SlotBonfire.java new file mode 100644 index 0000000..876f09a --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/slot/SlotBonfire.java @@ -0,0 +1,46 @@ +package jp.plusplus.fbs.container.slot;
+
+import jp.plusplus.fbs.alchemy.AlchemyRegistry;
+import jp.plusplus.fbs.alchemy.IAlchemyMaterial;
+import net.minecraft.init.Items;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import shift.mceconomy2.api.MCEconomyAPI;
+
+/**
+ * Created by plusplus_F on 2015/10/31.
+ */
+public class SlotBonfire extends Slot{
+ protected int type;
+
+ public SlotBonfire(IInventory p_i1824_1_, int p_i1824_2_, int p_i1824_3_, int p_i1824_4_, int type) {
+ super(p_i1824_1_, p_i1824_2_, p_i1824_3_, p_i1824_4_);
+ this.type=type;
+ }
+
+ public boolean isItemValid(ItemStack itemStack) {
+ if(type==0){
+ //焼くもの
+ if(itemStack.isItemStackDamageable()){
+ ItemStack it = itemStack.copy();
+ it.setItemDamage(0);
+ return MCEconomyAPI.getPurchase(it) >= 0 || itemStack.isItemEnchanted();
+ }
+ else {
+ return MCEconomyAPI.getPurchase(itemStack)>=0 || itemStack.isItemEnchanted() || itemStack.getItem()== Items.enchanted_book;
+ }
+ }
+ if(type==1){
+ //ハーブ
+ Item item=itemStack.getItem();
+ if(!(item instanceof IAlchemyMaterial)) return false;
+ return AlchemyRegistry.IsMatching("herb", itemStack);
+ }
+
+ return true;
+ }
+
+
+}
diff --git a/src/main/java/jp/plusplus/fbs/container/slot/SlotContract.class b/src/main/java/jp/plusplus/fbs/container/slot/SlotContract.class Binary files differnew file mode 100644 index 0000000..ee7d789 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/slot/SlotContract.class diff --git a/src/main/java/jp/plusplus/fbs/container/slot/SlotContract.java b/src/main/java/jp/plusplus/fbs/container/slot/SlotContract.java new file mode 100644 index 0000000..673b886 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/slot/SlotContract.java @@ -0,0 +1,49 @@ +package jp.plusplus.fbs.container.slot;
+
+import jp.plusplus.fbs.Registry;
+import jp.plusplus.fbs.alchemy.AlchemyRegistry;
+import jp.plusplus.fbs.alchemy.IAlchemyMaterial;
+import jp.plusplus.fbs.item.ItemBookSorcery;
+import jp.plusplus.fbs.item.ItemStoneSpirit;
+import jp.plusplus.fbs.spirit.SpiritManager;
+import net.minecraft.init.Items;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import shift.mceconomy2.api.MCEconomyAPI;
+
+/**
+ * Created by plusplus_F on 2015/11/04.
+ */
+public class SlotContract extends Slot{
+ protected int type;
+
+ public SlotContract(IInventory p_i1824_1_, int p_i1824_2_, int p_i1824_3_, int p_i1824_4_, int type) {
+ super(p_i1824_1_, p_i1824_2_, p_i1824_3_, p_i1824_4_);
+ this.type=type;
+ }
+
+ @Override
+ public boolean isItemValid(ItemStack itemStack) {
+ if(type==0){
+ //武器
+ return SpiritManager.isTool(itemStack.getItem());
+ }
+ else if(type==1){
+ //精霊石
+ return itemStack.getItem() instanceof ItemStoneSpirit;
+ }
+ else if(type==2){
+ //書物
+ if(!(itemStack.getItem() instanceof ItemBookSorcery)) return false;
+ Registry.BookData bd=Registry.GetBookDataFromItemStack(itemStack);
+ if(bd==null) return false;
+ return bd.title.equals("fbs.contract");
+ }
+
+ return true;
+ }
+
+
+}
diff --git a/src/main/java/jp/plusplus/fbs/container/slot/SlotCrafting.class b/src/main/java/jp/plusplus/fbs/container/slot/SlotCrafting.class Binary files differnew file mode 100644 index 0000000..8645c7a --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/slot/SlotCrafting.class diff --git a/src/main/java/jp/plusplus/fbs/container/slot/SlotCrafting.java b/src/main/java/jp/plusplus/fbs/container/slot/SlotCrafting.java new file mode 100644 index 0000000..3e73133 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/slot/SlotCrafting.java @@ -0,0 +1,81 @@ +package jp.plusplus.fbs.container.slot;
+
+import cpw.mods.fml.common.FMLCommonHandler;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.common.MinecraftForge;
+import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent;
+
+/**
+ * Createdby pluslus_Fon 2015/06/14.
+ */
+public class SlotCrafting extends Slot {
+ private EntityPlayer thePlayer;
+ private int amountCrafted;
+ private IInventory inventory;
+
+ public SlotCrafting(EntityPlayer player, IInventory p_i1823_3_, int p_i1823_4_, int p_i1823_5_, int p_i1823_6_) {
+ super(p_i1823_3_, p_i1823_4_, p_i1823_5_, p_i1823_6_);
+ this.thePlayer = player;
+ this.inventory=p_i1823_3_;
+ }
+
+ @Override
+ public boolean isItemValid(ItemStack p_75214_1_)
+ {
+ return false;
+ }
+
+ @Override
+ public ItemStack decrStackSize(int p_75209_1_) {
+ if (this.getHasStack()) {
+ this.amountCrafted += Math.min(p_75209_1_, this.getStack().stackSize);
+ }
+ return super.decrStackSize(p_75209_1_);
+ }
+
+ @Override
+ protected void onCrafting(ItemStack p_75210_1_, int p_75210_2_) {
+ this.amountCrafted += p_75210_2_;
+ this.onCrafting(p_75210_1_);
+ }
+
+ @Override
+ protected void onCrafting(ItemStack p_75208_1_) {
+ p_75208_1_.onCrafting(this.thePlayer.worldObj, this.thePlayer, this.amountCrafted);
+ this.amountCrafted = 0;
+ }
+
+ @Override
+ public void onPickupFromSlot(EntityPlayer p_82870_1_, ItemStack p_82870_2_) {
+ FMLCommonHandler.instance().firePlayerCraftingEvent(p_82870_1_, p_82870_2_, inventory);
+ this.onCrafting(p_82870_2_);
+
+ for (int i = 0; i < 9; ++i) {
+ ItemStack itemstack1 = inventory.getStackInSlot(i);
+
+ if (itemstack1 != null) {
+ inventory.decrStackSize(i, 1);
+
+ if (itemstack1.getItem().hasContainerItem(itemstack1)) {
+ ItemStack itemstack2 = itemstack1.getItem().getContainerItem(itemstack1);
+
+ if (itemstack2 != null && itemstack2.isItemStackDamageable() && itemstack2.getItemDamage() > itemstack2.getMaxDamage()) {
+ MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(thePlayer, itemstack2));
+ continue;
+ }
+
+ if (!itemstack1.getItem().doesContainerItemLeaveCraftingGrid(itemstack1) || !this.thePlayer.inventory.addItemStackToInventory(itemstack2)) {
+ if (inventory.getStackInSlot(i) == null) {
+ inventory.setInventorySlotContents(i, itemstack2);
+ } else {
+ this.thePlayer.dropPlayerItemWithRandomChoice(itemstack2, false);
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/container/slot/SlotCraftingPottery.class b/src/main/java/jp/plusplus/fbs/container/slot/SlotCraftingPottery.class Binary files differnew file mode 100644 index 0000000..fe12dd8 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/slot/SlotCraftingPottery.class diff --git a/src/main/java/jp/plusplus/fbs/container/slot/SlotCraftingPottery.java b/src/main/java/jp/plusplus/fbs/container/slot/SlotCraftingPottery.java new file mode 100644 index 0000000..2149c66 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/slot/SlotCraftingPottery.java @@ -0,0 +1,78 @@ +package jp.plusplus.fbs.container.slot;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.common.MinecraftForge;
+import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent;
+
+/**
+ * Createdby pluslus_Fon 2015/08/29.
+ */
+public class SlotCraftingPottery extends Slot {
+ private EntityPlayer thePlayer;
+ private int amountCrafted;
+
+ public SlotCraftingPottery(EntityPlayer player, IInventory p_i1823_3_, int p_i1823_4_, int p_i1823_5_, int p_i1823_6_) {
+ super(p_i1823_3_, p_i1823_4_, p_i1823_5_, p_i1823_6_);
+ this.thePlayer = player;
+ }
+
+ @Override
+ public boolean isItemValid(ItemStack p_75214_1_)
+ {
+ return false;
+ }
+
+ @Override
+ public ItemStack decrStackSize(int p_75209_1_) {
+ if (this.getHasStack()) {
+ this.amountCrafted += Math.min(p_75209_1_, this.getStack().stackSize);
+ }
+ return super.decrStackSize(p_75209_1_);
+ }
+
+ @Override
+ protected void onCrafting(ItemStack p_75210_1_, int p_75210_2_) {
+ this.amountCrafted += p_75210_2_;
+ this.onCrafting(p_75210_1_);
+ }
+
+ @Override
+ protected void onCrafting(ItemStack p_75208_1_) {
+ p_75208_1_.onCrafting(this.thePlayer.worldObj, this.thePlayer, this.amountCrafted);
+ this.amountCrafted = 0;
+ }
+
+ @Override
+ public void onPickupFromSlot(EntityPlayer p_82870_1_, ItemStack p_82870_2_) {
+ //FMLCommonHandler.instance().firePlayerCraftingEvent(p_82870_1_, p_82870_2_, craftMatrix);
+ this.onCrafting(p_82870_2_);
+
+ for (int i = 0; i < 25; ++i) {
+ ItemStack itemstack1 = inventory.getStackInSlot(i);
+
+ if (itemstack1 != null) {
+ inventory.decrStackSize(i, 1);
+
+ if (itemstack1.getItem().hasContainerItem(itemstack1)) {
+ ItemStack itemstack2 = itemstack1.getItem().getContainerItem(itemstack1);
+
+ if (itemstack2 != null && itemstack2.isItemStackDamageable() && itemstack2.getItemDamage() > itemstack2.getMaxDamage()) {
+ MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(thePlayer, itemstack2));
+ continue;
+ }
+
+ if (!itemstack1.getItem().doesContainerItemLeaveCraftingGrid(itemstack1) || !this.thePlayer.inventory.addItemStackToInventory(itemstack2)) {
+ if (inventory.getStackInSlot(i) == null) {
+ inventory.setInventorySlotContents(i, itemstack2);
+ } else {
+ this.thePlayer.dropPlayerItemWithRandomChoice(itemstack2, false);
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/container/slot/SlotInventory.class b/src/main/java/jp/plusplus/fbs/container/slot/SlotInventory.class Binary files differnew file mode 100644 index 0000000..d489ee4 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/slot/SlotInventory.class diff --git a/src/main/java/jp/plusplus/fbs/container/slot/SlotInventory.java b/src/main/java/jp/plusplus/fbs/container/slot/SlotInventory.java new file mode 100644 index 0000000..76a7c5a --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/slot/SlotInventory.java @@ -0,0 +1,49 @@ +package jp.plusplus.fbs.container.slot;
+
+import jp.plusplus.fbs.alchemy.AlchemyRegistry;
+import jp.plusplus.fbs.alchemy.IAlchemyMaterial;
+import jp.plusplus.fbs.alchemy.IAlchemyProduct;
+import jp.plusplus.fbs.item.ItemBookSorcery;
+import jp.plusplus.fbs.item.ItemCore;
+import jp.plusplus.fbs.item.ItemStaff;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.oredict.OreDictionary;
+
+import java.util.ArrayList;
+
+/**
+ * Createdby pluslus_Fon 2015/06/15.
+ */
+public class SlotInventory extends Slot {
+ private int type;//0 book, 1 charm,book, 2 inv, 3 alchemy
+ public SlotInventory(IInventory p_i1824_1_, int p_i1824_2_, int p_i1824_3_, int p_i1824_4_, int type) {
+ super(p_i1824_1_, p_i1824_2_, p_i1824_3_, p_i1824_4_);
+ this.type=type;
+ }
+
+
+ public boolean isItemValid(ItemStack p_75214_1_) {
+ if (type == 0) return p_75214_1_.getItem() == ItemCore.bookSorcery;
+ if (type == 1){
+ ArrayList<ItemStack> list=OreDictionary.getOres("fbs.charm");
+ for(ItemStack item : list){
+ if(OreDictionary.itemMatches(item, p_75214_1_, false)) return true;
+ }
+ return false;
+ }
+ if(type==3){
+ Item it=p_75214_1_.getItem();
+ return it instanceof IAlchemyMaterial || it instanceof IAlchemyProduct || AlchemyRegistry.isBasketItem(p_75214_1_);
+ }
+ return true;
+ }
+
+ @Override
+ public boolean canTakeStack(EntityPlayer p_82869_1_) {
+ return !(getHasStack() && getStack().getItem() instanceof ItemStaff);
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/container/slot/SlotMagic.class b/src/main/java/jp/plusplus/fbs/container/slot/SlotMagic.class Binary files differnew file mode 100644 index 0000000..28c1683 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/slot/SlotMagic.class diff --git a/src/main/java/jp/plusplus/fbs/container/slot/SlotMagic.java b/src/main/java/jp/plusplus/fbs/container/slot/SlotMagic.java new file mode 100644 index 0000000..b437a68 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/slot/SlotMagic.java @@ -0,0 +1,20 @@ +package jp.plusplus.fbs.container.slot;
+
+import jp.plusplus.fbs.container.inventory.InventoryMagic;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+
+/**
+ * Created by pluslus_F on 2015/06/18.
+ */
+public class SlotMagic extends Slot {
+ public SlotMagic(InventoryMagic p_i1824_1_, int p_i1824_2_, int p_i1824_3_, int p_i1824_4_) {
+ super(p_i1824_1_, p_i1824_2_, p_i1824_3_, p_i1824_4_);
+ }
+
+ @Override
+ public void onSlotChanged(){
+ super.onSlotChanged();
+ ((InventoryMagic)inventory).onInventoryChanged(getSlotIndex());
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/container/slot/SlotMagicCopy.class b/src/main/java/jp/plusplus/fbs/container/slot/SlotMagicCopy.class Binary files differnew file mode 100644 index 0000000..65d9a01 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/slot/SlotMagicCopy.class diff --git a/src/main/java/jp/plusplus/fbs/container/slot/SlotMagicCopy.java b/src/main/java/jp/plusplus/fbs/container/slot/SlotMagicCopy.java new file mode 100644 index 0000000..f0ed794 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/slot/SlotMagicCopy.java @@ -0,0 +1,25 @@ +package jp.plusplus.fbs.container.slot;
+
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.container.inventory.InventoryMagic;
+import jp.plusplus.fbs.mod.ForSS2;
+import net.minecraft.item.ItemStack;
+
+/**
+ * Created by pluslus_F on 2015/06/18.
+ */
+public class SlotMagicCopy extends SlotMagic {
+ public SlotMagicCopy(InventoryMagic p_i1824_1_, int p_i1824_2_, int p_i1824_3_, int p_i1824_4_) {
+ super(p_i1824_1_, p_i1824_2_, p_i1824_3_, p_i1824_4_);
+ }
+
+ @Override
+ public boolean isItemValid(ItemStack p_75214_1_) {
+ return p_75214_1_.getMaxStackSize()>1;
+ }
+ @Override
+ public int getSlotStackLimit()
+ {
+ return 1;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/container/slot/SlotMagicTakeOnly.class b/src/main/java/jp/plusplus/fbs/container/slot/SlotMagicTakeOnly.class Binary files differnew file mode 100644 index 0000000..c855f2e --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/slot/SlotMagicTakeOnly.class diff --git a/src/main/java/jp/plusplus/fbs/container/slot/SlotMagicTakeOnly.java b/src/main/java/jp/plusplus/fbs/container/slot/SlotMagicTakeOnly.java new file mode 100644 index 0000000..0316492 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/slot/SlotMagicTakeOnly.java @@ -0,0 +1,20 @@ +package jp.plusplus.fbs.container.slot;
+
+import jp.plusplus.fbs.container.inventory.InventoryMagic;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+
+/**
+ * Createdby pluslus_Fon 2015/06/18.
+ */
+public class SlotMagicTakeOnly extends SlotMagic{
+ public SlotMagicTakeOnly(InventoryMagic p_i1824_1_, int p_i1824_2_, int p_i1824_3_, int p_i1824_4_) {
+ super(p_i1824_1_, p_i1824_2_, p_i1824_3_, p_i1824_4_);
+ }
+
+ @Override
+ public boolean isItemValid(ItemStack item){
+ return false;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/container/slot/SlotMagicTimeTrace.class b/src/main/java/jp/plusplus/fbs/container/slot/SlotMagicTimeTrace.class Binary files differnew file mode 100644 index 0000000..94e315a --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/slot/SlotMagicTimeTrace.class diff --git a/src/main/java/jp/plusplus/fbs/container/slot/SlotMagicTimeTrace.java b/src/main/java/jp/plusplus/fbs/container/slot/SlotMagicTimeTrace.java new file mode 100644 index 0000000..a5ef88b --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/slot/SlotMagicTimeTrace.java @@ -0,0 +1,28 @@ +package jp.plusplus.fbs.container.slot;
+
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.container.inventory.InventoryMagic;
+import jp.plusplus.fbs.mod.ForSS2;
+import net.minecraft.item.ItemStack;
+
+/**
+ * Created by pluslus_F on 2015/02/28.
+ */
+public class SlotMagicTimeTrace extends SlotMagic {
+ public SlotMagicTimeTrace(InventoryMagic p_i1824_1_, int p_i1824_2_, int p_i1824_3_, int p_i1824_4_) {
+ super(p_i1824_1_, p_i1824_2_, p_i1824_3_, p_i1824_4_);
+ }
+
+ @Override
+ public boolean isItemValid(ItemStack p_75214_1_) {
+ if(FBS.cooperatesSS2 && ForSS2.canTimeTrace(p_75214_1_)){
+ return true;
+ }
+ return p_75214_1_.getItem().isItemTool(p_75214_1_);
+ }
+ @Override
+ public int getSlotStackLimit()
+ {
+ return 64;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/container/slot/SlotShowOnly.class b/src/main/java/jp/plusplus/fbs/container/slot/SlotShowOnly.class Binary files differnew file mode 100644 index 0000000..02ee690 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/slot/SlotShowOnly.class diff --git a/src/main/java/jp/plusplus/fbs/container/slot/SlotShowOnly.java b/src/main/java/jp/plusplus/fbs/container/slot/SlotShowOnly.java new file mode 100644 index 0000000..14f6be3 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/slot/SlotShowOnly.java @@ -0,0 +1,25 @@ +package jp.plusplus.fbs.container.slot;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+
+/**
+ * Created by plusplus_F on 2015/02/06.
+ */
+public class SlotShowOnly extends Slot {
+ public SlotShowOnly(IInventory p_i1824_1_, int p_i1824_2_, int p_i1824_3_, int p_i1824_4_) {
+ super(p_i1824_1_, p_i1824_2_, p_i1824_3_, p_i1824_4_);
+ }
+
+ @Override
+ public boolean isItemValid(ItemStack item){
+ return false;
+ }
+
+ @Override
+ public boolean canTakeStack(EntityPlayer p_82869_1_) {
+ return false;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/container/slot/SlotTakeOnly.class b/src/main/java/jp/plusplus/fbs/container/slot/SlotTakeOnly.class Binary files differnew file mode 100644 index 0000000..81c8e61 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/slot/SlotTakeOnly.class diff --git a/src/main/java/jp/plusplus/fbs/container/slot/SlotTakeOnly.java b/src/main/java/jp/plusplus/fbs/container/slot/SlotTakeOnly.java new file mode 100644 index 0000000..4476bb4 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/slot/SlotTakeOnly.java @@ -0,0 +1,53 @@ +package jp.plusplus.fbs.container.slot;
+
+import cpw.mods.fml.common.FMLCommonHandler;
+import jp.plusplus.fbs.AchievementRegistry;
+import jp.plusplus.fbs.api.IPottery;
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemBlock;
+import net.minecraft.item.ItemStack;
+
+/**
+ * Createdby pluslus_Fon 2015/06/08.
+ */
+public class SlotTakeOnly extends Slot{
+ protected int achievement;
+
+ public SlotTakeOnly(IInventory p_i1824_1_, int p_i1824_2_, int p_i1824_3_, int p_i1824_4_) {
+ this(p_i1824_1_, p_i1824_2_, p_i1824_3_, p_i1824_4_, 0);
+ }
+ public SlotTakeOnly(IInventory p_i1824_1_, int p_i1824_2_, int p_i1824_3_, int p_i1824_4_, int achievement){
+ super(p_i1824_1_, p_i1824_2_, p_i1824_3_, p_i1824_4_);
+ this.achievement=achievement;
+ }
+
+ @Override
+ public boolean isItemValid(ItemStack item){
+ return false;
+ }
+
+ @Override
+ public void onPickupFromSlot(EntityPlayer player, ItemStack stack) {
+ Item item=stack.getItem();
+ if(achievement==1){
+ if(item instanceof ItemBlock){
+ Block b=((ItemBlock) item).field_150939_a;
+ if(b instanceof IPottery){
+ player.triggerAchievement(AchievementRegistry.grade);
+ if(((IPottery) b).getGrade(stack.getTagCompound())== IPottery.PotteryGrade.SOULFUL){
+ player.triggerAchievement(AchievementRegistry.soulful);
+ }
+ }
+ }
+ }
+ else if(achievement==2){
+ FMLCommonHandler.instance().firePlayerCraftingEvent(player, stack, null);
+ }
+
+ super.onPickupFromSlot(player, stack);
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/container/slot/SlotTakeOnlyWithMagicEXP.class b/src/main/java/jp/plusplus/fbs/container/slot/SlotTakeOnlyWithMagicEXP.class Binary files differnew file mode 100644 index 0000000..24aae06 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/slot/SlotTakeOnlyWithMagicEXP.class diff --git a/src/main/java/jp/plusplus/fbs/container/slot/SlotTakeOnlyWithMagicEXP.java b/src/main/java/jp/plusplus/fbs/container/slot/SlotTakeOnlyWithMagicEXP.java new file mode 100644 index 0000000..dd6f2a8 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/slot/SlotTakeOnlyWithMagicEXP.java @@ -0,0 +1,65 @@ +package jp.plusplus.fbs.container.slot;
+
+import cpw.mods.fml.common.FMLCommonHandler;
+import jp.plusplus.fbs.AchievementRegistry;
+import jp.plusplus.fbs.alchemy.AlchemyRegistry;
+import jp.plusplus.fbs.api.FBSEntityPropertiesAPI;
+import net.minecraft.entity.item.EntityXPOrb;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.Items;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.inventory.Slot;
+import net.minecraft.inventory.SlotFurnace;
+import net.minecraft.item.ItemStack;
+import net.minecraft.item.crafting.FurnaceRecipes;
+import net.minecraft.stats.AchievementList;
+import net.minecraft.util.MathHelper;
+
+/**
+ * Created by plusplus_F on 2015/10/31.
+ */
+public class SlotTakeOnlyWithMagicEXP extends Slot {
+ protected EntityPlayer thePlayer;
+ protected int achievement;
+
+ public SlotTakeOnlyWithMagicEXP(EntityPlayer p_i1813_1_, IInventory p_i1813_2_, int p_i1813_3_, int p_i1813_4_, int p_i1813_5_) {
+ this(p_i1813_1_, p_i1813_2_, p_i1813_3_, p_i1813_4_, p_i1813_5_, 0);
+ }
+ public SlotTakeOnlyWithMagicEXP(EntityPlayer p_i1813_1_, IInventory p_i1813_2_, int p_i1813_3_, int p_i1813_4_, int p_i1813_5_, int achievement) {
+ super(p_i1813_2_, p_i1813_3_, p_i1813_4_, p_i1813_5_);
+ this.thePlayer = p_i1813_1_;
+ this.achievement=achievement;
+ }
+
+ public boolean isItemValid(ItemStack p_75214_1_) {
+ return false;
+ }
+
+ public ItemStack decrStackSize(int p_75209_1_) {
+ return super.decrStackSize(p_75209_1_);
+ }
+
+ public void onPickupFromSlot(EntityPlayer p_82870_1_, ItemStack p_82870_2_) {
+ this.onCrafting(p_82870_2_);
+ if(achievement==1){
+ p_82870_1_.triggerAchievement(AchievementRegistry.alchemy);
+ }
+ super.onPickupFromSlot(p_82870_1_, p_82870_2_);
+ }
+
+ protected void onCrafting(ItemStack p_75210_1_, int p_75210_2_) {
+ this.onCrafting(p_75210_1_);
+ }
+
+ protected void onCrafting(ItemStack p_75208_1_) {
+ p_75208_1_.onCrafting(this.thePlayer.worldObj, this.thePlayer, 1);
+
+ if (!this.thePlayer.worldObj.isRemote) {
+ double baseEXP = AlchemyRegistry.GetProductExp(p_75208_1_);
+
+ if(baseEXP>0){
+ FBSEntityPropertiesAPI.AddExp(thePlayer, baseEXP, true);
+ }
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/container/spirit/ContainerSpiritLearn.class b/src/main/java/jp/plusplus/fbs/container/spirit/ContainerSpiritLearn.class Binary files differnew file mode 100644 index 0000000..aa90a90 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/spirit/ContainerSpiritLearn.class diff --git a/src/main/java/jp/plusplus/fbs/container/spirit/ContainerSpiritLearn.java b/src/main/java/jp/plusplus/fbs/container/spirit/ContainerSpiritLearn.java new file mode 100644 index 0000000..79a0747 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/spirit/ContainerSpiritLearn.java @@ -0,0 +1,50 @@ +package jp.plusplus.fbs.container.spirit;
+
+import jp.plusplus.fbs.container.slot.SlotShowOnly;
+import jp.plusplus.fbs.spirit.ISpiritTool;
+import jp.plusplus.fbs.spirit.SkillManager;
+import jp.plusplus.fbs.spirit.SpiritManager;
+import jp.plusplus.fbs.spirit.SpiritStatus;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.Container;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+
+/**
+ * Created by plusplus_F on 2015/11/29.
+ */
+public class ContainerSpiritLearn extends Container {
+ public EntityPlayer player;
+ public ItemStack spiritTool;
+ public SpiritStatus status;
+
+ public ContainerSpiritLearn(EntityPlayer player){
+ this.player=player;
+ spiritTool= SpiritManager.findSpiritTool(player);
+ status=SpiritStatus.readFromNBT(spiritTool.getTagCompound());
+
+ for (int j = 0; j < 9; ++j) {
+ ItemStack is=player.inventory.getStackInSlot(j);
+ if(is!=null && is.getItem() instanceof ISpiritTool) this.addSlotToContainer(new SlotShowOnly(player.inventory, j, 8 + j * 18, 142));
+ else this.addSlotToContainer(new Slot(player.inventory, j, 8 + j * 18, 142));
+ }
+ }
+
+ @Override
+ public boolean canInteractWith(EntityPlayer p_75145_1_) {
+ return true;
+ }
+
+ @Override
+ public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int p_82846_2_) {
+ ItemStack itemstack = null;
+ return itemstack;
+ }
+
+ public void learn(String skill){
+ int now=status.getSkillLevel(skill);
+ status.reduceSkillPoint();
+ status.setSkill(skill, now+1);
+ SpiritManager.updateNBT(spiritTool, status);
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/container/spirit/ContainerSpiritMain.class b/src/main/java/jp/plusplus/fbs/container/spirit/ContainerSpiritMain.class Binary files differnew file mode 100644 index 0000000..3044b68 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/spirit/ContainerSpiritMain.class diff --git a/src/main/java/jp/plusplus/fbs/container/spirit/ContainerSpiritMain.java b/src/main/java/jp/plusplus/fbs/container/spirit/ContainerSpiritMain.java new file mode 100644 index 0000000..e84327f --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/container/spirit/ContainerSpiritMain.java @@ -0,0 +1,40 @@ +package jp.plusplus.fbs.container.spirit;
+
+import jp.plusplus.fbs.container.slot.SlotInventory;
+import jp.plusplus.fbs.container.slot.SlotShowOnly;
+import jp.plusplus.fbs.spirit.ISpiritTool;
+import jp.plusplus.fbs.spirit.SpiritManager;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.Container;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+
+/**
+ * Created by plusplus_F on 2015/11/15.
+ */
+public class ContainerSpiritMain extends Container{
+ public EntityPlayer player;
+ public int type;
+
+ public ContainerSpiritMain(EntityPlayer player, int type){
+ this.player=player;
+ this.type=type;
+
+ for (int j = 0; j < 9; ++j) {
+ ItemStack is=player.inventory.getStackInSlot(j);
+ if(is!=null && is.getItem() instanceof ISpiritTool) this.addSlotToContainer(new SlotShowOnly(player.inventory, j, 8 + j * 18, 142));
+ else this.addSlotToContainer(new Slot(player.inventory, j, 8 + j * 18, 142));
+ }
+ }
+
+ @Override
+ public boolean canInteractWith(EntityPlayer p_75145_1_) {
+ return true;
+ }
+
+ @Override
+ public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int p_82846_2_) {
+ ItemStack itemstack = null;
+ return itemstack;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/entity/EntityButterfly.class b/src/main/java/jp/plusplus/fbs/entity/EntityButterfly.class Binary files differnew file mode 100644 index 0000000..dfc5ecd --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/entity/EntityButterfly.class diff --git a/src/main/java/jp/plusplus/fbs/entity/EntityButterfly.java b/src/main/java/jp/plusplus/fbs/entity/EntityButterfly.java new file mode 100644 index 0000000..48cc74b --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/entity/EntityButterfly.java @@ -0,0 +1,121 @@ +package jp.plusplus.fbs.entity;
+
+import jp.plusplus.fbs.exprop.SanityManager;
+import jp.plusplus.fbs.item.ItemCore;
+import net.minecraft.block.Block;
+import net.minecraft.block.material.Material;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.EntityTracker;
+import net.minecraft.entity.EnumCreatureAttribute;
+import net.minecraft.entity.item.EntityXPOrb;
+import net.minecraft.entity.passive.EntityBat;
+import net.minecraft.entity.passive.EntityCow;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.DamageSource;
+import net.minecraft.util.MathHelper;
+import net.minecraft.world.World;
+
+/**
+ * Created by pluslus_F on 2015/06/25.
+ * 蝶。
+ */
+public class EntityButterfly extends EntityBat {
+ public float rotationW;
+ public boolean rotationFlag;
+ public int sinTicks;
+ public int nextDirTicks;
+
+ public EntityButterfly(World p_i1582_1_) {
+ super(p_i1582_1_);
+ this.setIsBatHanging(false);
+ }
+
+ public EntityButterfly(World w, float x, float y, float z) {
+ this(w);
+ setLocationAndAngles(x, y, z, 0, 0);
+ setIsBatHanging(false);
+ }
+
+ @Override
+ public void readEntityFromNBT(NBTTagCompound p_70037_1_) {
+ super.readEntityFromNBT(p_70037_1_);
+ rotationFlag = p_70037_1_.getBoolean("RotationWingsFlag");
+ rotationW = p_70037_1_.getFloat("RotationWingsAngle");
+ sinTicks = p_70037_1_.getInteger("SinTicks");
+ nextDirTicks = p_70037_1_.getInteger("NextDirTicks");
+ }
+
+ @Override
+ public void writeEntityToNBT(NBTTagCompound p_70014_1_) {
+ super.writeEntityToNBT(p_70014_1_);
+ p_70014_1_.setBoolean("RotationWingsFlag", rotationFlag);
+ p_70014_1_.setFloat("RotationWingsAngle", rotationW);
+ p_70014_1_.setInteger("SinTicks", sinTicks);
+ p_70014_1_.setInteger("NextDirTicks", nextDirTicks);
+ }
+
+ public boolean attackEntityFrom(DamageSource p_70097_1_, float p_70097_2_) {
+ if (this.isEntityInvulnerable()) {
+ return false;
+ } else {
+ if (!this.worldObj.isRemote) {
+ setDead();
+ if (p_70097_1_.getSourceOfDamage() instanceof EntityPlayer) {
+
+ EntityPlayer ep=(EntityPlayer)p_70097_1_.getSourceOfDamage();
+ SanityManager.loseSanity(ep, 1, 6, true);
+ this.entityDropItem(new ItemStack(ItemCore.butterfly), 0);
+ }
+ }
+ return true;
+ }
+ }
+
+ @Override
+ public void onUpdate(){
+ //setDead();
+ super.onUpdate();
+
+ //羽
+ float rotS=20;
+ if(rotationFlag){
+ rotationW+=rotS;
+ if(rotationW>=80){
+ rotationFlag=!rotationFlag;
+ rotationW=80;
+ }
+ }
+ else{
+ rotationW-=rotS;
+ if(rotationW<=-80){
+ rotationFlag=!rotationFlag;
+ rotationW=-80;
+ }
+ }
+
+ //func_145775_I();
+ }
+
+ @Override
+ protected String getLivingSound() {
+ return null;
+ }
+
+ @Override
+ protected String getHurtSound()
+ {
+ return null;
+ }
+
+ @Override
+ protected String getDeathSound()
+ {
+ return null;
+ }
+
+ @Override
+ public EnumCreatureAttribute getCreatureAttribute(){ return EnumCreatureAttribute.UNDEFINED; }
+}
diff --git a/src/main/java/jp/plusplus/fbs/entity/EntityLivingDummy.class b/src/main/java/jp/plusplus/fbs/entity/EntityLivingDummy.class Binary files differnew file mode 100644 index 0000000..5440079 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/entity/EntityLivingDummy.class diff --git a/src/main/java/jp/plusplus/fbs/entity/EntityLivingDummy.java b/src/main/java/jp/plusplus/fbs/entity/EntityLivingDummy.java new file mode 100644 index 0000000..7a3b977 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/entity/EntityLivingDummy.java @@ -0,0 +1,34 @@ +package jp.plusplus.fbs.entity;
+
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.item.ItemStack;
+import net.minecraft.world.World;
+
+/**
+ * Created by plusplus_F on 2016/03/03.
+ */
+public class EntityLivingDummy extends EntityLivingBase {
+ public EntityLivingDummy(World p_i1594_1_) {
+ super(p_i1594_1_);
+ }
+
+ @Override
+ public ItemStack getHeldItem() {
+ return null;
+ }
+
+ @Override
+ public ItemStack getEquipmentInSlot(int p_71124_1_) {
+ return null;
+ }
+
+ @Override
+ public void setCurrentItemOrArmor(int p_70062_1_, ItemStack p_70062_2_) {
+
+ }
+
+ @Override
+ public ItemStack[] getLastActiveItems() {
+ return new ItemStack[0];
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/entity/EntityMagicArrow.class b/src/main/java/jp/plusplus/fbs/entity/EntityMagicArrow.class Binary files differnew file mode 100644 index 0000000..d5ad24e --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/entity/EntityMagicArrow.class diff --git a/src/main/java/jp/plusplus/fbs/entity/EntityMagicArrow.java b/src/main/java/jp/plusplus/fbs/entity/EntityMagicArrow.java new file mode 100644 index 0000000..cfef033 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/entity/EntityMagicArrow.java @@ -0,0 +1,45 @@ +package jp.plusplus.fbs.entity;
+
+import net.minecraft.client.particle.EntityCritFX;
+import net.minecraft.entity.EntityLiving;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.monster.EntityMob;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.projectile.EntityArrow;
+import net.minecraft.util.DamageSource;
+import net.minecraft.util.MovingObjectPosition;
+import net.minecraft.world.World;
+
+/**
+ * Createdby pluslus_Fon 2015/06/08.
+ */
+public class EntityMagicArrow extends EntityMagicProjectileBase {
+ public EntityMagicArrow(World p_i1582_1_) {
+ super(p_i1582_1_);
+ }
+ public EntityMagicArrow(World par1World, EntityLivingBase par2EntityLivingBase, float speed, float speed2, float damage) {
+ super(par1World, par2EntityLivingBase, speed, speed2, 0, 0, 0);
+ setDamage(damage);
+ }
+
+ public boolean canExist(){ return worldObj.isRemote || ticksExisted<20*1.5; }
+
+ public void onCollideWithPlayer(MovingObjectPosition pos, EntityPlayer entity){
+ if(!worldObj.isRemote && !shootingEntity.isEntityEqual(entity)) {
+ entity.attackEntityFrom(DamageSource.causeIndirectMagicDamage(shootingEntity, entity), getDamage());
+ setDead();
+ }
+ }
+ public void onCollideWithMob(MovingObjectPosition pos, EntityMob entity){
+ if(!worldObj.isRemote) {
+ entity.attackEntityFrom(DamageSource.causeIndirectMagicDamage(shootingEntity, entity), getDamage());
+ setDead();
+ }
+ }
+ public void onCollideWithLiving(MovingObjectPosition pos, EntityLiving entity){
+ if(!worldObj.isRemote) {
+ entity.attackEntityFrom(DamageSource.causeIndirectMagicDamage(shootingEntity, entity), getDamage());
+ setDead();
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/entity/EntityMagicArrowFlexible.class b/src/main/java/jp/plusplus/fbs/entity/EntityMagicArrowFlexible.class Binary files differnew file mode 100644 index 0000000..10880c0 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/entity/EntityMagicArrowFlexible.class diff --git a/src/main/java/jp/plusplus/fbs/entity/EntityMagicArrowFlexible.java b/src/main/java/jp/plusplus/fbs/entity/EntityMagicArrowFlexible.java new file mode 100644 index 0000000..6e2a7ad --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/entity/EntityMagicArrowFlexible.java @@ -0,0 +1,147 @@ +package jp.plusplus.fbs.entity;
+
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.Registry;
+import jp.plusplus.fbs.api.IMagicEnchant;
+import jp.plusplus.fbs.packet.MessageMagicFlexible;
+import jp.plusplus.fbs.packet.PacketHandler;
+import net.minecraft.entity.EntityLiving;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.monster.EntityMob;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.nbt.NBTTagList;
+import net.minecraft.network.Packet;
+import net.minecraft.network.play.server.S06PacketUpdateHealth;
+import net.minecraft.network.play.server.S20PacketEntityProperties;
+import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
+import net.minecraft.util.DamageSource;
+import net.minecraft.util.MovingObjectPosition;
+import net.minecraft.world.World;
+
+/**
+ * Created by pluslus_F on 2015/06/23.
+ * 汎用共鳴魔法の矢
+ */
+public class EntityMagicArrowFlexible extends EntityMagicProjectileBase {
+ protected Registry.MagicData[] magics;
+ protected IMagicEnchant[] instances;
+
+ public EntityMagicArrowFlexible(World p_i1582_1_) {
+ super(p_i1582_1_);
+ }
+ public EntityMagicArrowFlexible(World par1World, EntityLivingBase par2EntityLivingBase, float speed, float speed2, float damage, Registry.MagicData... magics) {
+ super(par1World, par2EntityLivingBase, speed, speed2, 0, 0, 0);
+ setDamage(damage);
+ this.magics=magics;
+ }
+
+ public void readMagicsFromNBT(NBTTagCompound nbt){
+ NBTTagList nbttaglist = (NBTTagList)nbt.getTag("EnchantMagics");
+ magics=new Registry.MagicData[nbttaglist.tagCount()];
+ for(int i=0;i<nbttaglist.tagCount();i++){
+ NBTTagCompound nbt1 = nbttaglist.getCompoundTagAt(i);
+ magics[i]=Registry.GetMagic(nbt1.getString("MagicName"));
+ }
+ }
+ public void writeMagicsToNBT(NBTTagCompound nbt){
+ NBTTagList nbttaglist = new NBTTagList();
+ for(int i=0;i<magics.length;i++){
+ Registry.MagicData md=magics[i];
+ NBTTagCompound nbt1 = new NBTTagCompound();
+ nbt1.setString("MagicName", md.title);
+ nbttaglist.appendTag(nbt1);
+ }
+ nbt.setTag("EnchantMagics", nbttaglist);
+ }
+
+ @Override
+ protected void readEntityFromNBT(NBTTagCompound nbt) {
+ super.readEntityFromNBT(nbt);
+ readMagicsFromNBT(nbt);
+ }
+ @Override
+ protected void writeEntityToNBT(NBTTagCompound nbt) {
+ super.writeEntityToNBT(nbt);
+ writeMagicsToNBT(nbt);
+ }
+
+ public void hitWith(EntityLivingBase e){
+ float dValue=0.f;
+ float dScale=1.f;
+
+ //IMagicEnchantのインスタンス化
+ //スタッフによる使用なので常に詠唱破棄状態
+ IMagicEnchant[] me=new IMagicEnchant[magics.length];
+ for(int i=0;i<me.length;i++){
+ me[i]=(IMagicEnchant)magics[i].getMagic(worldObj, (EntityPlayer)shootingEntity, false);
+ dValue+=me[i].damageValue(e);
+ dScale*=me[i].damageScale(e);
+ }
+
+ //攻撃
+ e.attackEntityFrom(DamageSource.causeIndirectMagicDamage(shootingEntity, e), (getDamage()+dValue)*dScale);
+
+ //エンチャント
+ for(int i=0;i<me.length;i++){
+ me[i].enchant(e, true);
+ }
+
+ setDead();
+ }
+
+ @Override
+ public boolean canExist(){ return worldObj.isRemote || ticksExisted<20*1.5; }
+
+ @Override
+ public void onCollideWithPlayer(MovingObjectPosition pos, EntityPlayer entity){
+ if(!worldObj.isRemote && !shootingEntity.isEntityEqual(entity)) {
+ hitWith(entity);
+ }
+ }
+ @Override
+ public void onCollideWithMob(MovingObjectPosition pos, EntityMob entity){
+ if(!worldObj.isRemote) {
+ hitWith(entity);
+ }
+ }
+ @Override
+ public void onCollideWithLiving(MovingObjectPosition pos, EntityLiving entity){
+ if(!worldObj.isRemote) {
+ hitWith(entity);
+ }
+ }
+
+ @Override
+ protected void setParticleColor(){
+ if(magics==null) return;
+
+ //インスタンスの生成
+ if(instances==null){
+ instances=new IMagicEnchant[magics.length];
+ for(int i=0;i<instances.length;i++){
+ instances[i]=(IMagicEnchant)magics[i].getMagic(worldObj, (EntityPlayer)shootingEntity, false);
+ }
+ }
+
+ //色の設定
+ int i=rand.nextInt(magics.length);
+ IMagicEnchant.ParticleColor col=instances[i].setParticleColor();
+ if(col!=null){
+ particleRed=col.red;
+ particleGreen=col.green;
+ particleBlue=col.blue;
+ }
+ else{
+ particleRed=particleGreen=particleBlue=1;
+ }
+ }
+
+ @Override
+ public void onUpdate() {
+ super.onUpdate();
+ if(ticksInAir==1 && !worldObj.isRemote){
+ PacketHandler.INSTANCE.sendToDimension(new MessageMagicFlexible(this), worldObj.provider.dimensionId);
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/entity/EntityMagicAuthor.class b/src/main/java/jp/plusplus/fbs/entity/EntityMagicAuthor.class Binary files differnew file mode 100644 index 0000000..bb88bf4 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/entity/EntityMagicAuthor.class diff --git a/src/main/java/jp/plusplus/fbs/entity/EntityMagicAuthor.java b/src/main/java/jp/plusplus/fbs/entity/EntityMagicAuthor.java new file mode 100644 index 0000000..a7da41d --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/entity/EntityMagicAuthor.java @@ -0,0 +1,57 @@ +package jp.plusplus.fbs.entity;
+
+import cpw.mods.fml.common.registry.EntityRegistry;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.Registry;
+import net.minecraft.entity.ai.EntityAIBase;
+import net.minecraft.entity.ai.EntityAIFollowGolem;
+import net.minecraft.entity.ai.EntityAITasks;
+import net.minecraft.entity.ai.EntityAIVillagerMate;
+import net.minecraft.entity.passive.EntityVillager;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.Items;
+import net.minecraft.item.ItemStack;
+import net.minecraft.world.World;
+import shift.mceconomy2.api.MCEconomyAPI;
+
+/**
+ * Created by plusplus_F on 2016/02/24.
+ */
+public class EntityMagicAuthor extends EntityVillager {
+ public EntityMagicAuthor(World p_i1748_1_) {
+ super(p_i1748_1_);
+
+ //必要のないタスクを削除
+ for(int i=0;i<tasks.taskEntries.size();i++){
+ EntityAIBase ai=((EntityAITasks.EntityAITaskEntry)tasks.taskEntries.get(i)).action;
+ if(ai instanceof EntityAIVillagerMate || ai instanceof EntityAIFollowGolem){
+ tasks.removeTask(ai);
+ }
+ }
+
+
+ }
+
+ public void onLivingUpdate(){
+ super.onLivingUpdate();
+ setGrowingAge(100);
+ }
+
+ @Override
+ public boolean interact(EntityPlayer player) {
+ ItemStack itemstack = player.inventory.getCurrentItem();
+ boolean flag = itemstack != null && itemstack.getItem() == Items.spawn_egg;
+
+ if (!flag && this.isEntityAlive() && !this.isTrading() && !this.isChild() && !player.isSneaking()) {
+ if (!this.worldObj.isRemote) {
+ //this.setCustomer(player);
+ //MCEconomyAPI.openShopGui(Registry.shopAuthorId,player,worldObj,(int)posX, (int)posY, (int)posZ);
+ player.openGui(FBS.instance, FBS.GUI_SHOP_AUTHOR_ID, worldObj, (int)posX, (int)posY, (int)posZ);
+ }
+
+ return true;
+ } else {
+ return super.interact(player);
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/entity/EntityMagicDig.class b/src/main/java/jp/plusplus/fbs/entity/EntityMagicDig.class Binary files differnew file mode 100644 index 0000000..f4e5894 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/entity/EntityMagicDig.class diff --git a/src/main/java/jp/plusplus/fbs/entity/EntityMagicDig.java b/src/main/java/jp/plusplus/fbs/entity/EntityMagicDig.java new file mode 100644 index 0000000..3b38d4a --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/entity/EntityMagicDig.java @@ -0,0 +1,68 @@ +package jp.plusplus.fbs.entity;
+
+import cpw.mods.fml.common.FMLLog;
+import net.minecraft.block.Block;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.init.Blocks;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.MathHelper;
+import net.minecraft.util.MovingObjectPosition;
+import net.minecraft.world.World;
+
+/**
+ * Createdby pluslus_Fon 2015/06/07.
+ */
+public class EntityMagicDig extends EntityMagicProjectileBase {
+ protected int till;
+ protected boolean isPenetrate;
+
+ public EntityMagicDig(World p_i1582_1_) {
+ super(p_i1582_1_);
+ till=10;
+ }
+ public EntityMagicDig(World par1World, EntityLivingBase par2EntityLivingBase, float speed, float speed2, int till, boolean isPenetrate) {
+ super(par1World, par2EntityLivingBase, speed, speed2, 0, 0, 0);
+ this.till=10+till;
+ this.isPenetrate=isPenetrate;
+ }
+
+ @Override
+ protected void readEntityFromNBT(NBTTagCompound nbt) {
+ super.readEntityFromNBT(nbt);
+ isPenetrate=nbt.getBoolean("IsPenetrate");
+ till=nbt.getInteger("magicTill");
+ }
+ @Override
+ protected void writeEntityToNBT(NBTTagCompound nbt) {
+ super.writeEntityToNBT(nbt);
+ nbt.setBoolean("IsPenetrate", isPenetrate);
+ nbt.setInteger("magicTill", till);
+ }
+
+ public boolean canExist(){ return worldObj.isRemote || ticksExisted<till; }
+ public void onCollideWithBlock(MovingObjectPosition pos, Block block) {
+ if (!worldObj.isRemote) {
+ float h = block.getBlockHardness(worldObj, xTile, yTile, zTile);
+ if (h <= 30.0f && h != -1.0f){
+ worldObj.func_147480_a(xTile, yTile, zTile, true);
+ }
+ else{
+ setDead();
+ return;
+ }
+ }
+ if (isPenetrate) {
+ inTile = Blocks.air;
+ inData = 0;
+ } else {
+ setDead();
+ }
+ }
+
+ @Override
+ protected void setParticleColor(){
+ particleRed=0.5f+0.5f*rand.nextFloat();
+ particleGreen=0.25f+0.2f*rand.nextFloat();
+ particleBlue=0.2f*rand.nextFloat();
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/entity/EntityMagicFireBolt.class b/src/main/java/jp/plusplus/fbs/entity/EntityMagicFireBolt.class Binary files differnew file mode 100644 index 0000000..d184e57 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/entity/EntityMagicFireBolt.class diff --git a/src/main/java/jp/plusplus/fbs/entity/EntityMagicFireBolt.java b/src/main/java/jp/plusplus/fbs/entity/EntityMagicFireBolt.java new file mode 100644 index 0000000..2e13778 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/entity/EntityMagicFireBolt.java @@ -0,0 +1,101 @@ +package jp.plusplus.fbs.entity;
+
+import net.minecraft.block.Block;
+import net.minecraft.entity.EntityLiving;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.monster.EntityMob;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.Blocks;
+import net.minecraft.util.DamageSource;
+import net.minecraft.util.MovingObjectPosition;
+import net.minecraft.world.World;
+
+/**
+ * Createdby pluslus_Fon 2015/06/14.
+ */
+public class EntityMagicFireBolt extends EntityMagicProjectileBase {
+ public EntityMagicFireBolt(World p_i1582_1_) {
+ super(p_i1582_1_);
+ }
+
+ public EntityMagicFireBolt(World par1World, EntityLivingBase par2EntityLivingBase, float speed, float speed2, float damage) {
+ super(par1World, par2EntityLivingBase, speed, speed2, 0, 0, 0);
+ setDamage(damage);
+ }
+
+ @Override
+ public boolean canExist() {
+ return worldObj.isRemote || ticksExisted < 20 * 1.5;
+ }
+
+ @Override
+ public void onCollideWithPlayer(MovingObjectPosition pos, EntityPlayer entity) {
+ if (!worldObj.isRemote && !shootingEntity.isEntityEqual(entity)) {
+ entity.attackEntityFrom(DamageSource.causeIndirectMagicDamage(shootingEntity, entity), getDamage());
+ entity.setFire(20 * 3);
+ setDead();
+ }
+ }
+
+ @Override
+ public void onCollideWithMob(MovingObjectPosition pos, EntityMob entity) {
+ if (!worldObj.isRemote) {
+ entity.attackEntityFrom(DamageSource.causeIndirectMagicDamage(shootingEntity, entity), getDamage());
+ entity.setFire(20 * 3);
+ setDead();
+ }
+ }
+
+ @Override
+ public void onCollideWithLiving(MovingObjectPosition pos, EntityLiving entity) {
+ if (!worldObj.isRemote) {
+ entity.attackEntityFrom(DamageSource.causeIndirectMagicDamage(shootingEntity, entity), getDamage());
+ entity.setFire(20 * 3);
+ setDead();
+ }
+ }
+
+ @Override
+ public void onCollideWithBlock(MovingObjectPosition pos, Block block) {
+ if (!worldObj.isRemote) {
+
+ int i = pos.blockX;
+ int j = pos.blockY;
+ int k = pos.blockZ;
+
+ switch (pos.sideHit) {
+ case 0:
+ --j;
+ break;
+ case 1:
+ ++j;
+ break;
+ case 2:
+ --k;
+ break;
+ case 3:
+ ++k;
+ break;
+ case 4:
+ --i;
+ break;
+ case 5:
+ ++i;
+ }
+
+ if (this.worldObj.isAirBlock(i, j, k)) {
+ this.worldObj.setBlock(i, j, k, Blocks.fire);
+ }
+
+ setDead();
+ }
+ }
+
+ @Override
+ protected void setParticleColor(){
+ particleRed=0.8f+0.2f*rand.nextFloat();
+ particleGreen=0.5f*rand.nextFloat();
+ particleBlue=0;
+ }
+
+}
diff --git a/src/main/java/jp/plusplus/fbs/entity/EntityMagicHealingBall.class b/src/main/java/jp/plusplus/fbs/entity/EntityMagicHealingBall.class Binary files differnew file mode 100644 index 0000000..5760197 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/entity/EntityMagicHealingBall.class diff --git a/src/main/java/jp/plusplus/fbs/entity/EntityMagicHealingBall.java b/src/main/java/jp/plusplus/fbs/entity/EntityMagicHealingBall.java new file mode 100644 index 0000000..3c58aa1 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/entity/EntityMagicHealingBall.java @@ -0,0 +1,135 @@ +package jp.plusplus.fbs.entity;
+
+import cpw.mods.fml.client.FMLClientHandler;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.event.FBSEventHandler;
+import jp.plusplus.fbs.particle.EntityTracksFX;
+import jp.plusplus.fbs.particle.EntityTrajectoryFX;
+import net.minecraft.client.entity.EntityClientPlayerMP;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLiving;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.EntityPlayerMP;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.potion.Potion;
+import net.minecraft.potion.PotionEffect;
+import net.minecraft.util.*;
+import net.minecraft.world.World;
+
+import java.util.LinkedList;
+
+/**
+ * Createdby pluslus_Fon 2015/06/14.
+ */
+public class EntityMagicHealingBall extends EntityMagicProjectileBase {
+ LinkedList<Integer> entityIds=new LinkedList<Integer>();
+ int amplifier;
+
+ public EntityMagicHealingBall(World p_i1582_1_) {
+ super(p_i1582_1_);
+ this.setSize(0.25F, 0.25F);
+ }
+ public EntityMagicHealingBall(World par1World, EntityLivingBase par2EntityLivingBase, int amp) {
+ super(par1World, par2EntityLivingBase, 0, 0, 0, 0, 0);
+ amplifier=amp;
+ setPosition(posX, posY - 0.2D, posZ);
+ this.setSize(0.8F, 0.8F);
+ }
+
+ @Override
+ protected void readEntityFromNBT(NBTTagCompound nbt) {
+ super.readEntityFromNBT(nbt);
+ amplifier=nbt.getInteger("Amplifier");
+
+ entityIds=new LinkedList<Integer>();
+ int s=nbt.getInteger("ListSize");
+ for(int i=0;i<s;i++){
+ entityIds.add(nbt.getInteger("EntityIds-Id"+i));
+ }
+ }
+ @Override
+ protected void writeEntityToNBT(NBTTagCompound nbt) {
+ super.writeEntityToNBT(nbt);
+ nbt.setInteger("Amplifier", amplifier);
+
+ nbt.setInteger("ListSize", entityIds.size());
+ for(int i=0;i<entityIds.size();i++){
+ nbt.setInteger("EntityIds-Id"+i, entityIds.get(i));
+ }
+ }
+
+
+ @Override
+ public void onUpdate() {
+ super.onUpdate();
+ float s=MathHelper.sin(2 * 3.14159265f / 10.0f * (ticksExisted % 10));
+ float c=MathHelper.cos(2 * 3.14159265f / 10.0f * (ticksExisted % 10));
+
+ float mx=0.15f*c;
+ float my=0;
+ float mz=0.15f*s;
+
+ this.motionX = mx;
+ this.motionY = my;
+ this.motionZ = mz;
+
+ if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F) {
+ float f = MathHelper.sqrt_double(mx * mx + mz * mz);
+ this.prevRotationYaw = this.rotationYaw = (float) (Math.atan2(mx, mz) * 180.0D / Math.PI);
+ this.prevRotationPitch = this.rotationPitch = (float) (Math.atan2(my, (double) f) * 180.0D / Math.PI);
+ this.prevRotationPitch = this.rotationPitch;
+ this.prevRotationYaw = this.rotationYaw;
+ this.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch);
+ this.ticksInGround = 0;
+ }
+ }
+
+ @Override
+ public boolean canExist() {
+ return worldObj.isRemote || ticksExisted < 20 * 20;
+ }
+
+ @Override
+ public void onCollideWithPlayer(MovingObjectPosition pos, EntityPlayer entity) {
+ if (!worldObj.isRemote) {
+ for(Integer id : entityIds){
+ if(id==entity.getEntityId()){
+ return;
+ }
+ }
+
+ //entity.addPotionEffect(new PotionEffect(Potion.heal.getId(), 20, amplifier));
+ entity.setHealth(entity.getHealth()+0.5f*amplifier);
+ entityIds.add(entity.getEntityId());
+ }
+ }
+
+ @Override
+ public void onCollideWithLiving(MovingObjectPosition pos, EntityLiving entity) {
+ if (!worldObj.isRemote) {
+ for(Integer id : entityIds){
+ if(id==entity.getEntityId()){
+ return;
+ }
+ }
+
+ //entity.addPotionEffect(new PotionEffect(Potion.heal.getId(), 20, amplifier));
+ entity.setHealth(entity.getHealth() + 0.5f * amplifier);
+ entityIds.add(entity.getEntityId());
+ }
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ protected void spawnParticle(){
+ //setParticleColor();
+ particleRed=particleBlue=0.5f+0.2f*rand.nextFloat();
+ particleGreen=1.f;
+
+ EntityTracksFX fx=new EntityTracksFX(worldObj, posX, posY, posZ, 0, -(0.3f+0.6f*rand.nextFloat()), 0, particleRed, particleGreen, particleBlue, getParticleSize());
+ FMLClientHandler.instance().getClient().effectRenderer.addEffect(fx);
+ }
+
+}
diff --git a/src/main/java/jp/plusplus/fbs/entity/EntityMagicProjectileBase.class b/src/main/java/jp/plusplus/fbs/entity/EntityMagicProjectileBase.class Binary files differnew file mode 100644 index 0000000..9cba97d --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/entity/EntityMagicProjectileBase.class diff --git a/src/main/java/jp/plusplus/fbs/entity/EntityMagicProjectileBase.java b/src/main/java/jp/plusplus/fbs/entity/EntityMagicProjectileBase.java new file mode 100644 index 0000000..6f9ed82 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/entity/EntityMagicProjectileBase.java @@ -0,0 +1,547 @@ +package jp.plusplus.fbs.entity;
+
+import cpw.mods.fml.client.FMLClientHandler;
+import cpw.mods.fml.common.FMLLog;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.event.FBSEventHandler;
+import jp.plusplus.fbs.particle.EntityGlowFX;
+import jp.plusplus.fbs.particle.EntityTracksFX;
+import jp.plusplus.fbs.particle.EntityTrajectoryFX;
+import net.minecraft.block.Block;
+import net.minecraft.block.material.Material;
+import net.minecraft.client.particle.EffectRenderer;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLiving;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.IProjectile;
+import net.minecraft.entity.monster.EntityEnderman;
+import net.minecraft.entity.monster.EntityMob;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.projectile.EntityArrow;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.ItemBow;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.*;
+import net.minecraft.world.World;
+import net.minecraft.world.biome.BiomeCache;
+
+import java.util.List;
+import java.util.Random;
+
+/**
+ * Createdby pluslus_Fon 2015/06/07.
+ */
+public class EntityMagicProjectileBase extends Entity implements IProjectile {
+ /* 地中判定に使うもの */
+ protected int xTile = -1;
+ protected int yTile = -1;
+ protected int zTile = -1;
+ protected Block inTile;
+ protected int inData;
+ protected boolean inGround;
+
+ /* この弾を撃ったエンティティ */
+ public Entity shootingEntity;
+
+ /* 地中・空中にいる時間 */
+ protected int ticksInGround;
+ protected int ticksInAir;
+
+ /* ダメージの大きさ */
+ protected float damage;
+
+ /* ノックバックの大きさ */
+ protected int knockbackStrength = 1;
+
+ /* パーティクル */
+ protected boolean enableParticle=true;
+ protected float particleRed=1.f;
+ protected float particleGreen=1.f;
+ protected float particleBlue=1.f;
+
+ /* パーティクル関係 */
+ protected boolean hasMatrix=false;
+ protected double[] matrix=new double[4*4];
+ protected double preMotionX;
+ protected double preMotionY;
+ protected double preMotionZ;
+
+ public EntityMagicProjectileBase(World p_i1582_1_) {
+ super(p_i1582_1_);
+ this.renderDistanceWeight = 10.0D;
+ this.setSize(0.1875F, 0.3125F);
+ rand=new Random();
+ }
+
+ public EntityMagicProjectileBase(World par1World, EntityLivingBase entity, float speed, float speed2, float adjustX, float adjustZ, float adjustY) {
+ super(par1World);
+ this.renderDistanceWeight = 10.0D;
+ this.shootingEntity = entity;
+ this.yOffset = 0.0F;
+ this.setSize(0.1875F, 0.3125F);
+
+ //初期状態での向きの決定
+ this.setLocationAndAngles(entity.posX, entity.posY + (double) entity.getEyeHeight() -0.10000000149011612D, entity.posZ, entity.rotationYaw, entity.rotationPitch);
+ //this.posY += adjustY-0.10000000149011612D;
+ this.setPosition(this.posX, this.posY, this.posZ);
+
+ xTile=(int)posX;
+ yTile=(int)posY;
+ zTile=(int)posZ;
+
+ //初速度
+ this.motionX = (double) (-MathHelper.sin(this.rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI));
+ this.motionZ = (double) (MathHelper.cos(this.rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI));
+ this.motionY = (double) (-MathHelper.sin(this.rotationPitch / 180.0F * (float) Math.PI));
+ this.setThrowableHeading(this.motionX, this.motionY, this.motionZ, speed * 1.5F, speed2);
+ }
+
+ @Override
+ protected void readEntityFromNBT(NBTTagCompound nbt) {
+ this.xTile = nbt.getShort("xTile");
+ this.yTile = nbt.getShort("yTile");
+ this.zTile = nbt.getShort("zTile");
+
+ String t=nbt.getString("inTile");
+ if(t.equals("null")) inTile=null;
+ else this.inTile = Block.getBlockFromName(t);
+
+ this.inData = nbt.getByte("inData") & 255;
+ this.inGround = nbt.getByte("inGround") == 1;
+
+ if (nbt.hasKey("damage")) {
+ this.damage = nbt.getFloat("damage");
+ }
+
+ if(nbt.hasKey("EnableParticle")){
+ enableParticle=nbt.getBoolean("EnableParticle");
+ particleRed=nbt.getFloat("ParticleRed");
+ particleGreen=nbt.getFloat("ParticleGreen");
+ particleBlue=nbt.getFloat("ParticleBlue");
+ }
+
+ if(nbt.hasKey("ShooterId")){
+ shootingEntity=worldObj.getEntityByID(nbt.getInteger("ShooterId"));
+ }
+ }
+
+ @Override
+ protected void writeEntityToNBT(NBTTagCompound nbt) {
+ nbt.setShort("xTile", (short) this.xTile);
+ nbt.setShort("yTile", (short) this.yTile);
+ nbt.setShort("zTile", (short) this.zTile);
+ nbt.setString("inTile", inTile == null ? "null" : Block.blockRegistry.getNameForObject(inTile));
+ nbt.setByte("inData", (byte) this.inData);
+ nbt.setByte("inGround", (byte) (this.inGround ? 1 : 0));
+ nbt.setFloat("damage", this.damage);
+ nbt.setBoolean("EnableParticle", enableParticle);
+ nbt.setFloat("ParticleRed", particleRed);
+ nbt.setFloat("ParticleGreen", particleGreen);
+ nbt.setFloat("ParticleBlue", particleBlue);
+ nbt.setInteger("ShooterId", shootingEntity.getEntityId());
+ }
+
+ @Override
+ protected void entityInit() {
+ }
+
+ @Override
+ public void setThrowableHeading(double par1, double par3, double par5, float par7, float par8) {
+ float f2 = MathHelper.sqrt_double(par1 * par1 + par3 * par3 + par5 * par5);
+ par1 /= (double) f2;
+ par3 /= (double) f2;
+ par5 /= (double) f2;
+ par1 += this.rand.nextGaussian() * (double) (this.rand.nextBoolean() ? -1 : 1) * 0.007499999832361937D * (double) par8;
+ par3 += this.rand.nextGaussian() * (double) (this.rand.nextBoolean() ? -1 : 1) * 0.007499999832361937D * (double) par8;
+ par5 += this.rand.nextGaussian() * (double) (this.rand.nextBoolean() ? -1 : 1) * 0.007499999832361937D * (double) par8;
+ par1 *= (double) par7;
+ par3 *= (double) par7;
+ par5 *= (double) par7;
+ this.motionX = par1;
+ this.motionY = par3;
+ this.motionZ = par5;
+ float f3 = MathHelper.sqrt_double(par1 * par1 + par5 * par5);
+ this.prevRotationYaw = this.rotationYaw = (float) (Math.atan2(par1, par5) * 180.0D / Math.PI);
+ this.prevRotationPitch = this.rotationPitch = (float) (Math.atan2(par3, (double) f3) * 180.0D / Math.PI);
+ this.ticksInGround = 0;
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void setVelocity(double par1, double par3, double par5) {
+ this.motionX = par1;
+ this.motionY = par3;
+ this.motionZ = par5;
+
+ if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F) {
+ float f = MathHelper.sqrt_double(par1 * par1 + par5 * par5);
+ this.prevRotationYaw = this.rotationYaw = (float) (Math.atan2(par1, par5) * 180.0D / Math.PI);
+ this.prevRotationPitch = this.rotationPitch = (float) (Math.atan2(par3, (double) f) * 180.0D / Math.PI);
+ this.prevRotationPitch = this.rotationPitch;
+ this.prevRotationYaw = this.rotationYaw;
+ this.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch);
+ this.ticksInGround = 0;
+ }
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void setPositionAndRotation2(double par1, double par3, double par5, float par7, float par8, int par9) {
+ this.setPosition(par1, par3, par5);
+ this.setRotation(par7, par8);
+ }
+
+
+ public boolean isPenetrateBlock(){
+ return false;
+ }
+ public boolean isPenetrateEntity(){
+ return false;
+ }
+
+ public void onCollideWithPlayer(MovingObjectPosition pos, EntityPlayer entity){}
+
+ public void onCollideWithMob(MovingObjectPosition pos, EntityMob entity){}
+
+ public void onCollideWithLiving(MovingObjectPosition pos, EntityLiving entity){}
+
+ public void onCollideWithEntity(MovingObjectPosition pos, Entity entity){}
+
+ public void onCollideWithBlock(MovingObjectPosition pos, Block block){}
+
+ public void inWater(){}
+
+ public float fallSpeed(){ return 0; }
+
+ public DamageSource thisDamageSource(Entity entity) {
+ return entity != null ? EntityDamageSource.causeIndirectMagicDamage(entity, this) : DamageSource.magic;
+ }
+
+ public String getSoundName(){
+ return "random.bowhit";
+ }
+
+ public boolean canExist(){ return ticksExisted<20; }
+
+ protected boolean canTriggerWalking() {
+ return false;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public float getShadowSize() {
+ return 0.0F;
+ }
+
+ public void setDamage(float par1) {
+ this.damage = par1;
+ }
+
+ public float getDamage() {
+ return this.damage;
+ }
+
+ public void setKnockbackStrength(int par1) {
+ this.knockbackStrength = par1;
+ }
+
+ public boolean canAttackWithItem() {
+ return false;
+ }
+
+ /**
+ * パーティクル発生間隔
+ * @return
+ */
+ protected int getParticleInterval(){
+ return 1;
+ }
+
+ /**
+ * パーティクルの色を設定する。
+ * enableParticleがtrueでなければ呼ばれない
+ */
+ protected void setParticleColor(){
+ particleRed=particleGreen=particleBlue=1.f;
+ }
+
+ /**
+ * パーティクルの大きさを得る
+ * @return
+ */
+ protected float getParticleSize(){
+ return 0.75f+0.5f*rand.nextFloat();
+ }
+
+ protected void calcMatrix(){
+ double pc=MathHelper.cos(rotationPitch);
+ double ps=MathHelper.sin(rotationPitch);
+ double yc=MathHelper.cos(rotationYaw);
+ double ys=MathHelper.sin(rotationYaw);
+
+ // ロール・ピッチ・ヨーの回転行列を得る
+ matrix[0]=1*pc;
+ matrix[1]=1*ps*ys;
+ matrix[2]=1*ps*yc+0;
+ matrix[3]=0;
+
+ matrix[4]=ys*pc;
+ matrix[5]=0+1*yc;
+ matrix[6]=0-1*ys;
+ matrix[7]=0;
+
+ matrix[8]=-ps;
+ matrix[9]=pc*ys;
+ matrix[10]=pc*yc;
+ matrix[11]=0;
+
+ matrix[12]=matrix[13]=matrix[14]=0;
+ matrix[15]=1;
+ }
+
+ @SideOnly(Side.CLIENT)
+ protected void spawnParticle(){
+ //1.法線を得る
+ //Vec3 normal=Vec3.createVectorHelper(motionX, motionY, motionZ).normalize();
+
+ //2.法線から回転行列を得る(計算済み)
+
+ //3.x-z平面に360度の範囲で動くベクトルを得る
+ float angle=(float)(rand.nextDouble()*Math.PI*2);
+ float size=0.5f+0.75f*rand.nextFloat();
+ Vec3 baseV=Vec3.createVectorHelper(MathHelper.cos(angle), 0, MathHelper.sin(angle));
+ baseV.xCoord*=size;
+ baseV.zCoord*=size;
+
+ //4.回転行列でベクトルを回転させる
+ Vec3 vector=Vec3.createVectorHelper(0,0,0);
+ vector.xCoord=matrix[0]*baseV.xCoord+matrix[1]*baseV.yCoord+matrix[2]*baseV.zCoord+matrix[3]*1;
+ vector.yCoord=matrix[4]*baseV.xCoord+matrix[5]*baseV.yCoord+matrix[6]*baseV.zCoord+matrix[7]*1;
+ vector.zCoord=matrix[8]*baseV.xCoord+matrix[9]*baseV.yCoord+matrix[10]*baseV.zCoord+matrix[11]*1;
+
+ //5.パーティクルつくる
+ setParticleColor();
+
+ EntityTracksFX fx=new EntityTracksFX(worldObj, posX, posY, posZ, vector.xCoord, vector.yCoord, vector.zCoord, particleRed, particleGreen, particleBlue, getParticleSize());
+ FMLClientHandler.instance().getClient().effectRenderer.addEffect(fx);
+
+ if(this.ticksExisted%3==0){
+ EntityTrajectoryFX fx2=new EntityTrajectoryFX(worldObj, posX, posY, posZ, motionX, motionY, motionZ);
+ fx2.setParticleIcon(FBSEventHandler.SpellTexture);
+ fx2.setRBGColorF(particleRed, particleGreen, particleBlue);
+ FMLClientHandler.instance().getClient().effectRenderer.addEffect(fx2);
+ }
+ }
+
+ /*
+ * Tick毎に呼ばれる更新処理。
+ * 速度の更新、衝突判定などをここで行う。
+ */
+ public void onUpdate() {
+ super.onUpdate();
+
+ //パーティクル用行列の生成
+ if(!hasMatrix || preMotionX!=motionX || preMotionY!=motionY || preMotionZ!=motionZ){
+ calcMatrix();
+ hasMatrix=true;
+ preMotionX=motionX;
+ preMotionY=motionY;
+ preMotionZ=motionZ;
+ }
+
+ //パーティクルを生成
+ if(FBS.proxy.getClientWorld()!=null && worldObj.isRemote && enableParticle && this.ticksExisted%getParticleInterval()==0){
+ spawnParticle();
+ }
+
+ //直前のパラメータと新パラメータを一致させているところ。
+ //また、速度に応じてエンティティの向きを調整し、常に進行方向に前面が向くようにしている。
+ if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F) {
+ float f = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
+ this.prevRotationYaw = this.rotationYaw = (float) (Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI);
+ this.prevRotationPitch = this.rotationPitch = (float) (Math.atan2(this.motionY, (double) f) * 180.0D / Math.PI);
+ }
+
+ //激突したブロックを確認している
+ Block block=worldObj.getBlock(xTile, yTile, zTile);
+ if (block.getMaterial() != Material.air) {
+ block.setBlockBoundsBasedOnState(this.worldObj, xTile, yTile, zTile);
+ AxisAlignedBB axisalignedbb = block.getCollisionBoundingBoxFromPool(this.worldObj, xTile, yTile, zTile);
+
+ if (axisalignedbb != null && axisalignedbb.isVecInside(Vec3.createVectorHelper(this.posX, this.posY, this.posZ))) {
+ this.inGround = true;
+ }
+ }
+
+ //空気じゃないブロックに当たった
+ if (this.inGround) {
+ block = worldObj.getBlock(xTile, yTile, zTile);
+ int meta = worldObj.getBlockMetadata(xTile, yTile, zTile);
+
+ if (block == this.inTile && meta == this.inData) {
+ ++this.ticksInGround;
+
+ if (this.ticksInGround >= (isPenetrateBlock() ? 20 : 2)) {
+ this.setDead();
+ }
+ } else {
+ this.inGround = false;
+ this.motionX *= (double) (this.rand.nextFloat() * 0.2F);
+ this.motionY *= (double) (this.rand.nextFloat() * 0.2F);
+ this.motionZ *= (double) (this.rand.nextFloat() * 0.2F);
+ this.ticksInGround = 0;
+ this.ticksInAir = 0;
+ }
+ } else{
+ //埋まってない時。速度の更新。
+ //ブロックとの衝突判定
+ ++this.ticksInAir;
+ Vec3 vec31 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ);
+ Vec3 vec3 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
+ MovingObjectPosition movingobjectposition = this.worldObj.func_147447_a(vec31, vec3, false, true, false);
+ vec31 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ);
+ vec3 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
+
+ //ブロック貫通がONの場合、ブロック衝突判定をスキップ
+ if (this.isPenetrateBlock()) {
+ movingobjectposition = null;
+ }
+
+ //ブロックに当たった
+ if (movingobjectposition != null) {
+ vec3 = Vec3.createVectorHelper(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord);
+ }
+
+ //Entityとの衝突判定。
+ Entity entity = null;
+ List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D));
+ double d0 = 0.0D;
+ int l;
+ float f1;
+
+ //1ブロック分の範囲内にいるエンティティ全てに対して繰り返す
+ for (l = 0; l < list.size(); ++l) {
+ Entity entity1 = (Entity) list.get(l);
+ //FMLLog.severe("checking hit at:"+entity1.toString());
+ //発射物自身or発射後5tick以外だとすりぬける
+ if (entity1.canBeCollidedWith() /*&& (entity1 != this.shootingEntity ||this.ticksInAir >= 5)*/ ) {
+ f1 = 0.3F;
+ AxisAlignedBB axisalignedbb1 = entity1.boundingBox.expand((double) f1, (double) f1, (double) f1);
+ MovingObjectPosition movingobjectposition1 = axisalignedbb1.calculateIntercept(vec3, vec31);
+
+ if (movingobjectposition1 != null) {
+ double d1 = vec3.distanceTo(movingobjectposition1.hitVec);
+
+ if (d1 < d0 || d0 == 0.0D) {
+ //FMLLog.severe("hit at:"+entity1.toString());
+ entity = entity1;
+ d0 = d1;
+ }
+ }
+ }
+ }
+
+ //エンティティに当たった
+ if (entity != null) {
+ movingobjectposition = new MovingObjectPosition(entity);
+ }
+
+ int hitType=-1;
+
+ /* 当たったエンティティそれそれについての判定部分。*/
+ if (movingobjectposition != null && movingobjectposition.entityHit != null) {
+ if (movingobjectposition.entityHit instanceof EntityPlayer) {
+ hitType=0;
+ } else if(movingobjectposition.entityHit instanceof EntityMob){
+ hitType=1;
+ }
+ else if (movingobjectposition.entityHit instanceof EntityLiving) {
+ hitType=2;
+ } else {
+ hitType=3;
+ }
+
+ /*
+ //当たったあと、弾を消去する。エンティティ貫通がONの弾種はそのまま残す。
+ if (!(movingobjectposition.entityHit instanceof EntityEnderman) && !this.isPenetrateEntity()) {
+ this.setDead();
+ }
+ */
+ }
+
+ //当たったあとの処理
+ if (movingobjectposition != null) {
+ if(movingobjectposition.entityHit!=null){
+ switch (hitType){
+ case 0:
+ onCollideWithPlayer(movingobjectposition, (EntityPlayer) movingobjectposition.entityHit);
+ break;
+
+ case 1:
+ onCollideWithMob(movingobjectposition, (EntityMob)movingobjectposition.entityHit);
+ break;
+
+ case 2:
+ onCollideWithLiving(movingobjectposition, (EntityLiving)movingobjectposition.entityHit);
+ break;
+
+ case 3:
+ onCollideWithEntity(movingobjectposition, entity);
+ break;
+
+ default:
+ break;
+ }
+ }
+ else {
+ //エンティティには当たってない。ブロックに当たった。
+ this.xTile = movingobjectposition.blockX;
+ this.yTile = movingobjectposition.blockY;
+ this.zTile = movingobjectposition.blockZ;
+ this.inTile = this.worldObj.getBlock(this.xTile, this.yTile, this.zTile);
+ this.inData = this.worldObj.getBlockMetadata(this.xTile, this.yTile, this.zTile);
+
+ onCollideWithBlock(movingobjectposition, worldObj.getBlock(xTile, yTile, zTile));
+
+ if (!isPenetrateBlock() && inTile.getMaterial()!=Material.air) {
+ this.motionX = (double) ((float) (movingobjectposition.hitVec.xCoord - this.posX));
+ this.motionY = (double) ((float) (movingobjectposition.hitVec.yCoord - this.posY));
+ this.motionZ = (double) ((float) (movingobjectposition.hitVec.zCoord - this.posZ));
+ float f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ);
+ this.posX -= this.motionX / (double) f2 * 0.05000000074505806D;
+ this.posY -= this.motionY / (double) f2 * 0.05000000074505806D;
+ this.posZ -= this.motionZ / (double) f2 * 0.05000000074505806D;
+
+ this.playSound(getSoundName(), 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F));
+ }
+
+ //ブロックが破壊されていない場合
+ if (this.inTile.getMaterial() != Material.air) {
+ this.inGround = true;
+ inTile.onEntityCollidedWithBlock(this.worldObj, this.xTile, this.yTile, this.zTile, this);
+ }
+ }
+ }
+
+ //改めてポジションに速度を加算。
+ this.posX += this.motionX;
+ this.posY += this.motionY;
+ this.posZ += this.motionZ;
+ motionY-=fallSpeed();
+
+ if(isInWater()){
+ inWater();
+ }
+
+ if (!canExist()) {
+ this.setDead();
+ }
+
+ this.setPosition(this.posX, this.posY, this.posZ);
+ this.func_145775_I();
+
+ //ticksExisted++;
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/entity/EntityMagicWedge.class b/src/main/java/jp/plusplus/fbs/entity/EntityMagicWedge.class Binary files differnew file mode 100644 index 0000000..b0486d0 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/entity/EntityMagicWedge.class diff --git a/src/main/java/jp/plusplus/fbs/entity/EntityMagicWedge.java b/src/main/java/jp/plusplus/fbs/entity/EntityMagicWedge.java new file mode 100644 index 0000000..fdbd068 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/entity/EntityMagicWedge.java @@ -0,0 +1,70 @@ +package jp.plusplus.fbs.entity;
+
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLiving;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.monster.EntityMob;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.potion.Potion;
+import net.minecraft.potion.PotionEffect;
+import net.minecraft.util.DamageSource;
+import net.minecraft.util.MovingObjectPosition;
+import net.minecraft.world.World;
+
+/**
+ * Createdby pluslus_Fon 2015/06/14.
+ */
+public class EntityMagicWedge extends EntityMagicProjectileBase {
+ protected int encLv;
+ protected int encDur;
+
+ public EntityMagicWedge(World p_i1582_1_) {
+ super(p_i1582_1_);
+ }
+ public EntityMagicWedge(World par1World, EntityLivingBase par2EntityLivingBase, float speed, float speed2, float damage, int lv, int du) {
+ super(par1World, par2EntityLivingBase, speed, speed2, 0, 0, 0);
+ setDamage(damage);
+ encLv=lv;
+ encDur=du;
+ }
+
+ public boolean canExist(){ return worldObj.isRemote || ticksExisted<20*3; }
+
+ @Override
+ protected void readEntityFromNBT(NBTTagCompound nbt) {
+ super.readEntityFromNBT(nbt);
+ encLv=nbt.getInteger("EnchantLv");
+ encDur=nbt.getInteger("EnchantDur");
+ }
+ @Override
+ protected void writeEntityToNBT(NBTTagCompound nbt) {
+ super.writeEntityToNBT(nbt);
+ nbt.setInteger("EnchantLv", encLv);
+ nbt.setInteger("EnchantDur", encDur);
+ }
+
+ public void onCollideWithPlayer(MovingObjectPosition pos, EntityPlayer entity){
+ if(!worldObj.isRemote && !shootingEntity.isEntityEqual(entity)) {
+ entity.addPotionEffect(new PotionEffect(Potion.weakness.getId(), encDur, encLv));
+ entity.attackEntityFrom(DamageSource.causeIndirectMagicDamage(shootingEntity, entity), getDamage());
+ setDead();
+ }
+ }
+ public void onCollideWithMob(MovingObjectPosition pos, EntityMob entity){
+ if(!worldObj.isRemote) {
+ hitAt(entity);
+ }
+ }
+ public void onCollideWithLiving(MovingObjectPosition pos, EntityLiving entity){
+ if(!worldObj.isRemote) {
+ hitAt(entity);
+ }
+ }
+
+ protected void hitAt(EntityLiving entity){
+ entity.addPotionEffect(new PotionEffect(Potion.weakness.getId(), encDur, encLv));
+ entity.attackEntityFrom(DamageSource.causeIndirectMagicDamage(shootingEntity, entity), getDamage());
+ setDead();
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/entity/EntityTableware.class b/src/main/java/jp/plusplus/fbs/entity/EntityTableware.class Binary files differnew file mode 100644 index 0000000..f34510b --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/entity/EntityTableware.class diff --git a/src/main/java/jp/plusplus/fbs/entity/EntityTableware.java b/src/main/java/jp/plusplus/fbs/entity/EntityTableware.java new file mode 100644 index 0000000..753f195 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/entity/EntityTableware.java @@ -0,0 +1,398 @@ +package jp.plusplus.fbs.entity;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.item.ItemCore;
+import net.minecraft.block.material.Material;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.IHopper;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.*;
+import net.minecraft.world.World;
+
+import java.util.List;
+
+/**
+ * Created by plusplus_F on 2015/11/06.
+ */
+public class EntityTableware extends Entity {
+
+ protected int containerMeta;
+ private boolean field_70279_a;
+ private double speedMultiplier;
+ private int posRotationIncrements;
+ private double X;
+ private double Y;
+ private double Z;
+ private double yaw;
+ private double pitch;
+ @SideOnly(Side.CLIENT)
+ private double velocityX;
+ @SideOnly(Side.CLIENT)
+ private double velocityY;
+ @SideOnly(Side.CLIENT)
+ private double velocityZ;
+
+ public EntityTableware(World world) {
+ super(world);
+ this.containerMeta = 0;
+ this.field_70279_a = true;
+ this.speedMultiplier = 0.07D;
+ this.setSize(0.3F * this.getSize(), 0.1F * this.getSize());
+ this.yOffset = this.height;
+ }
+
+ public EntityTableware(World world, ItemStack item) {
+ this(world);
+ this.setContainerMeta(item.getItemDamage());
+ }
+
+ public EntityTableware(World world, ItemStack item, double x, double y, double z) {
+ this(world, item);
+ this.setPosition(x, y + (double)this.yOffset, z);
+ this.motionX = 0.0D;
+ this.motionY = 0.0D;
+ this.motionZ = 0.0D;
+ this.prevPosX = x;
+ this.prevPosY = y;
+ this.prevPosZ = z;
+ }
+
+ protected void entityInit() {
+ this.dataWatcher.addObject(17, new Integer(0));
+ this.dataWatcher.addObject(18, new Integer(1));
+ }
+
+ protected void readEntityFromNBT(NBTTagCompound nbt) {
+ this.setContainerMeta(nbt.getShort("meta"));
+ }
+
+ protected void writeEntityToNBT(NBTTagCompound nbt) {
+ nbt.setShort("meta", (short)this.getItemMetadata());
+ }
+
+ public int getItemMetadata() {
+ return this.dataWatcher.getWatchableObjectInt(17);
+ }
+
+ public void setContainerMeta(int m) {
+ this.containerMeta = m;
+ this.dataWatcher.updateObject(17, Integer.valueOf(m));
+ }
+
+ public void setForwardDirection(int par1) {
+ this.dataWatcher.updateObject(18, Integer.valueOf(par1));
+ }
+
+ public int getForwardDirection() {
+ return this.dataWatcher.getWatchableObjectInt(18);
+ }
+
+ protected boolean canTriggerWalking() {
+ return false;
+ }
+
+ public boolean canBeCollidedWith() {
+ return !this.isDead;
+ }
+
+ public AxisAlignedBB getCollisionBox(Entity par1Entity) {
+ return par1Entity.boundingBox;
+ }
+
+ public AxisAlignedBB getBoundingBox() {
+ return this.boundingBox;
+ }
+
+ public boolean canBePushed() {
+ return true;
+ }
+
+ public double getMountedYOffset() {
+ return (double)this.getScale() * 0.4D - 0.06D;
+ }
+
+ public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) {
+ if(this.isEntityInvulnerable()) {
+ return false;
+ } else if(!this.worldObj.isRemote && !this.isDead) {
+ this.setBeenAttacked();
+ if(par1DamageSource instanceof EntityDamageSource) {
+ Entity by = ((EntityDamageSource)par1DamageSource).getEntity();
+ if(by != null && by instanceof EntityPlayer) {
+ ItemStack drop1 = this.returnItem();
+ if(drop1 != null) {
+ this.worldObj.playSoundAtEntity(this, "random.pop", 0.4F, 1.8F);
+ this.entityDropItem(drop1, 0.2F);
+ if(this.riddenByEntity != null) {
+ this.riddenByEntity.mountEntity(this);
+ }
+
+ this.setDead();
+ }
+ }
+ }
+
+ return true;
+ } else {
+ return true;
+ }
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void setPositionAndRotation2(double par1, double par3, double par5, float par7, float par8, int par9) {
+ if(this.field_70279_a) {
+ this.posRotationIncrements = par9 + 5;
+ } else {
+ double d3 = par1 - this.posX;
+ double d4 = par3 - this.posY;
+ double d5 = par5 - this.posZ;
+ double d6 = d3 * d3 + d4 * d4 + d5 * d5;
+ if(d6 <= 1.0D) {
+ return;
+ }
+
+ this.posRotationIncrements = 3;
+ }
+
+ this.X = par1;
+ this.Y = par3;
+ this.Z = par5;
+ this.yaw = (double)par7;
+ this.pitch = (double)par8;
+ this.motionX = this.velocityX;
+ this.motionY = this.velocityY;
+ this.motionZ = this.velocityZ;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void setVelocity(double par1, double par3, double par5) {
+ this.velocityX = this.motionX = par1;
+ this.velocityY = this.motionY = par3;
+ this.velocityZ = this.motionZ = par5;
+ }
+
+ public void onUpdate() {
+ super.onUpdate();
+ this.prevPosX = this.posX;
+ this.prevPosY = this.posY;
+ this.prevPosZ = this.posZ;
+ byte b0 = 5;
+ double d0 = 0.0D;
+ boolean spl = false;
+
+ int d3;
+ for(d3 = 0; d3 < b0; ++d3) {
+ double j = this.boundingBox.minY + (this.boundingBox.maxY - this.boundingBox.minY) * (double)(d3 + 0) / (double)b0 - 0.125D;
+ double tile = this.boundingBox.minY + (this.boundingBox.maxY - this.boundingBox.minY) * (double)(d3 + 1) / (double)b0 - 0.125D;
+ AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox(this.boundingBox.minX, j, this.boundingBox.minZ, this.boundingBox.maxX, tile, this.boundingBox.maxZ);
+ if(this.worldObj.isAABBInMaterial(axisalignedbb, Material.water)) {
+ d0 += 1.0D / (double)b0;
+ spl = true;
+ }
+ }
+
+ if(!this.worldObj.isRemote) {
+ d3 = MathHelper.floor_double(this.posX);
+ int var21 = MathHelper.floor_double(this.posY);
+ int d4 = MathHelper.floor_double(this.posZ);
+ if(!this.worldObj.isAirBlock(d3, var21 - 1, d4) && this.worldObj.getTileEntity(d3, var21 - 1, d4) != null) {
+ TileEntity var23 = this.worldObj.getTileEntity(d3, var21 - 1, d4);
+ if(var23 instanceof IHopper) {
+ ItemStack d5 = this.returnItem();
+ this.entityDropItem(d5, 0.1F);
+ this.setDead();
+ }
+ }
+ }
+
+ double var20 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ);
+ double var22;
+ double var24;
+ if(var20 > 0.26249999999999996D && spl) {
+ var22 = Math.cos((double)this.rotationYaw * 3.141592653589793D / 180.0D);
+ var24 = Math.sin((double)this.rotationYaw * 3.141592653589793D / 180.0D);
+
+ for(int d10 = 0; (double)d10 < 1.0D + var20 * 60.0D; ++d10) {
+ double d6 = (double)(this.rand.nextFloat() * 2.0F - 1.0F);
+ double d7 = (double)(this.rand.nextInt(2) * 2 - 1) * 0.7D;
+ double d8;
+ double l;
+ if(this.rand.nextBoolean()) {
+ d8 = this.posX - var22 * d6 * 0.8D + var24 * d7;
+ l = this.posZ - var24 * d6 * 0.8D - var22 * d7;
+ this.worldObj.spawnParticle("splash", d8, this.posY - 0.125D, l, this.motionX, this.motionY, this.motionZ);
+ } else {
+ d8 = this.posX + var22 + var24 * d6 * 0.7D;
+ l = this.posZ + var24 - var22 * d6 * 0.7D;
+ this.worldObj.spawnParticle("splash", d8, this.posY - 0.125D, l, this.motionX, this.motionY, this.motionZ);
+ }
+ }
+ }
+
+ double d11;
+ double var25;
+ if(this.worldObj.isRemote && this.field_70279_a) {
+ if(this.posRotationIncrements > 0) {
+ var22 = this.posX + (this.X - this.posX) / (double)this.posRotationIncrements;
+ var24 = this.posY + (this.Y - this.posY) / (double)this.posRotationIncrements;
+ d11 = this.posZ + (this.Z - this.posZ) / (double)this.posRotationIncrements;
+ var25 = MathHelper.wrapAngleTo180_double(this.yaw - (double)this.rotationYaw);
+ this.rotationYaw = (float)((double)this.rotationYaw + var25 / (double)this.posRotationIncrements);
+ this.rotationPitch = (float)((double)this.rotationPitch + (this.pitch - (double)this.rotationPitch) / (double)this.posRotationIncrements);
+ --this.posRotationIncrements;
+ this.setPosition(var22, var24, d11);
+ this.setRotation(this.rotationYaw, this.rotationPitch);
+ } else {
+ var22 = this.posX + this.motionX;
+ var24 = this.posY + this.motionY;
+ d11 = this.posZ + this.motionZ;
+ this.setPosition(var22, var24, d11);
+ this.motionX *= 0.5D;
+ this.motionY *= 0.5D;
+ this.motionZ *= 0.5D;
+ this.motionX *= 0.9900000095367432D;
+ this.motionY *= 0.949999988079071D;
+ this.motionZ *= 0.9900000095367432D;
+ }
+ } else {
+ if(d0 < 1.0D) {
+ var22 = d0 * 2.0D - 1.0D;
+ this.motionY += 0.03999999910593033D * var22;
+ } else {
+ if(this.motionY < 0.0D) {
+ this.motionY /= 2.0D;
+ }
+
+ this.motionY += 0.007000000216066837D;
+ }
+
+ if(this.riddenByEntity != null && this.riddenByEntity instanceof EntityLivingBase) {
+ var22 = (double)((EntityLivingBase)this.riddenByEntity).moveForward;
+ if(var22 > 0.0D) {
+ var24 = -Math.sin((double)(this.riddenByEntity.rotationYaw * 3.1415927F / 180.0F));
+ d11 = Math.cos((double)(this.riddenByEntity.rotationYaw * 3.1415927F / 180.0F));
+ this.motionX += var24 * this.speedMultiplier * 0.05000000074505806D;
+ this.motionZ += d11 * this.speedMultiplier * 0.05000000074505806D;
+ }
+ }
+
+ var22 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ);
+ if(var22 > 0.35D) {
+ var24 = 0.35D / var22;
+ this.motionX *= var24;
+ this.motionZ *= var24;
+ var22 = 0.35D;
+ }
+
+ if(var22 > var20 && this.speedMultiplier < 0.35D) {
+ this.speedMultiplier += (0.1D - this.speedMultiplier) / 35.0D;
+ if(this.speedMultiplier > 0.35D) {
+ this.speedMultiplier = 0.35D;
+ }
+ } else {
+ this.speedMultiplier -= (this.speedMultiplier - 0.07D) / 35.0D;
+ if(this.speedMultiplier < 0.07D) {
+ this.speedMultiplier = 0.07D;
+ }
+ }
+
+ if(this.onGround) {
+ this.motionX *= 0.5D;
+ this.motionY *= 0.5D;
+ this.motionZ *= 0.5D;
+ }
+
+ this.moveEntity(this.motionX, this.motionY, this.motionZ);
+ this.motionX *= 0.9900000095367432D;
+ this.motionY *= 0.949999988079071D;
+ this.motionZ *= 0.9900000095367432D;
+ this.rotationPitch = 0.0F;
+ var24 = (double)this.rotationYaw;
+ d11 = this.prevPosX - this.posX;
+ var25 = this.prevPosZ - this.posZ;
+ if(d11 * d11 + var25 * var25 > 0.001D) {
+ var24 = (double)((float)(Math.atan2(var25, d11) * 180.0D / 3.141592653589793D));
+ }
+
+ double d12 = MathHelper.wrapAngleTo180_double(var24 - (double)this.rotationYaw);
+ if(d12 > 20.0D) {
+ d12 = 20.0D;
+ }
+
+ if(d12 < -20.0D) {
+ d12 = -20.0D;
+ }
+
+ this.rotationYaw = (float)((double)this.rotationYaw + d12);
+ this.setRotation(this.rotationYaw, this.rotationPitch);
+ if(!this.worldObj.isRemote) {
+ List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.expand(0.20000000298023224D, 0.0D, 0.20000000298023224D));
+ if(list != null && !list.isEmpty()) {
+ for(int var26 = 0; var26 < list.size(); ++var26) {
+ Entity entity = (Entity)list.get(var26);
+ if(entity != this.riddenByEntity && entity.canBePushed()) {
+ entity.applyEntityCollision(this);
+ }
+ }
+ }
+
+ if(this.riddenByEntity != null && this.riddenByEntity.isDead) {
+ this.riddenByEntity = null;
+ }
+ }
+ }
+ }
+
+ public void updateRiderPosition() {
+ if(this.riddenByEntity != null) {
+ double d0 = Math.cos((double)this.rotationYaw * 3.141592653589793D / 180.0D) * 0.4D;
+ double d1 = Math.sin((double)this.rotationYaw * 3.141592653589793D / 180.0D) * 0.4D;
+ this.riddenByEntity.setPosition(this.posX + d0, this.posY + this.getMountedYOffset() + this.riddenByEntity.getYOffset(), this.posZ + d1);
+ }
+
+ }
+
+ @SideOnly(Side.CLIENT)
+ public float getShadowSize() {
+ return 0.3F;
+ }
+
+ public boolean interactFirst(EntityPlayer par1EntityPlayer) {
+ ItemStack has;
+ has = this.returnItem();
+ if (has != null && !par1EntityPlayer.inventory.addItemStackToInventory(has) && !this.worldObj.isRemote) {
+ par1EntityPlayer.entityDropItem(has, 1.0F);
+ }
+
+ this.setDead();
+ this.worldObj.playSoundAtEntity(par1EntityPlayer, "random.pop", 0.4F, 1.8F);
+ return true;
+ }
+
+ protected ItemStack returnItem(){
+ return new ItemStack(ItemCore.tableware, 1, containerMeta);
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void func_70270_d(boolean par1) {
+ this.field_70279_a = par1;
+ }
+
+ protected byte particleNumber() {
+ return (byte)0;
+ }
+
+ protected float getScale() {
+ return 1.0F;
+ }
+
+ protected float getSize() {
+ return 1.0F;
+ }
+
+}
diff --git a/src/main/java/jp/plusplus/fbs/entity/render/RenderAuthor.class b/src/main/java/jp/plusplus/fbs/entity/render/RenderAuthor.class Binary files differnew file mode 100644 index 0000000..b0935ad --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/entity/render/RenderAuthor.class diff --git a/src/main/java/jp/plusplus/fbs/entity/render/RenderAuthor.java b/src/main/java/jp/plusplus/fbs/entity/render/RenderAuthor.java new file mode 100644 index 0000000..8b733fa --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/entity/render/RenderAuthor.java @@ -0,0 +1,19 @@ +package jp.plusplus.fbs.entity.render;
+
+import cpw.mods.fml.common.registry.VillagerRegistry;
+import jp.plusplus.fbs.FBS;
+import net.minecraft.client.renderer.entity.RenderVillager;
+import net.minecraft.entity.passive.EntityVillager;
+import net.minecraft.util.ResourceLocation;
+
+/**
+ * Created by plusplus_F on 2016/02/24.
+ */
+public class RenderAuthor extends RenderVillager {
+ private static final ResourceLocation rl = new ResourceLocation(FBS.MODID+":textures/entity/author.png");
+
+ @Override
+ protected ResourceLocation getEntityTexture(EntityVillager p_110775_1_) {
+ return rl;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/entity/render/RenderButterfly.class b/src/main/java/jp/plusplus/fbs/entity/render/RenderButterfly.class Binary files differnew file mode 100644 index 0000000..66a393f --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/entity/render/RenderButterfly.class diff --git a/src/main/java/jp/plusplus/fbs/entity/render/RenderButterfly.java b/src/main/java/jp/plusplus/fbs/entity/render/RenderButterfly.java new file mode 100644 index 0000000..ae5466e --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/entity/render/RenderButterfly.java @@ -0,0 +1,59 @@ +package jp.plusplus.fbs.entity.render;
+
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.entity.EntityButterfly;
+import jp.plusplus.fbs.model.ModelButterfly;
+import net.minecraft.client.renderer.entity.Render;
+import net.minecraft.entity.Entity;
+import net.minecraft.util.ResourceLocation;
+import org.lwjgl.opengl.GL11;
+import org.lwjgl.opengl.GL12;
+
+/**
+ * Created by pluslus_F on 2015/06/25.
+ */
+public class RenderButterfly extends Render {
+ private static final ResourceLocation bulletTextures = new ResourceLocation(FBS.MODID+":textures/entity/butterfly.png");
+
+ protected ModelButterfly model;
+
+ public RenderButterfly() {
+ this.model = new ModelButterfly();
+ this.shadowSize = 0.5F;
+ }
+
+ @Override
+ public void doRender(Entity entity, double par2, double par4, double par6, float par8, float par9) {
+ //FMLLog.severe("render! at:"+par2+","+par4+","+par6);
+
+ this.bindEntityTexture(entity);
+ GL11.glPushMatrix();
+ GL11.glDisable(GL11.GL_LIGHTING);
+ GL11.glEnable(GL12.GL_RESCALE_NORMAL);
+ GL11.glEnable(GL11.GL_BLEND);
+ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
+ //GL11.glEnable(GL11.TRa);
+ GL11.glColor4f(2.0F, 2.0F, 2.0F, 1.0F);
+ GL11.glTranslatef((float) par2, (float) par4, (float) par6);
+ GL11.glRotatef(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * par9, 0.0F, 1.0F, 0.0F);
+ GL11.glRotatef(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * par9, 0.0F, 0.0F, 1.0F);
+ GL11.glScalef(1.0F, -1.0F, -1.0F);
+
+ model.render((Entity) null, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F);
+
+ GL11.glRotatef(((EntityButterfly)entity).rotationW, 0, 0, 1);
+ model.renderWingsR(0.0625F);
+ GL11.glRotatef(-2*((EntityButterfly) entity).rotationW, 0, 0, 1);
+ model.renderWingsL(0.0625F);
+
+ GL11.glDisable(GL12.GL_RESCALE_NORMAL);
+ GL11.glEnable(GL11.GL_LIGHTING);
+ GL11.glDisable(GL11.GL_BLEND);
+ GL11.glPopMatrix();
+ }
+
+ @Override
+ protected ResourceLocation getEntityTexture(Entity p_110775_1_) {
+ return bulletTextures;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/entity/render/RenderMagicBase.class b/src/main/java/jp/plusplus/fbs/entity/render/RenderMagicBase.class Binary files differnew file mode 100644 index 0000000..2f82cc9 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/entity/render/RenderMagicBase.class diff --git a/src/main/java/jp/plusplus/fbs/entity/render/RenderMagicBase.java b/src/main/java/jp/plusplus/fbs/entity/render/RenderMagicBase.java new file mode 100644 index 0000000..3d39189 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/entity/render/RenderMagicBase.java @@ -0,0 +1,52 @@ +package jp.plusplus.fbs.entity.render;
+
+import cpw.mods.fml.common.FMLLog;
+import cpw.mods.fml.common.Mod;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.model.ModelMagicBase;
+import net.minecraft.client.model.ModelBase;
+import net.minecraft.client.renderer.entity.Render;
+import net.minecraft.entity.Entity;
+import net.minecraft.util.ResourceLocation;
+import org.lwjgl.opengl.GL11;
+import org.lwjgl.opengl.GL12;
+
+/**
+ * Createdby pluslus_Fon 2015/06/07.
+ */
+public class RenderMagicBase extends Render {
+ private static final ResourceLocation bulletTextures = new ResourceLocation(FBS.MODID+":textures/entity/magic0.png");
+
+ protected ModelBase modelBullet;
+
+ public RenderMagicBase(ModelBase par1ModelBase) {
+ this.modelBullet = par1ModelBase;
+ this.shadowSize = 0.0F;
+ }
+
+ @Override
+ public void doRender(Entity entity, double par2, double par4, double par6, float par8, float par9) {
+ //FMLLog.severe("render! at:"+par2+","+par4+","+par6);
+
+ ModelMagicBase model = (ModelMagicBase) this.modelBullet;
+
+ this.bindEntityTexture(entity);
+ GL11.glPushMatrix();
+ GL11.glDisable(GL11.GL_LIGHTING);
+ GL11.glEnable(GL12.GL_RESCALE_NORMAL);
+ GL11.glColor4f(2.0F, 2.0F, 2.0F, 1.0F);
+ GL11.glTranslatef((float)par2, (float)par4, (float)par6);
+ GL11.glRotatef(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * par9, 0.0F, 1.0F, 0.0F);
+ GL11.glRotatef(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * par9, -1.0F, 0.0F, 0);
+ GL11.glScalef(1.0F, -1.0F, -1.0F);
+ model.render((Entity)null, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F);
+ GL11.glDisable(GL12.GL_RESCALE_NORMAL);
+ GL11.glEnable(GL11.GL_LIGHTING);
+ GL11.glPopMatrix();
+ }
+
+ @Override
+ protected ResourceLocation getEntityTexture(Entity p_110775_1_) {
+ return bulletTextures;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/entity/render/RenderTableware.class b/src/main/java/jp/plusplus/fbs/entity/render/RenderTableware.class Binary files differnew file mode 100644 index 0000000..c45a1e5 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/entity/render/RenderTableware.class diff --git a/src/main/java/jp/plusplus/fbs/entity/render/RenderTableware.java b/src/main/java/jp/plusplus/fbs/entity/render/RenderTableware.java new file mode 100644 index 0000000..65d0fb2 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/entity/render/RenderTableware.java @@ -0,0 +1,62 @@ +package jp.plusplus.fbs.entity.render;
+
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.block.model.ModelFork;
+import jp.plusplus.fbs.block.model.ModelKnife;
+import jp.plusplus.fbs.block.model.ModelSpoon;
+import jp.plusplus.fbs.entity.EntityButterfly;
+import jp.plusplus.fbs.entity.EntityTableware;
+import jp.plusplus.fbs.model.ModelButterfly;
+import net.minecraft.client.renderer.entity.Render;
+import net.minecraft.entity.Entity;
+import net.minecraft.util.ResourceLocation;
+import org.lwjgl.opengl.GL11;
+import org.lwjgl.opengl.GL12;
+
+/**
+ * Created by plusplus_F on 2015/11/16.
+ */
+public class RenderTableware extends Render {
+ private static final ResourceLocation textures = new ResourceLocation(FBS.MODID+":textures/entity/Tableware.png");
+ protected ModelSpoon spoon=new ModelSpoon();
+ protected ModelFork fork=new ModelFork();
+ protected ModelKnife knife=new ModelKnife();
+
+ @Override
+ public void doRender(Entity entity, double x, double y, double z, float p_76986_8_, float partialTick) {
+ if(!(entity instanceof EntityTableware)) return;
+
+ this.bindEntityTexture(entity);
+ int meta=((EntityTableware) entity).getItemMetadata();
+
+ GL11.glPushMatrix();
+ GL11.glDisable(GL11.GL_LIGHTING);
+ GL11.glEnable(GL12.GL_RESCALE_NORMAL);
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ GL11.glTranslatef((float) x, (float) y, (float) z);
+ GL11.glRotatef(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * partialTick, 0.0F, 1.0F, 0.0F);
+ GL11.glRotatef(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * partialTick, 0.0F, 0.0F, 1.0F);
+ GL11.glScalef(1.0F*.3f, -1.0F*.3f, -1.0F*.3f);
+
+ switch (meta){
+ case 0:
+ spoon.render((Entity) null, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F);
+ break;
+ case 1:
+ knife.render((Entity) null, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F);
+ break;
+ case 2:
+ fork.render((Entity) null, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F);
+ break;
+ }
+
+ GL11.glDisable(GL12.GL_RESCALE_NORMAL);
+ GL11.glEnable(GL11.GL_LIGHTING);
+ GL11.glPopMatrix();
+ }
+
+ @Override
+ protected ResourceLocation getEntityTexture(Entity p_110775_1_) {
+ return textures;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/event/FBSEventHandler$1.class b/src/main/java/jp/plusplus/fbs/event/FBSEventHandler$1.class Binary files differnew file mode 100644 index 0000000..33dd0bd --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/event/FBSEventHandler$1.class diff --git a/src/main/java/jp/plusplus/fbs/event/FBSEventHandler.class b/src/main/java/jp/plusplus/fbs/event/FBSEventHandler.class Binary files differnew file mode 100644 index 0000000..065b24c --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/event/FBSEventHandler.class diff --git a/src/main/java/jp/plusplus/fbs/event/FBSEventHandler.java b/src/main/java/jp/plusplus/fbs/event/FBSEventHandler.java new file mode 100644 index 0000000..a3a0b48 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/event/FBSEventHandler.java @@ -0,0 +1,1214 @@ +package jp.plusplus.fbs.event;
+
+import cpw.mods.fml.client.FMLClientHandler;
+import cpw.mods.fml.common.IFuelHandler;
+import cpw.mods.fml.common.eventhandler.SubscribeEvent;
+import cpw.mods.fml.common.gameevent.PlayerEvent;
+import cpw.mods.fml.common.gameevent.TickEvent;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.AchievementRegistry;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.RecipeBladeSpice;
+import jp.plusplus.fbs.Registry;
+import jp.plusplus.fbs.alchemy.AlchemyRegistry;
+import jp.plusplus.fbs.alchemy.IAlchemyMaterial;
+import jp.plusplus.fbs.alchemy.IAlchemyProduct;
+import jp.plusplus.fbs.alchemy.characteristic.CharacteristicBase;
+import jp.plusplus.fbs.api.FBSEntityPropertiesAPI;
+import jp.plusplus.fbs.api.event.PlayerSanityEvent;
+import jp.plusplus.fbs.api.event.PlayerSanityRollEvent;
+import jp.plusplus.fbs.api.event.PlayerUseMagicEvent;
+import jp.plusplus.fbs.block.BlockBonfire;
+import jp.plusplus.fbs.block.BlockCore;
+import jp.plusplus.fbs.api.IPottery;
+import jp.plusplus.fbs.container.inventory.InventoryBasket;
+import jp.plusplus.fbs.entity.EntityButterfly;
+import jp.plusplus.fbs.exprop.FBSEntityProperties;
+import jp.plusplus.fbs.exprop.SanityManager;
+import jp.plusplus.fbs.item.*;
+import jp.plusplus.fbs.item.enchant.EnchantmentSanityProtect;
+import jp.plusplus.fbs.item.enchant.EnchantmentWealth;
+import jp.plusplus.fbs.packet.MessagePlayerJoinInAnnouncement;
+import jp.plusplus.fbs.packet.MessagePlayerProperties;
+import jp.plusplus.fbs.packet.PacketHandler;
+import jp.plusplus.fbs.particle.EntitySpellCircleFX;
+import jp.plusplus.fbs.particle.EntitySpellFX;
+import jp.plusplus.fbs.pottery.BlockPotteryBase;
+import jp.plusplus.fbs.pottery.ItemBlockPottery;
+import jp.plusplus.fbs.pottery.PotteryRegistry;
+import jp.plusplus.fbs.spirit.ISpiritTool;
+import jp.plusplus.fbs.spirit.SpiritManager;
+import jp.plusplus.fbs.spirit.SpiritStatus;
+import jp.plusplus.fbs.tileentity.TileEntityMagicCore;
+import jp.plusplus.fbs.world.TeleporterWarp;
+import jp.plusplus.fbs.world.WorldGenGrass;
+import jp.plusplus.fbs.world.WorldGenHerbs;
+import jp.plusplus.fbs.world.WorldGenMushroom;
+import jp.plusplus.fbs.world.biome.BiomeAutumn;
+import jp.plusplus.fbs.world.structure.MapGenSealdLib;
+import jp.plusplus.fbs.tileentity.render.RenderMagicCircle;
+import jp.plusplus.fbs.world.structure.MapGenStudy;
+import net.minecraft.block.*;
+import net.minecraft.enchantment.EnchantmentHelper;
+import net.minecraft.entity.*;
+import net.minecraft.entity.boss.EntityDragonPart;
+import net.minecraft.entity.item.EntityItem;
+import net.minecraft.entity.monster.EntityWitch;
+import net.minecraft.entity.monster.IMob;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.EntityPlayerMP;
+import net.minecraft.entity.projectile.EntityArrow;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.*;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.potion.Potion;
+import net.minecraft.potion.PotionEffect;
+import net.minecraft.server.management.ServerConfigurationManager;
+import net.minecraft.stats.AchievementList;
+import net.minecraft.stats.StatList;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.*;
+import net.minecraft.world.World;
+import net.minecraft.world.WorldServer;
+import net.minecraft.world.biome.BiomeGenBase;
+import net.minecraft.world.chunk.Chunk;
+import net.minecraft.world.gen.feature.WorldGenMinable;
+import net.minecraft.world.gen.feature.WorldGenerator;
+import net.minecraftforge.client.event.TextureStitchEvent;
+import net.minecraftforge.common.DimensionManager;
+import net.minecraftforge.event.entity.EntityEvent;
+import net.minecraftforge.event.entity.EntityJoinWorldEvent;
+import net.minecraftforge.event.entity.living.LivingDeathEvent;
+import net.minecraftforge.event.entity.living.LivingDropsEvent;
+import net.minecraftforge.event.entity.living.LivingHurtEvent;
+import net.minecraftforge.event.entity.player.*;
+import net.minecraftforge.event.terraingen.*;
+import net.minecraftforge.event.world.BlockEvent;
+import shift.mceconomy2.api.MCEconomyAPI;
+import shift.mceconomy2.api.event.PriceEvent;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Random;
+
+/**
+ * Createdby pluslus_Fon 2015/06/05.
+ */
+public class FBSEventHandler implements IFuelHandler{
+ public static IIcon SpellTexture;
+
+ private Random rand=new Random();
+ private long lastTime=-1;
+
+ public FBSEventHandler(){}
+
+ @SubscribeEvent
+ public void onInitNoiseGensEvent(InitNoiseGensEvent event) {
+
+ }
+
+ /*IExtendedEntityPropertiesを登録する処理を呼び出す*/
+ @SubscribeEvent
+ public void onEntityConstructing(EntityEvent.EntityConstructing event) {
+ if (event.entity instanceof EntityPlayer) {
+ FBSEntityProperties.register((EntityPlayer)event.entity);
+ }
+ }
+
+ @SubscribeEvent
+ /*ワールドに入った時に呼ばれるイベント。ここでIExtendedEntityPropertiesを読み込む処理を呼び出す*/
+ public void onEntityJoinWorld(EntityJoinWorldEvent event) {
+ if (event.world.isRemote && event.entity instanceof EntityPlayer) {
+ EntityPlayer player = (EntityPlayer)event.entity;
+ PacketHandler.INSTANCE.sendToServer(new MessagePlayerJoinInAnnouncement(player));
+ }
+ else{
+ Entity e=event.entity;
+
+ //火矢
+ if(e.ticksExisted==0 && e instanceof EntityArrow){
+ EntityArrow arrow=(EntityArrow)e;
+
+ //まだ火がついていないもののみ
+ if(!arrow.isBurning()){
+ int x=MathHelper.floor_double(arrow.posX);
+ int y=MathHelper.floor_double(arrow.posY);
+ int z=MathHelper.floor_double(arrow.posZ);
+
+ int r=2;
+
+ for(int i=x-r;i<=x+r;i++){
+ for(int j=y-r;j<=y+r;j++){
+ for(int k=z-r;k<=z+r;k++){
+ Block b=event.world.getBlock(i,j,k);
+ if(b instanceof BlockBonfire){
+ if(event.world.getBlockMetadata(i,j,k)>0){
+ arrow.setFire(100);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ }
+
+ @SubscribeEvent
+ //Dimension移動時や、リスポーン時に呼ばれるイベント。古いインスタンスと新しいインスタンスの両方を参照できる。
+ public void onClonePlayer(net.minecraftforge.event.entity.player.PlayerEvent.Clone event) {
+ //死亡時に呼ばれてるかどうか
+ if (event.wasDeath) {
+ FBSEntityProperties oldEntityProperties = (FBSEntityProperties)event.original.getExtendedProperties(FBSEntityProperties.EXT_PROP_NAME);
+ FBSEntityProperties newEntityProperties = (FBSEntityProperties)event.entityPlayer.getExtendedProperties(FBSEntityProperties.EXT_PROP_NAME);
+
+ NBTTagCompound playerData = new NBTTagCompound();
+
+ //SAN値の回復
+ //もしも回復基準値より小さければその分まで回復する
+ int t=(int)((float)FBS.sanityRecoveryRatio/100.f*oldEntityProperties.getMaxSanity());
+ if(t>oldEntityProperties.getSanity()) oldEntityProperties.setSanity(t);
+ if(oldEntityProperties.getSanity()<5) oldEntityProperties.setSanity(5);
+ oldEntityProperties.saveNBTData(playerData);
+
+ //データの書き込み
+ newEntityProperties.loadNBTData(playerData);
+
+ //ついでにバインド
+ oldEntityProperties.copyFromBindInventory(event.entityPlayer);
+ }
+ }
+
+ @SubscribeEvent
+ /*リスポーン時に呼ばれるイベント。Serverとの同期を取る*/
+ public void respawnEvent(PlayerEvent.PlayerRespawnEvent event) {
+ if (!event.player.worldObj.isRemote) {
+ PacketHandler.INSTANCE.sendTo(new MessagePlayerProperties(event.player), (EntityPlayerMP)event.player);
+ }
+ }
+
+ @SubscribeEvent
+ public void onDecorateChunckEvent(DecorateBiomeEvent.Pre event) {
+ WorldGenHerbs wgh;
+ WorldGenMushroom wgm;
+ WorldGenGrass wgg;
+
+ //地表と地下で分ける
+
+ //-----------------------------------------地表---------------------------------------------
+ wgg=new WorldGenGrass();
+ for(int i=0;i<2;i++){
+ int x = event.chunkX + event.rand.nextInt(16) + 8;
+ int z = event.chunkZ + event.rand.nextInt(16) + 8;
+ int h = event.world.getHeightValue(x, z);
+ int y = h + event.rand.nextInt(16) - event.rand.nextInt(16);
+ wgg.generate(event.world, event.rand, x, y, z);
+ }
+
+ if (event.rand.nextFloat() < 0.75f || event.world.provider.dimensionId == FBS.dimensionCrackId) {
+ wgh = new WorldGenHerbs(true);
+ for (int i = 0; i < 1; i++) {
+ int x = event.chunkX + event.rand.nextInt(16) + 8;
+ int z = event.chunkZ + event.rand.nextInt(16) + 8;
+ int h = event.world.getHeightValue(x, z);
+ int y = h + event.rand.nextInt(16) - event.rand.nextInt(16);
+ wgh.generate(event.world, event.rand, x, y, z);
+ }
+ }
+
+ wgm = new WorldGenMushroom(true);
+ for (int i = 0; i < 1; i++) {
+ int x = event.chunkX + event.rand.nextInt(16) + 8;
+ int z = event.chunkZ + event.rand.nextInt(16) + 8;
+ int h = event.world.getHeightValue(x, z);
+ int y = h + event.rand.nextInt(16) - event.rand.nextInt(16);
+ wgm.generate(event.world, event.rand, x, y, z);
+ }
+
+ //----------------------------------地下-----------------------------------------
+ wgh = new WorldGenHerbs(false);
+ for (int i = 0; i < 3; i++) {
+ int x = event.chunkX + event.rand.nextInt(16) + 8;
+ int z = event.chunkZ + event.rand.nextInt(16) + 8;
+ int y = 1 + event.rand.nextInt(Math.max(event.world.getHeightValue(x, z) - 16, 2));
+ if (event.world.provider.dimensionId == -1) y = 5 + event.rand.nextInt(100);
+ if (event.world.provider.dimensionId == 1) y = 35 + event.rand.nextInt(40);
+ wgh.generate(event.world, event.rand, x, y, z);
+ }
+
+ wgm = new WorldGenMushroom(false);
+ for (int i = 0; i < 3; i++) {
+ int x = event.chunkX + event.rand.nextInt(16) + 8;
+ int z = event.chunkZ + event.rand.nextInt(16) + 8;
+ int y = 1 + event.rand.nextInt(Math.max(event.world.getHeightValue(x, z) - 16, 2));
+ if (event.world.provider.dimensionId == -1) y = 5 + event.rand.nextInt(100);
+ if (event.world.provider.dimensionId == 1) y = 35 + event.rand.nextInt(40);
+ wgm.generate(event.world, event.rand, x, y, z);
+ }
+ }
+
+ @SubscribeEvent
+ public void onPopulateChunkEvent(PopulateChunkEvent.Pre event) {
+ }
+
+ // generateStructuresInChunk相当
+ // 完全にチャンクの要素が決定された後のタイミングならこちら
+ // ここで生成するなら要塞等を潰さないように注意
+ @SubscribeEvent
+ public void onPopulateChunkEvent(PopulateChunkEvent.Post event) {
+ int dId=event.world.provider.dimensionId;
+ if(dId==0 || dId==FBS.dimensionAutumnId){
+ MapGenSealdLib genSealedLib=new MapGenSealdLib();
+
+ genSealedLib.func_151539_a(event.chunkProvider, event.world, event.chunkX, event.chunkZ, null);
+ genSealedLib.generateStructuresInChunk(event.world, event.rand, event.chunkX, event.chunkZ);
+
+ MapGenStudy genStudy=new MapGenStudy();
+ genStudy.func_151539_a(event.chunkProvider, event.world, event.chunkX, event.chunkZ, null);
+ genStudy.generateStructuresInChunk(event.world, event.rand, event.chunkX, event.chunkZ);
+
+ //event.world.getChunkFromBlockCoords(event.chunkX, event.chunkZ).func_150802_k();
+ }
+
+ //Endのクソッタレだけ特別にここでハーブの生成処理
+ if(dId==1){
+ WorldGenHerbs wgh=new WorldGenHerbs(false);
+ for(int i=0;i<1;i++){
+ int x = event.chunkX*16 + event.rand.nextInt(16) + 8;
+ int z = event.chunkZ*16 + event.rand.nextInt(16) + 8;
+ int y=1+event.rand.nextInt(Math.max(event.world.getHeightValue(x, z)-16, 2));
+ if(event.world.provider.dimensionId==1) y=40+event.rand.nextInt(40);
+ wgh.generate(event.world, event.rand, x, y, z);
+ }
+ }
+ }
+
+ @SideOnly(Side.CLIENT)
+ @SubscribeEvent
+ public int onPlayerUseItemTickEvent(PlayerUseItemEvent.Tick event){
+ if(event.item.getItemUseAction()== FBS.actionSpell && event.duration%3==0){
+ if(FBS.proxy.getClientWorld()!=null && event.entityPlayer.worldObj.isRemote){
+ EntityPlayer ep=event.entityPlayer;
+ //魔法陣がある場合、いいかんじにエフェクト
+ boolean hasCircle=false;
+ int px=MathHelper.floor_double(ep.posX);
+ int py=MathHelper.floor_double(ep.posY)-1;
+ int pz=MathHelper.floor_double(ep.posZ);
+
+ TileEntity te=ep.worldObj.getTileEntity(px,py,pz);
+ if(te instanceof TileEntityMagicCore){
+ TileEntityMagicCore mc=(TileEntityMagicCore)te;
+ Registry.MagicData md=Registry.GetMagicDataFromItemStack(event.item);
+ if(md!=null && mc.getCircleName().equals(md.title)){
+ hasCircle=true;
+
+ EntitySpellCircleFX fx=new EntitySpellCircleFX(ep.getEntityWorld(), px+0.5f, py+0.25f*rand.nextFloat(), pz+0.5f, 1+Math.min(rand.nextFloat(), 0.85f)*mc.getCircleRadius(), (float)(2*rand.nextFloat()*Math.PI-Math.PI));
+ fx.setParticleIcon(SpellTexture);
+ FMLClientHandler.instance().getClient().effectRenderer.addEffect(fx);
+ }
+ }
+
+ if(!hasCircle){
+ //通常の詠唱エフェクト
+ double motionX = rand.nextDouble()*(double) (-MathHelper.sin(ep.rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(ep.rotationPitch / 180.0F * (float) Math.PI));
+ double motionZ = rand.nextDouble()*(double) (MathHelper.cos(ep.rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(ep.rotationPitch / 180.0F * (float) Math.PI));
+ double motionY = rand.nextDouble()*(double) (-MathHelper.sin(ep.rotationPitch / 180.0F * (float) Math.PI));
+
+ double x=1.5*(rand.nextDouble()-rand.nextDouble());
+ double y=1.5*(rand.nextDouble()-rand.nextDouble());
+ double z=1.5*(rand.nextDouble()-rand.nextDouble());
+
+ EntitySpellFX fx=new EntitySpellFX(ep.getEntityWorld(), ep.posX+motionX, ep.posY+ep.getEyeHeight()+motionY, ep.posZ+motionZ, motionX+x,motionY+y,motionZ+z);
+ fx.setParticleIcon(SpellTexture);
+ FMLClientHandler.instance().getClient().effectRenderer.addEffect(fx);
+ }
+ }
+ }
+ return 0;
+ }
+
+ public static boolean foodLocked=false;
+ @SubscribeEvent
+ public void onPlayerEatenItemEvent(PlayerUseItemEvent.Finish event){
+ if(event.entityPlayer.worldObj.isRemote) return;
+
+ Registry.ItemSanity s=Registry.GetItemSanity(event.item);
+ if(s!=null){
+ s.sanity(event.entityPlayer);
+ }
+
+ if(!foodLocked && event.item!=null && event.item.getItem() instanceof ItemFood){
+ int x=MathHelper.floor_double(event.entityPlayer.posX);
+ int y=MathHelper.floor_double(event.entityPlayer.posY);
+ int z=MathHelper.floor_double(event.entityPlayer.posZ);
+
+ int r=2;
+
+ for(int i=x-r;i<=x+r;i++){
+ for(int j=y-r;j<=y+r;j++){
+ for(int k=z-r;k<=z+r;k++){
+ Block b=event.entityPlayer.worldObj.getBlock(i, j, k);
+ if(b instanceof BlockBonfire){
+ if(event.entityPlayer.worldObj.getBlockMetadata(i,j,k)>0){
+ foodLocked=true;
+
+ //食べ物を焚き火の近くにいるプレイヤー全てに与える
+ AxisAlignedBB aabb= AxisAlignedBB.getBoundingBox(i-r, j-r, k-r, i+r+1, j+r+1, k+r+1);
+ List players=event.entityPlayer.worldObj.getEntitiesWithinAABB(EntityPlayer.class, aabb);
+ Iterator it=players.iterator();
+ while(it.hasNext()){
+ EntityPlayer ep=(EntityPlayer)it.next();
+ if(ep.equals(event.entityPlayer)) continue;
+
+ //食べ物渡す
+ ItemStack cpy=event.item.copy();
+ cpy.onFoodEaten(event.entityPlayer.worldObj, ep);
+
+ //メッセージ残す
+ String str=String.format(StatCollector.translateToLocal("info.fbs.food.shearing"), event.entityPlayer.getCommandSenderName(), cpy.getDisplayName());
+ ep.addChatComponentMessage(new ChatComponentText(str));
+ }
+
+ foodLocked=false;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ @SubscribeEvent
+ public void onLivingHurtEvent(LivingHurtEvent event) {
+ if (event.isCanceled()) return;
+
+ if (event.entityLiving instanceof EntityPlayer) {
+ EntityPlayer ep = (EntityPlayer) event.entityLiving;
+ Entity ee = event.source.getEntity();
+
+
+ //------------------------インフィニティ!------------------------
+ boolean isInfinity = true;
+ for (int i = 0; i < 4; i++) {
+ ItemStack armor = ep.inventory.armorItemInSlot(i);
+ if (armor == null || !(armor.getItem() instanceof ItemArmorInfinity)) {
+ isInfinity=false;
+ break;
+ }
+ }
+ if(isInfinity){
+ for(int i=0;i<4;i++){
+ ep.inventory.armorItemInSlot(i).damageItem(1, ep);
+ }
+ event.setCanceled(true);
+ return;
+ }
+
+
+ //------------------------契約によるダメージ無効------------------------
+ if (ep.isPotionActive(Registry.potionContract) && event.ammount >= ep.getHealth()) {
+ //契約
+ PotionEffect pe = ep.getActivePotionEffect(Registry.potionContract);
+ ep.heal(ep.getMaxHealth());
+ ep.removePotionEffect(Registry.potionContract.getId());
+ event.setCanceled(true);
+ return;
+ }
+
+ //------------------------攻撃によるSAN値減少------------------------
+ if (ee != null) {
+ Registry.MobSanity ms = Registry.GetMobSanity(ee);
+ if (ms != null) {
+ ms.sanity(ep);
+ }
+ }
+
+ //---------------------------壺の破壊------------------------------------
+ String type=event.source.getDamageType();
+ if(type.equals("fall") || type.equals("mob") || type.equals("explosion.player") || type.equals("explosion") || type.equals("player")){
+ int iSize=ep.inventory.getSizeInventory();
+ for(int i=0;i<iSize;i++){
+ ItemStack itemStack=ep.inventory.getStackInSlot(i);
+ if(itemStack!=null && itemStack.getItem() instanceof ItemBlockPottery){
+ IPottery ip=(IPottery)((ItemBlockPottery) itemStack.getItem()).field_150939_a;
+
+ float prob=ip.getCrashProbability(itemStack);
+ if(prob>0 && (event.source.getDamageType().equals("fall") || rand.nextFloat()<prob)){
+ String t=StatCollector.translateToLocal("info.pottery.crash");
+ ep.addChatComponentMessage(new ChatComponentText(String.format(t, itemStack.getDisplayName())));
+
+ //魔法の壺の効果
+ if(ip.hasEffect(itemStack.getTagCompound()) && ip.getState(itemStack.getTagCompound())== IPottery.PotteryState.BAKED){
+ int id= ItemBlockPottery.getId(itemStack);
+ PotteryRegistry.getPotteryEffect(id).onCrash(ep, itemStack);
+ }
+ ep.worldObj.playSoundAtEntity(ep, "dig.glass", 0.8F, 0.8F + ep.worldObj.rand.nextFloat() * 0.4F);
+ ep.inventory.setInventorySlotContents(i, null);
+ }
+ }
+ }
+ }
+
+
+ }
+ }
+
+ @SubscribeEvent
+ public void onLivingDeathEvent(LivingDeathEvent event){
+ EntityLivingBase e=event.entityLiving;
+
+ //魔力の秋で死亡した場合、蝶になる
+ if(e!=null && !e.worldObj.isRemote){
+ int x=MathHelper.floor_double(e.posX);
+ int z=MathHelper.floor_double(e.posZ);
+
+ BiomeGenBase bgb=e.worldObj.getBiomeGenForCoords(x, z);
+ if(bgb instanceof BiomeAutumn){
+ EntityButterfly eb=new EntityButterfly(e.worldObj, (float)e.posX, (float)e.posY+1, (float)e.posZ);
+ e.worldObj.spawnEntityInWorld(eb);
+ }
+ }
+
+ //ラッキーフィニッシュ
+ if(!e.worldObj.isRemote && MCEconomyAPI.ShopManager.hasEntityPurchase(e)){
+ EntityPlayer player=null;
+ if(event.source.getSourceOfDamage() instanceof EntityPlayer){
+ player=(EntityPlayer)event.source.getSourceOfDamage();
+ }
+ else if(event.source.getEntity() instanceof EntityPlayer){
+ player=(EntityPlayer)event.source.getEntity();
+ }
+
+ if(player!=null){
+ int luckyType=0;
+ int mp=MCEconomyAPI.ShopManager.getEntityPurchase(e);
+ int r, randMax=10000;
+
+ //ここでラッキーフィニッシュの効果
+ ItemStack spirit=SpiritManager.findSpiritTool(player);
+ if(spirit!=null){
+ int lucky=SpiritStatus.readFromNBT(spirit.getTagCompound()).getSkillLevel("fbs.lucky")+1;
+ if(lucky>0){
+ randMax-=200*lucky;
+ }
+ }
+
+ //エンチャント効果
+ int eSum= EnchantmentWealth.getSum(player);
+ if(eSum>0) randMax-=200*eSum;
+
+ //ラッキーフィニッシュ判定
+ r=rand.nextInt(randMax);
+ if(r<5) luckyType=3;
+ else if(r<80+5) luckyType=2;
+ else if(r<800+80+5) luckyType=1;
+
+ switch (luckyType){
+ case 1: mp*=5; player.addChatComponentMessage(new ChatComponentText("Lucky Finish!")); break;
+ case 2: mp*=100; player.addChatComponentMessage(new ChatComponentText("Big Lucky Finish!")); break;
+ case 3: mp*=2000; player.addChatComponentMessage(new ChatComponentText("Huge Lucky Finish!")); player.triggerAchievement(AchievementRegistry.lucky); break;
+ default: break;
+ }
+ if(luckyType>0) MCEconomyAPI.addPlayerMP(player, mp, false);
+ }
+ }
+
+ //ソウルバインド
+ if(e instanceof EntityPlayer) {
+ EntityPlayer ep = (EntityPlayer) e;
+ int index=SpiritManager.findSpiritToolIndex(ep);
+
+ if(index!=-1){
+ FBSEntityProperties prop = FBSEntityProperties.get(ep);
+ SpiritStatus status=SpiritStatus.readFromNBT(ep.inventory.getStackInSlot(index).getTagCompound());
+
+ //ここでソウルバインドの効果発動
+ if(status.hasSkill("fbs.soulBind")){
+ prop.bindPlayerInventory(ep, false);
+ for(int i=0;i<ep.inventory.getSizeInventory();i++){
+ ep.inventory.setInventorySlotContents(i, null);
+ }
+ }
+ else{
+ prop.bindPlayerInventory(ep, true);
+ ep.inventory.setInventorySlotContents(index, null);
+ }
+ }
+ }
+ }
+
+ @SubscribeEvent
+ public void onPlayerTickEvent(TickEvent.PlayerTickEvent event){
+ if(event.phase==TickEvent.Phase.START && !event.player.worldObj.isRemote){
+ EntityPlayer ep=event.player;
+
+ //------------------------------------
+ boolean fullInfinity=false;
+ for(int i=0;i<4;i++){
+ ItemStack armor=ep.inventory.armorItemInSlot(i);
+ if(armor==null || armor.getItem() instanceof ItemArmorInfinity){
+ fullInfinity=false;
+ break;
+ }
+ }
+ if(fullInfinity){
+ ep.triggerAchievement(AchievementRegistry.infinity);
+ }
+
+
+ if(!event.player.capabilities.isCreativeMode){
+ FBSEntityProperties prop=FBSEntityProperties.get(ep);
+ int san=prop.getSanity();
+
+ //----------------------------------不定の狂気--------------------------------------------------
+ float rate=(float)san/prop.getMaxSanity();
+ boolean flag=false;
+
+ if(san<40){
+ float rate1=(float)san/99;
+ if(rand.nextFloat()<0.0004f-0.00032f*rate1){
+ flag=true;
+ }
+ }
+ else if(rate<0.5f){
+ if(rand.nextFloat()<0.0004f-0.00032f*rate){
+ flag=true;
+ }
+ }
+
+ if(flag){
+ ep.addChatComponentMessage(new ChatComponentTranslation("info.fbs.san.3"));
+
+ ep.addPotionEffect(new PotionEffect(Potion.confusion.getId(), 20 * 15, 2));
+ ep.addPotionEffect(new PotionEffect(Potion.hunger.getId(), 20*15, 1));
+ }
+
+
+ //---------------------------------バイオームによるSAN値喪失------------------------------------------------
+ BiomeGenBase bgb=ep.worldObj.getBiomeGenForCoords(MathHelper.floor_double(ep.posX), MathHelper.floor_double(ep.posZ));
+ //ヴィンテールクロークを装備しているか
+ boolean flag1=false;
+ ItemStack armor = ep.getCurrentArmor(2);
+ if (armor == null || armor.getItem() instanceof ItemCloak) flag1=true;
+
+ if(bgb==Registry.biomeAutumn) {
+ //ついでに実績
+ ep.triggerAchievement(AchievementRegistry.autumn);
+
+ if (ep.worldObj.rand.nextInt(flag1?250:50)==1) {
+ SanityManager.loseSanity(ep, 1, 2, true);
+ ep.inventory.markDirty();
+ }
+ }
+ else if(bgb==Registry.biomeCrack) {
+ if (ep.worldObj.rand.nextInt(flag1?250:38)==1) {
+ SanityManager.loseSanity(ep, 1, 2, true);
+ ep.inventory.markDirty();
+ }
+ }
+
+ //-------------------------------------吸血-------------------------------------------------------
+ if(ep.worldObj.getWorldTime()%100==0){
+ ItemStack current=ep.getCurrentEquippedItem();
+ if(current!=null && current.getItem() instanceof ISpiritTool){
+ SpiritStatus ss=SpiritStatus.readFromNBT(current.getTagCompound());
+ if(ss!=null && ss.getSkillLevel("fbs.blood")>=0 && rand.nextInt(4096)==0){
+ ep.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("spirit.demerit.fbs.blood")));
+ ep.addPotionEffect(new PotionEffect(Potion.wither.getId(), 20*5, 0));
+ }
+ }
+ }
+ }
+
+ //---------------------------------狭間からの脱出------------------------------------------------
+ if(ep.dimension==FBS.dimensionCrackId && ep.posY<0){
+ World w= DimensionManager.getWorld(0);
+ ChunkCoordinates cc=w.getSpawnPoint();
+
+ cc.posX+=(rand.nextBoolean()?1:-1)*rand.nextInt(800);
+ cc.posZ+=(rand.nextBoolean()?1:-1)*rand.nextInt(800);
+ Chunk c=w.getChunkProvider().provideChunk(cc.posX/16, cc.posZ/16);
+ if(c==null) FBS.logger.info("chunk is null");
+ else{
+ int cx=cc.posX%16;
+ int cz=cc.posZ%16;
+ if(cx<0) cx+=16;
+ if(cz<0) cz+=16;
+
+ cc.posY=c.getHeightValue(cx, cz)+3;
+ //cc.posY=w.getHeightValue(cc.posX, cc.posZ);
+ }
+
+ EntityPlayerMP entityPlayerMP = (EntityPlayerMP) ep;
+ ServerConfigurationManager serverConfigurationManager = entityPlayerMP.mcServer.getConfigurationManager();
+ WorldServer worldServer = entityPlayerMP.mcServer.worldServerForDimension(0);
+
+ serverConfigurationManager.transferPlayerToDimension(entityPlayerMP, 0, new TeleporterWarp(worldServer));
+ ep.setPositionAndUpdate(cc.posX + 0.5, cc.posY + 1, cc.posZ+0.5);
+ ep.fallDistance=0;
+ }
+
+
+ }
+ }
+
+ @SubscribeEvent
+ public int onPlayerDestroyItemEvent(PlayerDestroyItemEvent event){
+ if(event.original == null) return 0;
+
+ if(event.original.getItem() instanceof ItemStaff){
+ ItemStack[] items=ItemStaff.loadInventory(event.original);
+ for(ItemStack i : items){
+ if(!event.entityPlayer.inventory.addItemStackToInventory(i)){
+ event.entityPlayer.entityDropItem(i, event.entityPlayer.getEyeHeight());
+ }
+ }
+ }
+ return 0;
+ }
+
+ @SubscribeEvent
+ public void onWorldTickEvent(TickEvent.WorldTickEvent event) {
+ float f = FBS.proxy.getRenderPartialTicks();
+ FBS.proxy.updateTimer();
+ FBS.proxy.setRenderPartialTicks(f);
+
+ //---------------------------------時報ボイスと空腹------------------------------------------------
+ long time = event.world.getWorldTime()%24000;
+ if (time!=lastTime && (time == 0 || time == 6000 || time == 15000)) {
+ Iterator it=event.world.playerEntities.iterator();
+ while(it.hasNext()){
+ EntityPlayer ep=(EntityPlayer)it.next();
+ if (ep != null) {
+ ItemStack spiritStack = SpiritManager.findSpiritTool(ep);
+ if (spiritStack != null) {
+ SpiritStatus status = SpiritStatus.readFromNBT(spiritStack.getTagCompound());
+
+ //空腹にする
+ boolean hunger=false;
+ /*
+ int food=status.getFoodLevel();
+ status.setFoodLevel(food-25);
+ if(food/25!=status.getFoodLevel()/25){
+ food=status.getFoodLevel();
+ if(food<50){
+ hunger=true;
+ SpiritManager.talk(ep, status.getCharacter(), "hunger", spiritStack);
+ }
+ }
+ */
+
+ //空腹でないなら時報ボイス
+ if(!hunger){
+ if (time == 0) SpiritManager.talk(ep, status.getCharacter(), "morning", spiritStack);
+ if (time == 6000) SpiritManager.talk(ep, status.getCharacter(), "noon", spiritStack);
+ if (time == 15000) SpiritManager.talk(ep, status.getCharacter(), "night", spiritStack);
+ }
+ }
+ }
+ }
+ }
+ //if(lastTime!=time) FBS.logger.info("time:"+time);
+ lastTime=time;
+ }
+
+
+ @SubscribeEvent
+ @SideOnly(Side.CLIENT)
+ public void onStitchTexture(TextureStitchEvent.Pre e){
+ //FMLLog.severe("called registering");
+ if(e.map.getTextureType()==0) {
+ BlockCore.mana.setIcons(e.map.registerIcon(FBS.MODID + ":fluidMana_still"));
+
+ //-----------------------魔法陣のテクスチャ----------------------------------------------------------
+ RenderMagicCircle.RegisterMagicCircleIcon("fbs.copy", e.map, FBS.MODID + ":circleCopy");
+ RenderMagicCircle.RegisterMagicCircleIcon("fbs.summonVillager", e.map, FBS.MODID + ":circleVillager");
+ RenderMagicCircle.RegisterMagicCircleIcon("fbs.harvest", e.map, FBS.MODID + ":circleHarvest");
+ RenderMagicCircle.RegisterMagicCircleIcon("fbs.barrier", e.map, FBS.MODID + ":circleBarrier");
+ RenderMagicCircle.RegisterMagicCircleIcon("fbs.warp", e.map, FBS.MODID + ":circleWarp");
+ RenderMagicCircle.RegisterMagicCircleIcon("fbs.contract", e.map, FBS.MODID + ":circleContract");
+ RenderMagicCircle.RegisterMagicCircleIcon("fbs.timeTrace", e.map, FBS.MODID + ":circleTimeTrace");
+ }
+ if(e.map.getTextureType()==1){
+ SpellTexture=e.map.registerIcon(FBS.MODID+":spelling");
+ }
+ }
+
+ @SubscribeEvent
+ public void onAttackEntity(AttackEntityEvent e){
+ EntityPlayer player=e.entityPlayer;
+ ItemStack itemStack=player.getCurrentEquippedItem();
+
+ //刃薬の処理
+ if(e.target instanceof EntityLivingBase && itemStack!=null){
+ if(itemStack.getItem() instanceof ItemSword){
+ ArrayList<CharacteristicBase> cbs= RecipeBladeSpice.getCharacteristics(itemStack);
+ for(CharacteristicBase cb : cbs){
+ cb.affectEntity(player.worldObj, (EntityLivingBase)e.target);
+ }
+
+ RecipeBladeSpice.consumeBladeSpiceAmount(itemStack);
+ }
+ }
+ }
+
+ @SubscribeEvent
+ public void onSpiritAttackEntity(AttackEntityEvent e){
+ EntityPlayer player=e.entityPlayer;
+ ItemStack itemStack=player.getCurrentEquippedItem();
+ if(itemStack!=null && itemStack.getItem() instanceof ISpiritTool){
+ /*
+ 精霊武器用に攻撃時の処理を作る。
+ */
+ ISpiritTool sp=(ISpiritTool)itemStack.getItem();
+ SpiritStatus status=SpiritStatus.readFromNBT(itemStack.getTagCompound());
+ Entity entity=e.target;
+
+ if (entity.canAttackWithItem()) {
+ if (!entity.hitByEntity(player)) {
+ float damage = sp.calcDamage(status);
+ int knockback = 0;
+ float additionalDamage = 0.0F;
+
+ if (entity instanceof EntityLivingBase) {
+ //ここでノックバックスキルの効果適用
+ knockback+=status.getSkillLevel("fbs.knockback")+1;
+
+ //ここで特効系
+ int lv=0;
+ switch (((EntityLivingBase) entity).getCreatureAttribute()){
+ case UNDEAD: lv=status.getSkillLevel("fbs,smite")+1; break;
+ case ARTHROPOD: lv=status.getSkillLevel("fbs.arthropods")+1; break;
+ }
+ if(lv>0){
+ additionalDamage+=1.5f*lv;
+ }
+ }
+
+ if (player.isSprinting()) {
+ ++knockback;
+ }
+
+ if (damage > 0.0F || additionalDamage > 0.0F) {
+ //クリティカル判定
+ boolean isCritical = player.fallDistance > 0.0F && !player.onGround && !player.isOnLadder() && !player.isInWater() && !player.isPotionActive(Potion.blindness) && player.ridingEntity == null && entity instanceof EntityLivingBase;
+ if(!isCritical){
+ //ここでクリティカルの効果適用
+ int criLv=status.getSkillLevel("fbs.critical")+1;
+ if(criLv>0){
+ isCritical=rand.nextFloat()<0.1f+0.05f*criLv;
+ }
+ }
+ if (isCritical && damage > 0.0F) {
+ damage *= 1.5F;
+ }
+
+ damage += additionalDamage;
+
+ //ここで炎の刃の効果適用
+ boolean flag1 = false;
+ int fire = status.getSkillLevel("fbs.fire")+1;
+ if (entity instanceof EntityLivingBase && fire > 0 && !entity.isBurning()) {
+ flag1 = true;
+ entity.setFire(1); //死亡時の処理のためにここでいったん燃やす
+ }
+
+ //ここで毒の刃の効果適応
+ if(entity instanceof EntityLivingBase){
+ int poison=status.getSkillLevel("fbs.poison")+1;
+ if(poison>0){
+ ((EntityLivingBase) entity).addPotionEffect(new PotionEffect(Potion.poison.getId(), 20*3*poison));
+ }
+ }
+
+ //ここで英雄効果
+ int hero=status.getSkillLevel("fbs.hero")+1;
+ if(hero>0){
+ List mobs=player.worldObj.getEntitiesWithinAABB(IMob.class, AxisAlignedBB.getBoundingBox(player.posX, player.posY, player.posZ, player.posX, player.posY, player.posZ).expand(5,5,5));
+ float ext=1.0f+hero*mobs.size()/20.f;
+ damage*=Math.min(ext, 2.0f);
+ }
+
+ //首狩り
+ if(entity instanceof EntityLivingBase){
+ int headhunt=status.getSkillLevel("fbs.headhunt")+1;
+ if(headhunt>0 && rand.nextFloat()<0.05f+0.03f*headhunt){
+ damage=((EntityLivingBase) entity).getMaxHealth()+1;
+ }
+ }
+
+ boolean damaged = entity.attackEntityFrom(DamageSource.causePlayerDamage(player), damage);
+ if (damaged) {
+ //ここで吸血の刃の効果適応
+ int vampire=status.getSkillLevel("fbs.vampire")+1;
+ if(vampire>0){
+ player.heal(0.5f*(1+MathHelper.floor_float((0.25f+0.05f*vampire)*damage/0.5f)));
+ }
+
+ if (knockback > 0) {
+ entity.addVelocity((double) (-MathHelper.sin(player.rotationYaw * (float) Math.PI / 180.0F) * (float) knockback * 0.5F), 0.1D, (double) (MathHelper.cos(player.rotationYaw * (float) Math.PI / 180.0F) * (float) knockback * 0.5F));
+ player.motionX *= 0.6D;
+ player.motionZ *= 0.6D;
+ player.setSprinting(false);
+ }
+
+ if (isCritical) {
+ player.onCriticalHit(entity);
+ }
+
+ if (additionalDamage > 0.0F) {
+ player.onEnchantmentCritical(entity);
+ }
+
+ //オーバーキル取得
+ if (damage >= 18.0F) {
+ player.triggerAchievement(AchievementList.overkill);
+ }
+
+ player.setLastAttacker(entity);
+
+ if (entity instanceof EntityLivingBase) {
+ EnchantmentHelper.func_151384_a((EntityLivingBase) entity, player);
+ }
+
+ EnchantmentHelper.func_151385_b(player, entity);
+ Object object = entity;
+
+ if (entity instanceof EntityDragonPart) {
+ IEntityMultiPart ientitymultipart = ((EntityDragonPart) entity).entityDragonObj;
+
+ if (ientitymultipart != null && ientitymultipart instanceof EntityLivingBase) {
+ object = (EntityLivingBase) ientitymultipart;
+ }
+ }
+
+ //ここで契約の効果発動
+ int cont=status.getSkillLevel("fbs.contract")+1;
+ if(cont>0 && rand.nextFloat()<0.10f+0.05f*cont){
+ player.addPotionEffect(new PotionEffect(Registry.potionContract.getId(), 20*10, 0));
+ }
+
+ if (itemStack != null && object instanceof EntityLivingBase) {
+ itemStack.hitEntity((EntityLivingBase) object, player);
+ }
+
+ if (entity instanceof EntityLivingBase) {
+ //実績関係
+ player.addStat(StatList.damageDealtStat, Math.round(damage * 10.0F));
+
+ //ここでちゃんと燃やす
+ if (fire > 0) {
+ entity.setFire(fire * 4);
+ }
+ }
+
+ player.addExhaustion(0.3F);
+ } else if (flag1) {
+ //鎮火処理?
+ entity.extinguish();
+ }
+ }
+ }
+ }
+
+
+
+ e.setCanceled(true);
+ }
+ }
+
+ @SubscribeEvent
+ public void onPlayerSleepInBed(PlayerSleepInBedEvent event){
+ if(!event.entityPlayer.worldObj.isRemote){
+ ItemStack item=SpiritManager.findSpiritTool(event.entityPlayer);
+ if(item!=null){
+ SpiritStatus ss=SpiritStatus.readFromNBT(item.getTagCompound());
+ SpiritManager.talk(event.entityPlayer, ss.getCharacter(), "sleep", item);
+ }
+ }
+ }
+
+ @SubscribeEvent
+ public void onPlayerUseMagicPre(PlayerUseMagicEvent.Pre e){
+ String title=e.magic.magicData.title;
+
+ if(!e.entityPlayer.worldObj.isRemote && title.equals("fbs.harvest")){
+ e.entityPlayer.triggerAchievement(AchievementRegistry.harvest);
+ }
+
+ if(title.equals("fbs.copy")){
+ int x=MathHelper.floor_double(e.entityPlayer.posX);
+ int y=MathHelper.floor_double(e.entityPlayer.posY);
+ int z=MathHelper.floor_double(e.entityPlayer.posZ);
+ e.entityPlayer.openGui(FBS.instance, FBS.GUI_MAGIC_COPY_ID, e.entityPlayer.worldObj, x,y,z);
+ e.setCanceled(true);
+ }
+ else if(title.equals("fbs.warp")){
+ int x=MathHelper.floor_double(e.entityPlayer.posX);
+ int y=MathHelper.floor_double(e.entityPlayer.posY);
+ int z=MathHelper.floor_double(e.entityPlayer.posZ);
+
+ //現在地を移動先リストへ追加
+ SanityManager.addDestination(e.entityPlayer, e.entityPlayer.worldObj.provider.dimensionId, x,y,z);
+
+ //魔術レベル一定以上で狭間追加
+ if(e.entityPlayer.capabilities.isCreativeMode || FBSEntityPropertiesAPI.GetMagicLevelRaw(e.entityPlayer)>=25) {
+ SanityManager.addDestination(e.entityPlayer, FBS.dimensionCrackId, -1, -1, -1);
+ }
+
+ if(!e.entityPlayer.worldObj.isRemote) e.entityPlayer.triggerAchievement(AchievementRegistry.warp);
+ e.entityPlayer.openGui(FBS.instance, FBS.GUI_MAGIC_WARP_ID, e.entityPlayer.worldObj, x,y,z);
+ e.setCanceled(true);
+ }
+ else if(title.equals("fbs.contract")){
+ int x=MathHelper.floor_double(e.entityPlayer.posX);
+ int y=MathHelper.floor_double(e.entityPlayer.posY);
+ int z=MathHelper.floor_double(e.entityPlayer.posZ);
+ e.entityPlayer.openGui(FBS.instance, FBS.GUI_MAGIC_CONTRACT_ID, e.entityPlayer.worldObj, x,y,z);
+ e.setCanceled(true);
+ }
+ else if(title.equals("fbs.timeTrace") && e.magic.checkMagicCircle("fbs.timeTrace")) {
+ int x = MathHelper.floor_double(e.entityPlayer.posX);
+ int y = MathHelper.floor_double(e.entityPlayer.posY);
+ int z = MathHelper.floor_double(e.entityPlayer.posZ);
+ e.entityPlayer.openGui(FBS.instance, FBS.GUI_MAGIC_TIME_TRACE_ID, e.entityPlayer.worldObj, x, y, z);
+ e.setCanceled(true);
+ }
+
+ //インフィニティ!
+ if(!e.isCanceled()){
+ EntityPlayer player=e.entityPlayer;
+ for(int i=0;i<4;i++){
+ ItemStack armor=player.inventory.armorItemInSlot(i);
+ if(armor!=null && armor.getItem() instanceof ItemArmorInfinity){
+ int repair=e.magic.bookData.lv;
+ armor.setItemDamage(armor.getItemDamage()-repair);
+ }
+ }
+ }
+ }
+
+ @SubscribeEvent
+ public void generateOrePre(OreGenEvent.Pre event){
+ if(!FBS.generatesOre) return;
+
+ WorldGenerator genRuby = new WorldGenMinable(BlockCore.ore, 0, 5, Blocks.stone);
+ WorldGenerator genSapphire = new WorldGenMinable(BlockCore.ore, 1, 5, Blocks.stone);
+ WorldGenerator genAmethyst = new WorldGenMinable(BlockCore.ore, 2, 5, Blocks.stone);
+
+ if(TerrainGen.generateOre(event.world, event.rand, genRuby, event.worldX, event.worldZ, OreGenEvent.GenerateMinable.EventType.CUSTOM)) {
+ for(int i=0;i<2;i++){
+ genRuby.generate(event.world, event.rand, event.worldX + event.rand.nextInt(16), 1 + event.rand.nextInt(16), event.worldZ + event.rand.nextInt(16));
+ }
+ }
+ if(TerrainGen.generateOre(event.world, event.rand, genSapphire, event.worldX, event.worldZ, OreGenEvent.GenerateMinable.EventType.CUSTOM)) {
+ for(int i=0;i<2;i++){
+ genSapphire.generate(event.world, event.rand, event.worldX + event.rand.nextInt(16), 1 + event.rand.nextInt(16), event.worldZ + event.rand.nextInt(16));
+ }
+ }
+ if(TerrainGen.generateOre(event.world, event.rand, genAmethyst, event.worldX, event.worldZ, OreGenEvent.GenerateMinable.EventType.CUSTOM)) {
+ for(int i=0;i<2;i++){
+ genAmethyst.generate(event.world, event.rand, event.worldX + event.rand.nextInt(16), 1 + event.rand.nextInt(16), event.worldZ + event.rand.nextInt(16));
+ }
+ }
+ }
+
+ @Override
+ public int getBurnTime(ItemStack fuel) {
+ if(fuel.getItem() instanceof ItemBlock){
+ Block b=((ItemBlock) fuel.getItem()).field_150939_a;
+ if(b==BlockCore.plank) return 20*10;
+ }
+ if(fuel.getItem()==ItemCore.stick) return 20*5;
+
+ return 0;
+ }
+
+ @SubscribeEvent
+ public void onPriceEvent(PriceEvent event){
+ ItemStack item=event.getPriceItem();
+
+ //壺
+ if(item.getItem() instanceof ItemBlockPottery){
+ IPottery ip=(IPottery)((ItemBlockPottery) item.getItem()).field_150939_a;
+ int p=ip.getMP(item);
+
+ //魔法の壺補正
+ if(ip.hasEffect(item.getTagCompound()) && ip.getState(item.getTagCompound())== IPottery.PotteryState.BAKED){
+ p=MathHelper.floor_float(p*PotteryRegistry.getPotteryEffect(item.getTagCompound().getInteger(BlockPotteryBase.EFFECT_ID)).getPriceScale(item));
+ }
+ event.setNewPrice(p);
+ }
+
+ //錬金術関係
+ if(item.getItem() instanceof IAlchemyProduct){
+ float op=event.getOldPrice();
+ ArrayList<CharacteristicBase> list= AlchemyRegistry.ReadCharacteristicFromNBT(item.getTagCompound());
+ for(CharacteristicBase cb : list){
+ op*=cb.getMPScale();
+ }
+ event.setNewPrice((int)op);
+ }
+ }
+
+ @SubscribeEvent
+ public void onHarvestDrops(BlockEvent.HarvestDropsEvent event){
+
+ }
+
+ @SubscribeEvent
+ public void onItemPickUp(EntityItemPickupEvent event){
+ EntityPlayer player=event.entityPlayer;
+ EntityItem eItem=event.item;
+ ItemStack picked=eItem.getEntityItem().copy();
+ Item item=picked.getItem();
+
+ if(!player.worldObj.isRemote){
+ if(item==ItemCore.bookNoDecoded) player.triggerAchievement(AchievementRegistry.book);
+ else if(item==ItemCore.butterfly) player.triggerAchievement(AchievementRegistry.butterfly);
+ else if(item==ItemCore.alchemyMaterial && picked.getItemDamage()==40) player.triggerAchievement(AchievementRegistry.tear);
+ else if(item==ItemCore.alchemyMaterial && picked.getItemDamage()==36) player.triggerAchievement(AchievementRegistry.herbGold);
+ }
+
+
+ if(picked.getItem() instanceof IAlchemyMaterial || picked.getItem() instanceof IAlchemyProduct || AlchemyRegistry.isBasketItem(picked)){
+ //カゴを探す
+ boolean flag=false;
+ int size=player.inventory.getSizeInventory();
+ int stacksize=picked.stackSize;
+ for(int i=0;i<size && !flag;i++){
+ ItemStack is=player.inventory.getStackInSlot(i);
+ if(is==null) continue;
+ if(is.getItem()!=ItemCore.basket) continue;
+
+ //インベントリがあいてるか調べる
+ InventoryBasket ib=new InventoryBasket(player.inventory, i);
+ ib.openInventory();
+ int size2=ib.getSizeInventory();
+ for(int k=0;k<size2;k++){
+ ItemStack is2=ib.getStackInSlot(k);
+ if(is2==null){
+ ib.setInventorySlotContents(k, picked.copy());
+ flag=true;
+ }
+ else if(picked.isItemEqual(is2) && ItemStack.areItemStackTagsEqual(picked, is2) && is2.stackSize<is2.getMaxStackSize()){
+ int t=is2.getMaxStackSize()-is2.stackSize;
+ is2.stackSize+=Math.min(t, picked.stackSize);
+ picked.stackSize-=t;
+ if(picked.stackSize<=0){
+ flag=true;
+ }
+ }
+ if(flag){
+ break;
+ }
+ }
+ ib.closeInventory();
+ }
+
+ if(flag){
+ //全部拾えたらEntityItemを消す
+ player.worldObj.playSoundAtEntity(player, "random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
+ eItem.setDead();
+ event.setCanceled(true);
+ return;
+ }
+ else if(picked.stackSize>0 && stacksize!=picked.stackSize){
+ player.onItemPickup(eItem, stacksize-picked.stackSize);
+ }
+ }
+
+ //MPCoinを拾った場合、即座にMPに変換
+ if(item!=null && item instanceof ItemMPCoin){
+ int v=picked.getItemDamage();
+ if(v>0 && !player.worldObj.isRemote){
+ MCEconomyAPI.addPlayerMP(player, v, false);
+ MCEconomyAPI.playCoinSoundEffect(player.worldObj, MathHelper.floor_double(eItem.posX), MathHelper.floor_double(eItem.posY), MathHelper.floor_double(eItem.posZ));
+ }
+ picked.stackSize=0;
+ eItem.setDead();
+ event.setCanceled(true);
+ }
+ }
+
+ @SubscribeEvent
+ public void onCrafted(PlayerEvent.ItemCraftedEvent event) {
+ EntityPlayer player = event.player;
+ ItemStack stack=event.crafting;
+ Item item=stack.getItem();
+
+ if(item==Item.getItemFromBlock(BlockCore.schoolTable)) player.triggerAchievement(AchievementRegistry.ga);
+ //else if(item==ItemCore.monocle) player.triggerAchievement(AchievementRegistry.monocle);
+ else if(item==Item.getItemFromBlock(BlockCore.workbench)) player.triggerAchievement(AchievementRegistry.workbench);
+ else if(item==ItemCore.membership) player.triggerAchievement(AchievementRegistry.witch);
+ else if(item==Item.getItemFromBlock(BlockCore.tableAlchemist)) player.triggerAchievement(AchievementRegistry.beginner);
+ else if(item==Item.getItemFromBlock(BlockCore.alchemyCauldron)) player.triggerAchievement(AchievementRegistry.atelier);
+ else if(item==Item.getItemFromBlock(BlockCore.pottersWheel)) player.triggerAchievement(AchievementRegistry.potter);
+ }
+
+ @SubscribeEvent
+ public void onLivingDropEvent(LivingDropsEvent event){
+ if(!event.entity.worldObj.isRemote){
+ if(event.entity instanceof EntityWitch && rand.nextInt(5)==1){
+ EntityItem entityItem=new EntityItem(event.entity.worldObj, event.entity.posX, event.entity.posY, event.entity.posZ);
+ entityItem.setEntityItemStack(new ItemStack(ItemCore.membership));
+ event.drops.add(entityItem);
+ }
+
+ if(event.entity instanceof IMob && rand.nextInt(2)==1){
+ EntityItem entityItem=new EntityItem(event.entity.worldObj, event.entity.posX, event.entity.posY, event.entity.posZ);
+ ItemStack drop;
+ switch (rand.nextInt(5)){
+ case 0: drop=new ItemStack(ItemCore.grassUnknown); break;
+ case 1: drop=new ItemStack(ItemCore.flowerUnknown); break;
+ case 2: drop=new ItemStack(ItemCore.fruitsUnknown); break;
+ case 3: drop=new ItemStack(ItemCore.herbUnknown); break;
+ case 4: drop=new ItemStack(ItemCore.mushroomUnknown); break;
+ default: drop=new ItemStack(ItemCore.seedsUnknown); break;
+ }
+ drop.stackSize=1+rand.nextInt(3);
+ entityItem.setEntityItemStack(drop);
+ event.drops.add(entityItem);
+ }
+ }
+ }
+
+ @SubscribeEvent
+ public void onEntityItemPickup(EntityItemPickupEvent event){
+ if(event.entityPlayer==null || event.entityPlayer.worldObj.isRemote) return;
+
+ ItemStack itemStack=event.item.getEntityItem();
+ if(itemStack==null) return;
+
+ if(itemStack.getItem()==ItemCore.membership) event.entityPlayer.triggerAchievement(AchievementRegistry.witch);
+ }
+
+ @SubscribeEvent
+ public void onPlayerSanityRoll(PlayerSanityRollEvent event){
+ EntityPlayer ep=event.entityPlayer;
+ if(!ep.worldObj.isRemote){
+ //----------------------金のモノクルによる正気度保護---------------------------
+ ItemStack helm=ep.getCurrentArmor(3);
+ if(helm!=null && helm.getItem()==ItemCore.monocleGold && event.getMax()<0){
+ event.newMax=(event.getMax()-1)/2;
+ }
+ }
+ }
+
+ @SubscribeEvent
+ public void onPlayerSanity(PlayerSanityEvent event){
+ EntityPlayer ep=event.entityPlayer;
+ if(!ep.worldObj.isRemote && event.newChangeSanity<0){
+ //--------------------エンチャントによる正気度保護-----------------------------
+ int lvSum= EnchantmentSanityProtect.getSum(ep); //最大20
+ int thMax=lvSum/2; //閾値。これを下回る場合は0になる
+ float prot=0.02f*lvSum;//軽減率
+
+ if(-event.newChangeSanity<thMax) event.newChangeSanity=0;
+ else event.newChangeSanity=MathHelper.floor_float(event.newChangeSanity * (1.f - prot));
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/event/wish/ContainerWish.class b/src/main/java/jp/plusplus/fbs/event/wish/ContainerWish.class Binary files differnew file mode 100644 index 0000000..600231f --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/event/wish/ContainerWish.class diff --git a/src/main/java/jp/plusplus/fbs/event/wish/ContainerWish.java b/src/main/java/jp/plusplus/fbs/event/wish/ContainerWish.java new file mode 100644 index 0000000..fca62b9 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/event/wish/ContainerWish.java @@ -0,0 +1,17 @@ +package jp.plusplus.fbs.event.wish;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.Container;
+
+/**
+ * Created by plusplus_F on 2016/03/31.
+ */
+public class ContainerWish extends Container {
+
+ public ContainerWish(){}
+
+ @Override
+ public boolean canInteractWith(EntityPlayer p_75145_1_) {
+ return true;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/event/wish/GuiWish.class b/src/main/java/jp/plusplus/fbs/event/wish/GuiWish.class Binary files differnew file mode 100644 index 0000000..435e82b --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/event/wish/GuiWish.class diff --git a/src/main/java/jp/plusplus/fbs/event/wish/GuiWish.java b/src/main/java/jp/plusplus/fbs/event/wish/GuiWish.java new file mode 100644 index 0000000..7874ca7 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/event/wish/GuiWish.java @@ -0,0 +1,88 @@ +package jp.plusplus.fbs.event.wish;
+
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.container.ContainerContract;
+import jp.plusplus.fbs.gui.button.GuiButtonEnchantment;
+import jp.plusplus.fbs.packet.MessageGuiButtonWithString;
+import jp.plusplus.fbs.packet.MessageWish;
+import jp.plusplus.fbs.packet.PacketHandler;
+import net.minecraft.client.gui.GuiButton;
+import net.minecraft.client.gui.GuiTextField;
+import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.client.resources.I18n;
+import net.minecraft.util.ResourceLocation;
+import net.minecraft.util.StatCollector;
+import org.lwjgl.input.Keyboard;
+import org.lwjgl.opengl.GL11;
+
+/**
+ * Created by plusplus_F on 2015/03/31.
+ */
+public class GuiWish extends GuiContainer {
+ public static final ResourceLocation rl = new ResourceLocation(FBS.MODID+":textures/gui/wish.png");
+ public GuiTextField textField;
+
+ public GuiWish() {
+ super(new ContainerWish());
+ this.ySize=37;
+ }
+
+ @Override
+ public void initGui() {
+ super.initGui();
+ int i = (this.width - this.xSize) / 2;
+ int j = (this.height - this.ySize) / 2;
+ this.allowUserInput = true;
+ Keyboard.enableRepeatEvents(true);
+
+ textField=new GuiTextField(fontRendererObj, i+9, j+17, 159, 9);
+ textField.setTextColor(-1);
+ textField.setDisabledTextColour(-1);
+ textField.setEnableBackgroundDrawing(false);
+ textField.setMaxStringLength(40);
+ }
+
+ @Override
+ public void onGuiClosed(){
+ super.onGuiClosed();
+ Keyboard.enableRepeatEvents(false);
+ PacketHandler.INSTANCE.sendToServer(new MessageWish(textField.getText()));
+ }
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(int par1, int par2){
+ super.drawGuiContainerForegroundLayer(par1, par2);
+ this.fontRendererObj.drawString(StatCollector.translateToLocal("info.fbs.wish.0"), 6, 4, 0x404040);
+ }
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float v, int i, int i1) {
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+
+ this.mc.getTextureManager().bindTexture(rl);
+
+ int k = (this.width - this.xSize) / 2;
+ int l = (this.height - this.ySize) / 2;
+ this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
+ }
+
+ @Override
+ protected void mouseClicked(int p_73864_1_, int p_73864_2_, int p_73864_3_) {
+ super.mouseClicked(p_73864_1_, p_73864_2_, p_73864_3_);
+ textField.mouseClicked(p_73864_1_, p_73864_2_, p_73864_3_);
+ }
+
+ @Override
+ protected void keyTyped(char p_73869_1_, int p_73869_2_) {
+ if(!textField.textboxKeyTyped(p_73869_1_, p_73869_2_)){
+ super.keyTyped(p_73869_1_, p_73869_2_);
+ }
+ }
+
+ @Override
+ public void drawScreen(int p_73863_1_, int p_73863_2_, float p_73863_3_) {
+ super.drawScreen(p_73863_1_, p_73863_2_, p_73863_3_);
+ GL11.glDisable(GL11.GL_LIGHTING);
+ GL11.glDisable(GL11.GL_BLEND);
+ textField.drawTextBox();
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/event/wish/WishHandler$1.class b/src/main/java/jp/plusplus/fbs/event/wish/WishHandler$1.class Binary files differnew file mode 100644 index 0000000..25f2f69 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/event/wish/WishHandler$1.class diff --git a/src/main/java/jp/plusplus/fbs/event/wish/WishHandler.class b/src/main/java/jp/plusplus/fbs/event/wish/WishHandler.class Binary files differnew file mode 100644 index 0000000..f482c7f --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/event/wish/WishHandler.class diff --git a/src/main/java/jp/plusplus/fbs/event/wish/WishHandler.java b/src/main/java/jp/plusplus/fbs/event/wish/WishHandler.java new file mode 100644 index 0000000..d6fecbb --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/event/wish/WishHandler.java @@ -0,0 +1,74 @@ +package jp.plusplus.fbs.event.wish;
+
+import jp.plusplus.fbs.event.wish.entry.*;
+import net.minecraft.entity.item.EntityItem;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.StatCollector;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+
+/**
+ * Created by plusplus_F on 2016/03/31.
+ */
+public class WishHandler {
+ private static WishHandler instance=new WishHandler();
+ private ArrayList<IWishEntry> wishEntries=new ArrayList<IWishEntry>();
+ private boolean isSorted=false;
+
+ private WishHandler(){}
+
+ public static void register(){
+ addWishEntry(new WishEntryGeneric());
+
+ addWishEntry(new WishEntryText("panty"));
+ addWishEntry(new WishEntryText("herobrine"));
+ addWishEntry(new WishEntryText("wish"));
+ addWishEntry(new WishEntryText("goddess"));
+ addWishEntry(new WishEntryText("achievement"));
+ addWishEntry(new WishEntryText("insanity"));
+
+ addWishEntry(new WishEntryMoney());
+ addWishEntry(new WishEntryDeath());
+ addWishEntry(new WishEntryExp());
+ addWishEntry(new WishEntryHealth());
+ addWishEntry(new WishEntrySanity());
+ }
+
+ public static void addWishEntry(IWishEntry entry){
+ instance.wishEntries.add(entry);
+ instance.isSorted=false;
+ }
+
+ public static void handleWish(EntityPlayer player, String wish){
+ if(!instance.isSorted){
+ instance.isSorted=true;
+ Collections.sort(instance.wishEntries, new Comparator<IWishEntry>() {
+ @Override
+ public int compare(IWishEntry o1, IWishEntry o2) {
+ float p=o2.priority()-o1.priority();
+ return p>0?1:(p<0?-1:0);
+ }
+ });
+ }
+
+ for(IWishEntry entry : instance.wishEntries){
+ if(entry.matches(wish)){
+ ItemStack itemStack=entry.get(player, wish);
+ if(itemStack!=null){
+ EntityItem entityItem=player.entityDropItem(itemStack, player.getEyeHeight());
+ if(entityItem!=null){
+ entityItem.delayBeforeCanPickup=0;
+ }
+ }
+ return;
+ }
+ }
+ }
+
+ public static String getGetMessage(String key){
+ return "<"+ StatCollector.translateToLocal("wish.fbs.goddess")+">"+StatCollector.translateToLocal("wish.fbs."+key+".get");
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/event/wish/entry/IWishEntry.class b/src/main/java/jp/plusplus/fbs/event/wish/entry/IWishEntry.class Binary files differnew file mode 100644 index 0000000..230c9bc --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/event/wish/entry/IWishEntry.class diff --git a/src/main/java/jp/plusplus/fbs/event/wish/entry/IWishEntry.java b/src/main/java/jp/plusplus/fbs/event/wish/entry/IWishEntry.java new file mode 100644 index 0000000..71f8edb --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/event/wish/entry/IWishEntry.java @@ -0,0 +1,31 @@ +package jp.plusplus.fbs.event.wish.entry;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+
+/**
+ * Created by plusplus_F on 2016/03/31.
+ */
+public interface IWishEntry {
+ /**
+ * 0.0f-1.0fの範囲で優先度を返す<br>
+ * 数値が大きいほど判定が優先される
+ * @return
+ */
+ public float priority();
+
+ /**
+ * プレイヤーの願いと一致するか判定する
+ * @param string 願い事
+ * @return 一致すればtrue
+ */
+ public boolean matches(String string);
+
+ /**
+ * 願いごとを叶える処理
+ * @param player 願ったプレイヤー
+ * @param string 願い事
+ * @return プレイヤーに与えるItemStack (Nullable)
+ */
+ public ItemStack get(EntityPlayer player, String string);
+}
diff --git a/src/main/java/jp/plusplus/fbs/event/wish/entry/WishEntryDeath.class b/src/main/java/jp/plusplus/fbs/event/wish/entry/WishEntryDeath.class Binary files differnew file mode 100644 index 0000000..f07be7a --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/event/wish/entry/WishEntryDeath.class diff --git a/src/main/java/jp/plusplus/fbs/event/wish/entry/WishEntryDeath.java b/src/main/java/jp/plusplus/fbs/event/wish/entry/WishEntryDeath.java new file mode 100644 index 0000000..9563aa2 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/event/wish/entry/WishEntryDeath.java @@ -0,0 +1,33 @@ +package jp.plusplus.fbs.event.wish.entry;
+
+import jp.plusplus.fbs.event.wish.WishHandler;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.DamageSource;
+import net.minecraft.util.StatCollector;
+
+import java.util.regex.Pattern;
+
+/**
+ * Created by plusplus_F on 2016/03/31.
+ */
+public class WishEntryDeath implements IWishEntry {
+ @Override
+ public float priority() {
+ return 1.f;
+ }
+
+ @Override
+ public boolean matches(String string) {
+ return Pattern.compile(StatCollector.translateToLocal("wish.fbs.death.regex"), Pattern.CASE_INSENSITIVE).matcher(string).matches();
+ }
+
+ @Override
+ public ItemStack get(EntityPlayer player, String string) {
+ player.addChatComponentMessage(new ChatComponentText(WishHandler.getGetMessage("death")));
+ player.attackEntityFrom(DamageSource.generic, 99999);
+ player.setDead();
+ return null;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/event/wish/entry/WishEntryExp.class b/src/main/java/jp/plusplus/fbs/event/wish/entry/WishEntryExp.class Binary files differnew file mode 100644 index 0000000..55dbc79 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/event/wish/entry/WishEntryExp.class diff --git a/src/main/java/jp/plusplus/fbs/event/wish/entry/WishEntryExp.java b/src/main/java/jp/plusplus/fbs/event/wish/entry/WishEntryExp.java new file mode 100644 index 0000000..1c63a22 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/event/wish/entry/WishEntryExp.java @@ -0,0 +1,33 @@ +package jp.plusplus.fbs.event.wish.entry;
+
+import jp.plusplus.fbs.event.wish.WishHandler;
+import net.minecraft.entity.boss.EntityDragon;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.DamageSource;
+import net.minecraft.util.StatCollector;
+
+import java.util.regex.Pattern;
+
+/**
+ * Created by plusplus_F on 2016/03/31.
+ */
+public class WishEntryExp implements IWishEntry {
+ @Override
+ public float priority() {
+ return 1.f;
+ }
+
+ @Override
+ public boolean matches(String string) {
+ return Pattern.compile(StatCollector.translateToLocal("wish.fbs.exp.regex"), Pattern.CASE_INSENSITIVE).matcher(string).matches();
+ }
+
+ @Override
+ public ItemStack get(EntityPlayer player, String string) {
+ player.addExperience(1000);
+ player.addChatComponentMessage(new ChatComponentText(WishHandler.getGetMessage("exp")));
+ return null;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/event/wish/entry/WishEntryGeneric.class b/src/main/java/jp/plusplus/fbs/event/wish/entry/WishEntryGeneric.class Binary files differnew file mode 100644 index 0000000..bad232e --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/event/wish/entry/WishEntryGeneric.class diff --git a/src/main/java/jp/plusplus/fbs/event/wish/entry/WishEntryGeneric.java b/src/main/java/jp/plusplus/fbs/event/wish/entry/WishEntryGeneric.java new file mode 100644 index 0000000..90e1346 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/event/wish/entry/WishEntryGeneric.java @@ -0,0 +1,153 @@ +package jp.plusplus.fbs.event.wish.entry;
+
+import com.google.common.collect.Maps;
+import cpw.mods.fml.common.registry.GameData;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.alchemy.characteristic.CharacteristicBase;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+
+import java.util.*;
+
+/**
+ * Created by plusplus_F on 2016/03/31.
+ */
+public class WishEntryGeneric implements IWishEntry {
+ private static Integer[] itemIds;
+ private static String[] itemNames;
+ private Random rand=new Random();
+
+ @Override
+ public float priority() {
+ return 0.0f;
+ }
+
+ @Override
+ public boolean matches(String string) {
+ return true;
+ }
+
+ @Override
+ public ItemStack get(EntityPlayer player, String string) {
+ if(itemIds==null){
+ Map<String,Integer> idMapping = Maps.newHashMap();
+ GameData.itemRegistry.serializeInto(idMapping);
+
+ itemIds=new Integer[idMapping.size()];
+ idMapping.values().toArray(itemIds);
+ itemNames=new String[idMapping.size()];
+ idMapping.keySet().toArray(itemNames);
+ }
+
+
+ int maxMatchIndex=-1;
+ int maxMatchValue=0;
+ ItemStack maxMatchItemStack=null;
+
+ //------------------------------------------------------------------------------------
+ // 一致度の判定
+ //------------------------------------------------------------------------------------
+ if(string.contains(":")){ //ドメイン指定の名前かどうか判定して処理を分ける
+ String[] domainAndName=string.split(":");
+ FBS.logger.info("<Wish>"+domainAndName[0]+":"+domainAndName[1]);
+
+ ArrayList<Character>[] tokens=new ArrayList[2];
+ for(int i=0;i<2;i++){
+ tokens[i]=new ArrayList<Character>(); // 名前を1文字ずつ区切ったトークン列
+ for(char c : domainAndName[i].toCharArray()){
+ if(c!=' ') tokens[i].add((Character)c);
+ }
+ }
+
+ for(int i=0;i<itemIds.length;i++){
+ int tmp=0;
+ String[] itemDomainAndName=itemNames[i].split(":");
+ itemDomainAndName[0]=itemDomainAndName[0].trim();
+ itemDomainAndName[1]=itemDomainAndName[1].trim();
+
+ for(int m=0;m<2;m++){
+ if(domainAndName[m].length()>0){
+ boolean perfect=(domainAndName[m].length()==itemDomainAndName[m].length());
+ int length=itemDomainAndName[m].length();
+
+ ArrayList<Character> t=(ArrayList<Character>)tokens[m].clone();
+ for(int k=0;k<length && !t.isEmpty();k++){
+ char c=itemDomainAndName[m].charAt(k);
+ if(c==' ') continue;
+
+ if(t.contains(c)){
+ tmp+=50+rand.nextInt(15);
+ t.remove((Character)c);
+ }
+ else perfect=false;
+ }
+ if(perfect){
+ tmp+=10000; //完全に一致している場合、メチャ一致度を上げる
+ }
+ }
+ }
+
+ if(maxMatchValue<tmp){
+ maxMatchIndex=i;
+ maxMatchValue=tmp;
+ }
+ }
+
+ // ItemStack生成
+ if(maxMatchIndex!=-1){
+ Item item=GameData.getItemRegistry().getObjectById(itemIds[maxMatchIndex]);
+ ArrayList<ItemStack> subItems=new ArrayList<ItemStack>();
+ item.getSubItems(item, item.getCreativeTab(), subItems);
+
+ maxMatchItemStack=subItems.get(rand.nextInt(subItems.size()));
+ }
+ }
+ else{
+ ArrayList<Character> tokens=new ArrayList<Character>(); // 名前を1文字ずつ区切ったトークン列
+ // Java死ね
+ for(char c : string.toCharArray()){
+ if(c!=' ') tokens.add((Character)c);
+ }
+
+ for(int i=0;i<itemIds.length;i++){
+ Item item=GameData.getItemRegistry().getObjectById(itemIds[i]);
+ if(item==null) continue;
+
+ ArrayList<ItemStack> subItems=new ArrayList<ItemStack>();
+ item.getSubItems(item, item.getCreativeTab(), subItems);
+
+ // CreativeTabsに見える全てのアイテムについて調べる
+ for(ItemStack itemStack : subItems){
+ int tmp=0;
+ String name=itemStack.getDisplayName();
+
+ boolean perfect=(name.length()==string.length());
+ int length=name.length();
+ ArrayList<Character> t=(ArrayList<Character>)tokens.clone();
+ for(int k=0;k<length && !t.isEmpty();k++){
+ char c=name.charAt(k);
+ if(c==' ') continue;
+
+ if(t.contains(c)){
+ tmp+=50+rand.nextInt(15);
+ t.remove((Character)c);
+ }
+ else perfect=false;
+ }
+ if(perfect) tmp+=10000; //名前が完全に一致している場合、メチャ一致度を上げる
+
+ if(maxMatchValue<tmp){
+ maxMatchIndex=i;
+ maxMatchValue=tmp;
+ maxMatchItemStack=itemStack;
+ }
+ }
+ }
+ }
+
+ // アイテムを得る
+ return maxMatchItemStack!=null?maxMatchItemStack.copy():new ItemStack(Blocks.dirt);
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/event/wish/entry/WishEntryHealth.class b/src/main/java/jp/plusplus/fbs/event/wish/entry/WishEntryHealth.class Binary files differnew file mode 100644 index 0000000..e3fe684 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/event/wish/entry/WishEntryHealth.class diff --git a/src/main/java/jp/plusplus/fbs/event/wish/entry/WishEntryHealth.java b/src/main/java/jp/plusplus/fbs/event/wish/entry/WishEntryHealth.java new file mode 100644 index 0000000..a299a45 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/event/wish/entry/WishEntryHealth.java @@ -0,0 +1,35 @@ +package jp.plusplus.fbs.event.wish.entry;
+
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.api.FBSEntityPropertiesAPI;
+import jp.plusplus.fbs.event.wish.WishHandler;
+import jp.plusplus.fbs.mod.ForSS2;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.StatCollector;
+
+import java.util.regex.Pattern;
+
+/**
+ * Created by plusplus_F on 2016/03/31.
+ */
+public class WishEntryHealth implements IWishEntry {
+ @Override
+ public float priority() {
+ return 1.f;
+ }
+
+ @Override
+ public boolean matches(String string) {
+ return Pattern.compile(StatCollector.translateToLocal("wish.fbs.health.regex"), Pattern.CASE_INSENSITIVE).matcher(string).matches();
+ }
+
+ @Override
+ public ItemStack get(EntityPlayer player, String string) {
+ player.addChatComponentMessage(new ChatComponentText(WishHandler.getGetMessage("health")));
+ player.heal(100);
+ player.getFoodStats().addStats(20,1);
+ return null;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/event/wish/entry/WishEntryMoney.class b/src/main/java/jp/plusplus/fbs/event/wish/entry/WishEntryMoney.class Binary files differnew file mode 100644 index 0000000..8f634a8 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/event/wish/entry/WishEntryMoney.class diff --git a/src/main/java/jp/plusplus/fbs/event/wish/entry/WishEntryMoney.java b/src/main/java/jp/plusplus/fbs/event/wish/entry/WishEntryMoney.java new file mode 100644 index 0000000..26763b4 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/event/wish/entry/WishEntryMoney.java @@ -0,0 +1,33 @@ +package jp.plusplus.fbs.event.wish.entry;
+
+import jp.plusplus.fbs.event.wish.WishHandler;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.DamageSource;
+import net.minecraft.util.StatCollector;
+import shift.mceconomy2.api.MCEconomyAPI;
+
+import java.util.regex.Pattern;
+
+/**
+ * Created by plusplus_F on 2016/03/31.
+ */
+public class WishEntryMoney implements IWishEntry {
+ @Override
+ public float priority() {
+ return 1.f;
+ }
+
+ @Override
+ public boolean matches(String string) {
+ return Pattern.compile(StatCollector.translateToLocal("wish.fbs.money.regex"), Pattern.CASE_INSENSITIVE).matcher(string).matches();
+ }
+
+ @Override
+ public ItemStack get(EntityPlayer player, String string) {
+ MCEconomyAPI.addPlayerMP(player, (player.experienceLevel/3+1)*8000, false);
+ player.addChatComponentMessage(new ChatComponentText(WishHandler.getGetMessage("money")));
+ return null;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/event/wish/entry/WishEntrySanity.class b/src/main/java/jp/plusplus/fbs/event/wish/entry/WishEntrySanity.class Binary files differnew file mode 100644 index 0000000..9db355e --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/event/wish/entry/WishEntrySanity.class diff --git a/src/main/java/jp/plusplus/fbs/event/wish/entry/WishEntrySanity.java b/src/main/java/jp/plusplus/fbs/event/wish/entry/WishEntrySanity.java new file mode 100644 index 0000000..96e5a95 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/event/wish/entry/WishEntrySanity.java @@ -0,0 +1,32 @@ +package jp.plusplus.fbs.event.wish.entry;
+
+import jp.plusplus.fbs.api.FBSEntityPropertiesAPI;
+import jp.plusplus.fbs.event.wish.WishHandler;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.StatCollector;
+
+import java.util.regex.Pattern;
+
+/**
+ * Created by plusplus_F on 2016/03/31.
+ */
+public class WishEntrySanity implements IWishEntry {
+ @Override
+ public float priority() {
+ return 1.f;
+ }
+
+ @Override
+ public boolean matches(String string) {
+ return Pattern.compile(StatCollector.translateToLocal("wish.fbs.sanity.regex"), Pattern.CASE_INSENSITIVE).matcher(string).matches();
+ }
+
+ @Override
+ public ItemStack get(EntityPlayer player, String string) {
+ FBSEntityPropertiesAPI.AddSanity(player, 100, 1, true);
+ player.addChatComponentMessage(new ChatComponentText(WishHandler.getGetMessage("sanity")));
+ return null;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/event/wish/entry/WishEntryText.class b/src/main/java/jp/plusplus/fbs/event/wish/entry/WishEntryText.class Binary files differnew file mode 100644 index 0000000..ff14820 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/event/wish/entry/WishEntryText.class diff --git a/src/main/java/jp/plusplus/fbs/event/wish/entry/WishEntryText.java b/src/main/java/jp/plusplus/fbs/event/wish/entry/WishEntryText.java new file mode 100644 index 0000000..913a8a8 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/event/wish/entry/WishEntryText.java @@ -0,0 +1,36 @@ +package jp.plusplus.fbs.event.wish.entry;
+
+import jp.plusplus.fbs.event.wish.WishHandler;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.StatCollector;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * Created by plusplus_F on 2016/03/31.
+ */
+public class WishEntryText implements IWishEntry {
+ protected String key;
+ public WishEntryText(String key){
+ this.key=key;
+ }
+
+ @Override
+ public float priority() {
+ return 1.f;
+ }
+
+ @Override
+ public boolean matches(String string) {
+ return Pattern.compile(StatCollector.translateToLocal("wish.fbs."+key+".regex"), Pattern.CASE_INSENSITIVE).matcher(string).matches();
+ }
+
+ @Override
+ public ItemStack get(EntityPlayer player, String string) {
+ player.addChatComponentMessage(new ChatComponentText(WishHandler.getGetMessage(key)));
+ return null;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/exprop/FBSEntityProperties$WarpPosition.class b/src/main/java/jp/plusplus/fbs/exprop/FBSEntityProperties$WarpPosition.class Binary files differnew file mode 100644 index 0000000..82fc851 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/exprop/FBSEntityProperties$WarpPosition.class diff --git a/src/main/java/jp/plusplus/fbs/exprop/FBSEntityProperties.class b/src/main/java/jp/plusplus/fbs/exprop/FBSEntityProperties.class Binary files differnew file mode 100644 index 0000000..1c75121 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/exprop/FBSEntityProperties.class diff --git a/src/main/java/jp/plusplus/fbs/exprop/FBSEntityProperties.java b/src/main/java/jp/plusplus/fbs/exprop/FBSEntityProperties.java new file mode 100644 index 0000000..417cdde --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/exprop/FBSEntityProperties.java @@ -0,0 +1,341 @@ +package jp.plusplus.fbs.exprop;
+
+import jp.plusplus.fbs.block.BlockCore;
+import jp.plusplus.fbs.spirit.ISpiritTool;
+import jp.plusplus.fbs.spirit.SpiritManager;
+import jp.plusplus.fbs.spirit.SpiritStatus;
+import jp.plusplus.fbs.tileentity.TileEntityMagicCore;
+import net.minecraft.block.Block;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.nbt.NBTTagList;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.MathHelper;
+import net.minecraft.world.World;
+import net.minecraft.world.WorldProvider;
+import net.minecraftforge.common.DimensionManager;
+import net.minecraftforge.common.IExtendedEntityProperties;
+
+import java.util.ArrayList;
+
+/**
+ * Createdby pluslus_Fon 2015/06/05.
+ */
+public class FBSEntityProperties implements IExtendedEntityProperties {
+ public final static String EXT_PROP_NAME = "FBSPlayerData";
+
+ /**
+ * 魔術レベルの最大値
+ */
+ public static final int MAGIC_LEVEL_MAX=50;
+
+ /**
+ * 一般人の魔術レベル最大値
+ */
+ public static final int MAGIC_LEVEL_BASIC_MAX=25;
+
+ private int san=99;
+ private int lvMagic=1;
+ private double exp=0;
+ private double next=30;
+
+ private String spiritToolName="";
+ private int spiritToolLv=-1;
+
+ private ArrayList<WarpPosition> positions=new ArrayList<WarpPosition>();
+ private ArrayList<String> decodedBooks=new ArrayList<String>();
+
+
+ private ItemStack[] bindInventory=new ItemStack[40];
+ private ItemStack[] pocketInventory=new ItemStack[72];
+
+ public static void register(EntityPlayer player) {
+ player.registerExtendedProperties(EXT_PROP_NAME, new FBSEntityProperties());
+ }
+ public static FBSEntityProperties get(EntityPlayer player) {
+ return (FBSEntityProperties)player.getExtendedProperties(EXT_PROP_NAME);
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound compound) {
+ NBTTagCompound nbt=new NBTTagCompound();
+ nbt.setInteger("SAN", san);
+ nbt.setInteger("LvMagic", lvMagic);
+ nbt.setDouble("EXP", exp);
+ nbt.setDouble("Next", next);
+ nbt.setString("SpiritToolName", spiritToolName);
+ nbt.setInteger("SpiritToolLevel", spiritToolLv);
+
+ NBTTagList tags=new NBTTagList();
+ for(WarpPosition pos : positions){
+ NBTTagCompound n=new NBTTagCompound();
+ pos.writeToNBT(n);
+ tags.appendTag(n);
+ }
+ nbt.setTag("WarpPositions", tags);
+
+ tags=new NBTTagList();
+ for (int i=0;i<bindInventory.length;i++){
+ if (bindInventory[i] != null){
+ NBTTagCompound nbt1 = new NBTTagCompound();
+ nbt1.setByte("Slot", (byte) i);
+ bindInventory[i].writeToNBT(nbt1);
+ tags.appendTag(nbt1);
+ }
+ }
+ nbt.setTag("BindInventory", tags);
+
+ tags=new NBTTagList();
+ for (int i=0;i<pocketInventory.length;i++){
+ if (pocketInventory[i] != null){
+ NBTTagCompound nbt1 = new NBTTagCompound();
+ nbt1.setByte("Slot", (byte) i);
+ pocketInventory[i].writeToNBT(nbt1);
+ tags.appendTag(nbt1);
+ }
+ }
+ nbt.setTag("PocketInventory", tags);
+
+ tags=new NBTTagList();
+ for(String s : decodedBooks){
+ NBTTagCompound nbt1=new NBTTagCompound();
+ nbt1.setString("Name", s);
+ tags.appendTag(nbt1);
+ }
+ nbt.setTag("DecodedBooks", tags);
+
+
+ compound.setTag(EXT_PROP_NAME, nbt);
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound compound) {
+ NBTTagCompound nbt=compound.getCompoundTag(EXT_PROP_NAME);
+ san=nbt.getInteger("SAN");
+ lvMagic=nbt.getInteger("LvMagic");
+ exp=nbt.getDouble("EXP");
+ next=nbt.getDouble("Next");
+ spiritToolName=nbt.getString("SpiritToolName");
+ spiritToolLv=nbt.getInteger("SpiritToolLevel");
+
+ positions.clear();
+ if(nbt.hasKey("WarpPositions")){
+ NBTTagList tags=(NBTTagList)nbt.getTag("WarpPositions");
+ for(int i=0;i<tags.tagCount();i++){
+ positions.add(new WarpPosition(tags.getCompoundTagAt(i)));
+ }
+ }
+
+ NBTTagList nbttaglist = (NBTTagList)nbt.getTag("BindInventory");
+ bindInventory = new ItemStack[bindInventory.length];
+ for (int i=0;i<nbttaglist.tagCount();i++){
+ NBTTagCompound nbt1 = nbttaglist.getCompoundTagAt(i);
+ byte b0 = nbt1.getByte("Slot");
+
+ if (b0>=0 && b0<bindInventory.length){
+ bindInventory[b0] = ItemStack.loadItemStackFromNBT(nbt1);
+ }
+ }
+
+ nbttaglist = (NBTTagList)nbt.getTag("PocketInventory");
+ pocketInventory = new ItemStack[72];
+ for (int i=0;i<nbttaglist.tagCount();i++){
+ NBTTagCompound nbt1 = nbttaglist.getCompoundTagAt(i);
+ byte b0 = nbt1.getByte("Slot");
+
+ if (b0>=0 && b0<pocketInventory.length){
+ pocketInventory[b0] = ItemStack.loadItemStackFromNBT(nbt1);
+ }
+ }
+
+ if(nbt.hasKey("DecodedBooks")){
+ decodedBooks=new ArrayList<String>();
+ nbttaglist=(NBTTagList)nbt.getTag("DecodedBooks");
+ for(int i=0;i<nbttaglist.tagCount();i++){
+ NBTTagCompound nbt1=nbttaglist.getCompoundTagAt(i);
+ decodedBooks.add(nbt1.getString("Name"));
+ }
+ }
+ }
+
+ @Override
+ public void init(Entity entity, World world) {}
+
+ public int getMagicLevelMax(){
+ return MAGIC_LEVEL_BASIC_MAX+(getSpiritToolLevel()+1)/2;
+ }
+
+ public int getMaxSanity(){
+ int m=100-lvMagic-(spiritToolLv/2);
+ return m<100?(m>5?m:5):99;
+ }
+ public int getSanity(){ return san; }
+ public void setSanity(int s){
+ san=s;
+ if(san>getMaxSanity()){
+ san=getMaxSanity();
+ }
+ if(san<0){
+ san=0;
+ }
+ }
+ public int getMagicLevel(){ return lvMagic; }
+ public void setMagicLevel(int s){
+ if(s<1) s=1;
+
+ lvMagic=s;
+ exp=0;
+ if(lvMagic==1) next=10;
+ else next=MathHelper.ceiling_double_int(10+Math.exp(0.25*(lvMagic-1)));
+ }
+ public double getEXP(){
+ return exp;
+ }
+ public double getNext(){
+ return next;
+ }
+ public void addEXP(double s){
+ if(s<=0) return;
+ exp+=s;
+ while(exp>=next && lvMagic<getMagicLevelMax()){
+ LvUp();
+ }
+ }
+ public void LvUp(){
+ lvMagic++;
+ if(san>getMaxSanity()){
+ san=getMaxSanity();
+ }
+ exp-=next;
+ //next=MathHelper.ceiling_double_int(10+Math.exp(0.25*(lvMagic-1)));
+ next+=15*(lvMagic+1);
+ }
+
+ public String getSpiritToolName(){ return spiritToolName; }
+ public void setSpiritToolName(String s){ spiritToolName=s; }
+ public int getSpiritToolLevel(){ return spiritToolLv; }
+ public void setSpiritToolLevel(int l){
+ if(l<=0 || l>SpiritStatus.LEVEL_MAX) return;
+ spiritToolLv =l;
+ }
+
+ public void bindPlayerInventory(EntityPlayer player, boolean spiritOnly){
+ bindInventory=new ItemStack[player.inventory.getSizeInventory()];
+
+ if(spiritOnly && SpiritManager.findSpiritToolIndex(player)!=-1){
+ for(int i=0;i<player.inventory.getSizeInventory();i++){
+ ItemStack is=player.inventory.getStackInSlot(i);
+ if(is!=null){
+ if(spiritOnly){
+ if(is.getItem() instanceof ISpiritTool){
+ bindInventory[i]=is.copy();
+ }
+ }
+ else{
+ bindInventory[i]=is.copy();
+ }
+ }
+ }
+ }
+ }
+ public void copyFromBindInventory(EntityPlayer player){
+ int size=player.inventory.getSizeInventory();
+ for(int i=0;i<size && i<bindInventory.length;i++){
+ if(bindInventory[i]!=null){
+ if(player.inventory.getStackInSlot(i)==null){
+ player.inventory.setInventorySlotContents(i, bindInventory[i]);
+ }
+ else{
+ player.inventory.addItemStackToInventory(bindInventory[i]);
+ }
+ }
+ bindInventory[i]=null;
+ }
+ }
+
+ public void addDecodedBook(String name){
+ decodedBooks.add(name);
+ }
+ public boolean isDecoded(String name){
+ return decodedBooks.contains(name);
+ }
+ public ArrayList<String> getDecodedBooks(){
+ return decodedBooks;
+ }
+
+ public ArrayList<WarpPosition> getDestinations(){
+ return positions;
+ }
+ public boolean addDestination(int dimId, int x, int y, int z){
+ WarpPosition wp=new WarpPosition(dimId, x, y, z);
+ if(!positions.contains(wp)){
+ positions.add(wp);
+ return true;
+ }
+ return false;
+ }
+
+ public static class WarpPosition{
+ public String name;
+ public int dimId;
+ public int x,y,z;
+
+ public WarpPosition(NBTTagCompound nbt){
+ readFromNBT(nbt);
+ }
+ public WarpPosition(int dimId, int x, int y, int z){
+ this.dimId=dimId;
+ this.x=x;
+ this.y=y;
+ this.z=z;
+ name=getDimName()+"("+x+","+y+","+z+")";
+ }
+
+ public void setName(String n){
+ name=n;
+ }
+ public String getName(){ return name; }
+
+ public boolean canWarp(){
+ World w=DimensionManager.getWorld(dimId);
+ if(w==null) return false;
+
+ Block b=w.getBlock(x,y,z);
+ if(b!=BlockCore.magicCore) return false;
+
+ TileEntity te=w.getTileEntity(x,y,z);
+ if(!(te instanceof TileEntityMagicCore)) return false;
+
+ return "fbs.warp".equals(((TileEntityMagicCore) te).getCircleName());
+ }
+
+ public String getDimName(){
+ WorldProvider wp=WorldProvider.getProviderForDimension(dimId);
+ if(wp==null) return "";
+ return wp.getDimensionName();
+ }
+
+ public void writeToNBT(NBTTagCompound nbt){
+ nbt.setString("Name", name);
+ nbt.setInteger("Dim", dimId);
+ nbt.setInteger("x", x);
+ nbt.setInteger("y", y);
+ nbt.setInteger("z", z);
+ }
+ public void readFromNBT(NBTTagCompound nbt){
+ name=nbt.getString("Name");
+ dimId=nbt.getInteger("Dim");
+ x=nbt.getInteger("x");
+ y=nbt.getInteger("y");
+ z=nbt.getInteger("z");
+ }
+ @Override
+ public boolean equals(Object obj){
+ if(!(obj instanceof WarpPosition)) return false;
+ WarpPosition wp=(WarpPosition)obj;
+ return dimId==wp.dimId && x==wp.x && y==wp.y && z==wp.z;
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/exprop/SanityManager.class b/src/main/java/jp/plusplus/fbs/exprop/SanityManager.class Binary files differnew file mode 100644 index 0000000..d398019 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/exprop/SanityManager.class diff --git a/src/main/java/jp/plusplus/fbs/exprop/SanityManager.java b/src/main/java/jp/plusplus/fbs/exprop/SanityManager.java new file mode 100644 index 0000000..5804c30 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/exprop/SanityManager.java @@ -0,0 +1,216 @@ +package jp.plusplus.fbs.exprop;
+
+import jp.plusplus.fbs.AchievementRegistry;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.api.event.PlayerSanityEvent;
+import jp.plusplus.fbs.api.event.PlayerSanityRollEvent;
+import jp.plusplus.fbs.packet.MessagePlayerProperties;
+import jp.plusplus.fbs.packet.PacketHandler;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.EntityPlayerMP;
+import net.minecraft.potion.Potion;
+import net.minecraft.potion.PotionEffect;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.DamageSource;
+import net.minecraft.util.StatCollector;
+import net.minecraftforge.common.MinecraftForge;
+
+import java.util.ArrayList;
+import java.util.Random;
+
+/**
+ * Createdby pluslus_Fon 2015/06/05.
+ * 正気度および魔術レベル・経験値の管理クラス
+ * 外部からこのクラスを呼び出してプレイヤーをいじる
+ * 基本的に正気度は XdY で変化する。Xはダイスを振る回数を、Yはダイスの面数を表す。
+ */
+public class SanityManager {
+ private static SanityManager instance = new SanityManager();
+ public static final String STATUS = "san";
+ private static Random rand=new Random();
+
+ private static void addSAN(EntityPlayer player, FBSEntityProperties prop, int san){
+ prop.setSanity(prop.getSanity()+san);
+ player.addChatComponentMessage(new ChatComponentText(String.format(StatCollector.translateToLocal("info.fbs.san.0"), san)));
+ }
+ private static void loseSAN(EntityPlayer player, FBSEntityProperties prop, int san){
+ int pre=prop.getSanity();
+ prop.setSanity(pre-san);
+ player.addChatComponentMessage(new ChatComponentText(String.format(StatCollector.translateToLocal("info.fbs.san.1"), san)));
+ player.triggerAchievement(AchievementRegistry.insanity);
+
+ if(prop.getSanity()<=0){
+ //死亡判定
+ player.attackEntityFrom(new DamageSource("fbs.madness."+rand.nextInt(3)), 10000);
+ player.triggerAchievement(AchievementRegistry.death);
+ }
+ else if(san>=2 && 100*san/pre>=20){
+ //発狂判定
+ player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("info.fbs.san.2")));
+ player.addPotionEffect(new PotionEffect(Potion.confusion.getId(), 20 * 15, 2));
+ player.addPotionEffect(new PotionEffect(Potion.hunger.getId(), 20*15, 1));
+ player.triggerAchievement(AchievementRegistry.madness);
+ }
+ }
+
+ /**
+ * 正気度を与える
+ * @param player
+ * @param trial ダイスを振る回数
+ * @param max 何面ダイス?
+ * @param sim 実際に結果を反映させるか否か
+ * @return 変化量
+ */
+ public static int addSanity(EntityPlayer player, int trial, int max, boolean sim){
+ if(max<=0 || trial<=0 || player==null) return 0;
+ FBSEntityProperties prop=FBSEntityProperties.get(player);
+ if(prop==null) return 0;
+
+ int as=0;
+ if(player instanceof EntityPlayerMP && !player.worldObj.isRemote){
+ PlayerSanityRollEvent psre=new PlayerSanityRollEvent(player, trial, max);
+ if(MinecraftForge.EVENT_BUS.post(psre) || psre.newTrial<=0 || psre.newMax==0) return 0;
+
+ //符号の反転
+ boolean isReversed=psre.newMax<0;
+ trial=psre.newTrial;
+ max=isReversed?-psre.newMax:psre.newMax;
+ for(int i=0;i<trial;i++){
+ as+=1+rand.nextInt(max);
+ }
+
+ if(sim){
+ PlayerSanityEvent ev=new PlayerSanityEvent(player, isReversed?-as:as, 0, 0);
+ boolean hc= MinecraftForge.EVENT_BUS.post(ev);
+ if(!hc){
+ as=ev.newChangeSanity;
+ if(as>0){
+ addSAN(player, prop, as);
+ }
+ else{
+ loseSAN(player, prop, as);
+ }
+
+ sendPacket(player);
+ }
+ }
+ }
+ return as;
+ }
+
+ /**
+ * 正気度を失わせる
+ * @param player
+ * @param trial ダイスを振る回数
+ * @param max 何面ダイス?
+ * @param sim 実際に結果を反映させるか否か
+ * @return 変化量
+ */
+ public static int loseSanity(EntityPlayer player, int trial, int max, boolean sim){
+ //FMLLog.info("called lose!");
+ if(max<=0 || trial<=0 || player==null) return 0;
+ FBSEntityProperties prop=FBSEntityProperties.get(player);
+ if(prop==null) return 0;
+
+ int as=0;
+ if(player instanceof EntityPlayerMP && !player.worldObj.isRemote){
+ PlayerSanityRollEvent psre=new PlayerSanityRollEvent(player, trial, -max);
+ if(MinecraftForge.EVENT_BUS.post(psre) || psre.newTrial<=0 || psre.newMax==0) return 0;
+
+ //符号の反転
+ boolean isReversed=psre.newMax>0;
+ trial=psre.newTrial;
+ max=isReversed?psre.newMax:-psre.newMax;
+ for(int i=0;i<trial;i++){
+ as+=1+rand.nextInt(max);
+ }
+
+ if(sim){
+ PlayerSanityEvent ev=new PlayerSanityEvent(player, isReversed?as:-as, 0, 0);
+ boolean hc=MinecraftForge.EVENT_BUS.post(ev);
+ if(!hc){
+ as=-ev.newChangeSanity; //新しい変化量
+ if(as>0){
+ loseSAN(player, prop, as);
+ }
+ else if(as<0){
+ //SAN値が増える場合
+ addSAN(player, prop, as);
+ }
+
+ sendPacket(player);
+ }
+ }
+ }
+ return as;
+ }
+
+ /**
+ * 魔術経験値を与える。レベルアップの判定と処理もここ
+ * @param player
+ * @param exp
+ * @param sim 実際に結果を反映させるか否か
+ * @return 経験値の変化量
+ */
+ public static double addExp(EntityPlayer player, double exp, boolean sim){
+ if(exp<=0 || player==null) return 0;
+ FBSEntityProperties prop=FBSEntityProperties.get(player);
+ if(prop==null) return 0;
+
+ if(player instanceof EntityPlayerMP && !player.worldObj.isRemote){
+ if(sim){
+ PlayerSanityEvent ev=new PlayerSanityEvent(player, 0, exp, 0);
+ boolean hc= MinecraftForge.EVENT_BUS.post(ev);
+ if(!hc){
+ int lv=prop.getMagicLevel();
+ exp=ev.newChangeExp;
+ if(exp>0){
+ //経験値が増える場合のみ
+ prop.addEXP(exp);
+ if(lv!=prop.getMagicLevel()) {
+ player.addChatComponentMessage(new ChatComponentText(String.format(StatCollector.translateToLocal("info.fbs.lv.0"), prop.getMagicLevel())));
+ }
+ }
+ sendPacket(player);
+ }
+ }
+ }
+ return exp;
+ }
+
+ public static void addDestination(EntityPlayer player, int dimId, int x, int y, int z){
+ FBSEntityProperties prop=FBSEntityProperties.get(player);
+ if(prop.addDestination(dimId, x, y,z)){
+ //狭間生成用が追加されたとき,名前の変更
+ if(dimId==FBS.dimensionCrackId && x==-1 && y==-1 && z==-1){
+ ArrayList<FBSEntityProperties.WarpPosition> list=prop.getDestinations();
+ list.get(list.size()-1).setName("???");
+ }
+ }
+ sendPacket(player);
+ }
+
+ public static void setSpirit(EntityPlayer player, String name, int lv){
+ FBSEntityProperties prop=FBSEntityProperties.get(player);
+ prop.setSpiritToolName(name);
+ prop.setSpiritToolLevel(lv);
+ sendPacket(player);
+ }
+ public static void setSpiritName(EntityPlayer entityPlayer, String name){
+ FBSEntityProperties prop=FBSEntityProperties.get(entityPlayer);
+ prop.setSpiritToolName(name);
+ sendPacket(entityPlayer);
+ }
+ public static void setSpiritLevel(EntityPlayer entityPlayer, int lv){
+ FBSEntityProperties prop=FBSEntityProperties.get(entityPlayer);
+ prop.setSpiritToolLevel(lv);
+ sendPacket(entityPlayer);
+ }
+
+ public static void loadProxyData(EntityPlayer player) {
+ PacketHandler.INSTANCE.sendTo(new MessagePlayerProperties(player), (EntityPlayerMP)player);
+ }
+ public static void sendPacket(EntityPlayer player) {
+ PacketHandler.INSTANCE.sendTo(new MessagePlayerProperties(player), (EntityPlayerMP)player);
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/gui/GuiAlchemyCauldron.class b/src/main/java/jp/plusplus/fbs/gui/GuiAlchemyCauldron.class Binary files differnew file mode 100644 index 0000000..7cf036f --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/gui/GuiAlchemyCauldron.class diff --git a/src/main/java/jp/plusplus/fbs/gui/GuiAlchemyCauldron.java b/src/main/java/jp/plusplus/fbs/gui/GuiAlchemyCauldron.java new file mode 100644 index 0000000..18cf3cf --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/gui/GuiAlchemyCauldron.java @@ -0,0 +1,88 @@ +package jp.plusplus.fbs.gui;
+
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.container.ContainerAlchemyCauldron;
+import jp.plusplus.fbs.gui.button.GuiButtonEnchantment;
+import jp.plusplus.fbs.packet.MessageGuiButton;
+import jp.plusplus.fbs.packet.PacketHandler;
+import jp.plusplus.fbs.tileentity.TileEntityAlchemyCauldron;
+import net.minecraft.client.gui.GuiButton;
+import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.client.resources.I18n;
+import net.minecraft.inventory.Container;
+import net.minecraft.util.ResourceLocation;
+import org.lwjgl.opengl.GL11;
+
+/**
+ * Createdby pluslus_Fon 2015/06/08.
+ */
+public class GuiAlchemyCauldron extends GuiContainer {
+ public static final ResourceLocation rl = new ResourceLocation(FBS.MODID, "textures/gui/alchemyCauldron.png");
+ private TileEntityAlchemyCauldron entity;
+ private GuiButtonEnchantment button;
+
+ public GuiAlchemyCauldron(Container p_i1072_1_, TileEntityAlchemyCauldron t) {
+ super(p_i1072_1_);
+ entity =t;
+ ySize=201;
+ }
+
+ @Override
+ public void initGui() {
+ super.initGui();
+ int i = (this.width - this.xSize) / 2;
+ int j = (this.height - this.ySize) / 2;
+ this.allowUserInput = true;
+ button=new GuiButtonEnchantment(0, i+99, j+36);
+ buttonList.add(button);
+ }
+
+ @Override
+ public void updateScreen() {
+ super.updateScreen();
+ button.enabled=((ContainerAlchemyCauldron)inventorySlots).entity.canCompounding();
+ }
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(int par1, int par2){
+ String s=entity.getInventoryName();
+ this.fontRendererObj.drawString(s, this.xSize / 2 - this.fontRendererObj.getStringWidth(s) / 2, 6, 0x404040);
+ this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 0x404040);
+
+ int k = (this.width - this.xSize) / 2;
+ int l = (this.height - this.ySize) / 2;
+ if(entity.cachedRecipe!=null){
+ if(!entity.materials.isEmpty()) {
+ this.fontRendererObj.drawString(entity.cachedRecipe.getProduct().getDisplayName(), 9, 37, 0x404040);
+ for (int i = 0; i < entity.materials.size(); i++) {
+ TileEntityAlchemyCauldron.MaterialPair p = entity.materials.get(i);
+ this.fontRendererObj.drawString(p.getName(), 9, 48 + (fontRendererObj.FONT_HEIGHT + 1) * i, p.get() ? 0xffffff : 0x404040);
+ }
+ }
+ float p=entity.getCompoundingProbability(((ContainerAlchemyCauldron) inventorySlots).player)*100;
+ fontRendererObj.drawString(String.format("%.2f%%", p), 102, 60, 0x404040);
+ }
+ }
+
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float v, int i, int i1) {
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+
+ this.mc.getTextureManager().bindTexture(rl);
+
+ int k = (this.width - this.xSize) / 2;
+ int l = (this.height - this.ySize) / 2;
+ this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
+ }
+
+ @Override
+ protected void actionPerformed(GuiButton p_146284_1_) {
+ if(p_146284_1_==button){
+ entity.inputMaterial.clear();
+ for(TileEntityAlchemyCauldron.MaterialPair mp : entity.materials){
+ mp.set(false);
+ }
+ PacketHandler.INSTANCE.sendToServer(new MessageGuiButton(0));
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/gui/GuiBasket.class b/src/main/java/jp/plusplus/fbs/gui/GuiBasket.class Binary files differnew file mode 100644 index 0000000..d62c670 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/gui/GuiBasket.class diff --git a/src/main/java/jp/plusplus/fbs/gui/GuiBasket.java b/src/main/java/jp/plusplus/fbs/gui/GuiBasket.java new file mode 100644 index 0000000..10cbe7b --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/gui/GuiBasket.java @@ -0,0 +1,39 @@ +package jp.plusplus.fbs.gui;
+
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.container.ContainerBasket;
+import jp.plusplus.fbs.item.ItemCore;
+import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.client.resources.I18n;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.util.ResourceLocation;
+import net.minecraft.util.StatCollector;
+import org.lwjgl.opengl.GL11;
+
+/**
+ * Created by plusplus_F on 2015/11/11.
+ */
+public class GuiBasket extends GuiContainer {
+ private static final ResourceLocation texture = new ResourceLocation(FBS.MODID, "textures/gui/basket.png");
+
+ public GuiBasket(InventoryPlayer inventoryPlayer) {
+ super(new ContainerBasket(inventoryPlayer));
+ this.ySize = 222;
+ }
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(int x, int p_146979_2_) {
+ String s = StatCollector.translateToLocal(ItemCore.basket.getUnlocalizedName() + ".name");
+ this.fontRendererObj.drawString(s, this.xSize / 2 - this.fontRendererObj.getStringWidth(s) / 2, 6, 0x404040);
+ this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 0x404040);
+ }
+
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ this.mc.getTextureManager().bindTexture(texture);
+ int k = (this.width - this.xSize) / 2;
+ int l = (this.height - this.ySize) / 2;
+ this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/gui/GuiBonfire.class b/src/main/java/jp/plusplus/fbs/gui/GuiBonfire.class Binary files differnew file mode 100644 index 0000000..797593f --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/gui/GuiBonfire.class diff --git a/src/main/java/jp/plusplus/fbs/gui/GuiBonfire.java b/src/main/java/jp/plusplus/fbs/gui/GuiBonfire.java new file mode 100644 index 0000000..dc84f10 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/gui/GuiBonfire.java @@ -0,0 +1,42 @@ +package jp.plusplus.fbs.gui;
+
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.container.ContainerBonfire;
+import jp.plusplus.fbs.container.ContainerMagic;
+import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.client.resources.I18n;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.util.ResourceLocation;
+import org.lwjgl.input.Mouse;
+import org.lwjgl.opengl.GL11;
+
+/**
+ * Created by pluslus_F on 2015/10/19.
+ */
+public class GuiBonfire extends GuiContainer {
+ public static final ResourceLocation rl=new ResourceLocation(FBS.MODID, "textures/gui/bonfire.png");
+ ContainerBonfire cm;
+
+ public GuiBonfire(ContainerBonfire p_i1072_1_) {
+ super(p_i1072_1_);
+ cm=p_i1072_1_;
+ }
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(int par1, int par2){
+ String s=cm.inventory.getInventoryName();
+ this.fontRendererObj.drawString(s, this.xSize / 2 - this.fontRendererObj.getStringWidth(s) / 2, 6, 0x404040);
+ this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 0x404040);
+ }
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float v, int i, int i1) {
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+
+ this.mc.getTextureManager().bindTexture(rl);
+
+ int k = (this.width - this.xSize) / 2;
+ int l = (this.height - this.ySize) / 2;
+ this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
+ }
+
+}
diff --git a/src/main/java/jp/plusplus/fbs/gui/GuiContract.class b/src/main/java/jp/plusplus/fbs/gui/GuiContract.class Binary files differnew file mode 100644 index 0000000..a60bc2b --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/gui/GuiContract.class diff --git a/src/main/java/jp/plusplus/fbs/gui/GuiContract.java b/src/main/java/jp/plusplus/fbs/gui/GuiContract.java new file mode 100644 index 0000000..19d0ff7 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/gui/GuiContract.java @@ -0,0 +1,110 @@ +package jp.plusplus.fbs.gui;
+
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.container.ContainerContract;
+import jp.plusplus.fbs.container.ContainerTFKEnchantment;
+import jp.plusplus.fbs.gui.button.GuiButtonEnchantment;
+import jp.plusplus.fbs.item.ItemCore;
+import jp.plusplus.fbs.packet.MessageGuiButton;
+import jp.plusplus.fbs.packet.MessageGuiButtonWithString;
+import jp.plusplus.fbs.packet.PacketHandler;
+import net.minecraft.client.gui.GuiButton;
+import net.minecraft.client.gui.GuiTextField;
+import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.client.resources.I18n;
+import net.minecraft.util.ResourceLocation;
+import net.minecraft.util.StatCollector;
+import org.lwjgl.input.Keyboard;
+import org.lwjgl.opengl.GL11;
+
+/**
+ * Created by plusplus_F on 2015/11/14.
+ */
+public class GuiContract extends GuiContainer {
+ public static final ResourceLocation rl = new ResourceLocation(FBS.MODID+":textures/gui/magicContract.png");
+ public ContainerContract con;
+ public GuiButtonEnchantment button;
+ public GuiTextField textField;
+
+ public GuiContract(ContainerContract p_i1072_1_) {
+ super(p_i1072_1_);
+ con=p_i1072_1_;
+ }
+
+ @Override
+ public void initGui() {
+ super.initGui();
+ int i = (this.width - this.xSize) / 2;
+ int j = (this.height - this.ySize) / 2;
+ this.allowUserInput = true;
+ Keyboard.enableRepeatEvents(true);
+
+ button=new GuiButtonEnchantment(0, i+92, j+40);
+ this.buttonList.add(button);
+
+ textField=new GuiTextField(fontRendererObj, i+9, j+34, 68, 9);
+ textField.setTextColor(-1);
+ textField.setDisabledTextColour(-1);
+ textField.setEnableBackgroundDrawing(false);
+ textField.setMaxStringLength(20);
+ }
+
+ @Override
+ public void onGuiClosed(){
+ super.onGuiClosed();
+ Keyboard.enableRepeatEvents(false);
+ }
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(int par1, int par2){
+ super.drawGuiContainerForegroundLayer(par1, par2);
+ String s= StatCollector.translateToLocal(con.inventory.getInventoryName());
+ this.fontRendererObj.drawString(s, this.xSize / 2 - this.fontRendererObj.getStringWidth(s) / 2, 6, 0x404040);
+ this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 0x404040);
+ }
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float v, int i, int i1) {
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+
+ this.mc.getTextureManager().bindTexture(rl);
+
+ int k = (this.width - this.xSize) / 2;
+ int l = (this.height - this.ySize) / 2;
+ this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
+ }
+
+ @Override
+ public void updateScreen() {
+ super.updateScreen();
+ button.enabled=((ContainerContract)inventorySlots).canContract() && !textField.getText().isEmpty();
+ }
+
+ @Override
+ protected void actionPerformed(GuiButton p_146284_1_) {
+ if(p_146284_1_==button && p_146284_1_.enabled){
+ PacketHandler.INSTANCE.sendToServer(new MessageGuiButtonWithString(0, textField.getText()));
+ textField.setText("");
+ }
+ }
+
+ @Override
+ protected void mouseClicked(int p_73864_1_, int p_73864_2_, int p_73864_3_) {
+ super.mouseClicked(p_73864_1_, p_73864_2_, p_73864_3_);
+ textField.mouseClicked(p_73864_1_, p_73864_2_, p_73864_3_);
+ }
+
+ @Override
+ protected void keyTyped(char p_73869_1_, int p_73869_2_) {
+ if(!textField.textboxKeyTyped(p_73869_1_, p_73869_2_)){
+ super.keyTyped(p_73869_1_, p_73869_2_);
+ }
+ }
+
+ @Override
+ public void drawScreen(int p_73863_1_, int p_73863_2_, float p_73863_3_) {
+ super.drawScreen(p_73863_1_, p_73863_2_, p_73863_3_);
+ GL11.glDisable(GL11.GL_LIGHTING);
+ GL11.glDisable(GL11.GL_BLEND);
+ textField.drawTextBox();
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/gui/GuiEnchantment.class b/src/main/java/jp/plusplus/fbs/gui/GuiEnchantment.class Binary files differnew file mode 100644 index 0000000..0c7d2af --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/gui/GuiEnchantment.class diff --git a/src/main/java/jp/plusplus/fbs/gui/GuiEnchantment.java b/src/main/java/jp/plusplus/fbs/gui/GuiEnchantment.java new file mode 100644 index 0000000..8466ab5 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/gui/GuiEnchantment.java @@ -0,0 +1,79 @@ +package jp.plusplus.fbs.gui;
+
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.container.ContainerTFKEnchantment;
+import jp.plusplus.fbs.gui.button.GuiButtonEnchantment;
+import jp.plusplus.fbs.item.ItemCore;
+import jp.plusplus.fbs.packet.MessageGuiButton;
+import jp.plusplus.fbs.packet.PacketHandler;
+import net.minecraft.client.gui.GuiButton;
+import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.client.resources.I18n;
+import net.minecraft.util.ResourceLocation;
+import net.minecraft.util.StatCollector;
+import org.lwjgl.opengl.GL11;
+
+/**
+ * Created by plusplus_F on 2015/10/21.
+ */
+public class GuiEnchantment extends GuiContainer {
+ public static final ResourceLocation rl = new ResourceLocation(FBS.MODID+":textures/gui/enchant.png");
+ public GuiButtonEnchantment button;
+ public ContainerTFKEnchantment con;
+
+ public GuiEnchantment(ContainerTFKEnchantment p_i1072_1_) {
+ super(p_i1072_1_);
+ con=p_i1072_1_;
+ }
+
+ @Override
+ public void initGui() {
+ super.initGui();
+ int i = (this.width - this.xSize) / 2;
+ int j = (this.height - this.ySize) / 2;
+ this.allowUserInput = true;
+ button=new GuiButtonEnchantment(0, i+83, j+28);
+ this.buttonList.add(button);
+ }
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(int par1, int par2){
+ super.drawGuiContainerForegroundLayer(par1, par2);
+ String s= StatCollector.translateToLocal(ItemCore.enchantScroll.getUnlocalizedName()+".name");
+ this.fontRendererObj.drawString(s, this.xSize / 2 - this.fontRendererObj.getStringWidth(s) / 2, 6, 0x404040);
+ this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 0x404040);
+
+ //エンチャント成功率
+ if(con.canEnchant()) {
+ int k = (this.width - this.xSize) / 2;
+ int l = (this.height - this.ySize) / 2;
+ float p = con.getEnchantProbability() * 100;
+ if (p < 0) p = 0;
+ if (p > 100) p = 100;
+ this.fontRendererObj.drawString(String.format("%.2f%%", p), 85, 50, 0x404040);
+ }
+ }
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float v, int i, int i1) {
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+
+ this.mc.getTextureManager().bindTexture(rl);
+
+ int k = (this.width - this.xSize) / 2;
+ int l = (this.height - this.ySize) / 2;
+ this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
+ }
+
+ @Override
+ public void updateScreen() {
+ super.updateScreen();
+ button.enabled=((ContainerTFKEnchantment)inventorySlots).canEnchant();
+ }
+
+ @Override
+ protected void actionPerformed(GuiButton p_146284_1_) {
+ if(p_146284_1_==button){
+ PacketHandler.INSTANCE.sendToServer(new MessageGuiButton(0));
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/gui/GuiExtractingFurnace.class b/src/main/java/jp/plusplus/fbs/gui/GuiExtractingFurnace.class Binary files differnew file mode 100644 index 0000000..4fd96f0 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/gui/GuiExtractingFurnace.class diff --git a/src/main/java/jp/plusplus/fbs/gui/GuiExtractingFurnace.java b/src/main/java/jp/plusplus/fbs/gui/GuiExtractingFurnace.java new file mode 100644 index 0000000..8883397 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/gui/GuiExtractingFurnace.java @@ -0,0 +1,79 @@ +package jp.plusplus.fbs.gui;
+
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.tileentity.TileEntityExtractingFurnace;
+import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.client.renderer.texture.TextureMap;
+import net.minecraft.client.resources.I18n;
+import net.minecraft.inventory.Container;
+import net.minecraft.util.IIcon;
+import net.minecraft.util.ResourceLocation;
+import org.lwjgl.opengl.GL11;
+import org.lwjgl.opengl.GL12;
+
+/**
+ * Createdby pluslus_Fon 2015/06/08.
+ */
+public class GuiExtractingFurnace extends GuiContainer {
+ public static final ResourceLocation rl=new ResourceLocation(FBS.MODID, "textures/gui/extractingFurnace.png");
+ private TileEntityExtractingFurnace entity;
+
+ public GuiExtractingFurnace(Container p_i1072_1_, TileEntityExtractingFurnace t) {
+ super(p_i1072_1_);
+ entity =t;
+ }
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(int par1, int par2){
+ String s=entity.getInventoryName();
+ this.fontRendererObj.drawString(s, this.xSize / 2 - this.fontRendererObj.getStringWidth(s) / 2, 6, 0x404040);
+ this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 0x404040);
+ }
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float v, int i, int i1) {
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+
+ this.mc.getTextureManager().bindTexture(rl);
+
+ int k = (this.width - this.xSize) / 2;
+ int l = (this.height - this.ySize) / 2;
+ this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
+ this.drawTexturedModalRect(k+68, l+35, 176, 0, entity.getProgressScaled(22), 15);
+
+ int amount = entity.tank.getFluidAmount();
+ if (amount > 0) {
+ IIcon icon = entity.getFluidIcon();
+ if (icon != null) {
+ int scale = 52 * amount / entity.tank.getCapacity();
+ drawFluid(this, k + 98, l + 69 - scale, icon, 34, scale);
+ }
+ }
+ }
+
+ public static void drawFluid(GuiContainer gui, int x, int y, IIcon icon, int w, int h) {
+ if(h==0) h=1;
+
+ GL11.glPushMatrix();
+ GL11.glEnable(GL12.GL_RESCALE_NORMAL);
+ GL11.glEnable(GL11.GL_BLEND);
+ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
+ GL11.glColor4f(2.0F, 2.0F, 2.0F, 0.75F);
+ gui.mc.getMinecraft().getTextureManager().bindTexture(TextureMap.locationBlocksTexture);
+
+ int sx, sy;
+ for (sy = 0; h - sy * 16 > 16; sy++) {
+ for (sx = 0; w - sx * 16 > 16; sx++) {
+ gui.drawTexturedModelRectFromIcon(x + sx * 16, y + sy * 16, icon, 16, 16);
+ }
+ gui.drawTexturedModelRectFromIcon(x + sx * 16, y + sy * 16, icon, w - sx * 16, 16);
+ }
+ for (sx = 0; w - sx * 16 > 16; sx++) {
+ gui.drawTexturedModelRectFromIcon(x + sx * 16, y + sy * 16, icon, 16, h - sy * 16);
+ }
+ gui.drawTexturedModelRectFromIcon(x + sx * 16, y + sy * 16, icon, w - sx * 16, h - sy * 16);
+
+ GL11.glDisable(GL12.GL_RESCALE_NORMAL);
+ GL11.glDisable(GL11.GL_BLEND);
+ GL11.glPopMatrix();
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/gui/GuiFillingTable.class b/src/main/java/jp/plusplus/fbs/gui/GuiFillingTable.class Binary files differnew file mode 100644 index 0000000..e979c2a --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/gui/GuiFillingTable.class diff --git a/src/main/java/jp/plusplus/fbs/gui/GuiFillingTable.java b/src/main/java/jp/plusplus/fbs/gui/GuiFillingTable.java new file mode 100644 index 0000000..c73a683 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/gui/GuiFillingTable.java @@ -0,0 +1,50 @@ +package jp.plusplus.fbs.gui;
+
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.tileentity.TileEntityExtractingFurnace;
+import jp.plusplus.fbs.tileentity.TileEntityFillingTable;
+import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.client.resources.I18n;
+import net.minecraft.inventory.Container;
+import net.minecraft.util.IIcon;
+import net.minecraft.util.ResourceLocation;
+import org.lwjgl.opengl.GL11;
+
+/**
+ * Createdby pluslus_Fon 2015/06/14.
+ */
+public class GuiFillingTable extends GuiContainer {
+ private TileEntityFillingTable entity;
+
+ public GuiFillingTable(Container p_i1072_1_, TileEntityFillingTable t) {
+ super(p_i1072_1_);
+ entity =t;
+ }
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(int par1, int par2){
+ String s=entity.getInventoryName();
+ this.fontRendererObj.drawString(s, this.xSize / 2 - this.fontRendererObj.getStringWidth(s) / 2, 6, 0x404040);
+ this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 0x404040);
+ }
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float v, int i, int i1) {
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+
+ this.mc.getTextureManager().bindTexture(new ResourceLocation(FBS.MODID, "textures/gui/fillingTable.png"));
+
+ int k = (this.width - this.xSize) / 2;
+ int l = (this.height - this.ySize) / 2;
+ this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
+ this.drawTexturedModalRect(k+76, l+35, 176, 0, entity.getProgressScaled(22), 15);
+
+ int amount = entity.tank.getFluidAmount();
+ if (amount > 0) {
+ IIcon icon = entity.getFluidIcon();
+ if (icon != null) {
+ int scale = 16 * amount / entity.tank.getCapacity();
+ GuiExtractingFurnace.drawFluid(this, k + 44, l + 69 - scale, icon, 16, scale);
+ }
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/gui/GuiHandler.class b/src/main/java/jp/plusplus/fbs/gui/GuiHandler.class Binary files differnew file mode 100644 index 0000000..0284291 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/gui/GuiHandler.class diff --git a/src/main/java/jp/plusplus/fbs/gui/GuiHandler.java b/src/main/java/jp/plusplus/fbs/gui/GuiHandler.java new file mode 100644 index 0000000..609a8ad --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/gui/GuiHandler.java @@ -0,0 +1,235 @@ +package jp.plusplus.fbs.gui;
+
+import cpw.mods.fml.common.network.IGuiHandler;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.Registry;
+import jp.plusplus.fbs.block.BlockCore;
+import jp.plusplus.fbs.container.*;
+import jp.plusplus.fbs.container.inventory.InventoryMagicCopy;
+import jp.plusplus.fbs.container.inventory.InventoryMagicTimeTrace;
+import jp.plusplus.fbs.container.spirit.ContainerSpiritLearn;
+import jp.plusplus.fbs.container.spirit.ContainerSpiritMain;
+import jp.plusplus.fbs.entity.EntityMagicAuthor;
+import jp.plusplus.fbs.event.wish.ContainerWish;
+import jp.plusplus.fbs.event.wish.GuiWish;
+import jp.plusplus.fbs.gui.spirit.GuiSpiritConfig;
+import jp.plusplus.fbs.gui.spirit.GuiSpiritLearn;
+import jp.plusplus.fbs.gui.spirit.GuiSpiritMain;
+import jp.plusplus.fbs.gui.spirit.GuiSpiritSkill;
+import jp.plusplus.fbs.pottery.GuiKiln;
+import jp.plusplus.fbs.pottery.GuiPottersWheel;
+import jp.plusplus.fbs.pottery.TileEntityKiln;
+import jp.plusplus.fbs.pottery.TileEntityPottersWheel;
+import jp.plusplus.fbs.pottery.usable.container.ContainerPotteryUsableBase;
+import jp.plusplus.fbs.pottery.usable.container.GuiPotteryUsableBase;
+import jp.plusplus.fbs.storage.ContainerMealTerminal;
+import jp.plusplus.fbs.storage.GuiMealTerminal;
+import jp.plusplus.fbs.storage.TileEntityMealTerminal;
+import jp.plusplus.fbs.tileentity.*;
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.AxisAlignedBB;
+import net.minecraft.world.World;
+import shift.mceconomy2.api.MCEconomyAPI;
+import shift.mceconomy2.gui.GuiShop;
+
+import java.util.List;
+
+/**
+ * Createdby pluslus_Fon 2015/06/08.
+ */
+public class GuiHandler implements IGuiHandler {
+ @Override
+ public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
+
+ if(ID==FBS.GUI_STAFF_ID){
+ return new ContainerStaff(player.inventory);
+ }
+ if(ID==FBS.GUI_MAGIC_COPY_ID){
+ TileEntity te=world.getTileEntity(x,y,z);
+ if(te instanceof TileEntityMagicCore){
+ return new ContainerMagic(player.inventory, new InventoryMagicCopy((TileEntityMagicCore)te, player));
+ }
+ }
+ if(ID==FBS.GUI_MAGIC_TIME_TRACE_ID){
+ TileEntity te=world.getTileEntity(x,y,z);
+ if(te instanceof TileEntityMagicCore){
+ return new ContainerMagic(player.inventory, new InventoryMagicTimeTrace((TileEntityMagicCore)te, player));
+ }
+ }
+ if(ID==FBS.GUI_ENCHANTMENT_ID){
+ return new ContainerTFKEnchantment(player);
+ }
+ if(ID==FBS.GUI_MAGIC_WARP_ID){
+ TileEntity te=world.getTileEntity(x,y,z);
+ if(te instanceof TileEntityMagicCore){
+ return new ContainerWarp(player);
+ }
+ }
+ if(ID==FBS.GUI_MAGIC_CONTRACT_ID){
+ TileEntity te=world.getTileEntity(x,y,z);
+ if(te instanceof TileEntityMagicCore){
+ return new ContainerContract(player);
+ }
+ }
+ if(ID==FBS.GUI_SPIRIT_MAIN_ID){
+ return new ContainerSpiritMain(player, 0);
+ }
+ if(ID==FBS.GUI_BASKET_ID){
+ return new ContainerBasket(player.inventory);
+ }
+ if(ID==FBS.GUI_SPIRIT_CONFIG_ID){
+ return new ContainerSpiritMain(player, 1);
+ }
+ if(ID==FBS.GUI_SPIRIT_LEARN_ID){
+ return new ContainerSpiritLearn(player);
+ }
+ if(ID==FBS.GUI_SPIRIT_SKILL_ID){
+ return new ContainerSpiritLearn(player);
+ }
+ if(ID==FBS.GUI_SHOP_AUTHOR_ID){
+ return new ContainerShopAuthor(player, MCEconomyAPI.getShop(Registry.shopAuthorId), world, null);
+ }
+ if(ID==FBS.GUI_MAGIC_POT_ID){
+ return new ContainerPotteryUsableBase(player);
+ }
+ if(ID==FBS.GUI_WISH_ID){
+ return new ContainerWish();
+ }
+
+ //-------------------------------------------------------
+ if(!world.blockExists(x,y,z)) return null;
+
+ Block b=world.getBlock(x,y,z);
+ if(b== BlockCore.bonfire){
+ return new ContainerBonfire(x,y,z, player);
+ }
+
+ TileEntity e=world.getTileEntity(x,y,z);
+ if(e instanceof TileEntityExtractingFurnace){
+ return new ContainerExtractingFurnace(player, (TileEntityExtractingFurnace)e);
+ }
+ if(e instanceof TileEntityFillingTable){
+ return new ContainerFillingTable(player, (TileEntityFillingTable)e);
+ }
+ if(e instanceof TileEntityFBSWorkbench){
+ return new ContainerFBSWorkbench(player, (TileEntityFBSWorkbench)e);
+ }
+ if(e instanceof TileEntityPottersWheel){
+ return new ContainerPottersWheel(player, (TileEntityPottersWheel)e);
+ }
+ if(e instanceof TileEntityKiln){
+ return new ContainerKiln(player, (TileEntityKiln)e);
+ }
+ if(e instanceof TileEntityAlchemyCauldron){
+ return new ContainerAlchemyCauldron(player, (TileEntityAlchemyCauldron)e);
+ }
+ if(e instanceof TileEntityMealTerminal){
+ return new ContainerMealTerminal(player, (TileEntityMealTerminal)e);
+ }
+
+ return null;
+ }
+
+ @Override
+ public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
+
+ if(ID== FBS.GUI_STAFF_ID){
+ return new GuiStaff(player.inventory);
+ }
+ if(ID==FBS.GUI_MAGIC_COPY_ID){
+ TileEntity te=world.getTileEntity(x,y,z);
+ if(te instanceof TileEntityMagicCore){
+ return new GuiMagic(new ContainerMagic(player.inventory, new InventoryMagicCopy((TileEntityMagicCore)te, player)));
+ }
+ }
+ if(ID==FBS.GUI_MAGIC_TIME_TRACE_ID){
+ TileEntity te=world.getTileEntity(x,y,z);
+ if(te instanceof TileEntityMagicCore){
+ return new GuiMagic(new ContainerMagic(player.inventory, new InventoryMagicTimeTrace((TileEntityMagicCore)te, player)));
+ }
+ }
+ if(ID==FBS.GUI_ENCHANTMENT_ID){
+ return new GuiEnchantment(new ContainerTFKEnchantment(player));
+ }
+ if(ID==FBS.GUI_MAGIC_WARP_ID){
+ TileEntity te=world.getTileEntity(x,y,z);
+ if(te instanceof TileEntityMagicCore){
+ return new GuiWarp(new ContainerWarp(player));
+ }
+ }
+ if(ID==FBS.GUI_MAGIC_CONTRACT_ID){
+ TileEntity te=world.getTileEntity(x,y,z);
+ if(te instanceof TileEntityMagicCore){
+ return new GuiContract(new ContainerContract(player));
+ }
+ }
+ if(ID==FBS.GUI_SPIRIT_MAIN_ID){
+ return new GuiSpiritMain(player);
+ }
+ if(ID==FBS.GUI_BASKET_ID){
+ return new GuiBasket(player.inventory);
+ }
+ if(ID==FBS.GUI_SPIRIT_CONFIG_ID){
+ return new GuiSpiritConfig(player);
+ }
+ if(ID==FBS.GUI_SPIRIT_LEARN_ID){
+ return new GuiSpiritLearn(player);
+ }
+ if(ID==FBS.GUI_SPIRIT_SKILL_ID){
+ return new GuiSpiritSkill(player);
+ }
+ if(ID==FBS.GUI_SHOP_AUTHOR_ID){
+ List list=world.getEntitiesWithinAABB(EntityMagicAuthor.class, AxisAlignedBB.getBoundingBox(x,y,z,x+1,y+1,z+1).expand(1,1,1));
+ for(int i=0;i<list.size();i++){
+ EntityMagicAuthor e=(EntityMagicAuthor)list.get(i);
+ if(true || e.getCustomer()==player){
+ GuiShop gui=new GuiShop(player, MCEconomyAPI.getShop(Registry.shopAuthorId), Registry.shopAuthorId, world);
+ gui.inventorySlots=new ContainerShopAuthor(player, MCEconomyAPI.getShop(Registry.shopAuthorId), world, null);
+ return gui;
+ }
+ }
+ return null;
+ }
+ if(ID==FBS.GUI_MAGIC_POT_ID){
+ return new GuiPotteryUsableBase(new ContainerPotteryUsableBase(player));
+ }
+ if(ID==FBS.GUI_WISH_ID){
+ return new GuiWish();
+ }
+
+ //-------------------------------------------------------
+ if(!world.blockExists(x,y,z)) return null;
+
+ Block b=world.getBlock(x,y,z);
+ if(b== BlockCore.bonfire){
+ return new GuiBonfire(new ContainerBonfire(x,y,z, player));
+ }
+
+ TileEntity e=world.getTileEntity(x,y,z);
+ if(e instanceof TileEntityExtractingFurnace){
+ return new GuiExtractingFurnace(new ContainerExtractingFurnace(player, (TileEntityExtractingFurnace)e), (TileEntityExtractingFurnace)e);
+ }
+ if(e instanceof TileEntityFillingTable){
+ return new GuiFillingTable(new ContainerFillingTable(player, (TileEntityFillingTable)e), (TileEntityFillingTable)e);
+ }
+ if(e instanceof TileEntityFBSWorkbench){
+ return new GuiWorkbench(new ContainerFBSWorkbench(player, (TileEntityFBSWorkbench)e), (TileEntityFBSWorkbench)e);
+ }
+ if(e instanceof TileEntityPottersWheel){
+ return new GuiPottersWheel(new ContainerPottersWheel(player, (TileEntityPottersWheel)e), (TileEntityPottersWheel)e);
+ }
+ if(e instanceof TileEntityKiln){
+ return new GuiKiln(new ContainerKiln(player, (TileEntityKiln)e), (TileEntityKiln)e);
+ }
+ if(e instanceof TileEntityAlchemyCauldron){
+ return new GuiAlchemyCauldron(new ContainerAlchemyCauldron(player, (TileEntityAlchemyCauldron)e), (TileEntityAlchemyCauldron)e);
+ }
+ if(e instanceof TileEntityMealTerminal){
+ return new GuiMealTerminal(new ContainerMealTerminal(player, (TileEntityMealTerminal)e));
+ }
+
+ return null;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/gui/GuiMagic.class b/src/main/java/jp/plusplus/fbs/gui/GuiMagic.class Binary files differnew file mode 100644 index 0000000..18839a7 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/gui/GuiMagic.class diff --git a/src/main/java/jp/plusplus/fbs/gui/GuiMagic.java b/src/main/java/jp/plusplus/fbs/gui/GuiMagic.java new file mode 100644 index 0000000..7aa751d --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/gui/GuiMagic.java @@ -0,0 +1,40 @@ +package jp.plusplus.fbs.gui;
+
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.container.ContainerMagic;
+import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.client.resources.I18n;
+import net.minecraft.inventory.Container;
+import net.minecraft.util.IIcon;
+import net.minecraft.util.ResourceLocation;
+import org.lwjgl.opengl.GL11;
+
+/**
+ * Created by pluslus_F on 2015/06/18.
+ */
+public class GuiMagic extends GuiContainer {
+ ContainerMagic cm;
+
+ public GuiMagic(ContainerMagic p_i1072_1_) {
+ super(p_i1072_1_);
+ cm=p_i1072_1_;
+ }
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(int par1, int par2){
+ String s=cm.inventory.getInventoryName();
+ this.fontRendererObj.drawString(s, this.xSize / 2 - this.fontRendererObj.getStringWidth(s) / 2, 6, 0x404040);
+ this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 0x404040);
+ }
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float v, int i, int i1) {
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+
+ this.mc.getTextureManager().bindTexture(cm.inventory.getResource());
+
+ int k = (this.width - this.xSize) / 2;
+ int l = (this.height - this.ySize) / 2;
+ this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
+ this.drawTexturedModalRect(k+cm.inventory.getProgressX(), l+cm.inventory.getProgressY(), 176, 0, cm.inventory.getProgressScaled(22), 15);
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/gui/GuiShopAuthor.class b/src/main/java/jp/plusplus/fbs/gui/GuiShopAuthor.class Binary files differnew file mode 100644 index 0000000..ef3dfce --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/gui/GuiShopAuthor.class diff --git a/src/main/java/jp/plusplus/fbs/gui/GuiShopAuthor.java b/src/main/java/jp/plusplus/fbs/gui/GuiShopAuthor.java new file mode 100644 index 0000000..a5079df --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/gui/GuiShopAuthor.java @@ -0,0 +1,18 @@ +package jp.plusplus.fbs.gui;
+
+import jp.plusplus.fbs.container.ContainerShopAuthor;
+import jp.plusplus.fbs.entity.EntityMagicAuthor;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.world.World;
+import shift.mceconomy2.api.shop.IShop;
+import shift.mceconomy2.gui.GuiShop;
+
+/**
+ * Created by plusplus_F on 2016/02/24.
+ */
+public class GuiShopAuthor extends GuiShop {
+ public GuiShopAuthor(EntityPlayer entityPlayer, IShop productList, int id, World world, EntityMagicAuthor author) {
+ super(entityPlayer, productList, id, world);
+ inventorySlots=new ContainerShopAuthor(entityPlayer, productList, world, author);
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/gui/GuiStaff.class b/src/main/java/jp/plusplus/fbs/gui/GuiStaff.class Binary files differnew file mode 100644 index 0000000..3d72b47 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/gui/GuiStaff.class diff --git a/src/main/java/jp/plusplus/fbs/gui/GuiStaff.java b/src/main/java/jp/plusplus/fbs/gui/GuiStaff.java new file mode 100644 index 0000000..9c99286 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/gui/GuiStaff.java @@ -0,0 +1,49 @@ +package jp.plusplus.fbs.gui;
+
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.container.ContainerStaff;
+import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.client.resources.I18n;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.ResourceLocation;
+import org.lwjgl.opengl.GL11;
+
+/**
+ * Createdby pluslus_Fon 2015/06/15.
+ */
+public class GuiStaff extends GuiContainer {
+ private static final ResourceLocation[] gui1 = {
+ new ResourceLocation(FBS.MODID + ":textures/gui/staff.png"),
+ new ResourceLocation(FBS.MODID + ":textures/gui/staffResona.png")
+ };
+ private ItemStack cItem;
+
+ public GuiStaff(InventoryPlayer inventoryPlayer) {
+ super(new ContainerStaff(inventoryPlayer));
+ cItem=inventoryPlayer.getCurrentItem();
+ }
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(int x, int p_146979_2_) {
+ String s=I18n.format(cItem.getItem().getUnlocalizedName() + ".name");
+ this.fontRendererObj.drawString(s, this.xSize / 2 - this.fontRendererObj.getStringWidth(s) / 2, 6, 4210752);
+ this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
+ }
+
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
+ ContainerStaff cs=(ContainerStaff)inventorySlots;
+
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ this.mc.getTextureManager().bindTexture(gui1[cs.inventory.bookNum-1]);
+ int k = (this.width - this.xSize) / 2;
+ int l = (this.height - this.ySize) / 2;
+ this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
+
+ int gn=cs.inventory.gemNum;
+ for(int i=0;i<5-gn;i++){
+ this.drawTexturedModalRect(k+116-18*i, l+53, 176, 0, 16, 16);
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/gui/GuiWarp.class b/src/main/java/jp/plusplus/fbs/gui/GuiWarp.class Binary files differnew file mode 100644 index 0000000..462d6ae --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/gui/GuiWarp.class diff --git a/src/main/java/jp/plusplus/fbs/gui/GuiWarp.java b/src/main/java/jp/plusplus/fbs/gui/GuiWarp.java new file mode 100644 index 0000000..4c4fc3a --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/gui/GuiWarp.java @@ -0,0 +1,181 @@ +package jp.plusplus.fbs.gui;
+
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.container.ContainerWarp;
+import jp.plusplus.fbs.exprop.FBSEntityProperties;
+import jp.plusplus.fbs.gui.button.GuiButtonDestination;
+import jp.plusplus.fbs.gui.button.GuiButtonWarp;
+import jp.plusplus.fbs.packet.MessageGuiButtonDecide;
+import jp.plusplus.fbs.packet.MessageGuiButtonWithString;
+import jp.plusplus.fbs.packet.PacketHandler;
+import net.minecraft.client.gui.GuiButton;
+import net.minecraft.client.gui.GuiTextField;
+import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.util.ResourceLocation;
+import net.minecraft.util.StatCollector;
+import org.lwjgl.input.Keyboard;
+import org.lwjgl.opengl.GL11;
+
+import java.util.ArrayList;
+
+/**
+ * Created by plusplus_F on 2015/10/22.
+ */
+public class GuiWarp extends GuiContainer {
+ public static final ResourceLocation rl = new ResourceLocation(FBS.MODID+":textures/gui/magicWarp.png");
+ public static final int PAGE_ITEM_MAX=11;
+ protected ContainerWarp con;
+ protected GuiButtonWarp buttonPrev;
+ protected GuiButtonWarp buttonNext;
+ protected GuiButtonWarp buttonDecide;
+ protected GuiButtonWarp buttonRename;
+ protected GuiButtonDestination[] buttons=new GuiButtonDestination[PAGE_ITEM_MAX];
+ protected GuiTextField textField;
+ protected int page;
+
+ protected ArrayList<FBSEntityProperties.WarpPosition> destinations;
+
+ public GuiWarp(ContainerWarp p_i1072_1_) {
+ super(p_i1072_1_);
+ con=p_i1072_1_;
+ }
+
+ @Override
+ public void initGui() {
+ super.initGui();
+ Keyboard.enableRepeatEvents(true);
+ int i = (this.width - this.xSize) / 2;
+ int j = (this.height - this.ySize) / 2;
+ this.allowUserInput = true;
+ page=0;
+
+ buttonPrev=new GuiButtonWarp(0, i+15, j+16, "");
+ buttonNext=new GuiButtonWarp(1, i+115, j+16, "");
+ buttonDecide=new GuiButtonWarp(2, i+128, j+16, "Decide");
+ buttonDecide.enabled=false;
+ buttonRename=new GuiButtonWarp(3, i+128, j+48, "Rename");
+ buttonRename.enabled=false;
+
+ buttonList.add(buttonPrev);
+ buttonList.add(buttonNext);
+ buttonList.add(buttonDecide);
+ buttonList.add(buttonRename);
+
+ for(int k=0;k<PAGE_ITEM_MAX;k++){
+ buttons[k]=new GuiButtonDestination(4+k, i+27, j+18+12*k);
+ buttonList.add(buttons[k]);
+ }
+
+ textField=new GuiTextField(fontRendererObj, i+118, j+34, 51, 11);
+ textField.setTextColor(-1);
+ textField.setDisabledTextColour(-1);
+ textField.setEnableBackgroundDrawing(false);
+ textField.setMaxStringLength(40);
+
+ destinations=FBSEntityProperties.get(con.player).getDestinations();
+ changePage(0);
+ }
+
+ @Override
+ public void onGuiClosed(){
+ super.onGuiClosed();
+ Keyboard.enableRepeatEvents(false);
+ }
+
+ @Override
+ protected void actionPerformed(GuiButton p_146284_1_) {
+ if(p_146284_1_==buttonPrev && page>1) changePage(-1);
+ else if(p_146284_1_==buttonNext && (page+1)*PAGE_ITEM_MAX<=destinations.size()) changePage(1);
+
+ int i=getSelectedIndex();
+ if(p_146284_1_==buttonDecide){
+ PacketHandler.INSTANCE.sendToServer(new MessageGuiButtonDecide(con.player, destinations.get(i+page*PAGE_ITEM_MAX)));
+ }
+ if(p_146284_1_==buttonRename && i!=-1){
+ if(i!=-1){
+ PacketHandler.INSTANCE.sendToServer(new MessageGuiButtonWithString(i, textField.getText()));
+ destinations.get(i).setName(textField.getText());
+ buttons[i].setDisplayString(textField.getText());
+ textField.setText("");
+ }
+ }
+ if(p_146284_1_ instanceof GuiButtonDestination){
+ for(int k=0;k<PAGE_ITEM_MAX;k++){
+ buttons[k].selected=false;
+ }
+ ((GuiButtonDestination)p_146284_1_).selected=true;
+ buttonDecide.enabled=true;
+ buttonRename.enabled=false;
+ textField.setText("");
+ }
+ }
+
+ @Override
+ public void updateScreen() {
+ super.updateScreen();
+ }
+
+ @Override
+ protected void mouseClicked(int p_73864_1_, int p_73864_2_, int p_73864_3_) {
+ super.mouseClicked(p_73864_1_, p_73864_2_, p_73864_3_);
+ textField.mouseClicked(p_73864_1_, p_73864_2_, p_73864_3_);
+ }
+
+ @Override
+ protected void keyTyped(char p_73869_1_, int p_73869_2_) {
+ if(!textField.textboxKeyTyped(p_73869_1_, p_73869_2_)){
+ super.keyTyped(p_73869_1_, p_73869_2_);
+ }
+ else{
+ buttonRename.enabled=!textField.getText().isEmpty();
+ }
+ }
+
+ @Override
+ public void drawScreen(int p_73863_1_, int p_73863_2_, float p_73863_3_) {
+ super.drawScreen(p_73863_1_, p_73863_2_, p_73863_3_);
+ GL11.glDisable(GL11.GL_LIGHTING);
+ GL11.glDisable(GL11.GL_BLEND);
+ textField.drawTextBox();
+ }
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(int par1, int par2){
+ super.drawGuiContainerForegroundLayer(par1, par2);
+ String s= StatCollector.translateToLocal("book.fbs.warp.title");
+ this.fontRendererObj.drawString(s, this.xSize / 2 - this.fontRendererObj.getStringWidth(s) / 2, 6, 0x404040);
+ //this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 0x404040);
+ }
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float v, int i, int i1) {
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+
+ this.mc.getTextureManager().bindTexture(rl);
+
+ int k = (this.width - this.xSize) / 2;
+ int l = (this.height - this.ySize) / 2;
+ this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
+ }
+
+ protected int getSelectedIndex(){
+ for(int i=0;i<PAGE_ITEM_MAX;i++){
+ if(buttons[i].selected) return i;
+ }
+ return -1;
+ }
+ protected void changePage(int add){
+ page+=add;
+ for(int i=0;i<PAGE_ITEM_MAX;i++){
+ buttons[i].enabled=false;
+ buttons[i].selected=false;
+ }
+ for(int i=0;i<PAGE_ITEM_MAX && page*PAGE_ITEM_MAX+i<destinations.size();i++){
+ buttons[i].enabled=true;
+ buttons[i].setDisplayString(destinations.get(page*PAGE_ITEM_MAX+i).getName());
+ }
+ buttonDecide.enabled=false;
+ buttonRename.enabled=false;
+ buttonPrev.enabled=(page>0);
+ buttonNext.enabled=((page+1)*PAGE_ITEM_MAX<destinations.size());
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/gui/GuiWorkbench.class b/src/main/java/jp/plusplus/fbs/gui/GuiWorkbench.class Binary files differnew file mode 100644 index 0000000..c5b53ae --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/gui/GuiWorkbench.class diff --git a/src/main/java/jp/plusplus/fbs/gui/GuiWorkbench.java b/src/main/java/jp/plusplus/fbs/gui/GuiWorkbench.java new file mode 100644 index 0000000..bdb9267 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/gui/GuiWorkbench.java @@ -0,0 +1,56 @@ +package jp.plusplus.fbs.gui;
+
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.tileentity.TileEntityFBSWorkbench;
+import jp.plusplus.fbs.tileentity.TileEntityFillingTable;
+import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.client.resources.I18n;
+import net.minecraft.inventory.Container;
+import net.minecraft.util.IIcon;
+import net.minecraft.util.ResourceLocation;
+import org.lwjgl.opengl.GL11;
+
+/**
+ * Createdby pluslus_Fon 2015/06/14.
+ */
+public class GuiWorkbench extends GuiContainer {
+ private TileEntityFBSWorkbench entity;
+
+ public GuiWorkbench(Container p_i1072_1_, TileEntityFBSWorkbench t) {
+ super(p_i1072_1_);
+ entity =t;
+ ySize=185;
+ }
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(int par1, int par2){
+ String s=entity.getInventoryName();
+ this.fontRendererObj.drawString(s, this.xSize / 2 - this.fontRendererObj.getStringWidth(s) / 2, 6, 0x404040);
+ this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 0x404040);
+
+ /*
+ if(!entity.tank.isEmpty()){
+ this.fontRendererObj.drawString(entity.tank.getFluidName()+entity.tank.getFluidAmount()+"mb", 8, this.ySize - 116 + 2, 0x404040);
+ }
+ */
+ }
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float v, int i, int i1) {
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+
+ this.mc.getTextureManager().bindTexture(new ResourceLocation(FBS.MODID, "textures/gui/crafting.png"));
+
+ int k = (this.width - this.xSize) / 2;
+ int l = (this.height - this.ySize) / 2;
+ this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
+
+ int amount = entity.tank.getFluidAmount();
+ if (amount > 0) {
+ IIcon icon = entity.getFluidIcon();
+ if (icon != null) {
+ int scale = 16 * amount / entity.tank.getCapacity();
+ GuiExtractingFurnace.drawFluid(this, k + 30, l + 87 - scale, icon, 16, scale);
+ }
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/gui/button/GuiButtonDestination.class b/src/main/java/jp/plusplus/fbs/gui/button/GuiButtonDestination.class Binary files differnew file mode 100644 index 0000000..ac4e2ed --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/gui/button/GuiButtonDestination.class diff --git a/src/main/java/jp/plusplus/fbs/gui/button/GuiButtonDestination.java b/src/main/java/jp/plusplus/fbs/gui/button/GuiButtonDestination.java new file mode 100644 index 0000000..ea00477 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/gui/button/GuiButtonDestination.java @@ -0,0 +1,35 @@ +package jp.plusplus.fbs.gui.button;
+
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.FontRenderer;
+import net.minecraft.client.gui.GuiButton;
+import net.minecraft.client.renderer.OpenGlHelper;
+import org.lwjgl.opengl.GL11;
+
+/**
+ * Created by plusplus_F on 2015/10/22.
+ */
+public class GuiButtonDestination extends GuiButton {
+ public boolean selected;
+
+ public GuiButtonDestination(int p_i1020_1_, int p_i1020_2_, int p_i1020_3_) {
+ super(p_i1020_1_, p_i1020_2_, p_i1020_3_,86 ,20, "");
+ enabled=false;
+ }
+
+ public void setDisplayString(String str){
+ displayString=str;
+ enabled=!str.isEmpty();
+ }
+
+ @Override
+ public void drawButton(Minecraft p_146112_1_, int p_146112_2_, int p_146112_3_) {
+ if (this.enabled && !displayString.isEmpty()) {
+ FontRenderer fontrenderer = p_146112_1_.fontRenderer;
+ this.mouseDragged(p_146112_1_, p_146112_2_, p_146112_3_);
+ int col=selected?0xffffff:0x404040;
+
+ this.drawCenteredString(fontrenderer, this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - 16) / 2, col);
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/gui/button/GuiButtonEnchantment.class b/src/main/java/jp/plusplus/fbs/gui/button/GuiButtonEnchantment.class Binary files differnew file mode 100644 index 0000000..d4af4de --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/gui/button/GuiButtonEnchantment.class diff --git a/src/main/java/jp/plusplus/fbs/gui/button/GuiButtonEnchantment.java b/src/main/java/jp/plusplus/fbs/gui/button/GuiButtonEnchantment.java new file mode 100644 index 0000000..e25475d --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/gui/button/GuiButtonEnchantment.java @@ -0,0 +1,35 @@ +package jp.plusplus.fbs.gui.button;
+
+import jp.plusplus.fbs.FBS;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.GuiButton;
+import net.minecraft.util.ResourceLocation;
+import org.lwjgl.opengl.GL11;
+
+/**
+ * Created by plusplus_F on 2015/10/21.
+ */
+public class GuiButtonEnchantment extends GuiButton {
+ public static final ResourceLocation rl = new ResourceLocation(FBS.MODID+":textures/gui/enchant.png");
+
+ public GuiButtonEnchantment(int id, int x, int y) {
+ super(id, x, y, 28, 23, "");
+ }
+
+ @Override
+ public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
+ if (this.visible) {
+ par1Minecraft.getTextureManager().bindTexture(rl);
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ boolean onMouse = par2 >= this.xPosition && par3 >= this.yPosition && par2 < this.xPosition + this.width && par3 < this.yPosition + this.height;
+
+ int drawX = 176;
+ int drawY = 0;
+
+ if (!this.enabled) drawY += height * 2;
+ else if (onMouse) drawY += height;
+
+ this.drawTexturedModalRect(this.xPosition, this.yPosition, drawX, drawY, this.width, this.height);
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/gui/button/GuiButtonSpiritArrow.class b/src/main/java/jp/plusplus/fbs/gui/button/GuiButtonSpiritArrow.class Binary files differnew file mode 100644 index 0000000..e42576a --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/gui/button/GuiButtonSpiritArrow.class diff --git a/src/main/java/jp/plusplus/fbs/gui/button/GuiButtonSpiritArrow.java b/src/main/java/jp/plusplus/fbs/gui/button/GuiButtonSpiritArrow.java new file mode 100644 index 0000000..89e342c --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/gui/button/GuiButtonSpiritArrow.java @@ -0,0 +1,43 @@ +package jp.plusplus.fbs.gui.button;
+
+import jp.plusplus.fbs.FBS;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.GuiButton;
+import net.minecraft.util.ResourceLocation;
+import org.lwjgl.opengl.GL11;
+
+/**
+ * Created by plusplus_F on 2015/10/22.
+ */
+public class GuiButtonSpiritArrow extends GuiButton {
+ public static final ResourceLocation rl = new ResourceLocation(FBS.MODID+":textures/gui/spiritConfig.png");
+ public boolean selected;
+
+ public GuiButtonSpiritArrow(int id, int x, int y) {
+ super(id, x, y, 10, 15, "");
+ }
+
+ @Override
+ public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
+ if (this.visible) {
+ par1Minecraft.getTextureManager().bindTexture(rl);
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ boolean onMouse = par2 >= this.xPosition && par3 >= this.yPosition && par2 < this.xPosition + this.width && par3 < this.yPosition + this.height;
+
+ int drawX = 176;
+ int drawY = 15*id;
+
+ if(id<2){
+ if (!this.enabled) drawX += width * 2;
+ else if (onMouse) drawX += width;
+ }
+ else{
+ if (!this.enabled) drawY += height * 2;
+ else if (onMouse) drawY += height;
+ }
+
+ //selected?0xffffff:0x404040
+ this.drawTexturedModalRect(this.xPosition, this.yPosition, drawX, drawY, this.width, this.height);
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/gui/button/GuiButtonSpiritCheckBox.class b/src/main/java/jp/plusplus/fbs/gui/button/GuiButtonSpiritCheckBox.class Binary files differnew file mode 100644 index 0000000..257d8b2 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/gui/button/GuiButtonSpiritCheckBox.class diff --git a/src/main/java/jp/plusplus/fbs/gui/button/GuiButtonSpiritCheckBox.java b/src/main/java/jp/plusplus/fbs/gui/button/GuiButtonSpiritCheckBox.java new file mode 100644 index 0000000..5ebd4e1 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/gui/button/GuiButtonSpiritCheckBox.java @@ -0,0 +1,39 @@ +package jp.plusplus.fbs.gui.button;
+
+import jp.plusplus.fbs.FBS;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.GuiButton;
+import net.minecraft.util.ResourceLocation;
+import net.minecraft.util.StatCollector;
+import org.lwjgl.opengl.GL11;
+
+/**
+ * Created by plusplus_F on 2015/11/14.
+ */
+public class GuiButtonSpiritCheckBox extends GuiButton {
+ public static final ResourceLocation rl = new ResourceLocation(FBS.MODID+":textures/gui/spiritConfig.png");
+ public boolean checked;
+ public String keyString;
+
+ public GuiButtonSpiritCheckBox(int id, int x, int y, String str) {
+ super(id, x, y, 10, 10, StatCollector.translateToLocal("spirit.config.fbs."+str));
+ checked=false;
+ keyString=str;
+ }
+
+ @Override
+ public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
+ if (this.visible) {
+ par1Minecraft.getTextureManager().bindTexture(rl);
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ int drawX = 176;
+ int drawY = 48;
+
+ if(checked) drawY+=10;
+
+ this.drawTexturedModalRect(this.xPosition, this.yPosition, drawX, drawY, this.width, this.height);
+ par1Minecraft.fontRenderer.drawString(displayString, xPosition + 11, yPosition + 1, 0x404040);
+ //drawString(par1Minecraft.fontRenderer, displayString, xPosition+11, yPosition+1, 0x404040);
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/gui/button/GuiButtonSpiritLearn.class b/src/main/java/jp/plusplus/fbs/gui/button/GuiButtonSpiritLearn.class Binary files differnew file mode 100644 index 0000000..de5b8c1 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/gui/button/GuiButtonSpiritLearn.class diff --git a/src/main/java/jp/plusplus/fbs/gui/button/GuiButtonSpiritLearn.java b/src/main/java/jp/plusplus/fbs/gui/button/GuiButtonSpiritLearn.java new file mode 100644 index 0000000..280fcbe --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/gui/button/GuiButtonSpiritLearn.java @@ -0,0 +1,50 @@ +package jp.plusplus.fbs.gui.button;
+
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.spirit.SkillManager;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.GuiButton;
+import net.minecraft.util.ResourceLocation;
+import net.minecraft.util.StatCollector;
+import org.lwjgl.opengl.GL11;
+
+/**
+ * Created by plusplus_F on 2015/11/28.
+ */
+public class GuiButtonSpiritLearn extends GuiButton {
+ public static final ResourceLocation rl = new ResourceLocation(FBS.MODID+":textures/gui/spiritConfig.png");
+
+ public String[] skillStr=new String[0];
+ public String skillName="";
+
+ public GuiButtonSpiritLearn(int id, int x, int y, String str) {
+ super(id, x, y, 34, 16, StatCollector.translateToLocal("spirit.gui.fbs.button."+str));
+ }
+
+ @Override
+ public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
+ if (this.visible) {
+ par1Minecraft.getTextureManager().bindTexture(rl);
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ boolean onMouse = par2 >= this.xPosition && par3 >= this.yPosition && par2 < this.xPosition + this.width && par3 < this.yPosition + this.height;
+
+ int drawX = 186;
+ int drawY = 48;
+
+ if(!enabled) drawY+=32;
+ else if(onMouse) drawY+=16;
+
+ this.drawTexturedModalRect(this.xPosition, this.yPosition, drawX, drawY, this.width, this.height);
+ drawCenteredString(par1Minecraft.fontRenderer, displayString, xPosition + width / 2, yPosition + (this.height - 8) / 2, enabled? 0xffffff:0xa0a0a0);
+
+ for(int i=0;i<skillStr.length;i++){
+ par1Minecraft.fontRenderer.drawString(skillStr[i], xPosition - 120, yPosition + (this.height - 8) / 2-3+par1Minecraft.fontRenderer.FONT_HEIGHT*i, 0x404040);
+ }
+ }
+ }
+
+ public void setSkill(SkillManager.SkillEntry entry, int lv) {
+ skillStr=entry.getString(lv).split("\n");
+ skillName=SkillManager.getSkill(entry.getSkillId()).getName();
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/gui/button/GuiButtonSpiritLearnDummy.class b/src/main/java/jp/plusplus/fbs/gui/button/GuiButtonSpiritLearnDummy.class Binary files differnew file mode 100644 index 0000000..7ffcb50 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/gui/button/GuiButtonSpiritLearnDummy.class diff --git a/src/main/java/jp/plusplus/fbs/gui/button/GuiButtonSpiritLearnDummy.java b/src/main/java/jp/plusplus/fbs/gui/button/GuiButtonSpiritLearnDummy.java new file mode 100644 index 0000000..255f196 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/gui/button/GuiButtonSpiritLearnDummy.java @@ -0,0 +1,31 @@ +package jp.plusplus.fbs.gui.button;
+
+import jp.plusplus.fbs.spirit.SkillManager;
+import net.minecraft.client.Minecraft;
+import org.lwjgl.opengl.GL11;
+
+/**
+ * Created by plusplus_F on 2015/11/29.
+ */
+public class GuiButtonSpiritLearnDummy extends GuiButtonSpiritLearn {
+ public GuiButtonSpiritLearnDummy(int id, int x, int y, String str) {
+ super(id, x, y, str);
+ }
+
+ @Override
+ public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
+ if (this.visible) {
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ par1Minecraft.fontRenderer.drawString(skillStr[0], xPosition - 120, yPosition + (this.height - 8) / 2 -3, 0x404040);
+ }
+ }
+
+ public void setSkill(SkillManager.SkillData data) {
+ skillStr=new String[]{data.getString()};
+ skillName=data.getSkill().getName();
+ }
+ @Override
+ public void setSkill(SkillManager.SkillEntry entry, int lv){
+
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/gui/button/GuiButtonSpiritMain.class b/src/main/java/jp/plusplus/fbs/gui/button/GuiButtonSpiritMain.class Binary files differnew file mode 100644 index 0000000..fa31022 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/gui/button/GuiButtonSpiritMain.class diff --git a/src/main/java/jp/plusplus/fbs/gui/button/GuiButtonSpiritMain.java b/src/main/java/jp/plusplus/fbs/gui/button/GuiButtonSpiritMain.java new file mode 100644 index 0000000..2033c8f --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/gui/button/GuiButtonSpiritMain.java @@ -0,0 +1,124 @@ +package jp.plusplus.fbs.gui.button;
+
+import jp.plusplus.fbs.FBS;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.FontRenderer;
+import net.minecraft.client.gui.GuiButton;
+import net.minecraft.client.renderer.RenderHelper;
+import net.minecraft.util.ResourceLocation;
+import net.minecraft.util.StatCollector;
+import org.lwjgl.opengl.GL11;
+import org.lwjgl.opengl.GL12;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * Created by plusplus_F on 2015/11/14.
+ */
+public class GuiButtonSpiritMain extends GuiButton {
+ public static final ResourceLocation rl = new ResourceLocation(FBS.MODID+":textures/gui/spiritMain.png");
+ public String rowString;
+ public String character;
+
+ public GuiButtonSpiritMain(int id, int x, int y, String str) {
+ this(id, x, y, str, "");
+ }
+ public GuiButtonSpiritMain(int id, int x, int y, String str, String character){
+ super(id, x, y, 48, 16, StatCollector.translateToLocal("spirit.gui.fbs.button."+str));
+ rowString=str;
+ this.character=character;
+ }
+
+ @Override
+ public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
+ if (this.visible) {
+ par1Minecraft.getTextureManager().bindTexture(rl);
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ boolean onMouse = par2 >= this.xPosition && par3 >= this.yPosition && par2 < this.xPosition + this.width && par3 < this.yPosition + this.height;
+
+ int drawX = 176;
+ int drawY = 0;
+
+ if(!enabled) drawY=32;
+ else if(onMouse) drawY=16;
+
+ this.drawTexturedModalRect(this.xPosition, this.yPosition, drawX, drawY, this.width, this.height);
+ drawCenteredString(par1Minecraft.fontRenderer, displayString, xPosition + width / 2, yPosition + (this.height - 8) / 2, enabled? 0xffffff:0xa0a0a0);
+ }
+ }
+
+
+ public void drawHoveringText(List p_146283_1_, int p_146283_2_, int p_146283_3_, FontRenderer font) {
+ if (!p_146283_1_.isEmpty()) {
+ GL11.glDisable(GL12.GL_RESCALE_NORMAL);
+ RenderHelper.disableStandardItemLighting();
+ GL11.glDisable(GL11.GL_LIGHTING);
+ GL11.glDisable(GL11.GL_DEPTH_TEST);
+ int width = 0;
+ Iterator iterator = p_146283_1_.iterator();
+
+ while (iterator.hasNext()) {
+ String s = (String) iterator.next();
+ int l = font.getStringWidth(s);
+
+ if (l > width) {
+ width = l;
+ }
+ }
+
+ int xMin = p_146283_2_ + 12;
+ int yMin = p_146283_3_ - 12;
+ int i1 = 8;
+
+ if (p_146283_1_.size() > 1) {
+ i1 += 2 + (p_146283_1_.size() - 1) * 10;
+ }
+
+ /*
+ if (xMin + width > this.width) {
+ xMin -= 28 + width;
+ }
+
+ if (yMin + i1 + 6 > this.height) {
+ yMin = this.height - i1 - 6;
+ }
+ */
+
+
+ //this.zLevel = 300.0F;
+ //itemRender.zLevel = 300.0F;
+ int color = -267386864;
+ this.drawGradientRect(xMin - 3, yMin - 4, xMin + width + 3, yMin - 3, color, color);
+ this.drawGradientRect(xMin - 3, yMin + i1 + 3, xMin + width + 3, yMin + i1 + 4, color, color);
+ this.drawGradientRect(xMin - 3, yMin - 3, xMin + width + 3, yMin + i1 + 3, color, color);
+ this.drawGradientRect(xMin - 4, yMin - 3, xMin - 3, yMin + i1 + 3, color, color);
+ this.drawGradientRect(xMin + width + 3, yMin - 3, xMin + width + 4, yMin + i1 + 3, color, color);
+ int k1 = 1347420415;
+ int l1 = (k1 & 16711422) >> 1 | k1 & -16777216;
+ this.drawGradientRect(xMin - 3, yMin - 3 + 1, xMin - 3 + 1, yMin + i1 + 3 - 1, k1, l1);
+ this.drawGradientRect(xMin + width + 2, yMin - 3 + 1, xMin + width + 3, yMin + i1 + 3 - 1, k1, l1);
+ this.drawGradientRect(xMin - 3, yMin - 3, xMin + width + 3, yMin - 3 + 1, k1, k1);
+ this.drawGradientRect(xMin - 3, yMin + i1 + 2, xMin + width + 3, yMin + i1 + 3, l1, l1);
+
+ for (int i2 = 0; i2 < p_146283_1_.size(); ++i2) {
+ String s1 = (String) p_146283_1_.get(i2);
+ font.drawStringWithShadow(s1, xMin, yMin, -1);
+
+ if (i2 == 0) {
+ yMin += 2;
+ }
+
+ yMin += 10;
+ }
+
+ //this.zLevel = 0.0F;
+ //itemRender.zLevel = 0.0F;
+ GL11.glEnable(GL11.GL_LIGHTING);
+ GL11.glEnable(GL11.GL_DEPTH_TEST);
+ RenderHelper.enableStandardItemLighting();
+ GL11.glEnable(GL12.GL_RESCALE_NORMAL);
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/gui/button/GuiButtonWarp.class b/src/main/java/jp/plusplus/fbs/gui/button/GuiButtonWarp.class Binary files differnew file mode 100644 index 0000000..7d0a259 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/gui/button/GuiButtonWarp.class diff --git a/src/main/java/jp/plusplus/fbs/gui/button/GuiButtonWarp.java b/src/main/java/jp/plusplus/fbs/gui/button/GuiButtonWarp.java new file mode 100644 index 0000000..7594662 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/gui/button/GuiButtonWarp.java @@ -0,0 +1,44 @@ +package jp.plusplus.fbs.gui.button;
+
+import jp.plusplus.fbs.FBS;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.GuiButton;
+import net.minecraft.util.ResourceLocation;
+import org.lwjgl.opengl.GL11;
+
+/**
+ * Created by plusplus_F on 2015/10/22.
+ */
+public class GuiButtonWarp extends GuiButton {
+ public static final ResourceLocation rl = new ResourceLocation(FBS.MODID+":textures/gui/magicWarp.png");
+ public boolean selected;
+
+ public GuiButtonWarp(int id, int x, int y, String str) {
+ super(id, x, y, id<2?10:42, 15, str);
+ }
+
+ @Override
+ public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
+ if (this.visible) {
+ par1Minecraft.getTextureManager().bindTexture(rl);
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ boolean onMouse = par2 >= this.xPosition && par3 >= this.yPosition && par2 < this.xPosition + this.width && par3 < this.yPosition + this.height;
+
+ int drawX = 176;
+ int drawY = (id<2?15*id:45*(id-2)+30);
+
+ if(id<2){
+ if (!this.enabled) drawX += width * 2;
+ else if (onMouse) drawX += width;
+ }
+ else{
+ if (!this.enabled) drawY += height * 2;
+ else if (onMouse) drawY += height;
+ }
+
+ //selected?0xffffff:0x404040
+ this.drawTexturedModalRect(this.xPosition, this.yPosition, drawX, drawY, this.width, this.height);
+ drawCenteredString(par1Minecraft.fontRenderer, displayString, xPosition+width/2, yPosition+(this.height - 8) / 2, 0xffffff);
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/gui/spirit/GuiSpiritConfig.class b/src/main/java/jp/plusplus/fbs/gui/spirit/GuiSpiritConfig.class Binary files differnew file mode 100644 index 0000000..5ad6f25 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/gui/spirit/GuiSpiritConfig.class diff --git a/src/main/java/jp/plusplus/fbs/gui/spirit/GuiSpiritConfig.java b/src/main/java/jp/plusplus/fbs/gui/spirit/GuiSpiritConfig.java new file mode 100644 index 0000000..e1a224c --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/gui/spirit/GuiSpiritConfig.java @@ -0,0 +1,107 @@ +package jp.plusplus.fbs.gui.spirit;
+
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.container.spirit.ContainerSpiritMain;
+import jp.plusplus.fbs.gui.button.GuiButtonSpiritCheckBox;
+import jp.plusplus.fbs.gui.button.GuiButtonSpiritMain;
+import jp.plusplus.fbs.packet.MessageGuiButton;
+import jp.plusplus.fbs.packet.MessageGuiButtonWithNBT;
+import jp.plusplus.fbs.packet.MessageGuiButtonWithString;
+import jp.plusplus.fbs.packet.PacketHandler;
+import jp.plusplus.fbs.spirit.ISpiritTool;
+import jp.plusplus.fbs.spirit.SpiritStatus;
+import net.minecraft.client.gui.GuiButton;
+import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.ResourceLocation;
+import net.minecraft.util.StatCollector;
+import org.lwjgl.opengl.GL11;
+
+import java.util.ArrayList;
+
+/**
+ * Created by plusplus_F on 2015/11/14.
+ */
+public class GuiSpiritConfig extends GuiContainer{
+ public static final ResourceLocation rl = new ResourceLocation(FBS.MODID+":textures/gui/spiritConfig.png");
+
+ public ItemStack tool;
+ public SpiritStatus status;
+ public SpiritStatus.Configuration configuration;
+ public ISpiritTool spiritTool;
+
+ private GuiButtonSpiritMain ok;
+ private GuiButtonSpiritMain cancel;
+ private ArrayList<GuiButtonSpiritCheckBox> checks=new ArrayList<GuiButtonSpiritCheckBox>();
+
+ public GuiSpiritConfig(EntityPlayer player) {
+ super(new ContainerSpiritMain(player, 1));
+ tool=player.getCurrentEquippedItem();
+ status=SpiritStatus.readFromNBT(tool.getTagCompound());
+ configuration=status.getConfiguration();
+ spiritTool=(ISpiritTool)tool.getItem();
+ }
+
+ @Override
+ public void initGui() {
+ super.initGui();
+ int i = (this.width - this.xSize) / 2;
+ int j = (this.height - this.ySize) / 2;
+ this.allowUserInput = true;
+
+ ok=new GuiButtonSpiritMain(0, i+64, j+116, "ok");
+ buttonList.add(ok);
+ cancel=new GuiButtonSpiritMain(1, i+116, j+116, "cancel");
+ buttonList.add(cancel);
+
+ int count=0;
+ for(String key : configuration.getKeys()){
+ GuiButtonSpiritCheckBox b=new GuiButtonSpiritCheckBox(count+2, i+6, j+25+11*count, key);
+ b.checked=configuration.get(key);
+ checks.add(b);
+ buttonList.add(b);
+ count++;
+ }
+ }
+
+ @Override
+ public void updateScreen() {
+ super.updateScreen();
+ }
+
+ @Override
+ protected void actionPerformed(GuiButton p_146284_1_) {
+ if(p_146284_1_ instanceof GuiButtonSpiritMain){
+ NBTTagCompound nbt=new NBTTagCompound();
+ configuration.writeToNBT(nbt);
+ PacketHandler.INSTANCE.sendToServer(new MessageGuiButtonWithNBT(p_146284_1_.id, nbt));
+
+ if(p_146284_1_.id==0){
+ NBTTagCompound nbt1=new NBTTagCompound();
+ SpiritStatus.writeToNBT(status, nbt1);
+ tool.setTagCompound(nbt1);
+ }
+ }
+ else if(p_146284_1_ instanceof GuiButtonSpiritCheckBox) {
+ GuiButtonSpiritCheckBox b = ((GuiButtonSpiritCheckBox) p_146284_1_);
+ b.checked = !b.checked;
+ configuration.update(b.keyString, b.checked);
+ }
+ }
+
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float v, int i, int i1) {
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+
+ this.mc.getTextureManager().bindTexture(rl);
+
+ int k = (this.width - this.xSize) / 2;
+ int l = (this.height - this.ySize) / 2;
+ this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
+ }
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(int par1, int par2){}
+}
diff --git a/src/main/java/jp/plusplus/fbs/gui/spirit/GuiSpiritLearn.class b/src/main/java/jp/plusplus/fbs/gui/spirit/GuiSpiritLearn.class Binary files differnew file mode 100644 index 0000000..46ff7cb --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/gui/spirit/GuiSpiritLearn.class diff --git a/src/main/java/jp/plusplus/fbs/gui/spirit/GuiSpiritLearn.java b/src/main/java/jp/plusplus/fbs/gui/spirit/GuiSpiritLearn.java new file mode 100644 index 0000000..abbb709 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/gui/spirit/GuiSpiritLearn.java @@ -0,0 +1,139 @@ +package jp.plusplus.fbs.gui.spirit;
+
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.container.spirit.ContainerSpiritLearn;
+import jp.plusplus.fbs.container.spirit.ContainerSpiritMain;
+import jp.plusplus.fbs.gui.button.GuiButtonSpiritArrow;
+import jp.plusplus.fbs.gui.button.GuiButtonSpiritCheckBox;
+import jp.plusplus.fbs.gui.button.GuiButtonSpiritLearn;
+import jp.plusplus.fbs.gui.button.GuiButtonSpiritMain;
+import jp.plusplus.fbs.packet.MessageGuiButton;
+import jp.plusplus.fbs.packet.MessageGuiButtonWithString;
+import jp.plusplus.fbs.packet.PacketHandler;
+import jp.plusplus.fbs.spirit.ISpiritTool;
+import jp.plusplus.fbs.spirit.SkillManager;
+import jp.plusplus.fbs.spirit.SpiritStatus;
+import net.minecraft.client.gui.GuiButton;
+import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.ResourceLocation;
+import net.minecraft.util.StatCollector;
+import org.lwjgl.opengl.GL11;
+
+import java.util.ArrayList;
+
+/**
+ * Created by plusplus_F on 2015/11/14.
+ */
+public class GuiSpiritLearn extends GuiContainer{
+ public static final ResourceLocation rl = new ResourceLocation(FBS.MODID+":textures/gui/spiritConfig.png");
+ public static final int PAGE_ITEM_MAX=5;
+
+ public ItemStack tool;
+ public SpiritStatus status;
+ public ISpiritTool spiritTool;
+
+ private GuiButtonSpiritMain ok;
+ private GuiButtonSpiritArrow prev;
+ private GuiButtonSpiritArrow next;
+ private GuiButtonSpiritLearn[] buttons;
+
+ private ArrayList<SkillManager.SkillEntry> skillEntries;
+ private int page;
+
+ public GuiSpiritLearn(EntityPlayer player) {
+ super(new ContainerSpiritLearn(player));
+ tool=player.getCurrentEquippedItem();
+ status=SpiritStatus.readFromNBT(tool.getTagCompound());
+ spiritTool=(ISpiritTool)tool.getItem();
+
+ skillEntries=SkillManager.getSkillEntiries();
+ }
+
+ @Override
+ public void initGui() {
+ super.initGui();
+ int i = (this.width - this.xSize) / 2;
+ int j = (this.height - this.ySize) / 2;
+ this.allowUserInput = true;
+
+ prev=new GuiButtonSpiritArrow(0, i+144, j+6);
+ buttonList.add(prev);
+ next=new GuiButtonSpiritArrow(1, i+154, j+6);
+ buttonList.add(next);
+
+ ok =new GuiButtonSpiritMain(2, i+116, j+122, "ok");
+ buttonList.add(ok);
+
+ buttons =new GuiButtonSpiritLearn[PAGE_ITEM_MAX];
+ for(int k=0;k<buttons.length;k++){
+ buttons[k]=new GuiButtonSpiritLearn(3+k, i+130, j+25+19*k, "learn2");
+ buttonList.add(buttons[k]);
+ }
+ page=0;
+ changePage(0);
+ }
+
+ @Override
+ public void updateScreen() {
+ super.updateScreen();
+ }
+
+ @Override
+ protected void actionPerformed(GuiButton p_146284_1_) {
+ if(p_146284_1_==ok){
+ PacketHandler.INSTANCE.sendToServer(new MessageGuiButton(p_146284_1_.id));
+ }
+ else if(p_146284_1_==prev){
+ changePage(-1);
+ }
+ else if(p_146284_1_==next){
+ changePage(1);
+ }
+ else if(p_146284_1_ instanceof GuiButtonSpiritLearn) {
+ GuiButtonSpiritLearn b = ((GuiButtonSpiritLearn) p_146284_1_);
+ PacketHandler.INSTANCE.sendToServer(new MessageGuiButtonWithString(p_146284_1_.id, b.skillName));
+ ((ContainerSpiritLearn)this.inventorySlots).learn(b.skillName);
+ status=SpiritStatus.readFromNBT(tool.getTagCompound());
+ changePage(0);
+ }
+ }
+
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float v, int i, int i1) {
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+
+ this.mc.getTextureManager().bindTexture(rl);
+
+ int k = (this.width - this.xSize) / 2;
+ int l = (this.height - this.ySize) / 2;
+ this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
+ }
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(int par1, int par2){
+ String s= StatCollector.translateToLocal("spirit.gui.fbs.sp")+":"+status.getSkillPoint();
+ this.fontRendererObj.drawString(s, this.xSize / 2 - this.fontRendererObj.getStringWidth(s) / 2, 6, 0x404040);
+ }
+
+ protected void changePage(int add){
+ page+=add;
+ for(int i=0;i<PAGE_ITEM_MAX;i++){
+ buttons[i].enabled=false;
+ buttons[i].visible=false;
+ }
+
+ int size=skillEntries.size();
+ for(int i=0;i<PAGE_ITEM_MAX && page*PAGE_ITEM_MAX+i<size;i++){
+ SkillManager.SkillEntry e=skillEntries.get(i+page * PAGE_ITEM_MAX);
+ int lv=status.getSkillLevel(e.getSkillId());
+ buttons[i].setSkill(e, lv+1);
+ buttons[i].visible=true;
+ buttons[i].enabled=e.canLearn(status);
+ }
+ prev.enabled=(page>0);
+ next.enabled=((page+1)*PAGE_ITEM_MAX<size);
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/gui/spirit/GuiSpiritMain.class b/src/main/java/jp/plusplus/fbs/gui/spirit/GuiSpiritMain.class Binary files differnew file mode 100644 index 0000000..ac271fc --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/gui/spirit/GuiSpiritMain.class diff --git a/src/main/java/jp/plusplus/fbs/gui/spirit/GuiSpiritMain.java b/src/main/java/jp/plusplus/fbs/gui/spirit/GuiSpiritMain.java new file mode 100644 index 0000000..eb39141 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/gui/spirit/GuiSpiritMain.java @@ -0,0 +1,228 @@ +package jp.plusplus.fbs.gui.spirit;
+
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.ProxyClient;
+import jp.plusplus.fbs.container.ContainerAlchemyCauldron;
+import jp.plusplus.fbs.container.spirit.ContainerSpiritMain;
+import jp.plusplus.fbs.entity.EntityLivingDummy;
+import jp.plusplus.fbs.gui.button.GuiButtonEnchantment;
+import jp.plusplus.fbs.gui.button.GuiButtonSpiritMain;
+import jp.plusplus.fbs.item.ItemCore;
+import jp.plusplus.fbs.packet.MessageGuiButton;
+import jp.plusplus.fbs.packet.PacketHandler;
+import jp.plusplus.fbs.spirit.ISpiritTool;
+import jp.plusplus.fbs.spirit.SpiritManager;
+import jp.plusplus.fbs.spirit.SpiritStatus;
+import jp.plusplus.fbs.tileentity.TileEntityAlchemyCauldron;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.GuiButton;
+import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.client.gui.inventory.GuiInventory;
+import net.minecraft.client.renderer.OpenGlHelper;
+import net.minecraft.client.renderer.RenderHelper;
+import net.minecraft.client.renderer.entity.RenderManager;
+import net.minecraft.client.renderer.entity.RendererLivingEntity;
+import net.minecraft.client.resources.I18n;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.Container;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.ResourceLocation;
+import net.minecraft.util.StatCollector;
+import org.lwjgl.opengl.GL11;
+import org.lwjgl.opengl.GL12;
+
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.List;
+
+/**
+ * Created by plusplus_F on 2015/11/14.
+ */
+public class GuiSpiritMain extends GuiContainer{
+ public static final ResourceLocation rl = new ResourceLocation(FBS.MODID+":textures/gui/spiritMain.png");
+
+ public EntityPlayer player;
+ public ItemStack tool;
+ public SpiritStatus status;
+ public ISpiritTool spiritTool;
+
+ public RendererLivingEntity spiritRenderer;
+ public EntityLivingBase dummy;
+
+ private GuiButtonSpiritMain skill;
+ private GuiButtonSpiritMain learn;
+ private GuiButtonSpiritMain bless;
+ private GuiButtonSpiritMain repair;
+ private GuiButtonSpiritMain summon;
+ private GuiButtonSpiritMain config;
+ private float xSizeFloat;
+ private float ySizeFloat;
+
+ public GuiSpiritMain(EntityPlayer player) {
+ super(new ContainerSpiritMain(player, 0));
+ this.player=player;
+ tool=player.getCurrentEquippedItem();
+ status=SpiritStatus.readFromNBT(tool.getTagCompound());
+ spiritTool=(ISpiritTool)tool.getItem();
+
+ spiritRenderer=((ProxyClient)FBS.proxy).getSpiritModel(status.getCharacter());
+ dummy=new EntityLivingDummy(FBS.proxy.getClientWorld());
+ }
+
+ @Override
+ public void initGui() {
+ super.initGui();
+ int i = (this.width - this.xSize) / 2;
+ int j = (this.height - this.ySize) / 2;
+ this.allowUserInput = true;
+
+ skill=new GuiButtonSpiritMain(0, i+12, j+96, "skill", status.getCharacter());
+ buttonList.add(skill);
+ learn=new GuiButtonSpiritMain(1, i+12, j+116, "learn", status.getCharacter());
+ buttonList.add(learn);
+ bless=new GuiButtonSpiritMain(2, i+64, j+96, "bless", status.getCharacter());
+ buttonList.add(bless);
+ repair=new GuiButtonSpiritMain(3, i+64, j+116, "repair", status.getCharacter());
+ buttonList.add(repair);
+ summon=new GuiButtonSpiritMain(4, i+116, j+96, "summon", status.getCharacter());
+ buttonList.add(summon);
+ config=new GuiButtonSpiritMain(5, i+116, j+116, "config", status.getCharacter());
+ buttonList.add(config);
+
+ bless.enabled=summon.enabled=false;
+ repair.enabled=status.getItemDamage()>0 && player.inventory.hasItemStack(new ItemStack(ItemCore.alchemyPotion, 1, 2));
+ }
+
+ @Override
+ public void updateScreen() {
+ super.updateScreen();
+ bless.enabled=(player.worldObj.getCurrentDate().get(Calendar.DATE)!=status.getLastBlessDate());
+
+ }
+
+ @Override
+ public void drawScreen(int p_73863_1_, int p_73863_2_, float p_73863_3_) {
+ super.drawScreen(p_73863_1_, p_73863_2_, p_73863_3_);
+ this.xSizeFloat = (float) p_73863_1_;
+ this.ySizeFloat = (float) p_73863_2_;
+ }
+
+ @Override
+ protected void actionPerformed(GuiButton p_146284_1_) {
+ PacketHandler.INSTANCE.sendToServer(new MessageGuiButton(p_146284_1_.id));
+ if(p_146284_1_.id==2){
+ status.updateLastBlessDate(player.worldObj.getCurrentDate().get(Calendar.DATE));
+
+ NBTTagCompound nbt=new NBTTagCompound();
+ SpiritStatus.writeToNBT(status, nbt);
+ tool.setTagCompound(nbt);
+ }
+ }
+
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float v, int i, int i1) {
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+
+ this.mc.getTextureManager().bindTexture(rl);
+
+ int k = (this.width - this.xSize) / 2;
+ int l = (this.height - this.ySize) / 2;
+ this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
+
+ /*
+ if(spiritRenderer!=null){
+ renderSpirit(k + 33, l + 75, 30, (float)(k + 33) - this.xSizeFloat, (float)(l + 75 - 50) - this.ySizeFloat);
+ }
+ */
+ }
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(int x, int y){
+ int rowHeight=10;
+ String str="";
+
+ str="Lv."+status.getLv()+" "+tool.getDisplayName();
+ this.fontRendererObj.drawString(str, 64, rowHeight*0+7, 0x404040);
+
+ this.fontRendererObj.drawString("[Status]", 64, rowHeight*1+7, 0x404040);
+
+ str= StatCollector.translateToLocal("spirit.gui.fbs.sp")+":"+status.getSkillPoint();
+ this.fontRendererObj.drawString(str, 64, rowHeight*2+7, 0x404040);
+
+ str= StatCollector.translateToLocal("spirit.gui.fbs.str")+":"+status.getStrength();
+ str+=" "+StatCollector.translateToLocal("spirit.gui.fbs.tou")+":"+status.getToughness();
+ this.fontRendererObj.drawString(str, 64, rowHeight*3+7, 0x404040);
+
+ this.fontRendererObj.drawString("[Tool]", 64, rowHeight*4+7, 0x404040);
+
+ str= String.format(StatCollector.translateToLocal("attribute.name.generic.attackDamage")+":%.1f", 0.5+spiritTool.calcDamage(status));
+ this.fontRendererObj.drawString(str, 64, rowHeight*5+7, 0x404040);
+
+ int t=spiritTool.calcDurable(status);
+ str= StatCollector.translateToLocal("spirit.gui.fbs.dur")+":"+(t-status.getItemDamage())+"/"+t;
+ this.fontRendererObj.drawString(str, 64, rowHeight*6+7, 0x404040);
+
+
+ int i = (this.width - this.xSize) / 2;
+ int j = (this.height - this.ySize) / 2;
+ for(Object obj : buttonList) {
+ if (obj instanceof GuiButtonSpiritMain) {
+ GuiButtonSpiritMain b = (GuiButtonSpiritMain) obj;
+ boolean onMouse = x >= b.xPosition && y >= b.yPosition && x < b.xPosition + b.width && y < b.yPosition + b.height;
+
+ if(!b.character.isEmpty() && onMouse){
+ //説明文の表示
+ List list=new ArrayList();
+ for(int k=0;k<3;k++){
+ String s="spirit.gui.button."+b.rowString+"."+b.character+"."+k;
+ if(k>0 && !StatCollector.canTranslate(s)){
+ break;
+ }
+ list.add(SpiritManager.translateString(s, status));
+ }
+ b.drawHoveringText(list, x-i, y-j, Minecraft.getMinecraft().fontRenderer);
+ break;
+ }
+ }
+ }
+ }
+
+ public void renderSpirit(int x, int y, int scale, float rotYaw, float rotPitch)
+ {
+ GL11.glEnable(GL11.GL_COLOR_MATERIAL);
+ GL11.glPushMatrix();
+ GL11.glTranslatef((float)x, (float)y, 50.0F);
+ GL11.glScalef((float)(-scale), (float)scale, (float)scale);
+ GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
+ float f2 = dummy.renderYawOffset;
+ float f3 = dummy.rotationYaw;
+ float f4 = dummy.rotationPitch;
+ float f5 = dummy.prevRotationYawHead;
+ float f6 = dummy.rotationYawHead;
+ GL11.glRotatef(135.0F, 0.0F, 1.0F, 0.0F);
+ RenderHelper.enableStandardItemLighting();
+ GL11.glRotatef(-135.0F, 0.0F, 1.0F, 0.0F);
+ GL11.glRotatef(-((float)Math.atan((double)(rotPitch / 40.0F))) * 20.0F, 1.0F, 0.0F, 0.0F);
+ dummy.renderYawOffset = (float)Math.atan((double)(rotYaw / 40.0F)) * 20.0F;
+ dummy.rotationYaw = (float)Math.atan((double)(rotYaw / 40.0F)) * 40.0F;
+ dummy.rotationPitch = -((float)Math.atan((double)(rotPitch / 40.0F))) * 20.0F;
+ dummy.rotationYawHead = dummy.rotationYaw;
+ dummy.prevRotationYawHead = dummy.rotationYaw;
+ GL11.glTranslatef(0.0F, dummy.yOffset, 0.0F);
+ RenderManager.instance.playerViewY = 180.0F;
+ spiritRenderer.doRender(dummy, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F);
+ dummy.renderYawOffset = f2;
+ dummy.rotationYaw = f3;
+ dummy.rotationPitch = f4;
+ dummy.prevRotationYawHead = f5;
+ dummy.rotationYawHead = f6;
+ GL11.glPopMatrix();
+ RenderHelper.disableStandardItemLighting();
+ GL11.glDisable(GL12.GL_RESCALE_NORMAL);
+ OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit);
+ GL11.glDisable(GL11.GL_TEXTURE_2D);
+ OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit);
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/gui/spirit/GuiSpiritSkill.class b/src/main/java/jp/plusplus/fbs/gui/spirit/GuiSpiritSkill.class Binary files differnew file mode 100644 index 0000000..514fbe6 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/gui/spirit/GuiSpiritSkill.class diff --git a/src/main/java/jp/plusplus/fbs/gui/spirit/GuiSpiritSkill.java b/src/main/java/jp/plusplus/fbs/gui/spirit/GuiSpiritSkill.java new file mode 100644 index 0000000..328d54c --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/gui/spirit/GuiSpiritSkill.java @@ -0,0 +1,127 @@ +package jp.plusplus.fbs.gui.spirit;
+
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.container.spirit.ContainerSpiritLearn;
+import jp.plusplus.fbs.gui.button.GuiButtonSpiritArrow;
+import jp.plusplus.fbs.gui.button.GuiButtonSpiritLearn;
+import jp.plusplus.fbs.gui.button.GuiButtonSpiritLearnDummy;
+import jp.plusplus.fbs.gui.button.GuiButtonSpiritMain;
+import jp.plusplus.fbs.packet.MessageGuiButton;
+import jp.plusplus.fbs.packet.MessageGuiButtonWithString;
+import jp.plusplus.fbs.packet.PacketHandler;
+import jp.plusplus.fbs.spirit.ISpiritTool;
+import jp.plusplus.fbs.spirit.SkillManager;
+import jp.plusplus.fbs.spirit.SpiritStatus;
+import net.minecraft.client.gui.GuiButton;
+import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.ResourceLocation;
+import net.minecraft.util.StatCollector;
+import org.lwjgl.opengl.GL11;
+
+import java.util.ArrayList;
+
+/**
+ * Created by plusplus_F on 2015/11/14.
+ */
+public class GuiSpiritSkill extends GuiContainer{
+ public static final ResourceLocation rl = new ResourceLocation(FBS.MODID+":textures/gui/spiritConfig.png");
+ public static final int PAGE_ITEM_MAX=5;
+
+ public ItemStack tool;
+ public SpiritStatus status;
+ public ISpiritTool spiritTool;
+
+ private GuiButtonSpiritMain ok;
+ private GuiButtonSpiritArrow prev;
+ private GuiButtonSpiritArrow next;
+ private GuiButtonSpiritLearnDummy[] buttons;
+
+ private ArrayList<SkillManager.SkillData> skillDatas;
+ private int page;
+
+ public GuiSpiritSkill(EntityPlayer player) {
+ super(new ContainerSpiritLearn(player));
+ tool=player.getCurrentEquippedItem();
+ status=SpiritStatus.readFromNBT(tool.getTagCompound());
+ spiritTool=(ISpiritTool)tool.getItem();
+ skillDatas =status.getSkills();
+ }
+
+ @Override
+ public void initGui() {
+ super.initGui();
+ int i = (this.width - this.xSize) / 2;
+ int j = (this.height - this.ySize) / 2;
+ this.allowUserInput = true;
+
+ prev=new GuiButtonSpiritArrow(0, i+144, j+6);
+ buttonList.add(prev);
+ next=new GuiButtonSpiritArrow(1, i+154, j+6);
+ buttonList.add(next);
+
+ ok =new GuiButtonSpiritMain(2, i+116, j+122, "ok");
+ buttonList.add(ok);
+
+ buttons =new GuiButtonSpiritLearnDummy[PAGE_ITEM_MAX];
+ for(int k=0;k<buttons.length;k++){
+ buttons[k]=new GuiButtonSpiritLearnDummy(3+k, i+130, j+25+19*k, "");
+ buttonList.add(buttons[k]);
+ }
+ page=0;
+ changePage(0);
+ }
+
+ @Override
+ public void updateScreen() {
+ super.updateScreen();
+ }
+
+ @Override
+ protected void actionPerformed(GuiButton p_146284_1_) {
+ if(p_146284_1_==ok){
+ PacketHandler.INSTANCE.sendToServer(new MessageGuiButton(p_146284_1_.id));
+ }
+ else if(p_146284_1_==prev){
+ changePage(-1);
+ }
+ else if(p_146284_1_==next){
+ changePage(1);
+ }
+ }
+
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float v, int i, int i1) {
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+
+ this.mc.getTextureManager().bindTexture(rl);
+
+ int k = (this.width - this.xSize) / 2;
+ int l = (this.height - this.ySize) / 2;
+ this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
+ }
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(int par1, int par2){
+ String s= StatCollector.translateToLocal("spirit.gui.fbs.sp")+":"+status.getSkillPoint();
+ this.fontRendererObj.drawString(s, this.xSize / 2 - this.fontRendererObj.getStringWidth(s) / 2, 6, 0x404040);
+ }
+
+ protected void changePage(int add){
+ page+=add;
+ for(int i=0;i<PAGE_ITEM_MAX;i++){
+ buttons[i].enabled=false;
+ buttons[i].visible=false;
+ }
+
+ int size= skillDatas.size();
+ for(int i=0;i<PAGE_ITEM_MAX && page*PAGE_ITEM_MAX+i<size;i++){
+ SkillManager.SkillData e= skillDatas.get(i+page * PAGE_ITEM_MAX);
+ buttons[i].setSkill(e);
+ buttons[i].visible=true;
+ }
+ prev.enabled=(page>0);
+ next.enabled=((page+1)*PAGE_ITEM_MAX<size);
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/item/ItemAlchemyCauldron.class b/src/main/java/jp/plusplus/fbs/item/ItemAlchemyCauldron.class Binary files differnew file mode 100644 index 0000000..34b39f3 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/ItemAlchemyCauldron.class diff --git a/src/main/java/jp/plusplus/fbs/item/ItemAlchemyCauldron.java b/src/main/java/jp/plusplus/fbs/item/ItemAlchemyCauldron.java new file mode 100644 index 0000000..1cbe9ce --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/ItemAlchemyCauldron.java @@ -0,0 +1,55 @@ +package jp.plusplus.fbs.item;
+
+import jp.plusplus.fbs.block.BlockAlchemistTable;
+import jp.plusplus.fbs.block.BlockAlchemyCauldron;
+import jp.plusplus.fbs.block.BlockCore;
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemBlock;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.MathHelper;
+import net.minecraft.util.StatCollector;
+import net.minecraft.world.World;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Created by plusplus_F on 2015/09/25.
+ * 死ね
+ */
+public class ItemAlchemyCauldron extends ItemBlock {
+ public ItemAlchemyCauldron(Block p_i45328_1_) {
+ super(p_i45328_1_);
+ }
+
+ @Override
+ public void addInformation(ItemStack item, EntityPlayer p_77624_2_, List list, boolean flag){
+ list.add(StatCollector.translateToLocal("info.fbs.alchemyCauldron.0"));
+ list.add("Size:W2H1D2");
+ }
+
+ @Override
+ public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata) {
+ int l = MathHelper.floor_double((double) (player.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
+ int pSide=0;
+
+ /*
+ //プレイヤーの向きの決定
+ switch (l){
+ case 0: pSide=2; break;
+ case 1: pSide=5; break;
+ case 2: pSide=3; break;
+ case 3: pSide=4; break;
+ }
+ */
+ pSide=(l==0||l==2)?0:8;
+
+ ArrayList<BlockAlchemyCauldron.BlockPos> pos= ((BlockAlchemyCauldron)field_150939_a).getBlocks(world, x, y, z);
+ for(BlockAlchemyCauldron.BlockPos bp : pos){
+ if(!bp.getBlock(world).isReplaceable(world, bp.x, bp.y, bp.z)) return false;
+ }
+
+ return super.placeBlockAt(stack, player, world, x, y, z, side, hitX, hitY, hitZ, pSide);
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/item/ItemAlchemyTable.class b/src/main/java/jp/plusplus/fbs/item/ItemAlchemyTable.class Binary files differnew file mode 100644 index 0000000..ee26cfb --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/ItemAlchemyTable.class diff --git a/src/main/java/jp/plusplus/fbs/item/ItemAlchemyTable.java b/src/main/java/jp/plusplus/fbs/item/ItemAlchemyTable.java new file mode 100644 index 0000000..3f51f1d --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/ItemAlchemyTable.java @@ -0,0 +1,48 @@ +package jp.plusplus.fbs.item;
+
+import jp.plusplus.fbs.block.BlockAlchemistTable;
+import jp.plusplus.fbs.block.BlockBase;
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemBlock;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.MathHelper;
+import net.minecraft.util.StatCollector;
+import net.minecraft.world.World;
+
+import java.util.List;
+
+/**
+ * Created by plusplus_F on 2015/09/25.
+ * 死ね
+ */
+public class ItemAlchemyTable extends ItemBlock {
+ public ItemAlchemyTable(Block p_i45328_1_) {
+ super(p_i45328_1_);
+ }
+
+ @Override
+ public void addInformation(ItemStack item, EntityPlayer p_77624_2_, List list, boolean flag){
+ list.add(StatCollector.translateToLocal("info.fbs.translator.0"));
+ list.add("Size:W2H1D1");
+ }
+
+ @Override
+ public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata) {
+ int l = MathHelper.floor_double((double) (player.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
+ int pSide=0;
+
+ //プレイヤーの向きの決定
+ switch (l){
+ case 0: pSide=2; break;
+ case 1: pSide=5; break;
+ case 2: pSide=3; break;
+ case 3: pSide=4; break;
+ }
+
+ if(world.getBlock(x,y,z).isReplaceable(world,x,y,z) && world.getBlock(x+BlockAlchemistTable.X_SHIFT[pSide-2],y,z+BlockAlchemistTable.Z_SHIFT[pSide-2]).isReplaceable(world,x+BlockAlchemistTable.X_SHIFT[pSide-2],y,z+BlockAlchemistTable.Z_SHIFT[pSide-2])){
+ return super.placeBlockAt(stack, player, world, x, y, z, side, hitX, hitY, hitZ, pSide);
+ }
+ return false;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/item/ItemArmorInfinity.class b/src/main/java/jp/plusplus/fbs/item/ItemArmorInfinity.class Binary files differnew file mode 100644 index 0000000..8cb260b --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/ItemArmorInfinity.class diff --git a/src/main/java/jp/plusplus/fbs/item/ItemArmorInfinity.java b/src/main/java/jp/plusplus/fbs/item/ItemArmorInfinity.java new file mode 100644 index 0000000..e795704 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/ItemArmorInfinity.java @@ -0,0 +1,65 @@ +package jp.plusplus.fbs.item;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.FBS;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.Items;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemArmor;
+import net.minecraft.item.ItemStack;
+import net.minecraft.potion.Potion;
+import net.minecraft.potion.PotionEffect;
+import net.minecraft.util.StatCollector;
+import net.minecraft.world.World;
+
+import java.util.List;
+
+/**
+ * Created by plusplus_F on 2015/11/22.
+ */
+public class ItemArmorInfinity extends ItemArmor {
+ public ItemArmorInfinity(ArmorMaterial p_i45325_1_, int p_i45325_3_) {
+ super(p_i45325_1_, 0, p_i45325_3_);
+ setCreativeTab(FBS.tab);
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void addInformation(ItemStack p_77624_1_, EntityPlayer p_77624_2_, List p_77624_3_, boolean p_77624_4_) {
+ p_77624_3_.add(StatCollector.translateToLocal("info.fbs.infinity.0"));
+ }
+
+ @Override
+ public String getArmorTexture(ItemStack stack, Entity entity, int slot, String layer) {
+ if(slot==0 || slot==1 || slot==3) return FBS.MODID+":textures/armor/infinity1.png";
+ else return FBS.MODID+":textures/armor/infinity2.png";
+ }
+
+ @SideOnly(Side.CLIENT)
+ public boolean hasEffect(ItemStack par1ItemStack, int pass) {
+ return true;
+ }
+
+ public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) {
+ Item item=itemStack.getItem();
+
+ if(item==ItemCore.infinityHelm){
+ player.addPotionEffect(new PotionEffect(Potion.waterBreathing.getId(), 10, 0));
+ //player.addPotionEffect(new PotionEffect(Potion.nightVision.getId(), 10, 0));
+ }
+ else if(item==ItemCore.infinityArmor){
+ player.addPotionEffect(new PotionEffect(Potion.fireResistance.getId(), 10, 0));
+ player.addPotionEffect(new PotionEffect(Potion.regeneration.getId(), 10, 0));
+ }
+ else if(item==ItemCore.infinityLegs){
+ player.addPotionEffect(new PotionEffect(Potion.digSpeed.getId(), 10, 1));
+ }
+ else if(item==ItemCore.infinityBoots){
+ player.addPotionEffect(new PotionEffect(Potion.moveSpeed.getId(), 10, 0));
+ player.addPotionEffect(new PotionEffect(Potion.jump.getId(), 10, 0));
+ }
+
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/item/ItemBase.class b/src/main/java/jp/plusplus/fbs/item/ItemBase.class Binary files differnew file mode 100644 index 0000000..f81a79e --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/ItemBase.class diff --git a/src/main/java/jp/plusplus/fbs/item/ItemBase.java b/src/main/java/jp/plusplus/fbs/item/ItemBase.java new file mode 100644 index 0000000..416a922 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/ItemBase.java @@ -0,0 +1,38 @@ +package jp.plusplus.fbs.item;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.FBS;
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.StatCollector;
+
+import java.util.List;
+
+/**
+ * Createdby pluslus_Fon 2015/06/13.
+ */
+public class ItemBase extends Item {
+ public ItemBase(){
+ setCreativeTab(FBS.tab);
+ }
+
+ public Item setUnlocalizedName(String s){
+ super.setUnlocalizedName("fbs." + s);
+ return this;
+ }
+ public Item setTextureName(String s){
+ super.setTextureName(FBS.MODID + ":" + s);
+ return this;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void addInformation(ItemStack p_77624_1_, EntityPlayer p_77624_2_, List p_77624_3_, boolean p_77624_4_) {
+ if(p_77624_1_.getItem()==ItemCore.potionBless){
+ p_77624_3_.add(StatCollector.translateToLocal("info.fbs.potionBless.0"));
+ }
+ }
+
+}
diff --git a/src/main/java/jp/plusplus/fbs/item/ItemBasket.class b/src/main/java/jp/plusplus/fbs/item/ItemBasket.class Binary files differnew file mode 100644 index 0000000..e659172 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/ItemBasket.class diff --git a/src/main/java/jp/plusplus/fbs/item/ItemBasket.java b/src/main/java/jp/plusplus/fbs/item/ItemBasket.java new file mode 100644 index 0000000..99b5e6b --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/ItemBasket.java @@ -0,0 +1,42 @@ +package jp.plusplus.fbs.item;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.FBS;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.nbt.NBTTagList;
+import net.minecraft.util.MathHelper;
+import net.minecraft.util.StatCollector;
+import net.minecraft.world.World;
+
+import java.util.List;
+import java.util.Random;
+
+/**
+ * Created by plusplus_F on 2015/03/09.
+ */
+public class ItemBasket extends ItemBase {
+ public Random rand = new Random();
+
+ public ItemBasket() {
+ setUnlocalizedName("basket");
+ setTextureName("basket");
+ setMaxStackSize(1);
+ setNoRepair();
+ setMaxDamage(0);
+ setCreativeTab(FBS.tabAlchemy);
+ }
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void addInformation(ItemStack itemStack, EntityPlayer player, List list, boolean flag) {
+ list.add(StatCollector.translateToLocal("info.fbs.basket.0"));
+ }
+
+ @Override
+ public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) {
+ player.openGui(FBS.instance, FBS.GUI_BASKET_ID, world, MathHelper.floor_double(player.posX), MathHelper.floor_double(player.posY), MathHelper.floor_double(player.posZ));
+ return itemStack;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/item/ItemBlockBase.class b/src/main/java/jp/plusplus/fbs/item/ItemBlockBase.class Binary files differnew file mode 100644 index 0000000..ac7ca97 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/ItemBlockBase.class diff --git a/src/main/java/jp/plusplus/fbs/item/ItemBlockBase.java b/src/main/java/jp/plusplus/fbs/item/ItemBlockBase.java new file mode 100644 index 0000000..910a30f --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/ItemBlockBase.java @@ -0,0 +1,36 @@ +package jp.plusplus.fbs.item;
+
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.block.BlockBase;
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemBlock;
+import net.minecraft.item.ItemBlockWithMetadata;
+import net.minecraft.item.ItemStack;
+
+import java.util.List;
+
+/**
+ * Createdby pluslus_Fon 2015/06/14.
+ */
+public class ItemBlockBase extends ItemBlock {
+ public ItemBlockBase(Block p_i45328_1_) {
+ super(p_i45328_1_);
+ setCreativeTab(FBS.tab);
+ }
+
+ public ItemBlock setUnlocalizedName(String s){
+ super.setUnlocalizedName("fbs." + s);
+ return this;
+ }
+ public Item setTextureName(String s){
+ super.setTextureName(FBS.MODID + ":" + s);
+ return this;
+ }
+
+ @Override
+ public void addInformation(ItemStack item, EntityPlayer p_77624_2_, List list, boolean flag){
+ if(field_150939_a instanceof BlockBase) ((BlockBase)(field_150939_a)).addBlockInformation(item, p_77624_2_, list, flag);
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/item/ItemBlockMeta.class b/src/main/java/jp/plusplus/fbs/item/ItemBlockMeta.class Binary files differnew file mode 100644 index 0000000..a0a0142 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/ItemBlockMeta.class diff --git a/src/main/java/jp/plusplus/fbs/item/ItemBlockMeta.java b/src/main/java/jp/plusplus/fbs/item/ItemBlockMeta.java new file mode 100644 index 0000000..f9359be --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/ItemBlockMeta.java @@ -0,0 +1,41 @@ +package jp.plusplus.fbs.item;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.block.BlockBlock;
+import jp.plusplus.fbs.block.IMeta;
+import net.minecraft.block.Block;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.IIcon;
+
+/**
+ * Created by plusplus_F on 2015/08/25.
+ */
+public class ItemBlockMeta extends ItemBlockBase {
+ public ItemBlockMeta(Block p_i45328_1_) {
+ super(p_i45328_1_);
+ this.setMaxDamage(0);
+ this.setHasSubtypes(true);
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public IIcon getIconFromDamage(int p_77617_1_)
+ {
+ return this.field_150939_a.getIcon(2, p_77617_1_);
+ }
+
+ @Override
+ public int getMetadata(int p_77647_1_)
+ {
+ return p_77647_1_;
+ }
+
+ @Override
+ public String getUnlocalizedName(ItemStack par1ItemStack) {
+ if(field_150939_a instanceof IMeta) {
+ return ((IMeta) field_150939_a).getUnlocalizedName(par1ItemStack.getItemDamage());
+ }
+ return super.getUnlocalizedName();
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/item/ItemBookBroken.class b/src/main/java/jp/plusplus/fbs/item/ItemBookBroken.class Binary files differnew file mode 100644 index 0000000..ce7e4b0 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/ItemBookBroken.class diff --git a/src/main/java/jp/plusplus/fbs/item/ItemBookBroken.java b/src/main/java/jp/plusplus/fbs/item/ItemBookBroken.java new file mode 100644 index 0000000..a41a49b --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/ItemBookBroken.java @@ -0,0 +1,56 @@ +package jp.plusplus.fbs.item;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.FBS;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.IIcon;
+
+/**
+ * Created by plusplus_F on 2015/08/24.
+ */
+public class ItemBookBroken extends ItemBase {
+ private IIcon iconOverlay;
+
+ public ItemBookBroken(){
+ setCreativeTab(FBS.tabBook);
+ setUnlocalizedName("bookBroken");
+ setTextureName("bookNoDecoded");
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public IIcon getIconFromDamage(int par1){
+ return super.getIconFromDamage(par1);
+ }
+ @Override
+ public int getMetadata(int par1) {
+ return par1;
+ }
+ @Override
+ public int getSpriteNumber(){
+ return 1;
+ }
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void registerIcons(IIconRegister par1IconRegister) {
+ super.registerIcons(par1IconRegister);
+ iconOverlay=par1IconRegister.registerIcon(FBS.MODID+":bookBroken");
+ }
+ @SideOnly(Side.CLIENT)
+ public boolean requiresMultipleRenderPasses(){
+ return true;
+ }
+ @SideOnly(Side.CLIENT)
+ public IIcon getIconFromDamageForRenderPass(int par1, int par2){
+ return par2 > 0 ? iconOverlay : itemIcon;
+ }
+ @SideOnly(Side.CLIENT)
+ public int getColorFromItemStack(ItemStack par1ItemStack, int par2) {
+ if(par2==0) return 0xffffff;
+ int d=par1ItemStack.getItemDamage();
+ int r=(d>>8)&0xf, g=(d>>4)&0xf, b=d&0xf;
+ return ~(((r*17)<<16)+((g*17)<<8)+(b*17));
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/item/ItemBookNoDecoded$1.class b/src/main/java/jp/plusplus/fbs/item/ItemBookNoDecoded$1.class Binary files differnew file mode 100644 index 0000000..3a8f357 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/ItemBookNoDecoded$1.class diff --git a/src/main/java/jp/plusplus/fbs/item/ItemBookNoDecoded.class b/src/main/java/jp/plusplus/fbs/item/ItemBookNoDecoded.class Binary files differnew file mode 100644 index 0000000..5e955b0 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/ItemBookNoDecoded.class diff --git a/src/main/java/jp/plusplus/fbs/item/ItemBookNoDecoded.java b/src/main/java/jp/plusplus/fbs/item/ItemBookNoDecoded.java new file mode 100644 index 0000000..723ce62 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/ItemBookNoDecoded.java @@ -0,0 +1,189 @@ +package jp.plusplus.fbs.item;
+
+import com.mojang.realmsclient.gui.ChatFormatting;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.Registry;
+import jp.plusplus.fbs.exprop.FBSEntityProperties;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.client.resources.I18n;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.*;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.IIcon;
+import net.minecraft.util.StatCollector;
+import net.minecraft.world.World;
+
+import java.util.*;
+
+/**
+ * Createdby pluslus_Fon 2015/06/06.
+ */
+public class ItemBookNoDecoded extends ItemBase {
+ private IIcon iconOverlay;
+
+ public ItemBookNoDecoded(){
+ setCreativeTab(FBS.tabBook);
+ setMaxStackSize(1);
+ setUnlocalizedName("bookNDec");
+ setTextureName("bookNoDecoded");
+ setHasSubtypes(true);
+ }
+
+ @Override
+ public int getMaxItemUseDuration(ItemStack p_77626_1_){
+ return 20*6;
+ }
+ @Override
+ public EnumAction getItemUseAction(ItemStack p_77661_1_)
+ {
+ return FBS.actionDecode;
+ }
+
+ @Override
+ public ItemStack onItemRightClick(ItemStack p_77659_1_, World p_77659_2_, EntityPlayer p_77659_3_) {
+ /*
+ ItemStack helm=p_77659_3_.getCurrentArmor(3);
+ if(helm!=null && helm.getItem() instanceof ItemMonocle) {
+ p_77659_3_.setItemInUse(p_77659_1_, this.getMaxItemUseDuration(p_77659_1_));
+ }
+ */
+ if(ItemMonocle.findMonocle(p_77659_3_)!=null) p_77659_3_.setItemInUse(p_77659_1_, this.getMaxItemUseDuration(p_77659_1_));
+ return p_77659_1_;
+ }
+ @Override
+ public ItemStack onEaten(ItemStack itemStack, World world, EntityPlayer player) {
+ if(!itemStack.hasTagCompound()) return itemStack;
+
+ ItemStack monocle=ItemMonocle.findMonocle(player);
+ if(monocle==null) return itemStack;
+
+ if(!player.capabilities.isCreativeMode){
+ ItemMonocle.damageMonocle(player, monocle);
+ player.inventory.markDirty();
+ }
+
+ if(world.isRemote) return itemStack;
+
+ NBTTagCompound nbt=itemStack.getTagCompound();
+ boolean result=Registry.TryDecodingBook(nbt.getString("title"), player, true);
+ if(result){
+ NBTTagCompound nbtNew=(NBTTagCompound)nbt.copy();
+ nbtNew.setString("decoder", player.getDisplayName());
+
+ ItemStack ret=null;
+ String t=nbt.getString("title");
+ if(Registry.GetBook(t).isMagic) {
+ ret=new ItemStack(ItemCore.bookSorcery, 1, itemStack.getItemDamage());
+ ret.setTagCompound(nbtNew);
+ ((ItemBookSorcery)ItemCore.bookSorcery).setMagicMaxUse(ret, Registry.GetMagic(t));
+ }
+ else{
+ ret=new ItemStack(ItemCore.bookOld, 1, itemStack.getItemDamage());
+ ret.setTagCompound(nbtNew);
+ }
+
+ return ret;
+ }
+
+ //p_77654_2_.playSoundAtEntity(p_77654_3_, "random.burp", 0.5F, p_77654_2_.rand.nextFloat() * 0.1F + 0.9F);
+ return itemStack;
+ }
+ @Override
+ public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List itemList) {
+ Map.Entry<String, Registry.BookData>[] books=Registry.GetBooks();
+ Arrays.sort(books, new Comparator<Map.Entry<String, Registry.BookData>>() {
+ @Override
+ public int compare(Map.Entry<String, Registry.BookData> o1, Map.Entry<String, Registry.BookData> o2) {
+ return o1.getValue().lv-o2.getValue().lv;
+ }
+ });
+
+ for(int i=0;i<books.length;i++){
+ if(books[i].getValue().weight<=0) continue;
+
+ ItemStack itemStack = new ItemStack(this, 1, itemRand.nextInt(0xfff+1));
+ NBTTagCompound nbt = new NBTTagCompound();
+ nbt.setString("title", books[i].getValue().title);
+ itemStack.setTagCompound(nbt);//ItemStackにNBTTagCompoundを格納
+ itemList.add(itemStack);//クリエイティブタブのアイテムリストに追加
+ }
+ }
+
+ public void addInformation(ItemStack itemStack, EntityPlayer player, List list, boolean p_77624_4_) {
+ Registry.BookData bd=Registry.GetBookDataFromItemStack(itemStack);
+ if(bd==null) return;
+
+ /*
+ ItemStack helm=player.getCurrentArmor(3);
+ if(helm!=null && helm.getItem() instanceof ItemMonocle){
+ */
+ if(ItemMonocle.findMonocle(player)!=null){
+ FBSEntityProperties prop=FBSEntityProperties.get(player);
+ if(prop==null) return;
+
+ String d;
+ float prob=Registry.GetDecodingProbability(prop.getMagicLevel(), bd.lv, bd.scProb);
+ if(prob<0.3f) d=ChatFormatting.RED+ I18n.format("info.fbs.book.high");
+ else if(prob<0.8) d=ChatFormatting.YELLOW+I18n.format("info.fbs.book.middle");
+ else d=ChatFormatting.DARK_GREEN+I18n.format("info.fbs.book.low");
+
+ list.add(I18n.format("info.fbs.book.lv")+":"+bd.lv);
+ list.add(I18n.format("info.fbs.book.difficult")+":"+d);
+ }
+ else{
+ list.add(I18n.format("info.fbs.book.lv")+":???");
+ list.add(I18n.format("info.fbs.book.difficult")+":???");
+ }
+ }
+
+ public String getLocalizedBookTitle(ItemStack item){
+ NBTTagCompound nbt=item.getTagCompound();
+ if(nbt==null) return "";
+ return StatCollector.translateToLocal("book."+nbt.getString("title")+".title");
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public IIcon getIconFromDamage(int par1){
+ return super.getIconFromDamage(par1);
+ }
+ @Override
+ public int getMetadata(int par1) {
+ return par1;
+ }
+ @Override
+ public int getSpriteNumber(){
+ return 1;
+ }
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void registerIcons(IIconRegister par1IconRegister) {
+ super.registerIcons(par1IconRegister);
+ iconOverlay=par1IconRegister.registerIcon(FBS.MODID+":book");
+ }
+ @SideOnly(Side.CLIENT)
+ public boolean requiresMultipleRenderPasses(){
+ return true;
+ }
+ @SideOnly(Side.CLIENT)
+ public IIcon getIconFromDamageForRenderPass(int par1, int par2){
+ return par2 > 0 ? iconOverlay : itemIcon;
+ }
+ @SideOnly(Side.CLIENT)
+ public int getColorFromItemStack(ItemStack par1ItemStack, int par2) {
+ if(par2==0) return 0xffffff;
+ int d=par1ItemStack.getItemDamage();
+ int r=(d>>8)&0xf, g=(d>>4)&0xf, b=d&0xf;
+ return ~(((r*17)<<16)+((g*17)<<8)+(b*17));
+ }
+
+ @Override
+ public String getItemStackDisplayName(ItemStack item){
+ String s=getLocalizedBookTitle(item);
+ if(s.length()==0) return super.getItemStackDisplayName(item);
+ return s;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/item/ItemBookSorcery.class b/src/main/java/jp/plusplus/fbs/item/ItemBookSorcery.class Binary files differnew file mode 100644 index 0000000..17e7a3c --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/ItemBookSorcery.class diff --git a/src/main/java/jp/plusplus/fbs/item/ItemBookSorcery.java b/src/main/java/jp/plusplus/fbs/item/ItemBookSorcery.java new file mode 100644 index 0000000..30aca10 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/ItemBookSorcery.java @@ -0,0 +1,251 @@ +package jp.plusplus.fbs.item;
+
+import com.mojang.realmsclient.gui.ChatFormatting;
+import cpw.mods.fml.common.FMLLog;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.Registry;
+import jp.plusplus.fbs.api.event.PlayerUseMagicEvent;
+import jp.plusplus.fbs.exprop.SanityManager;
+import jp.plusplus.fbs.api.IMagicEnchant;
+import jp.plusplus.fbs.api.MagicBase;
+import net.minecraft.client.resources.I18n;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.EnumAction;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.ChatComponentTranslation;
+import net.minecraft.util.StatCollector;
+import net.minecraft.world.World;
+import net.minecraftforge.common.MinecraftForge;
+
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Random;
+
+/**
+ * Createdby pluslus_Fon 2015/06/06.
+ */
+public class ItemBookSorcery extends ItemBookNoDecoded {
+ Random rand=new Random();
+
+ public ItemBookSorcery(){
+ setMaxStackSize(1);
+ setCreativeTab(null);
+ setUnlocalizedName("bookDec");
+ setTextureName("bookNoDecoded");
+ setHasSubtypes(true);
+ }
+
+ @Override
+ public boolean hasEffect(ItemStack itemStack, int i){
+ return true;
+ }
+
+ @Override
+ public int getMaxItemUseDuration(ItemStack p_77626_1_){
+ Registry.MagicData md=Registry.GetMagicDataFromItemStack(p_77626_1_);
+ if(md==null) return 32;
+ return md.ariaTick;
+ }
+ @Override
+ public EnumAction getItemUseAction(ItemStack p_77661_1_)
+ {
+ return FBS.actionSpell;
+ }
+
+ @Override
+ public ItemStack onItemRightClick(ItemStack p_77659_1_, World p_77659_2_, EntityPlayer p_77659_3_) {
+ if(getMagicMaxUse(p_77659_1_)>0) {
+ if (p_77659_3_.isSneaking()) {
+ executesMagic(p_77659_1_, p_77659_2_, p_77659_3_, false);
+ } else {
+ p_77659_3_.setItemInUse(p_77659_1_, this.getMaxItemUseDuration(p_77659_1_));
+ }
+ }
+ return p_77659_1_;
+ }
+ @Override
+ public ItemStack onEaten(ItemStack itemStack, World world, EntityPlayer player) {
+ if(getMagicMaxUse(itemStack)>0){
+ executesMagic(itemStack, world, player, true);
+ }
+ return itemStack;
+ }
+ @Override
+ public void addInformation(ItemStack itemStack, EntityPlayer player, List list, boolean p_77624_4_) {
+ Registry.BookData bd = Registry.GetBookDataFromItemStack(itemStack);
+ Registry.MagicData md = Registry.GetMagicDataFromItemStack(itemStack);
+ if (bd == null || md==null) return;
+
+ //list.add("\"" + bd.getLocalizedTitle() + "\"");
+ list.add(I18n.format("info.fbs.book.decoder")+":"+itemStack.getTagCompound().getString("decoder"));
+ list.add(I18n.format("info.fbs.book.lv") + ":" + bd.lv);
+
+ String s=I18n.format("magic.type.fbs.type") + ":" + I18n.format("magic.type."+md.type);
+ if(IMagicEnchant.class.isAssignableFrom(md.magic)) s+=","+I18n.format("magic.type.fbs.enchant");
+ list.add(s);
+
+ for(int i=0;i<5;i++){
+ String sss="flavor."+bd.title+"."+i;
+ if(!StatCollector.canTranslate(sss)) break;
+ list.add(ChatFormatting.ITALIC+StatCollector.translateToLocal(sss));
+ }
+ }
+
+ @Override
+ public String getItemStackDisplayName(ItemStack item){
+ return super.getItemStackDisplayName(item)+"("+StatCollector.translateToLocal("info.fbs.book.decoded")+")["+getMagicMaxUse(item)+"]";
+ }
+
+ public void executesMagic(ItemStack itemStack, World world, EntityPlayer player, boolean spell){
+ if(!itemStack.hasTagCompound() || world.isRemote) return;
+
+ Registry.MagicData md=Registry.GetMagicDataFromItemStack(itemStack);
+ if(md==null) return;
+
+ try {
+ MagicBase mb = md.getMagic(world, player, spell);
+
+ String cir=mb.getMagicCircleName();
+ if(cir!=null && !cir.equals("null") && !mb.checkMagicCircle(cir)){
+ player.addChatComponentMessage(new ChatComponentTranslation("info.fbs.magic.circle.need"));
+ return;
+ }
+
+ PlayerUseMagicEvent pume=new PlayerUseMagicEvent.Pre(player, mb, new ItemStack[]{itemStack});
+ if(!MinecraftForge.EVENT_BUS.post(pume)){
+
+ double exp=md.exp;
+ if(mb.checkSuccess() || player.capabilities.isCreativeMode){
+ mb.success();
+ }
+ else{
+ mb.failureMessage();
+ mb.failure();
+ exp*=0.2;
+ }
+ if(!spell) exp*=0.1;
+ SanityManager.addExp(player, exp, true);
+
+ pume=new PlayerUseMagicEvent.Post(player, mb, new ItemStack[]{itemStack});
+ MinecraftForge.EVENT_BUS.post(pume);
+ }
+ }
+ catch (Exception e){
+ FMLLog.severe("Error! magic:"+md.title);
+ e.printStackTrace();
+ }
+
+ if(!player.capabilities.isCreativeMode){
+ reduceMagicMaxUse(itemStack);
+ }
+ }
+ public void executesMagicWithStaff(World world, EntityPlayer player, ItemStack[] staffItems, int bookNum) {
+ if (world.isRemote) return;
+
+ //共鳴しているかどうかの判定用リストを作成する
+ LinkedList<ItemStack> books = new LinkedList<ItemStack>();
+ for (int i = 0; i < bookNum; i++) {
+ if (staffItems[i] != null && staffItems[i].getItem() == ItemCore.bookSorcery) {
+ books.add(staffItems[i]);
+ }
+ }
+ if (books.isEmpty()) return;
+
+ //共鳴している魔法がデータとして存在するか確認
+ Registry.MagicData md = Registry.GetResonanceMagicData(books);
+ if (md == null) return;
+
+ try {
+ //魔法のインスタンスを作成
+ MagicBase mb = md.getMagic(world, player, false);
+
+ //その魔法が魔法陣を必要とする場合、要求された魔法陣の中心にいるかどうかの判定
+ String cir=mb.getMagicCircleName();
+ if(cir!=null && !cir.equals("null") && !mb.checkMagicCircle(cir)){
+ player.addChatComponentMessage(new ChatComponentTranslation("info.fbs.magic.circle.need"));
+ return;
+ }
+
+ //魔法使用直前のイベントを発生させ、キャンセルされていない場合魔法を実行する
+ if(!MinecraftForge.EVENT_BUS.post(new PlayerUseMagicEvent.Pre(player, mb, books.toArray(new ItemStack[books.size()])))){
+ boolean sc = mb.checkSuccess();
+ double exp = md.exp;
+ mb.isSpelled = true;
+ if (sc || player.capabilities.isCreativeMode) {
+ mb.success();
+ } else {
+ //失敗
+ mb.failureMessage();
+
+ //スタッフにセットされているチャームを探す
+ int charm = -1;
+ for (int i = bookNum; i < staffItems.length; i++) {
+ if (staffItems[i] != null && staffItems[i].getItem() == ItemCore.charm) {
+ charm = i;
+ break;
+ }
+ }
+
+ //チャームがセットされている場合、それを消費して魔法失敗時のデメリット回避
+ if (charm != -1) {
+ staffItems[charm].stackSize--;
+ if (staffItems[charm].stackSize <= 0) staffItems[charm] = null;
+ player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("info.fbs.magic.charm")));
+ } else mb.failure();
+
+ exp *= 0.2;
+ }
+
+ exp *= 0.5;//スタッフ使用時、経験値に補正をかける
+ SanityManager.addExp(player, exp, true);
+
+ //魔法使用直後のイベント発生
+ MinecraftForge.EVENT_BUS.post(new PlayerUseMagicEvent.Post(player, mb, books.toArray(new ItemStack[books.size()])));
+ }
+ } catch (Exception e) {
+ FMLLog.severe("Error! magic:" + md.title);
+ e.printStackTrace();
+ }
+
+ //魔導書の使用回数を減らす
+ if (!player.capabilities.isCreativeMode) {
+ for (ItemStack item : books) {
+ reduceMagicMaxUse(item);
+ }
+ }
+ }
+
+ @Override
+ public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List itemList) {
+ itemList.add(new ItemStack(this, 1, itemRand.nextInt(0xffffff+1)));
+ }
+
+ public static void setMagicMaxUse(ItemStack item, Registry.MagicData md){
+ NBTTagCompound nbt=item.getTagCompound();
+ if(nbt==null) return;
+ if(nbt.hasKey("useAmount")) nbt.removeTag("useAmount");
+ nbt.setInteger("useAmount", md.minUse+itemRand.nextInt(md.maxUse-md.minUse+1));
+ }
+ public static void setMagicMaxUse(ItemStack item, int num){
+ NBTTagCompound nbt=item.getTagCompound();
+ if(nbt==null) return;
+ if(nbt.hasKey("useAmount")) nbt.removeTag("useAmount");
+ nbt.setInteger("useAmount", num);
+ }
+ public static int getMagicMaxUse(ItemStack item){
+ NBTTagCompound nbt=item.getTagCompound();
+ if(nbt==null) return 0;
+ return nbt.getInteger("useAmount");
+ }
+ public static void reduceMagicMaxUse(ItemStack item){
+ NBTTagCompound nbt=item.getTagCompound();
+ if(nbt==null) return;
+ int c=nbt.getInteger("useAmount")-1;
+ nbt.removeTag("useAmount");
+ nbt.setInteger("useAmount", c);
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/item/ItemBookWhite.class b/src/main/java/jp/plusplus/fbs/item/ItemBookWhite.class Binary files differnew file mode 100644 index 0000000..0632932 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/ItemBookWhite.class diff --git a/src/main/java/jp/plusplus/fbs/item/ItemBookWhite.java b/src/main/java/jp/plusplus/fbs/item/ItemBookWhite.java new file mode 100644 index 0000000..e780a9c --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/ItemBookWhite.java @@ -0,0 +1,54 @@ +package jp.plusplus.fbs.item;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.Registry;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.StatCollector;
+import net.minecraft.world.World;
+
+import java.util.*;
+
+/**
+ * Created by plusplus_F on 2015/08/25.
+ */
+public class ItemBookWhite extends ItemBase {
+ protected Random rand=new Random();
+
+ public ItemBookWhite(){
+ setCreativeTab(FBS.tabBook);
+ setUnlocalizedName("bookWhite");
+ setTextureName("bookWhite");
+ setMaxStackSize(1);
+ }
+
+ @Override
+ public ItemStack onItemRightClick(ItemStack p_77659_1_, World p_77659_2_, EntityPlayer p_77659_3_) {
+ if(p_77659_2_.isRemote) return p_77659_1_;
+
+ ArrayList<Registry.BookData> list=new ArrayList<Registry.BookData>();
+ Map.Entry<String, Registry.BookData>[] books=Registry.GetBooks();
+
+ //魔導書の抽出
+ for(Map.Entry<String, Registry.BookData> bd : books){
+ if(!bd.getValue().isMagic) continue;
+
+ Registry.MagicData md=Registry.GetMagic(bd.getValue().title);
+ if(md.isResonance) continue;
+
+ list.add(bd.getValue());
+ }
+
+ //ランダムに変化
+ int r=rand.nextInt(list.size());
+ return Registry.GetBookItemStack(list.get(r).title);
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void addInformation(ItemStack p_77624_1_, EntityPlayer p_77624_2_, List p_77624_3_, boolean p_77624_4_) {
+ if(!FBS.enableDescription) return;
+ p_77624_3_.add(StatCollector.translateToLocal("info.fbs.bookWhite.0"));
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/item/ItemBookmark.class b/src/main/java/jp/plusplus/fbs/item/ItemBookmark.class Binary files differnew file mode 100644 index 0000000..31f872a --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/ItemBookmark.class diff --git a/src/main/java/jp/plusplus/fbs/item/ItemBookmark.java b/src/main/java/jp/plusplus/fbs/item/ItemBookmark.java new file mode 100644 index 0000000..a51aec9 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/ItemBookmark.java @@ -0,0 +1,140 @@ +package jp.plusplus.fbs.item;
+
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.block.BlockCore;
+import jp.plusplus.fbs.world.structure.MapGenSealdLib;
+import net.minecraft.client.multiplayer.ChunkProviderClient;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.ChatComponentTranslation;
+import net.minecraft.util.MathHelper;
+import net.minecraft.util.StatCollector;
+import net.minecraft.world.ChunkPosition;
+import net.minecraft.world.World;
+import net.minecraft.world.chunk.Chunk;
+import net.minecraft.world.chunk.IChunkProvider;
+import net.minecraft.world.gen.ChunkProviderServer;
+import net.minecraft.world.gen.structure.MapGenStructureIO;
+
+import java.util.List;
+
+/**
+ * Created by pluslus_F on 2015/06/23.
+ */
+public class ItemBookmark extends ItemBase {
+ public ItemBookmark() {
+ setUnlocalizedName("bookmark");
+ setTextureName("bookmark");
+ setMaxDamage(64);
+ setMaxStackSize(1);
+ }
+
+ @Override
+ public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer player){
+ if(!world.isRemote){
+ /*
+ まー言いたい事はいろいろあるけどさ、
+ なんでfindClosestStructureが実質Stronghold限定の実装なのよ。
+ わざわざ引数に構造物名とっといてさ。
+
+ @もやん
+ fニヽ
+ |_||
+ |= |
+ | |
+ |= |
+ i⌒| |⌒i_
+ /| | | | ヽ
+ | ( ( ( ( |
+ |/ |
+ | |
+ \ ノ
+ \ /
+ | |
+ */
+ item.damageItem(1, player);
+
+ int x=MathHelper.floor_double(player.posX), z=MathHelper.floor_double(player.posZ);
+ int dx=(x/16)-1, dz=(z/16);
+
+ //FBS.logger.info("at:"+dx+","+dz);
+
+ //強硬手段
+ for(int i=10;i<50;i++){
+ if(world.getBlock(x, i, z)== BlockCore.plank){
+ player.addChatComponentMessage(new ChatComponentTranslation("info.fbs.bookmark.shining"));
+ break;
+ }
+ }
+
+ if(MapGenSealdLib.isLibraryChunk(world, dx, dz)){
+ player.addChatComponentMessage(new ChatComponentTranslation("info.fbs.bookmark.success"));
+ }
+ else{
+ boolean found=false;
+ for(int i=0;i<3 && !found;i++){
+ for(int k=0;k<3 && !found;k++){
+ if(MapGenSealdLib.isLibraryChunk(world, dx+(i-1), dz+(k-1))){
+ found=true;
+ }
+ }
+ }
+ if(found){
+ player.addChatComponentMessage(new ChatComponentTranslation("info.fbs.bookmark.found"));
+ }
+ else{
+ player.addChatComponentMessage(new ChatComponentTranslation("info.fbs.bookmark.failure"));
+ }
+ }
+ }
+
+
+ return item;
+ }
+
+ /*
+ @Override
+ public boolean onItemUse(ItemStack item, EntityPlayer player, World world, int x, int y, int z, int side, float p_77648_8_, float p_77648_9_, float p_77648_10_) {
+ if(world.isRemote) return true;
+
+ item.damageItem(1, player);
+
+ world.findClosestStructure("Sealed Library", )
+
+ if(world.provider.dimensionCrackId!=0){
+ player.addChatComponentMessage(new ChatComponentTranslation("info.fbs.bookmark.failure"));
+ return true;
+ }
+
+ int dx=(x/16)-1, dz=(z/16);
+
+ if(MapGenSealdLib.isLibraryChunk(world, dx, dz)){
+ player.addChatComponentMessage(new ChatComponentTranslation("info.fbs.bookmark.success"));
+ }
+ else{
+ boolean found=false;
+ for(int i=0;i<3 && !found;i++){
+ for(int k=0;k<3 && !found;k++){
+ if(MapGenSealdLib.isLibraryChunk(world, dx+(i-1), dz+(k-1))){
+ found=true;
+ }
+ }
+ }
+ if(found){
+ player.addChatComponentMessage(new ChatComponentTranslation("info.fbs.bookmark.found"));
+ }
+ else{
+ player.addChatComponentMessage(new ChatComponentTranslation("info.fbs.bookmark.failure"));
+ }
+ }
+
+ return true;
+ }
+ */
+
+ @Override
+ public void addInformation(ItemStack p_77624_1_, EntityPlayer p_77624_2_, List p_77624_3_, boolean p_77624_4_) {
+ p_77624_3_.add(StatCollector.translateToLocal("info.fbs.bookmark.0"));
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/item/ItemButterfly.class b/src/main/java/jp/plusplus/fbs/item/ItemButterfly.class Binary files differnew file mode 100644 index 0000000..184b549 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/ItemButterfly.class diff --git a/src/main/java/jp/plusplus/fbs/item/ItemButterfly.java b/src/main/java/jp/plusplus/fbs/item/ItemButterfly.java new file mode 100644 index 0000000..e952580 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/ItemButterfly.java @@ -0,0 +1,278 @@ +package jp.plusplus.fbs.item;
+
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.block.BlockCore;
+import jp.plusplus.fbs.entity.EntityButterfly;
+import net.minecraft.block.Block;
+import net.minecraft.block.BlockLiquid;
+import net.minecraft.block.material.Material;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLiving;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.IEntityLivingData;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.Facing;
+import net.minecraft.util.MathHelper;
+import net.minecraft.util.MovingObjectPosition;
+import net.minecraft.world.World;
+import net.minecraftforge.common.util.ForgeDirection;
+
+/**
+ * Created by plusplus_F on 2015/08/20.
+ * ちょうちょ
+ */
+public class ItemButterfly extends ItemBase {
+ public ItemButterfly() {
+ setUnlocalizedName("butterfly");
+ setTextureName("butterfly");
+ }
+
+ //Entityの生成
+ public static Entity spawnCreature(World par0World, int meta, double x, double y, double z) {
+ Entity entity = null;
+ entity = new EntityButterfly(par0World);
+
+ EntityLiving entityliving = (EntityLiving) entity;
+ entity.setLocationAndAngles(x, y, z, MathHelper.wrapAngleTo180_float(par0World.rand.nextFloat() * 360.0F), 0.0F);
+ entityliving.rotationYawHead = entityliving.rotationYaw;
+ entityliving.renderYawOffset = entityliving.rotationYaw;
+ entityliving.onSpawnWithEgg((IEntityLivingData) null);
+ par0World.spawnEntityInWorld(entity);
+ entityliving.playLivingSound();
+
+ return entity;
+ }
+
+ @Override
+ public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
+ if (par2World.isRemote) {
+ return par1ItemStack;
+ } else {
+ MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(par2World, par3EntityPlayer, true);
+
+ if (movingobjectposition == null) {
+ return par1ItemStack;
+ } else {
+ if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
+ int i = movingobjectposition.blockX;
+ int j = movingobjectposition.blockY;
+ int k = movingobjectposition.blockZ;
+
+ if (!par2World.canMineBlock(par3EntityPlayer, i, j, k)) {
+ return par1ItemStack;
+ }
+
+ if (!par3EntityPlayer.canPlayerEdit(i, j, k, movingobjectposition.sideHit, par1ItemStack)) {
+ return par1ItemStack;
+ }
+
+ if (par2World.getBlock(i, j, k) instanceof BlockLiquid) {
+ Entity entity = spawnCreature(par2World, par1ItemStack.getItemDamage(), (double) i, (double) j, (double) k);
+
+ if (entity != null) {
+ if (entity instanceof EntityLivingBase && par1ItemStack.hasDisplayName()) {
+ ((EntityLiving) entity).setCustomNameTag(par1ItemStack.getDisplayName());
+ }
+
+ if (!par3EntityPlayer.capabilities.isCreativeMode) {
+ --par1ItemStack.stackSize;
+ }
+ }
+ }
+ }
+
+ return par1ItemStack;
+ }
+ }
+ }
+ @Override
+ public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int x, int y, int z, int side, float par8, float par9, float par10) {
+ if (par3World.isRemote) {
+ return true;
+ } else {
+ Block block = par3World.getBlock(x, y, z);
+ x += Facing.offsetsXForSide[side];
+ y += Facing.offsetsYForSide[side];
+ z += Facing.offsetsZForSide[side];
+
+ //-------------------------------ポータル生成処理-------------------------------
+ boolean genPortal=false;
+ if(block==BlockCore.plank){
+ int sizeMax=4;//半径
+ int sizeU=0, sizeD=0, sizeL=0, sizeR=0;
+ int sx=x, sy=y, sz=z;
+
+ //縦方向に木材があるか
+ boolean foundT=false, foundB=false;
+ for(int i=0;i<sizeMax;i++){
+ Block b=par3World.getBlock(sx, sy, sz);
+ if(b.getMaterial()!= Material.air){
+ foundT=b==BlockCore.plank;
+ sizeU=i;
+ break;
+ }
+ sy++;
+ }
+ sy=y;
+ for(int i=0;i<sizeMax;i++){
+ Block b=par3World.getBlock(sx, sy, sz);
+ if(b.getMaterial()!= Material.air){
+ foundB=b==BlockCore.plank;
+ sizeD=i;
+ break;
+ }
+ sy--;
+ }
+
+ //縦方向が揃っていれば次は横
+ if(foundT && foundB){
+ //横方向に木材があるかどうか
+ boolean foundL=false, foundR=false;
+ sy=y;
+
+ //南北
+ for(int i=0;i<sizeMax;i++){
+ Block b=par3World.getBlock(sx, sy, sz);
+ if(b.getMaterial()!= Material.air){
+ foundL=b==BlockCore.plank;
+ sizeL=i;
+ break;
+ }
+ sz--;
+ }
+ sz=z;
+ for(int i=0;i<sizeMax;i++){
+ Block b=par3World.getBlock(sx, sy, sz);
+ if(b.getMaterial()!= Material.air){
+ foundR=b==BlockCore.plank;
+ sizeR=i;
+ break;
+ }
+ sz++;
+ }
+
+ if(foundL && foundR){
+ //ポータル生成
+ if(tryMakePortal(par3World, x,y,z, false, sizeU, sizeD, sizeL, sizeR)){
+ return true;
+ }
+ }
+
+ //東西
+ foundL=foundR=false;
+ sz=z;
+ for(int i=0;i<sizeMax;i++){
+ Block b=par3World.getBlock(sx, sy, sz);
+ if(b.getMaterial()!= Material.air){
+ foundL=b==BlockCore.plank;
+ sizeL=i;
+ break;
+ }
+ sx--;
+ }
+ sx=x;
+ for(int i=0;i<sizeMax;i++){
+ Block b=par3World.getBlock(sx, sy, sz);
+ if(b.getMaterial()!= Material.air){
+ foundR=b==BlockCore.plank;
+ sizeR=i;
+ break;
+ }
+ sx++;
+ }
+ if(foundL && foundR){
+ //ポータル生成
+ if(tryMakePortal(par3World, x,y,z, true, sizeU, sizeD, sizeL, sizeR)){
+ return true;
+ }
+ }
+
+ }
+ }
+
+ //--------------------------蝶をスポーンする-------------------------------------
+ if(!genPortal){
+ double d0 = 0.0D;
+
+ if (side == 1 && block.getRenderType() == 11) {
+ d0 = 0.5D;
+ }
+
+ Entity entity = spawnCreature(par3World, par1ItemStack.getItemDamage(), (double) x + 0.5D, (double) y + d0, (double) z + 0.5D);
+ if (entity != null) {
+ if (entity instanceof EntityLivingBase && par1ItemStack.hasDisplayName()) {
+ ((EntityLiving) entity).setCustomNameTag(par1ItemStack.getDisplayName());
+ }
+
+ if (!par2EntityPlayer.capabilities.isCreativeMode) {
+ --par1ItemStack.stackSize;
+ }
+ }
+ }
+
+ return true;
+ }
+ }
+
+ /**
+ * ポータルを生成できるか判定し、生成できたらtrue
+ * @param world
+ * @param x
+ * @param y
+ * @param z
+ * @param sizeU
+ * @param sizeD
+ * @param sizeL
+ * @param sizeR
+ * @return
+ */
+ protected boolean tryMakePortal(World world, int x, int y, int z, boolean we, int sizeU, int sizeD, int sizeL, int sizeR){
+ int sizeUD=sizeU+sizeD+1;
+ int sizeLR=sizeL+sizeR+1;
+
+ int dx=x-sizeL;
+ int dy=y-sizeD;
+ int dz=z-sizeL;
+ if(we){
+ //枠が揃ってるか調べる
+ for(int i=0;i<sizeLR;i++){
+ if(world.getBlock(dx+i, dy, z)!=BlockCore.plank) return false;
+ if(world.getBlock(dx+i, dy+sizeUD-1, z)!=BlockCore.plank) return false;
+ }
+ for(int i=0;i<sizeUD;i++){
+ if(world.getBlock(dx, dy+i, z)!=BlockCore.plank) return false;
+ if(world.getBlock(dx+sizeLR-1, dy+i, z)!=BlockCore.plank) return false;
+ }
+
+ //ポータル生成
+ for(int xx=dx+1;xx<dx+sizeLR-1;xx++){
+ for(int yy=dy+1;yy<dy+sizeUD-1;yy++){
+ world.setBlock(xx,yy,z,BlockCore.portal2,1,2);
+ }
+ }
+
+ return true;
+ }
+ else{
+ //枠が揃ってるか調べる
+ for(int i=0;i<sizeLR;i++){
+ if(world.getBlock(x, dy, dz+i)!=BlockCore.plank) return false;
+ if(world.getBlock(x, dy+sizeUD-1, dz+i)!=BlockCore.plank) return false;
+ }
+ for(int i=0;i<sizeUD;i++){
+ if(world.getBlock(x, dy+i, dz)!=BlockCore.plank) return false;
+ if(world.getBlock(x, dy+i, dz+sizeLR-1)!=BlockCore.plank) return false;
+ }
+
+ //ポータル生成
+ for(int zz=dz+1;zz<dz+sizeLR-1;zz++){
+ for(int yy=dy+1;yy<dy+sizeUD-1;yy++){
+ world.setBlock(x,yy,zz,BlockCore.portal2,2,2);
+ }
+ }
+
+ return true;
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/item/ItemCharm.class b/src/main/java/jp/plusplus/fbs/item/ItemCharm.class Binary files differnew file mode 100644 index 0000000..c3e60fd --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/ItemCharm.class diff --git a/src/main/java/jp/plusplus/fbs/item/ItemCharm.java b/src/main/java/jp/plusplus/fbs/item/ItemCharm.java new file mode 100644 index 0000000..f1a2615 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/ItemCharm.java @@ -0,0 +1,92 @@ +package jp.plusplus.fbs.item;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.block.BlockCore;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemDye;
+import net.minecraft.item.ItemRedstone;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.StatCollector;
+import net.minecraft.world.World;
+
+import java.util.List;
+
+/**
+ * Createdby pluslus_Fon 2015/06/15.
+ */
+public class ItemCharm extends ItemBase {
+ public static final int[] COLOR_VALUE = {0x333333, 0xff0000, 0x009113, 0x552700, 0x2b00ff, 0xff00f7, 0x00afaf, 0xcdcdcd,
+ 0x787878, 0xffaaaa, 0x48ff37, 0xffea00, 0x00ffff, 0xd7008b, 0xff9500, 0xffffff};
+
+ public ItemCharm() {
+ setHasSubtypes(true);
+ setUnlocalizedName("charm");
+ setTextureName("charm");
+ getContainerItem(null);
+ }
+
+ @Override
+ public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List itemList) {
+ for (int i = 0; i < 16; i++) itemList.add(new ItemStack(this, 1, i));
+ }
+
+ @Override
+ public String getItemStackDisplayName(ItemStack item) {
+ return StatCollector.translateToLocal("item.fbs.charm." + ItemDye.field_150923_a[item.getItemDamage()] + ".name");
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public int getColorFromItemStack(ItemStack par1ItemStack, int par2) {
+ return COLOR_VALUE[par1ItemStack.getItemDamage()];
+ }
+
+ @Override
+ public boolean onItemUse(ItemStack p_77648_1_, EntityPlayer p_77648_2_, World p_77648_3_, int p_77648_4_, int p_77648_5_, int p_77648_6_, int p_77648_7_, float p_77648_8_, float p_77648_9_, float p_77648_10_) {
+ if (p_77648_3_.getBlock(p_77648_4_, p_77648_5_, p_77648_6_) != Blocks.snow_layer) {
+ if (p_77648_7_ == 0) {
+ --p_77648_5_;
+ }
+
+ if (p_77648_7_ == 1) {
+ ++p_77648_5_;
+ }
+
+ if (p_77648_7_ == 2) {
+ --p_77648_6_;
+ }
+
+ if (p_77648_7_ == 3) {
+ ++p_77648_6_;
+ }
+
+ if (p_77648_7_ == 4) {
+ --p_77648_4_;
+ }
+
+ if (p_77648_7_ == 5) {
+ ++p_77648_4_;
+ }
+
+ if (!p_77648_3_.isAirBlock(p_77648_4_, p_77648_5_, p_77648_6_)) {
+ return false;
+ }
+ }
+
+ if (!p_77648_2_.canPlayerEdit(p_77648_4_, p_77648_5_, p_77648_6_, p_77648_7_, p_77648_1_)) {
+ return false;
+ } else {
+ if (BlockCore.charm.canPlaceBlockAt(p_77648_3_, p_77648_4_, p_77648_5_, p_77648_6_)) {
+ --p_77648_1_.stackSize;
+ p_77648_3_.setBlock(p_77648_4_, p_77648_5_, p_77648_6_, BlockCore.charm);
+ p_77648_3_.setBlockMetadataWithNotify(p_77648_4_, p_77648_5_, p_77648_6_, p_77648_1_.getItemDamage()^15, 2);
+ }
+
+ return true;
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/item/ItemCloak.class b/src/main/java/jp/plusplus/fbs/item/ItemCloak.class Binary files differnew file mode 100644 index 0000000..d8db710 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/ItemCloak.class diff --git a/src/main/java/jp/plusplus/fbs/item/ItemCloak.java b/src/main/java/jp/plusplus/fbs/item/ItemCloak.java new file mode 100644 index 0000000..3602dcd --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/ItemCloak.java @@ -0,0 +1,33 @@ +package jp.plusplus.fbs.item;
+
+import jp.plusplus.fbs.FBS;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemArmor;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.StatCollector;
+
+import java.util.List;
+
+/**
+ * Createdby pluslus_Fon 2015/08/25.
+ */
+public class ItemCloak extends ItemArmor {
+ public ItemCloak(ArmorMaterial p_i45325_1_) {
+ super(p_i45325_1_, 0, 1);
+ setCreativeTab(FBS.tab);
+ setUnlocalizedName("fbs.cloak");
+ setTextureName(FBS.MODID+":cloak");
+ }
+
+ @Override
+ public String getArmorTexture(ItemStack stack, Entity entity, int slot, String layer) {
+ return FBS.MODID+":textures/armor/monocle.png";
+ }
+ @Override
+ public void addInformation(ItemStack p_77624_1_, EntityPlayer p_77624_2_, List p_77624_3_, boolean p_77624_4_) {
+ if(!FBS.enableDescription) return;
+ p_77624_3_.add(StatCollector.translateToLocal("info.fbs.cloak.0"));
+ p_77624_3_.add(StatCollector.translateToLocal("info.fbs.valuable"));
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/item/ItemCore.class b/src/main/java/jp/plusplus/fbs/item/ItemCore.class Binary files differnew file mode 100644 index 0000000..44d48a8 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/ItemCore.class diff --git a/src/main/java/jp/plusplus/fbs/item/ItemCore.java b/src/main/java/jp/plusplus/fbs/item/ItemCore.java new file mode 100644 index 0000000..4d6a328 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/ItemCore.java @@ -0,0 +1,301 @@ +package jp.plusplus.fbs.item;
+
+import cpw.mods.fml.common.registry.GameRegistry;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.alchemy.*;
+import jp.plusplus.fbs.block.BlockCore;
+import jp.plusplus.fbs.item.enchant.EnchantmentCleverness;
+import jp.plusplus.fbs.item.enchant.EnchantmentSanityProtect;
+import jp.plusplus.fbs.item.enchant.EnchantmentWealth;
+import jp.plusplus.fbs.spirit.ItemSwordSpirit;
+import jp.plusplus.fbs.storage.ItemMealFragment;
+import net.minecraft.enchantment.Enchantment;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemArmor;
+import net.minecraft.item.ItemSeeds;
+import net.minecraftforge.common.util.EnumHelper;
+
+/**
+ * Createdby pluslus_Fon 2015/06/05.
+ */
+public class ItemCore {
+ public static ItemArmor.ArmorMaterial materialMonocleWood;
+ public static ItemArmor.ArmorMaterial materialMonocle;
+ public static ItemArmor.ArmorMaterial materialMonocleGold;
+ public static ItemArmor.ArmorMaterial materialInifinity;
+
+ public static int eIdSanity;
+ public static int eIdCleverness;
+ public static int eIdWealth;
+ public static Enchantment enchantmentSanity;
+ public static Enchantment enchantmentCleverness;
+ public static Enchantment enchantmentWealth;
+
+ public static Item gem;
+
+ public static Item seedLavender;
+ public static Item lavender;
+ public static Item seedRedLily;
+ public static Item redLily;
+ public static Item redLilyDirty;
+
+ public static Item stick;
+ public static Item butterfly;
+ public static Item instantMana;
+ public static Item membership;
+ public static Item enchantScroll;
+ public static Item mpCoin;
+ public static Item potionBless;
+ public static Item cookieFortune;
+
+ public static Item monocleWood;
+ public static Item monocle;
+ public static Item monocleGold;
+ public static Item cloak;
+ public static Item infinityHelm;
+ public static Item infinityArmor;
+ public static Item infinityLegs;
+ public static Item infinityBoots;
+ public static Item luckyDagger;
+
+ public static Item bucketMana;
+ public static Item bookmark;
+ public static Item net;
+ public static Item shovel;
+ public static Item foldingFan;
+ public static Item tableware;
+
+ public static Item potionOblivion;
+ public static Item potionSan;
+
+ public static Item stoneInactive;
+ public static Item stoneActive;
+ public static Item stoneActiveMale;
+ public static Item stoneActiveFemale;
+ public static Item spiritSword;
+
+ public static Item staffHead1;
+ public static Item staffHead2;
+ public static Item staffHead3;
+ public static Item staffHead4;
+ public static Item staffHead5;
+
+ public static Item staff1_1;
+ public static Item staff1_2;
+ public static Item staff1_3;
+ public static Item staff1_4;
+ public static Item staff1_5;
+ public static Item staff2_1;
+ public static Item staff2_2;
+ public static Item staff2_3;
+ public static Item staff2_4;
+ public static Item staff2_5;
+
+ public static Item charm;
+
+ public static ItemBookNoDecoded bookNoDecoded;
+ public static ItemOldBook bookOld;
+ public static ItemBookSorcery bookSorcery;
+ public static ItemBookBroken bookBroken;
+ public static ItemBookWhite bookWhite;
+
+ public static Item clayWet;
+ public static Item clayGlow;
+
+ public static Item basket;
+ public static Item alchemyMaterial;
+ public static Item alchemyIntermediateMaterial;
+ public static Item alchemyMaterialEatable;
+ public static Item alchemyPotion;
+ public static Item alchemyRecipe;
+
+ public static Item herbUnknown;
+ public static Item seedsUnknown;
+ public static Item fruitsUnknown;
+ public static Item flowerUnknown;
+ public static Item grassUnknown;
+ public static Item mushroomUnknown;
+
+ public static Item mealFragment;
+
+ public static Item potMagic;
+
+
+ public static void Init(){
+ materialMonocleWood=EnumHelper.addArmorMaterial("MonocleWood", 1, new int[]{0,0,0,0}, 0);
+ materialMonocle=EnumHelper.addArmorMaterial("Monocle", 5, new int[]{0,0,0,0}, 0);
+ materialMonocleGold=EnumHelper.addArmorMaterial("MonocleGold", 3, new int[]{0,0,0,0}, 0);
+ materialInifinity=EnumHelper.addArmorMaterial("Infinity", 60, new int[]{3,8,6,3}, 0);
+
+ enchantmentSanity=new EnchantmentSanityProtect(eIdSanity, 8);
+ enchantmentCleverness=new EnchantmentCleverness(eIdCleverness, 2);
+ enchantmentWealth=new EnchantmentWealth(eIdWealth, 2);
+
+ gem=new ItemGem();
+ GameRegistry.registerItem(gem, "gem");
+
+ seedLavender=new ItemSeeds(BlockCore.cropLavender, Blocks.farmland).setCreativeTab(FBS.tab).setUnlocalizedName("fbs.seedLavender").setTextureName(FBS.MODID+":seedLavender");
+ lavender=new ItemLavender();
+ seedRedLily=new ItemSeedRedLily();
+ redLily=new ItemBase().setCreativeTab(FBS.tab).setUnlocalizedName("redLily").setTextureName("redLily");
+ redLilyDirty=new ItemBase().setCreativeTab(FBS.tab).setUnlocalizedName("redLilyDirty").setTextureName("redLilyDirty");
+ GameRegistry.registerItem(seedLavender, "seedLavender");
+ GameRegistry.registerItem(lavender, "lavender");
+ GameRegistry.registerItem(seedRedLily, "seedRedLily");
+ GameRegistry.registerItem(redLily, "redLily");
+ GameRegistry.registerItem(redLilyDirty, "redLilyDirty");
+
+ stick=new ItemBase().setUnlocalizedName("stick").setTextureName("stick").setFull3D();
+ butterfly=new ItemButterfly();
+ instantMana=new ItemBase().setUnlocalizedName("instantMana").setTextureName("instantMana");
+ membership=new ItemBase().setUnlocalizedName("membership").setTextureName("membership");
+ enchantScroll=new ItemEnchantScroll();
+ mpCoin=new ItemMPCoin();
+ potionBless=new ItemBase().setUnlocalizedName("potionBless").setTextureName("potionBless");
+ cookieFortune=new ItemFortuneCookie();
+ GameRegistry.registerItem(stick, "stick");
+ GameRegistry.registerItem(butterfly, "butterfly");
+ GameRegistry.registerItem(instantMana, "instantMana");
+ GameRegistry.registerItem(membership, "membership");
+ GameRegistry.registerItem(enchantScroll, "enchantScroll");
+ GameRegistry.registerItem(mpCoin, "mpCoin");
+ GameRegistry.registerItem(potionBless, "potionBless");
+ GameRegistry.registerItem(cookieFortune, "cookieFortune");
+
+ monocleWood=new ItemMonocle(materialMonocleWood).setUnlocalizedName("fbs.monocleWood").setTextureName(FBS.MODID+":monocleWood");
+ monocle=new ItemMonocle(materialMonocle).setUnlocalizedName("fbs.monocle").setTextureName(FBS.MODID+":monocle");
+ monocleGold=new ItemMonocle(materialMonocleGold).setUnlocalizedName("fbs.monocleGold").setTextureName(FBS.MODID+":monocleGold");
+ cloak=new ItemCloak(materialMonocle);
+ infinityHelm=new ItemArmorInfinity(materialInifinity, 0).setUnlocalizedName("fbs.infinityHelm").setTextureName(FBS.MODID+":infinityHelm");
+ infinityArmor=new ItemArmorInfinity(materialInifinity, 1).setUnlocalizedName("fbs.infinityArmor").setTextureName(FBS.MODID+":infinityArmor");
+ infinityLegs=new ItemArmorInfinity(materialInifinity, 2).setUnlocalizedName("fbs.infinityLegs").setTextureName(FBS.MODID+":infinityLegs");
+ infinityBoots=new ItemArmorInfinity(materialInifinity, 3).setUnlocalizedName("fbs.infinityBoots").setTextureName(FBS.MODID+":infinityBoots");
+ luckyDagger=new ItemLuckyDagger();
+ GameRegistry.registerItem(monocleWood, "monocleWood");
+ GameRegistry.registerItem(monocle, "monocle");
+ GameRegistry.registerItem(monocleGold, "monocleGold");
+ GameRegistry.registerItem(cloak, "cloak");
+ GameRegistry.registerItem(infinityHelm, "infinityHelm");
+ GameRegistry.registerItem(infinityArmor, "infinityArmor");
+ GameRegistry.registerItem(infinityLegs, "infinityLegs");
+ GameRegistry.registerItem(infinityBoots, "infinityBoots");
+ GameRegistry.registerItem(luckyDagger, "luckyDagger");
+
+ bucketMana=new Item().setCreativeTab(FBS.tab).setTextureName(FBS.MODID+":bucketMana").setUnlocalizedName("fbs.bucketMana").setMaxStackSize(1);
+ bookmark=new ItemBookmark();
+ net=new ItemNet();
+ shovel=new ItemShovel();
+ foldingFan=new ItemFoldingFan();
+ tableware=new ItemPlaceable();
+ GameRegistry.registerItem(bucketMana, "bucketMana");
+ GameRegistry.registerItem(bookmark, "bookmark");
+ GameRegistry.registerItem(net, "net");
+ GameRegistry.registerItem(shovel, "shovel");
+ GameRegistry.registerItem(foldingFan, "foldingFan");
+ GameRegistry.registerItem(tableware, "tableware");
+
+ potionOblivion=new ItemPotionOblivion();
+ potionSan=new ItemPotionSanity();
+ GameRegistry.registerItem(potionOblivion, "potionOblivion");
+ GameRegistry.registerItem(potionSan, "potionSan");
+
+ stoneInactive=new ItemBase().setCreativeTab(FBS.tabSpirit).setUnlocalizedName("stoneInactive").setTextureName("stoneInactive").setMaxStackSize(1);
+ stoneActive=new ItemStoneSpirit().setUnlocalizedName("stoneActivated").setTextureName("stoneActivated");
+ stoneActiveMale=new ItemStoneSpirit().setUnlocalizedName("stoneActivatedMale").setTextureName("stoneActivatedMale");
+ stoneActiveFemale=new ItemStoneSpirit().setUnlocalizedName("stoneActivatedFemale").setTextureName("stoneActivatedFemale");
+ spiritSword=new ItemSwordSpirit();
+ GameRegistry.registerItem(stoneInactive, "stoneInactive");
+ GameRegistry.registerItem(stoneActive, "stoneActive");
+ GameRegistry.registerItem(stoneActiveMale, "stoneActiveMale");
+ GameRegistry.registerItem(stoneActiveFemale, "stoneActiveFemale");
+ GameRegistry.registerItem(spiritSword, "spiritSword");
+
+ staffHead1=new ItemBase().setTextureName("staffhead1").setUnlocalizedName("staffHead1");
+ staffHead2=new ItemBase().setTextureName("staffhead2").setUnlocalizedName("staffHead2");
+ staffHead3=new ItemBase().setTextureName("staffhead3").setUnlocalizedName("staffHead3");
+ staffHead4=new ItemBase().setTextureName("staffhead4").setUnlocalizedName("staffHead4");
+ staffHead5=new ItemBase().setTextureName("staffhead5").setUnlocalizedName("staffHead5");
+ GameRegistry.registerItem(staffHead1, "staffHead1");
+ GameRegistry.registerItem(staffHead2, "staffHead2");
+ GameRegistry.registerItem(staffHead3, "staffHead3");
+ GameRegistry.registerItem(staffHead4, "staffHead4");
+ GameRegistry.registerItem(staffHead5, "staffHead5");
+
+ staff1_1 =new ItemStaff(1, 1);
+ staff1_2 =new ItemStaff(1, 2);
+ staff1_3 =new ItemStaff(1, 3);
+ staff1_4 =new ItemStaff(1, 4);
+ staff1_5 =new ItemStaff(1, 5);
+ GameRegistry.registerItem(staff1_1, "staff1_1");
+ GameRegistry.registerItem(staff1_2, "staff1_2");
+ GameRegistry.registerItem(staff1_3, "staff1_3");
+ GameRegistry.registerItem(staff1_4, "staff1_4");
+ GameRegistry.registerItem(staff1_5, "staff1_5");
+
+ staff2_1 =new ItemStaff(2, 1);
+ staff2_2 =new ItemStaff(2, 2);
+ staff2_3 =new ItemStaff(2, 3);
+ staff2_4 =new ItemStaff(2, 4);
+ staff2_5 =new ItemStaff(2, 5);
+ GameRegistry.registerItem(staff2_1, "staff2_1");
+ GameRegistry.registerItem(staff2_2, "staff2_2");
+ GameRegistry.registerItem(staff2_3, "staff2_3");
+ GameRegistry.registerItem(staff2_4, "staff2_4");
+ GameRegistry.registerItem(staff2_5, "staff2_5");
+
+ charm=new ItemCharm();
+ GameRegistry.registerItem(charm, "charm");
+
+ bookWhite=new ItemBookWhite();
+ bookBroken=new ItemBookBroken();
+ bookNoDecoded=new ItemBookNoDecoded();
+ bookOld=new ItemOldBook();
+ bookSorcery=new ItemBookSorcery();
+ GameRegistry.registerItem(bookWhite, "bookWhite");
+ GameRegistry.registerItem(bookBroken, "bookBroken");
+ GameRegistry.registerItem(bookNoDecoded, "bookNoDecoded");
+ GameRegistry.registerItem(bookOld, "bookOld");
+ GameRegistry.registerItem(bookSorcery, "bookSorcery");
+
+ clayWet=new ItemBase().setUnlocalizedName("clayWet").setTextureName("clayWet").setCreativeTab(FBS.tabPottery);
+ clayGlow=new ItemBase().setUnlocalizedName("clayGlow").setTextureName("clayGlow").setCreativeTab(FBS.tabPottery);
+ GameRegistry.registerItem(clayWet, "clayWet");
+ GameRegistry.registerItem(clayGlow, "clayGlow");
+
+ basket=new ItemBasket();
+ alchemyRecipe=new ItemRecipeBook();
+ GameRegistry.registerItem(basket, "basket");
+ GameRegistry.registerItem(alchemyRecipe, "alchemyRecipe");
+
+ herbUnknown=new ItemBase().setCreativeTab(FBS.tabAlchemy).setUnlocalizedName("in.herb").setTextureName("herbUnknown");
+ seedsUnknown=new ItemBase().setCreativeTab(FBS.tabAlchemy).setUnlocalizedName("in.seeds").setTextureName("seedsUnknown");
+ flowerUnknown=new ItemBase().setCreativeTab(FBS.tabAlchemy).setUnlocalizedName("in.flower").setTextureName("flowerUnknown");
+ fruitsUnknown=new ItemBase().setCreativeTab(FBS.tabAlchemy).setUnlocalizedName("in.fruits").setTextureName("fruitsUnknown");
+ grassUnknown=new ItemBase().setCreativeTab(FBS.tabAlchemy).setUnlocalizedName("in.grass").setTextureName("grassUnknown");
+ mushroomUnknown=new ItemBase().setCreativeTab(FBS.tabAlchemy).setUnlocalizedName("in.mushroom").setTextureName("mushroomUnknown");
+ GameRegistry.registerItem(herbUnknown, "herbUnknown");
+ GameRegistry.registerItem(seedsUnknown, "seedsUnknown");
+ GameRegistry.registerItem(flowerUnknown, "flowerUnknown");
+ GameRegistry.registerItem(fruitsUnknown, "fruitsUnknown");
+ GameRegistry.registerItem(grassUnknown, "grassUnknown");
+ GameRegistry.registerItem(mushroomUnknown, "mushroomUnknown");
+
+ alchemyMaterial =new ItemAlchemyMaterial();
+ alchemyIntermediateMaterial=new ItemAlchemyIntermediateMaterial();
+ alchemyMaterialEatable=new ItemEatableAlchemyMaterial();
+ alchemyPotion =new ItemAlchemyPotion();
+ GameRegistry.registerItem(alchemyMaterial, "materials0");
+ GameRegistry.registerItem(alchemyIntermediateMaterial, "materials1");
+ GameRegistry.registerItem(alchemyMaterialEatable, "materials2");
+ GameRegistry.registerItem(alchemyPotion, "potions0");
+
+ mealFragment=new ItemMealFragment();
+ GameRegistry.registerItem(mealFragment, "mealFragment");
+
+ /*
+ potMagic=new ItemPotteryUsableBase();
+ GameRegistry.registerItem(potMagic, "potMagic");
+ */
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/item/ItemEnchantScroll.class b/src/main/java/jp/plusplus/fbs/item/ItemEnchantScroll.class Binary files differnew file mode 100644 index 0000000..09687e1 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/ItemEnchantScroll.class diff --git a/src/main/java/jp/plusplus/fbs/item/ItemEnchantScroll.java b/src/main/java/jp/plusplus/fbs/item/ItemEnchantScroll.java new file mode 100644 index 0000000..d273567 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/ItemEnchantScroll.java @@ -0,0 +1,38 @@ +package jp.plusplus.fbs.item;
+
+import jp.plusplus.fbs.FBS;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.MathHelper;
+import net.minecraft.world.World;
+
+/**
+ * Created by plusplus_F on 2015/10/19.
+ */
+public class ItemEnchantScroll extends ItemBase {
+ public ItemEnchantScroll(){
+ setMaxStackSize(1);
+ setUnlocalizedName("enchantScroll");
+ setTextureName("enchantScroll");
+ setMaxDamage(100);
+ }
+
+ @Override
+ public ItemStack onItemRightClick(ItemStack p_77659_1_, World p_77659_2_, EntityPlayer p_77659_3_) {
+ if(!p_77659_2_.isRemote){
+ p_77659_3_.openGui(FBS.instance, FBS.GUI_ENCHANTMENT_ID, p_77659_2_, MathHelper.floor_double(p_77659_3_.posX), MathHelper.floor_double(p_77659_3_.posY), MathHelper.floor_double(p_77659_3_.posZ));
+ }
+ return p_77659_1_;
+ }
+ /*
+ @Override
+ public boolean onItemUse(ItemStack p_77648_1_, EntityPlayer p_77648_2_, World p_77648_3_, int p_77648_4_, int p_77648_5_, int p_77648_6_, int p_77648_7_, float p_77648_8_, float p_77648_9_, float p_77648_10_) {
+
+ if(!p_77648_3_.isRemote){
+ p_77648_2_.openGui(FBS.instance, FBS.GUI_ENCHANTMENT_ID, p_77648_3_, p_77648_4_, p_77648_5_, p_77648_6_);
+ }
+
+ return true;
+ }
+ */
+}
diff --git a/src/main/java/jp/plusplus/fbs/item/ItemFoldingFan.class b/src/main/java/jp/plusplus/fbs/item/ItemFoldingFan.class Binary files differnew file mode 100644 index 0000000..1d8d701 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/ItemFoldingFan.class diff --git a/src/main/java/jp/plusplus/fbs/item/ItemFoldingFan.java b/src/main/java/jp/plusplus/fbs/item/ItemFoldingFan.java new file mode 100644 index 0000000..76b556f --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/ItemFoldingFan.java @@ -0,0 +1,45 @@ +package jp.plusplus.fbs.item;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.FBS;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.enchantment.Enchantment;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.item.ItemSword;
+import net.minecraft.util.StatCollector;
+import net.minecraftforge.common.util.EnumHelper;
+
+import java.util.List;
+
+/**
+ * Created by plusplus_F on 2015/08/21.
+ */
+public class ItemFoldingFan extends ItemSword{
+ public ItemFoldingFan() {
+ super(EnumHelper.addToolMaterial("fbs.foldingFan", 0, 131, 3.0f, 2.0f, 0));
+ setCreativeTab(FBS.tab);
+ setUnlocalizedName("fbs.foldingFan");
+ setTextureName(FBS.MODID + ":foldingFan");
+ }
+
+ public static ItemStack GetItemStack(){
+ ItemStack it=new ItemStack(ItemCore.foldingFan, 1, 0);
+ it.addEnchantment(Enchantment.knockback, 2);
+
+ return it;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void getSubItems(Item p_150895_1_, CreativeTabs p_150895_2_, List p_150895_3_) {
+ p_150895_3_.add(GetItemStack());
+ }
+
+ @Override
+ public void addInformation(ItemStack itemStack, EntityPlayer player, List list, boolean p_77624_4_) {
+ if(!FBS.enableDescription) return;
+ list.add(StatCollector.translateToLocal("info.fbs.foldingFan.0"));
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/item/ItemFortuneCookie.class b/src/main/java/jp/plusplus/fbs/item/ItemFortuneCookie.class Binary files differnew file mode 100644 index 0000000..fa09ec3 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/ItemFortuneCookie.class diff --git a/src/main/java/jp/plusplus/fbs/item/ItemFortuneCookie.java b/src/main/java/jp/plusplus/fbs/item/ItemFortuneCookie.java new file mode 100644 index 0000000..d7b372b --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/ItemFortuneCookie.java @@ -0,0 +1,51 @@ +package jp.plusplus.fbs.item;
+
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.Registry;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemFood;
+import net.minecraft.item.ItemStack;
+import net.minecraft.potion.PotionEffect;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.MathHelper;
+import net.minecraft.util.StatCollector;
+import net.minecraft.world.World;
+
+/**
+ * Created by plusplus_F on 2016/03/31.
+ */
+public class ItemFortuneCookie extends ItemFood {
+ public ItemFortuneCookie() {
+ super(2, 0.1f, false);
+ setUnlocalizedName("fbs.cookieFortune");
+ setTextureName(FBS.MODID + ":cookieFortune");
+ setCreativeTab(FBS.tab);
+ }
+
+ @Override
+ public ItemStack onEaten(ItemStack itemStack, World world, EntityPlayer player) {
+ super.onEaten(itemStack, world, player);
+
+ //メッセージを出す
+ if(!world.isRemote){
+ if(world.rand.nextInt(256)==1){
+ //願い判定
+ player.openGui(FBS.instance, FBS.GUI_WISH_ID, world, MathHelper.floor_double(player.posX), MathHelper.floor_double(player.posY), MathHelper.floor_double(player.posZ));
+ }
+ else{
+ //ランダムにメッセージ
+ String m= Registry.GetRandomMessage();
+ int v=Registry.GetRandomMessageVariant(m);
+ player.addChatComponentMessage(new ChatComponentText("<"+itemStack.getDisplayName()+">"+Registry.GetLocalizedFortuneCookieMessage(m, v)));
+ }
+ }
+
+ return itemStack;
+ }
+
+ @Override
+ protected void onFoodEaten(ItemStack itemStack, World world, EntityPlayer player) {
+ super.onFoodEaten(itemStack, world, player);
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/item/ItemGem.class b/src/main/java/jp/plusplus/fbs/item/ItemGem.class Binary files differnew file mode 100644 index 0000000..b748ee8 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/ItemGem.class diff --git a/src/main/java/jp/plusplus/fbs/item/ItemGem.java b/src/main/java/jp/plusplus/fbs/item/ItemGem.java new file mode 100644 index 0000000..b3ed77d --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/ItemGem.java @@ -0,0 +1,69 @@ +package jp.plusplus.fbs.item;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.FBS;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.init.Items;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemDye;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.IIcon;
+import net.minecraft.util.StatCollector;
+
+import java.util.List;
+
+/**
+ * Createdby pluslus_Fon 2015/06/15.
+ */
+public class ItemGem extends ItemBase {
+ public static final String[] NAMES={"gemRuby","gemSapphire","gemAmethyst", "gemInfinity"};
+ public static final int[] COLOR_VALUE={0xff3333, 0x3333ff, 0xcc00cc, 0xc8e6ff};
+ private IIcon overlay;
+
+ public ItemGem(){
+ setHasSubtypes(true);
+ setTextureName("gem");
+ setUnlocalizedName("gem");
+ }
+
+ @Override
+ public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List itemList) {
+ for(int i=0;i<NAMES.length;i++) itemList.add(new ItemStack(this, 1, i));
+ }
+
+ @Override
+ public String getUnlocalizedName(ItemStack item){
+ return "item.fbs."+NAMES[item.getItemDamage()];
+ }
+
+
+ @SideOnly(Side.CLIENT)
+ public void registerIcons(IIconRegister p_94581_1_){
+ super.registerIcons(p_94581_1_);
+ overlay=p_94581_1_.registerIcon(FBS.MODID+":gemOverlay");
+ }
+
+ @SideOnly(Side.CLIENT)
+ public boolean hasEffect(ItemStack par1ItemStack, int pass) {
+ return par1ItemStack.getItemDamage()==3;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public boolean requiresMultipleRenderPasses()
+ {
+ return true;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public IIcon getIconFromDamageForRenderPass(int p_77618_1_, int pass){
+ return pass == 0 ? itemIcon : overlay;
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public int getColorFromItemStack(ItemStack par1ItemStack, int par2) {
+ return par2==0?COLOR_VALUE[par1ItemStack.getItemDamage()]:0xffffff;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/item/ItemLavender.class b/src/main/java/jp/plusplus/fbs/item/ItemLavender.class Binary files differnew file mode 100644 index 0000000..800bb06 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/ItemLavender.class diff --git a/src/main/java/jp/plusplus/fbs/item/ItemLavender.java b/src/main/java/jp/plusplus/fbs/item/ItemLavender.java new file mode 100644 index 0000000..9ab9f13 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/ItemLavender.java @@ -0,0 +1,37 @@ +package jp.plusplus.fbs.item;
+
+import com.mojang.realmsclient.gui.ChatFormatting;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.exprop.FBSEntityProperties;
+import jp.plusplus.fbs.exprop.SanityManager;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemFood;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.StatCollector;
+import net.minecraft.world.World;
+
+import java.util.List;
+
+/**
+ * Createdby pluslus_Fon 2015/06/05.
+ */
+public class ItemLavender extends ItemFood{
+ public ItemLavender() {
+ super(2, 0.2f, false);
+ setCreativeTab(FBS.tab);
+ setUnlocalizedName("fbs.lavender");
+ setTextureName(FBS.MODID+":lavender");
+ setAlwaysEdible();
+ }
+ public ItemStack onEaten(ItemStack p_77654_1_, World p_77654_2_, EntityPlayer p_77654_3_) {
+ return super.onEaten(p_77654_1_, p_77654_2_, p_77654_3_);
+ }
+ public ItemStack onItemRightClick(ItemStack p_77659_1_, World p_77659_2_, EntityPlayer player) {
+ FBSEntityProperties prop=FBSEntityProperties.get(player);
+ if(prop!=null && prop.getSanity()<prop.getMaxSanity()) {
+ player.setItemInUse(p_77659_1_, this.getMaxItemUseDuration(p_77659_1_));
+ }
+
+ return p_77659_1_;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/item/ItemLuckyDagger.class b/src/main/java/jp/plusplus/fbs/item/ItemLuckyDagger.class Binary files differnew file mode 100644 index 0000000..1680b73 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/ItemLuckyDagger.class diff --git a/src/main/java/jp/plusplus/fbs/item/ItemLuckyDagger.java b/src/main/java/jp/plusplus/fbs/item/ItemLuckyDagger.java new file mode 100644 index 0000000..69f832b --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/ItemLuckyDagger.java @@ -0,0 +1,51 @@ +package jp.plusplus.fbs.item;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.Registry;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.enchantment.Enchantment;
+import net.minecraft.enchantment.EnchantmentHelper;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.item.ItemSword;
+import net.minecraft.util.StatCollector;
+import net.minecraftforge.common.util.EnumHelper;
+
+import java.util.LinkedHashMap;
+import java.util.List;
+
+/**
+ * Created by plusplus_F on 2016/04/01.
+ */
+public class ItemLuckyDagger extends ItemSword {
+ public ItemLuckyDagger() {
+ super(EnumHelper.addToolMaterial("fbs.luckyDagger", 0, 1024, 5.0f, 1.5f, 0));
+ setUnlocalizedName("fbs.luckyDagger");
+ setTextureName(FBS.MODID + ":luckyDagger");
+ setCreativeTab(FBS.tab);
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void getSubItems(Item p_150895_1_, CreativeTabs p_150895_2_, List p_150895_3_) {
+ p_150895_3_.add(getItemStack());
+ }
+
+ @Override
+ public void addInformation(ItemStack p_77624_1_, EntityPlayer p_77624_2_, List p_77624_3_, boolean p_77624_4_) {
+ if(!FBS.enableDescription) return;
+ p_77624_3_.add(StatCollector.translateToLocal("info.fbs.valuable"));
+ }
+
+ public static ItemStack getItemStack(){
+ ItemStack itemStack=new ItemStack(ItemCore.luckyDagger);
+ LinkedHashMap linkedhashmap = new LinkedHashMap();
+ linkedhashmap.put(ItemCore.enchantmentWealth.effectId, ItemCore.enchantmentWealth.getMaxLevel());
+ linkedhashmap.put(Enchantment.looting.effectId, Enchantment.looting.getMaxLevel());
+ linkedhashmap.put(Enchantment.field_151369_A.effectId, Enchantment.field_151369_A.getMaxLevel());
+ EnchantmentHelper.setEnchantments(linkedhashmap, itemStack);
+ return itemStack;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/item/ItemMPCoin.class b/src/main/java/jp/plusplus/fbs/item/ItemMPCoin.class Binary files differnew file mode 100644 index 0000000..17d4de3 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/ItemMPCoin.class diff --git a/src/main/java/jp/plusplus/fbs/item/ItemMPCoin.java b/src/main/java/jp/plusplus/fbs/item/ItemMPCoin.java new file mode 100644 index 0000000..ffd1671 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/ItemMPCoin.java @@ -0,0 +1,68 @@ +package jp.plusplus.fbs.item;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.FBS;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.IIcon;
+import net.minecraft.util.StatCollector;
+import net.minecraft.world.World;
+import shift.mceconomy2.api.MCEconomyAPI;
+
+import java.util.List;
+
+/**
+ * Created by plusplus_F on 2015/10/20.
+ */
+public class ItemMPCoin extends ItemBase {
+ protected IIcon[] icons;
+
+ public ItemMPCoin() {
+ setMaxStackSize(1);
+ setMaxDamage(0);
+ setHasSubtypes(true);
+ setUnlocalizedName("mpCoin");
+ }
+
+ @Override
+ public ItemStack onItemRightClick(ItemStack p_77659_1_, World p_77659_2_, EntityPlayer p_77659_3_) {
+ int v = p_77659_1_.getItemDamage();
+ if (!p_77659_2_.isRemote && v > 0) {
+ MCEconomyAPI.addPlayerMP(p_77659_3_, v, false);
+ }
+ p_77659_1_.stackSize=0;
+ return p_77659_1_;
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void registerIcons(IIconRegister p_94581_1_) {
+ icons=new IIcon[2];
+ icons[0]=p_94581_1_.registerIcon(FBS.MODID+":coin0");
+ icons[1]=p_94581_1_.registerIcon(FBS.MODID+":coin1");
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public IIcon getIconFromDamage(int p_77617_1_) {
+ return p_77617_1_>=1000?icons[1]:icons[0];
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void getSubItems(Item p_150895_1_, CreativeTabs p_150895_2_, List p_150895_3_) {
+ p_150895_3_.add(new ItemStack(p_150895_1_, 1, 1));
+ p_150895_3_.add(new ItemStack(p_150895_1_, 1, 500));
+ p_150895_3_.add(new ItemStack(p_150895_1_, 1, 1000));
+ p_150895_3_.add(new ItemStack(p_150895_1_, 1, 2000));
+ }
+
+ @Override
+ public String getItemStackDisplayName(ItemStack p_77653_1_) {
+ return super.getItemStackDisplayName(p_77653_1_)+"("+p_77653_1_.getItemDamage()+"MP)";
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/item/ItemMagicCore.class b/src/main/java/jp/plusplus/fbs/item/ItemMagicCore.class Binary files differnew file mode 100644 index 0000000..5d6c916 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/ItemMagicCore.class diff --git a/src/main/java/jp/plusplus/fbs/item/ItemMagicCore.java b/src/main/java/jp/plusplus/fbs/item/ItemMagicCore.java new file mode 100644 index 0000000..063182c --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/ItemMagicCore.java @@ -0,0 +1,28 @@ +package jp.plusplus.fbs.item;
+
+import jp.plusplus.fbs.FBS;
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemBlock;
+import net.minecraft.item.ItemDye;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.StatCollector;
+
+import java.util.List;
+
+/**
+ * Created by pluslus_F on 2015/06/17.
+ */
+public class ItemMagicCore extends ItemBlock {
+ public ItemMagicCore(Block p_i45328_1_) {
+ super(p_i45328_1_);
+ setUnlocalizedName("fbs.magicCore");
+ setTextureName(FBS.MODID+":magicCore");
+ }
+
+ @Override
+ public void addInformation(ItemStack p_77624_1_, EntityPlayer p_77624_2_, List p_77624_3_, boolean p_77624_4_) {
+ if(!FBS.enableDescription) return;
+ p_77624_3_.add(StatCollector.translateToLocal("info.fbs.magicCore.0"));
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/item/ItemMonocle.class b/src/main/java/jp/plusplus/fbs/item/ItemMonocle.class Binary files differnew file mode 100644 index 0000000..a02e8a1 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/ItemMonocle.class diff --git a/src/main/java/jp/plusplus/fbs/item/ItemMonocle.java b/src/main/java/jp/plusplus/fbs/item/ItemMonocle.java new file mode 100644 index 0000000..dcd1b41 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/ItemMonocle.java @@ -0,0 +1,80 @@ +package jp.plusplus.fbs.item;
+
+import jp.plusplus.fbs.AchievementRegistry;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.api.event.CheckingMonocleEvent;
+import jp.plusplus.fbs.api.event.DamageMonocleEvent;
+import net.minecraft.enchantment.Enchantment;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemArmor;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.StatCollector;
+import net.minecraft.world.World;
+import net.minecraftforge.common.MinecraftForge;
+
+import java.util.List;
+
+/**
+ * Createdby pluslus_Fon 2015/06/06.
+ */
+public class ItemMonocle extends ItemArmor{
+ public ItemMonocle(ArmorMaterial p_i45325_1_) {
+ super(p_i45325_1_, 0, 0);
+ setCreativeTab(FBS.tab);
+ }
+
+ @Override
+ public String getArmorTexture(ItemStack stack, Entity entity, int slot, String layer) {
+ Item item=stack.getItem();
+ if(item==ItemCore.monocleWood) return FBS.MODID+":textures/armor/monocleWood.png";
+ if(item==ItemCore.monocleGold) return FBS.MODID+":textures/armor/monocleGold.png";
+ return FBS.MODID+":textures/armor/monocle.png";
+ }
+ @Override
+ public void addInformation(ItemStack p_77624_1_, EntityPlayer p_77624_2_, List p_77624_3_, boolean p_77624_4_) {
+ if(!FBS.enableDescription) return;
+ p_77624_3_.add(StatCollector.translateToLocal("info.fbs.monocle.0"));
+ if(p_77624_1_.getItem()==ItemCore.monocleGold) p_77624_3_.add(StatCollector.translateToLocal("info.fbs.monocle.1"));
+ }
+
+
+ public static ItemStack findMonocle(EntityPlayer player){
+ //まずモノクル
+ ItemStack helm = player.getCurrentArmor(3);
+ if (helm == null || !(helm.getItem() instanceof ItemMonocle)){
+ helm=null;
+ }
+
+ //だめならイベントで
+ CheckingMonocleEvent event=new CheckingMonocleEvent(player, helm);
+ MinecraftForge.EVENT_BUS.post(event);
+
+ if(event.hasMonocle()){
+ return event.getMonocle();
+ }
+ return null;
+ }
+ public static void damageMonocle(EntityPlayer player, ItemStack monocle){
+ DamageMonocleEvent event=new DamageMonocleEvent(player, monocle);
+ if(!MinecraftForge.EVENT_BUS.post(event)){
+ monocle.damageItem(1, player);
+ if(monocle.stackSize<=0 || monocle.getItemDamage()>monocle.getMaxDamage()){
+ player.playSound("random.break", 0.8F, 0.8F + player.worldObj.rand.nextFloat() * 0.4F);
+ for(int i=0;i<player.inventory.getSizeInventory();i++){
+ ItemStack itemStack=player.inventory.getStackInSlot(i);
+ if( itemStack!=null && monocle.isItemEqual(itemStack)){
+ player.inventory.setInventorySlotContents(i, null);
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ @Override
+ public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) {
+ if(!world.isRemote) player.triggerAchievement(AchievementRegistry.monocle);
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/item/ItemNet.class b/src/main/java/jp/plusplus/fbs/item/ItemNet.class Binary files differnew file mode 100644 index 0000000..e06ccc0 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/ItemNet.class diff --git a/src/main/java/jp/plusplus/fbs/item/ItemNet.java b/src/main/java/jp/plusplus/fbs/item/ItemNet.java new file mode 100644 index 0000000..c314785 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/ItemNet.java @@ -0,0 +1,56 @@ +package jp.plusplus.fbs.item;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.entity.EntityButterfly;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.AxisAlignedBB;
+import net.minecraft.util.MathHelper;
+import net.minecraft.util.StatCollector;
+import net.minecraft.world.World;
+
+import java.util.List;
+
+/**
+ * Created by plusplus_F on 2015/08/23.
+ * 虫取り網
+ */
+public class ItemNet extends ItemBase {
+ public ItemNet(){
+ setUnlocalizedName("net");
+ setTextureName("net");
+ setFull3D();
+ }
+
+ @Override
+ public ItemStack onItemRightClick(ItemStack item, World w, EntityPlayer p) {
+ if(w.isRemote) return item;
+
+ FBS.logger.info("net!");
+
+ AxisAlignedBB aabb=AxisAlignedBB.getBoundingBox(p.posX-0.5, p.posY+p.getEyeHeight()-0.5, p.posZ-0.5, p.posX+0.5, p.posY+p.getEyeHeight()+0.5, p.posZ+0.5);
+ aabb=aabb.expand(4,2,4);
+ List list=w.getEntitiesWithinAABB(EntityButterfly.class, aabb);
+ if(!list.isEmpty()){
+ for(int i=0;i<list.size();i++){
+ EntityButterfly eb=(EntityButterfly)list.get(i);
+ eb.setDead();
+ eb.entityDropItem(new ItemStack(ItemCore.butterfly), 0);
+ /*
+ p.inventory.addItemStackToInventory(new ItemStack(ItemCore.butterfly));
+ p.inventory.markDirty();
+ */
+ }
+ }
+
+ return item;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void addInformation(ItemStack p_77624_1_, EntityPlayer p_77624_2_, List p_77624_3_, boolean p_77624_4_) {
+ if(!FBS.enableDescription) return;
+ p_77624_3_.add(StatCollector.translateToLocal("info.fbs.net.0"));
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/item/ItemOldBook.class b/src/main/java/jp/plusplus/fbs/item/ItemOldBook.class Binary files differnew file mode 100644 index 0000000..13de297 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/ItemOldBook.class diff --git a/src/main/java/jp/plusplus/fbs/item/ItemOldBook.java b/src/main/java/jp/plusplus/fbs/item/ItemOldBook.java new file mode 100644 index 0000000..f63f055 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/ItemOldBook.java @@ -0,0 +1,66 @@ +package jp.plusplus.fbs.item;
+
+import com.mojang.realmsclient.gui.ChatFormatting;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.Registry;
+import jp.plusplus.fbs.exprop.FBSEntityProperties;
+import net.minecraft.client.resources.I18n;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.EnumAction;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.StatCollector;
+import net.minecraft.world.World;
+
+import java.util.List;
+
+/**
+ * Createdby pluslus_Fon 2015/06/06.
+ */
+public class ItemOldBook extends ItemBookNoDecoded {
+ public ItemOldBook(){
+ setHasSubtypes(true);
+ setCreativeTab(null);
+ setUnlocalizedName("bookOld");
+ setTextureName("bookNoDecoded");
+ setMaxStackSize(1);
+ }
+ @Override
+ public boolean hasEffect(ItemStack itemStack, int i){
+ return true;
+ }
+
+ public void addInformation(ItemStack itemStack, EntityPlayer player, List list, boolean p_77624_4_) {
+ Registry.BookData bd = Registry.GetBookDataFromItemStack(itemStack);
+ if (bd == null) return;
+
+ //list.add("\"" + bd.getLocalizedTitle() + "\"");
+ list.add(I18n.format("info.fbs.book.decoder")+":"+itemStack.getTagCompound().getString("decoder"));
+ list.add(I18n.format("info.fbs.book.lv") + ":" + bd.lv);
+ }
+
+ @Override
+ public EnumAction getItemUseAction(ItemStack p_77661_1_)
+ {
+ return EnumAction.none;
+ }
+ public ItemStack onEaten(ItemStack itemStack, World world, EntityPlayer player){
+ return itemStack;
+ }
+ public ItemStack onItemRightClick(ItemStack p_77659_1_, World p_77659_2_, EntityPlayer p_77659_3_){
+ return p_77659_1_;
+ }
+
+ @Override
+ public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List itemList) {
+ itemList.add(new ItemStack(this, 1, itemRand.nextInt(0xffffff+1)));
+ }
+
+ @Override
+ public String getItemStackDisplayName(ItemStack item){
+ return super.getItemStackDisplayName(item)+"("+StatCollector.translateToLocal("info.fbs.book.decoded")+")";
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/item/ItemOre.class b/src/main/java/jp/plusplus/fbs/item/ItemOre.class Binary files differnew file mode 100644 index 0000000..6072f17 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/ItemOre.class diff --git a/src/main/java/jp/plusplus/fbs/item/ItemOre.java b/src/main/java/jp/plusplus/fbs/item/ItemOre.java new file mode 100644 index 0000000..62a637a --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/ItemOre.java @@ -0,0 +1,31 @@ +package jp.plusplus.fbs.item;
+
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.block.BlockBlock;
+import net.minecraft.block.Block;
+import net.minecraft.item.ItemBlock;
+import net.minecraft.item.ItemStack;
+
+/**
+ * Created by pluslus_F on 2015/06/23.
+ */
+public class ItemOre extends ItemBlock {
+ public ItemOre(Block p_i45328_1_) {
+ super(p_i45328_1_);
+ setCreativeTab(FBS.tab);
+ this.setMaxDamage(0);
+ this.setHasSubtypes(true);
+ }
+
+ @Override
+ public int getMetadata(int par1) {
+ return par1;
+ }
+ @Override
+ public String getUnlocalizedName(ItemStack par1ItemStack) {
+ if(field_150939_a instanceof BlockBlock) {
+ return super.getUnlocalizedName() + BlockBlock.NAMES[par1ItemStack.getItemDamage()];
+ }
+ return super.getUnlocalizedName();
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/item/ItemPlaceable.class b/src/main/java/jp/plusplus/fbs/item/ItemPlaceable.class Binary files differnew file mode 100644 index 0000000..74e77ab --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/ItemPlaceable.class diff --git a/src/main/java/jp/plusplus/fbs/item/ItemPlaceable.java b/src/main/java/jp/plusplus/fbs/item/ItemPlaceable.java new file mode 100644 index 0000000..a4239bc --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/ItemPlaceable.java @@ -0,0 +1,135 @@ +package jp.plusplus.fbs.item;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.alchemy.AlchemyRegistry;
+import jp.plusplus.fbs.alchemy.characteristic.CharacteristicBase;
+import jp.plusplus.fbs.entity.EntityTableware;
+import net.minecraft.block.Block;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.IIcon;
+import net.minecraft.world.World;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Created by plusplus_F on 2015/11/06.
+ */
+public class ItemPlaceable extends ItemBase {
+ public static final String[] NAMES={"Spoon", "Knife", "Fork"};
+ protected IIcon[] icons;
+
+ public ItemPlaceable(){
+ setUnlocalizedName("tableware");
+ setTextureName("tableware");
+ setMaxDamage(0);
+ setHasSubtypes(true);
+ }
+
+
+ @Override
+ public int getMetadata(int par1) {
+ return par1;
+ }
+
+ @Override
+ public String getUnlocalizedName(ItemStack p_77667_1_) {
+ int meta=p_77667_1_.getItemDamage();
+ if(meta<0 ||meta>=NAMES.length) meta=0;
+
+ return super.getUnlocalizedName() + NAMES[meta];
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void getSubItems(Item item, CreativeTabs tab, List list) {
+ for(int i=0;i<NAMES.length;i++){
+ list.add(new ItemStack(item, 1, i));
+ }
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void registerIcons(IIconRegister register) {
+ icons=new IIcon[NAMES.length];
+ for(int i=0;i<NAMES.length;i++){
+ icons[i]=register.registerIcon(FBS.MODID+":tableware"+NAMES[i]);
+ }
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public IIcon getIconFromDamage(int p_77617_1_) {
+ if(p_77617_1_<0 || p_77617_1_>=icons.length) p_77617_1_=0;
+ return icons[p_77617_1_];
+ }
+
+
+ public boolean onItemUse(ItemStack item, EntityPlayer player, World world, int x, int y, int z, int side, float p_77648_8_, float p_77648_9_, float p_77648_10_) {
+ //カラスさんありがとー
+ if(player != null && player.isSneaking()) {
+ this.onItemRightClick(item, world, player);
+ return false;
+ } else {
+ Block block = world.getBlock(x, y, z);
+ if(block == Blocks.snow_layer && (world.getBlockMetadata(x, y, z) & 7) < 1) {
+ side = 1;
+ } else if(block != Blocks.vine && block != Blocks.tallgrass && block != Blocks.deadbush && !block.isReplaceable(world, x, y, z)) {
+ if(side == 0) {
+ --y;
+ }
+
+ if(side == 1) {
+ ++y;
+ }
+
+ if(side == 2) {
+ --z;
+ }
+
+ if(side == 3) {
+ ++z;
+ }
+
+ if(side == 4) {
+ --x;
+ }
+
+ if(side == 5) {
+ ++x;
+ }
+ }
+
+ if(item.stackSize == 0) {
+ return false;
+ } else if(!player.canPlayerEdit(x, y, z, side, item)) {
+ return false;
+ } else if(y >= 255) {
+ return false;
+ } else{
+ int m = this.getMetadata(item.getItemDamage());
+ if(!world.isRemote && this.spawnEntity(world, player, new ItemStack(this, 1, m), (double) ((float) x + 0.5F), (double) ((float) y + 0.0F), (double) ((float) z + 0.5F))) {
+ world.playSoundEffect((double)((float)x + 0.5F), (double)((float)y + 0.5F), (double)((float)z + 0.5F), block.stepSound.func_150496_b(), (block.stepSound.getVolume() + 1.0F) / 2.0F, block.stepSound.getPitch() * 0.8F);
+ --item.stackSize;
+ }
+
+ return true;
+ }
+ }
+ }
+
+ protected boolean spawnEntity(World world, EntityPlayer player, ItemStack item, double x, double y, double z) {
+ EntityTableware entity=new EntityTableware(world, item, x,y,z);
+ world.spawnEntityInWorld(entity);
+ return true;
+ }
+
+}
diff --git a/src/main/java/jp/plusplus/fbs/item/ItemPotionOblivion.class b/src/main/java/jp/plusplus/fbs/item/ItemPotionOblivion.class Binary files differnew file mode 100644 index 0000000..ff90c51 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/ItemPotionOblivion.class diff --git a/src/main/java/jp/plusplus/fbs/item/ItemPotionOblivion.java b/src/main/java/jp/plusplus/fbs/item/ItemPotionOblivion.java new file mode 100644 index 0000000..1009d2f --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/ItemPotionOblivion.java @@ -0,0 +1,92 @@ +package jp.plusplus.fbs.item;
+
+import com.mojang.realmsclient.gui.ChatFormatting;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.exprop.FBSEntityProperties;
+import jp.plusplus.fbs.exprop.SanityManager;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.projectile.EntityPotion;
+import net.minecraft.init.Items;
+import net.minecraft.item.EnumAction;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemPotion;
+import net.minecraft.item.ItemStack;
+import net.minecraft.potion.PotionEffect;
+import net.minecraft.potion.PotionHelper;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.IIcon;
+import net.minecraft.util.StatCollector;
+import net.minecraft.world.World;
+
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * Createdby pluslus_Fon 2015/06/06.
+ */
+public class ItemPotionOblivion extends ItemPotion {
+ public ItemPotionOblivion() {
+ setCreativeTab(FBS.tab);
+ setUnlocalizedName("fbs.potOblivion");
+ setTextureName("potion");
+ setMaxStackSize(64);
+
+ }
+
+ @SideOnly(Side.CLIENT)
+ public int getColorFromItemStack(ItemStack p_82790_1_, int p_82790_2_) {
+ return p_82790_2_==0?0xaaaaff:0xffffff;
+ }
+
+ public ItemStack onEaten(ItemStack p_77654_1_, World p_77654_2_, EntityPlayer p_77654_3_) {
+ if (!p_77654_3_.capabilities.isCreativeMode) {
+ --p_77654_1_.stackSize;
+ }
+
+ if (!p_77654_2_.isRemote) {
+ FBSEntityProperties prop = FBSEntityProperties.get(p_77654_3_);
+ if (prop != null) {
+ prop.setMagicLevel(prop.getMagicLevel() - 5);
+
+ String str=String.format(StatCollector.translateToLocal("info.fbs.lv.0"), prop.getMagicLevel());
+ p_77654_3_.addChatComponentMessage(new ChatComponentText(str));
+
+ SanityManager.sendPacket(p_77654_3_);
+ }
+ }
+
+ if (!p_77654_3_.capabilities.isCreativeMode) {
+ if (p_77654_1_.stackSize <= 0) {
+ return new ItemStack(Items.glass_bottle);
+ }
+
+ p_77654_3_.inventory.addItemStackToInventory(new ItemStack(Items.glass_bottle));
+ }
+
+ return p_77654_1_;
+ }
+
+ @Override
+ public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List itemList) {
+ itemList.add(new ItemStack(this));
+ }
+
+ @Override
+ public String getItemStackDisplayName(ItemStack p_77653_1_) {
+ return StatCollector.translateToLocal(getUnlocalizedName()+".name");
+ }
+
+ @SideOnly(Side.CLIENT)
+ public IIcon getIconFromDamage(int p_77617_1_){
+ return super.getIconFromDamage(0);
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void addInformation(ItemStack p_77624_1_, EntityPlayer p_77624_2_, List p_77624_3_, boolean p_77624_4_) {
+ if(!FBS.enableDescription) return;
+ p_77624_3_.add(StatCollector.translateToLocal("info.fbs.potObl.0"));
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/item/ItemPotionSanity.class b/src/main/java/jp/plusplus/fbs/item/ItemPotionSanity.class Binary files differnew file mode 100644 index 0000000..269687b --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/ItemPotionSanity.class diff --git a/src/main/java/jp/plusplus/fbs/item/ItemPotionSanity.java b/src/main/java/jp/plusplus/fbs/item/ItemPotionSanity.java new file mode 100644 index 0000000..5f0dfd5 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/ItemPotionSanity.java @@ -0,0 +1,50 @@ +package jp.plusplus.fbs.item;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.Registry;
+import jp.plusplus.fbs.exprop.FBSEntityProperties;
+import jp.plusplus.fbs.exprop.SanityManager;
+import net.minecraft.client.resources.I18n;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.Items;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.StatCollector;
+import net.minecraft.world.World;
+
+import java.util.List;
+
+/**
+ * Created by pluslus_F on 2015/06/16.
+ */
+public class ItemPotionSanity extends ItemPotionOblivion {
+ public ItemPotionSanity(){
+ setUnlocalizedName("fbs.potSan");
+ }
+
+ @SideOnly(Side.CLIENT)
+ public int getColorFromItemStack(ItemStack p_82790_1_, int p_82790_2_) {
+ return p_82790_2_==0?0x99ff99:0xffffff;
+ }
+
+ public ItemStack onEaten(ItemStack p_77654_1_, World p_77654_2_, EntityPlayer p_77654_3_) {
+ if (!p_77654_3_.capabilities.isCreativeMode) {
+ --p_77654_1_.stackSize;
+ }
+
+ if (!p_77654_3_.capabilities.isCreativeMode) {
+ if (p_77654_1_.stackSize <= 0) {
+ return new ItemStack(Items.glass_bottle);
+ }
+
+ p_77654_3_.inventory.addItemStackToInventory(new ItemStack(Items.glass_bottle));
+ }
+
+ return p_77654_1_;
+ }
+
+ @Override
+ public void addInformation(ItemStack itemStack, EntityPlayer player, List list, boolean p_77624_4_) {}
+
+}
diff --git a/src/main/java/jp/plusplus/fbs/item/ItemSeedRedLily.class b/src/main/java/jp/plusplus/fbs/item/ItemSeedRedLily.class Binary files differnew file mode 100644 index 0000000..d9fc7f2 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/ItemSeedRedLily.class diff --git a/src/main/java/jp/plusplus/fbs/item/ItemSeedRedLily.java b/src/main/java/jp/plusplus/fbs/item/ItemSeedRedLily.java new file mode 100644 index 0000000..dddbdcd --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/ItemSeedRedLily.java @@ -0,0 +1,57 @@ +package jp.plusplus.fbs.item;
+
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.block.BlockCore;
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.ItemSeeds;
+import net.minecraft.item.ItemStack;
+import net.minecraft.world.IBlockAccess;
+import net.minecraft.world.World;
+import net.minecraftforge.common.EnumPlantType;
+import net.minecraftforge.common.util.ForgeDirection;
+
+/**
+ * Created by plusplus_F on 2015/08/24.
+ */
+public class ItemSeedRedLily extends ItemSeeds {
+ protected Block fucking_private_field_150925_a;
+
+ public ItemSeedRedLily() {
+ super(BlockCore.cropRedLily, Blocks.dirt);
+ setUnlocalizedName("fbs.seedRedLily");
+ setTextureName(FBS.MODID+":seedRedLily");
+ setCreativeTab(FBS.tab);
+ fucking_private_field_150925_a=BlockCore.cropRedLily;
+ }
+
+ @Override
+ public EnumPlantType getPlantType(IBlockAccess world, int x, int y, int z) {
+ return EnumPlantType.Plains;
+ }
+
+ @Override
+ public boolean onItemUse(ItemStack p_77648_1_, EntityPlayer p_77648_2_, World p_77648_3_, int p_77648_4_, int p_77648_5_, int p_77648_6_, int p_77648_7_, float p_77648_8_, float p_77648_9_, float p_77648_10_) {
+ if (p_77648_7_ != 1) {
+ return false;
+ } else if (p_77648_2_.canPlayerEdit(p_77648_4_, p_77648_5_, p_77648_6_, p_77648_7_, p_77648_1_) && p_77648_2_.canPlayerEdit(p_77648_4_, p_77648_5_ + 1, p_77648_6_, p_77648_7_, p_77648_1_)) {
+ Block b=p_77648_3_.getBlock(p_77648_4_, p_77648_5_, p_77648_6_);
+
+ if(b==Blocks.dirt || b==Blocks.grass || b==Blocks.farmland || b==BlockCore.fallenLeaves){
+ if (p_77648_3_.isAirBlock(p_77648_4_, p_77648_5_ + 1, p_77648_6_)) {
+ p_77648_3_.setBlock(p_77648_4_, p_77648_5_ + 1, p_77648_6_, fucking_private_field_150925_a);
+ --p_77648_1_.stackSize;
+ return true;
+ } else {
+ return false;
+ }
+ }
+ else return false;
+
+
+ } else {
+ return false;
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/item/ItemShovel.class b/src/main/java/jp/plusplus/fbs/item/ItemShovel.class Binary files differnew file mode 100644 index 0000000..6073a2c --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/ItemShovel.class diff --git a/src/main/java/jp/plusplus/fbs/item/ItemShovel.java b/src/main/java/jp/plusplus/fbs/item/ItemShovel.java new file mode 100644 index 0000000..6bff900 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/ItemShovel.java @@ -0,0 +1,45 @@ +package jp.plusplus.fbs.item;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.FBS;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.enchantment.Enchantment;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.item.ItemSword;
+import net.minecraft.util.StatCollector;
+import net.minecraftforge.common.util.EnumHelper;
+
+import java.util.List;
+
+/**
+ * Created by plusplus_F on 2015/08/21.
+ */
+public class ItemShovel extends ItemSword{
+ public ItemShovel() {
+ super(EnumHelper.addToolMaterial("fbs.shovel", 0, 250, 6.0f, 2.0f, 0));
+ setCreativeTab(FBS.tab);
+ setUnlocalizedName("fbs.shovel");
+ setTextureName(FBS.MODID + ":shovel");
+ }
+
+ public static ItemStack GetItemStack(){
+ ItemStack it=new ItemStack(ItemCore.shovel, 1, 0);
+ it.addEnchantment(Enchantment.smite, 2);
+
+ return it;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void getSubItems(Item p_150895_1_, CreativeTabs p_150895_2_, List p_150895_3_) {
+ p_150895_3_.add(GetItemStack());
+ }
+
+ @Override
+ public void addInformation(ItemStack itemStack, EntityPlayer player, List list, boolean p_77624_4_) {
+ if(!FBS.enableDescription) return;
+ list.add(StatCollector.translateToLocal("info.fbs.shovel.0"));
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/item/ItemStaff.class b/src/main/java/jp/plusplus/fbs/item/ItemStaff.class Binary files differnew file mode 100644 index 0000000..ba07f2d --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/ItemStaff.class diff --git a/src/main/java/jp/plusplus/fbs/item/ItemStaff.java b/src/main/java/jp/plusplus/fbs/item/ItemStaff.java new file mode 100644 index 0000000..15b1e45 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/ItemStaff.java @@ -0,0 +1,152 @@ +package jp.plusplus.fbs.item;
+
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.Registry;
+import jp.plusplus.fbs.api.IResonance;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.nbt.NBTTagList;
+import net.minecraft.util.StatCollector;
+import net.minecraft.world.World;
+
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * Createdby pluslus_Fon 2015/06/15.
+ * 闇の実装
+ */
+public class ItemStaff extends ItemBase {
+ public int gemNum;
+ public int bookNum=1;
+ public ItemStaff(int bookNum, int gem) {
+ this.bookNum = bookNum;
+ gemNum = gem;
+ setMaxStackSize(1);
+ setUnlocalizedName("staff" + bookNum + "_" + gem);
+ setTextureName("staff" + bookNum + "_" + gem);
+ setFull3D();
+ setMaxDamage(59);
+ setNoRepair();
+ }
+
+ @Override
+ public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) {
+ if(player.isSneaking()) openGUI(itemStack, world, player);
+ else{
+ ItemStack[] items=loadInventory(itemStack);
+ String name=getStaffMagicName(itemStack);
+ if(name.equals("null")) openGUI(itemStack, world, player);
+ else{
+ if(getStaffMagicMaxUse(itemStack)>0) {
+ execute(itemStack, items, world, player);
+ saveInventory(itemStack, items);
+ }
+ itemStack.damageItem(1, player);
+ player.swingItem();
+ }
+ }
+ return itemStack;
+ }
+
+ public static ItemStack[] loadInventory(ItemStack itemStack){
+ ItemStaff staff=(ItemStaff)itemStack.getItem();
+ ItemStack[] items=new ItemStack[staff.gemNum+staff.bookNum];
+
+ if (!itemStack.hasTagCompound()) {
+ itemStack.setTagCompound(new NBTTagCompound());
+ }
+ if(!itemStack.getTagCompound().hasKey("Items")){
+ itemStack.getTagCompound().setTag("Items", new NBTTagList());
+ }
+ NBTTagList tags = (NBTTagList) itemStack.getTagCompound().getTag("Items");
+
+ for (int i = 0; i < tags.tagCount(); i++) {
+ NBTTagCompound tagCompound = tags.getCompoundTagAt(i);
+ int slot = tagCompound.getByte("Slot");
+ if (slot >= 0 && slot < items.length) {
+ items[slot] = ItemStack.loadItemStackFromNBT(tagCompound);
+ }
+ }
+
+ return items;
+ }
+ public static void saveInventory(ItemStack itemStack, ItemStack[] inv){
+ NBTTagList tagList = new NBTTagList();
+ for (int i = 0; i < inv.length; i++) {
+ if (inv[i] != null) {
+ NBTTagCompound compound = new NBTTagCompound();
+ compound.setByte("Slot", (byte) i);
+ inv[i].writeToNBT(compound);
+ tagList.appendTag(compound);
+ }
+ }
+ itemStack.setTagCompound(new NBTTagCompound());
+ itemStack.getTagCompound().setTag("Items", tagList);
+
+ //resonance
+ int minUse=9999;
+ LinkedList<ItemStack> books=new LinkedList<ItemStack>();
+ for(int i=0;i<((ItemStaff)itemStack.getItem()).bookNum;i++){
+ if (inv[i] != null && inv[i].getItem() == ItemCore.bookSorcery) {
+ books.add(inv[i]);
+ int u=ItemBookSorcery.getMagicMaxUse(inv[i]);
+ if(u<minUse) minUse=u;
+ }
+ }
+
+ Registry.MagicData md=Registry.GetResonanceMagicData(books);
+ if(md==null) itemStack.getTagCompound().setString("MagicName", "null");
+ else itemStack.getTagCompound().setString("MagicName", md.title);
+ itemStack.getTagCompound().setInteger("MagicMinUse", minUse);
+ }
+
+ public static String getStaffMagicName(ItemStack item){
+ if(!item.hasTagCompound()) return "null";
+ NBTTagCompound nbt=item.getTagCompound();
+ return nbt.hasKey("MagicName")?nbt.getString("MagicName"):"null";
+ }
+ public static int getStaffMagicMaxUse(ItemStack item){
+ if(!item.hasTagCompound()) return 0;
+ NBTTagCompound nbt=item.getTagCompound();
+ return nbt.hasKey("MagicMinUse")?nbt.getInteger("MagicMinUse"):0;
+ }
+
+ @Override
+ public String getItemStackDisplayName(ItemStack item){
+ if(!item.hasTagCompound()) return super.getItemStackDisplayName(item);
+
+ String n=getStaffMagicName(item);
+ if(n.length()==0 || n.equals("null")) return super.getItemStackDisplayName(item);
+
+ String ln="";
+ IResonance r=Registry.GetResonance(n);
+ if(r!=null){
+ ItemStack[] items=loadInventory(item);
+ String[] tt=new String[bookNum];
+ for(int i=0;i<bookNum;i++){
+ if(items==null) continue;
+ tt[i]=Registry.GetUnlocalizedBookTitleFromItemStack(items[i]);
+ }
+ ln=r.getDisplayMagicName(tt);
+ }
+ else ln=Registry.GetMagic(n).getLocalizedTitle();
+
+ return super.getItemStackDisplayName(item)+"("+ln+"["+getStaffMagicMaxUse(item)+"]"+")";
+ }
+
+ @Override
+ public void addInformation(ItemStack itemStack, EntityPlayer player, List list, boolean p_77624_4_) {
+ if(!FBS.enableDescription) return;
+ list.add(String.format(StatCollector.translateToLocal("info.fbs.staff.0"), bookNum));
+ list.add(String.format(StatCollector.translateToLocal("info.fbs.staff.1"), gemNum));
+ }
+
+ public void openGUI(ItemStack itemStack, World world, EntityPlayer player){
+ player.openGui(FBS.instance, FBS.GUI_STAFF_ID, world, (int) player.posX, (int) player.posY, (int) player.posZ);
+ }
+ public void execute(ItemStack itemStack, ItemStack[] items, World world, EntityPlayer player){
+ ((ItemBookSorcery) ItemCore.bookSorcery).executesMagicWithStaff(world, player, items, ((ItemStaff)itemStack.getItem()).bookNum);
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/item/ItemStoneSpirit.class b/src/main/java/jp/plusplus/fbs/item/ItemStoneSpirit.class Binary files differnew file mode 100644 index 0000000..50d96cc --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/ItemStoneSpirit.class diff --git a/src/main/java/jp/plusplus/fbs/item/ItemStoneSpirit.java b/src/main/java/jp/plusplus/fbs/item/ItemStoneSpirit.java new file mode 100644 index 0000000..16c8556 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/ItemStoneSpirit.java @@ -0,0 +1,23 @@ +package jp.plusplus.fbs.item;
+
+import jp.plusplus.fbs.FBS;
+
+import java.util.Random;
+
+/**
+ * Created by plusplus_F on 2015/11/14.
+ */
+public class ItemStoneSpirit extends ItemBase {
+ protected Random rand=new Random();
+
+ public ItemStoneSpirit(){
+ setCreativeTab(FBS.tabSpirit);
+ setMaxStackSize(1);
+ }
+
+ public boolean getSex(){
+ if(this==ItemCore.stoneActiveFemale) return false;
+ if(this==ItemCore.stoneActiveMale) return true;
+ return rand.nextBoolean();
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/item/enchant/EnchantmentCleverness.class b/src/main/java/jp/plusplus/fbs/item/enchant/EnchantmentCleverness.class Binary files differnew file mode 100644 index 0000000..15fb8a7 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/enchant/EnchantmentCleverness.class diff --git a/src/main/java/jp/plusplus/fbs/item/enchant/EnchantmentCleverness.java b/src/main/java/jp/plusplus/fbs/item/enchant/EnchantmentCleverness.java new file mode 100644 index 0000000..bf736ee --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/enchant/EnchantmentCleverness.java @@ -0,0 +1,55 @@ +package jp.plusplus.fbs.item.enchant;
+
+import jp.plusplus.fbs.item.ItemCore;
+import jp.plusplus.fbs.item.ItemStaff;
+import net.minecraft.enchantment.Enchantment;
+import net.minecraft.enchantment.EnchantmentHelper;
+import net.minecraft.enchantment.EnumEnchantmentType;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+
+/**
+ * Created by nori on 2016/03/17.
+ */
+public class EnchantmentCleverness extends Enchantment {
+ public EnchantmentCleverness(int id, int weight) {
+ super(id, weight, EnumEnchantmentType.armor_head);
+ this.setName("fbs.cleverness");
+ }
+
+ @Override
+ public boolean canApply(ItemStack p_92089_1_) {
+ if(p_92089_1_.getItem() instanceof ItemStaff) return true;
+ return this.type.canEnchantItem(p_92089_1_.getItem());
+ }
+
+ @Override
+ public int getMinEnchantability(int p_77321_1_) {
+ return 2 + (p_77321_1_ - 1) * 5;
+ }
+
+ @Override
+ public int getMaxEnchantability(int p_77317_1_) {
+ return this.getMinEnchantability(p_77317_1_) + 10;
+ }
+
+ @Override
+ public int getMaxLevel()
+ {
+ return 5;
+ }
+
+ public static int getSum(EntityPlayer ep){
+ int sum=0;
+
+ for(ItemStack armor : ep.inventory.armorInventory){
+ if(armor==null) continue;
+ sum+=EnchantmentHelper.getEnchantmentLevel(ItemCore.eIdCleverness, armor);
+ }
+ if(ep.getCurrentEquippedItem()!=null){
+ sum+=EnchantmentHelper.getEnchantmentLevel(ItemCore.eIdCleverness, ep.getCurrentEquippedItem());
+ }
+
+ return sum;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/item/enchant/EnchantmentSanityProtect.class b/src/main/java/jp/plusplus/fbs/item/enchant/EnchantmentSanityProtect.class Binary files differnew file mode 100644 index 0000000..a53739d --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/enchant/EnchantmentSanityProtect.class diff --git a/src/main/java/jp/plusplus/fbs/item/enchant/EnchantmentSanityProtect.java b/src/main/java/jp/plusplus/fbs/item/enchant/EnchantmentSanityProtect.java new file mode 100644 index 0000000..46ed123 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/enchant/EnchantmentSanityProtect.java @@ -0,0 +1,55 @@ +package jp.plusplus.fbs.item.enchant;
+
+import jp.plusplus.fbs.item.ItemCore;
+import jp.plusplus.fbs.item.ItemStaff;
+import net.minecraft.enchantment.Enchantment;
+import net.minecraft.enchantment.EnchantmentHelper;
+import net.minecraft.enchantment.EnumEnchantmentType;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+
+/**
+ * Created by nori on 2016/03/17.
+ */
+public class EnchantmentSanityProtect extends Enchantment {
+ public EnchantmentSanityProtect(int id, int weight) {
+ super(id, weight, EnumEnchantmentType.armor);
+ this.setName("fbs.sanity");
+ }
+
+ @Override
+ public boolean canApply(ItemStack p_92089_1_) {
+ if(p_92089_1_.getItem() instanceof ItemStaff) return true;
+ return this.type.canEnchantItem(p_92089_1_.getItem());
+ }
+
+ @Override
+ public int getMinEnchantability(int p_77321_1_) {
+ return 3 + (p_77321_1_ - 1) * 6;
+ }
+
+ @Override
+ public int getMaxEnchantability(int p_77317_1_) {
+ return this.getMinEnchantability(p_77317_1_) + 6;
+ }
+
+ @Override
+ public int getMaxLevel()
+ {
+ return 4;
+ }
+
+ public static int getSum(EntityPlayer ep){
+ int sum=0;
+
+ for(ItemStack armor : ep.inventory.armorInventory){
+ if(armor==null) continue;
+ sum+=EnchantmentHelper.getEnchantmentLevel(ItemCore.eIdSanity, armor);
+ }
+ if(ep.getCurrentEquippedItem()!=null){
+ sum+=EnchantmentHelper.getEnchantmentLevel(ItemCore.eIdSanity, ep.getCurrentEquippedItem());
+ }
+
+ return sum;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/item/enchant/EnchantmentWealth.class b/src/main/java/jp/plusplus/fbs/item/enchant/EnchantmentWealth.class Binary files differnew file mode 100644 index 0000000..a64a8b9 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/enchant/EnchantmentWealth.class diff --git a/src/main/java/jp/plusplus/fbs/item/enchant/EnchantmentWealth.java b/src/main/java/jp/plusplus/fbs/item/enchant/EnchantmentWealth.java new file mode 100644 index 0000000..83b3f4d --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/item/enchant/EnchantmentWealth.java @@ -0,0 +1,47 @@ +package jp.plusplus.fbs.item.enchant;
+
+import jp.plusplus.fbs.item.ItemCore;
+import jp.plusplus.fbs.item.ItemStaff;
+import net.minecraft.enchantment.Enchantment;
+import net.minecraft.enchantment.EnchantmentHelper;
+import net.minecraft.enchantment.EnumEnchantmentType;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+
+/**
+ * Created by nori on 2016/03/17.
+ */
+public class EnchantmentWealth extends Enchantment {
+ public EnchantmentWealth(int id, int weight) {
+ super(id, weight, EnumEnchantmentType.weapon);
+ this.setName("fbs.wealth");
+ }
+
+ @Override
+ public int getMinEnchantability(int p_77321_1_)
+ {
+ return 15 + (p_77321_1_ - 1) * 9;
+ }
+
+ @Override
+ public int getMaxEnchantability(int p_77317_1_)
+ {
+ return super.getMinEnchantability(p_77317_1_) + 50;
+ }
+
+ @Override
+ public int getMaxLevel()
+ {
+ return 3;
+ }
+
+ public static int getSum(EntityPlayer ep){
+ int sum=0;
+
+ if(ep.getCurrentEquippedItem()!=null){
+ sum+=EnchantmentHelper.getEnchantmentLevel(ItemCore.eIdWealth, ep.getCurrentEquippedItem());
+ }
+
+ return sum;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/magic/MagicArrow.class b/src/main/java/jp/plusplus/fbs/magic/MagicArrow.class Binary files differnew file mode 100644 index 0000000..6cdfa03 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/MagicArrow.class diff --git a/src/main/java/jp/plusplus/fbs/magic/MagicArrow.java b/src/main/java/jp/plusplus/fbs/magic/MagicArrow.java new file mode 100644 index 0000000..dc7cb20 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/MagicArrow.java @@ -0,0 +1,33 @@ +package jp.plusplus.fbs.magic;
+
+import jp.plusplus.fbs.api.MagicBase;
+import jp.plusplus.fbs.entity.EntityMagicArrow;
+import net.minecraft.entity.Entity;
+
+/**
+ * Createdby pluslus_Fon 2015/06/08.
+ */
+public class MagicArrow extends MagicBase {
+ @Override
+ public boolean checkSuccess() {
+ if(isSpelled) return true;
+
+ float prob=0.4f+0.03f*property.getMagicLevel();
+ return rand.nextFloat()<=prob;
+ }
+
+ @Override
+ public void success() {
+ int d=getLvDiff();
+ float dm=isSpelled?2.0f:1.0f;
+ if(d>0) dm+=0.5f*(d/5);
+
+ Entity e=new EntityMagicArrow(world, player, 1.0F, 1.0F, dm);
+ world.spawnEntityInWorld(e);
+ }
+
+ @Override
+ public void failure() {
+ sanity(1, 6);
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/magic/MagicArrowFlexible.class b/src/main/java/jp/plusplus/fbs/magic/MagicArrowFlexible.class Binary files differnew file mode 100644 index 0000000..e2ca74c --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/MagicArrowFlexible.class diff --git a/src/main/java/jp/plusplus/fbs/magic/MagicArrowFlexible.java b/src/main/java/jp/plusplus/fbs/magic/MagicArrowFlexible.java new file mode 100644 index 0000000..68d243e --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/MagicArrowFlexible.java @@ -0,0 +1,63 @@ +package jp.plusplus.fbs.magic;
+
+import jp.plusplus.fbs.Registry;
+import jp.plusplus.fbs.api.IMagicEnchant;
+import jp.plusplus.fbs.api.MagicBase;
+import jp.plusplus.fbs.entity.EntityMagicArrowFlexible;
+import jp.plusplus.fbs.item.ItemCore;
+import jp.plusplus.fbs.item.ItemStaff;
+import net.minecraft.entity.Entity;
+import net.minecraft.item.ItemStack;
+
+import java.util.LinkedList;
+
+/**
+ * Created by pluslus_F on 2015/06/23.
+ *
+ * 魔法の矢+付与魔法の汎用共鳴
+ */
+public class MagicArrowFlexible extends MagicBase {
+ @Override
+ public boolean checkSuccess() {
+ return true;
+ }
+
+ @Override
+ public void success() {
+ ItemStack item=player.getCurrentEquippedItem();
+ if(item==null || !(item.getItem() instanceof ItemStaff)) return;
+
+ int bookNum=((ItemStaff) item.getItem()).bookNum;
+ ItemStack[] items=ItemStaff.loadInventory(item);
+
+ //付与魔法のリストを作成する
+ LinkedList<Registry.MagicData> magics = new LinkedList<Registry.MagicData>();
+ for (int i = 0; i < bookNum; i++) {
+ if (items[i] != null && items[i].getItem() == ItemCore.bookSorcery) {
+ Registry.MagicData md=Registry.GetMagicDataFromItemStack(items[i]);
+ if(md==null) continue;
+ if(MagicArrow.class==md.magic) continue;
+
+ //付与魔法であればリストに追加
+ if(IMagicEnchant.class.isAssignableFrom(md.magic)){
+ magics.add(md);
+ }
+ }
+ }
+ if (magics.isEmpty()) return;
+
+
+ //エンティティの生成
+ int d=getLvDiff();
+ float dm=isSpelled?2.0f:1.0f;
+ if(d>0) dm+=0.5f*(d/5);
+
+ Entity e=new EntityMagicArrowFlexible(world, player, 1.0F, 1.0F, dm, magics.toArray(new Registry.MagicData[magics.size()]));
+ world.spawnEntityInWorld(e);
+ }
+
+ @Override
+ public void failure() {
+ sanity(2,4);
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/magic/MagicBarrier.class b/src/main/java/jp/plusplus/fbs/magic/MagicBarrier.class Binary files differnew file mode 100644 index 0000000..f69ebb4 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/MagicBarrier.class diff --git a/src/main/java/jp/plusplus/fbs/magic/MagicBarrier.java b/src/main/java/jp/plusplus/fbs/magic/MagicBarrier.java new file mode 100644 index 0000000..65da382 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/MagicBarrier.java @@ -0,0 +1,100 @@ +package jp.plusplus.fbs.magic;
+
+import jp.plusplus.fbs.api.MagicBase;
+import jp.plusplus.fbs.block.BlockCore;
+import net.minecraft.block.Block;
+import net.minecraft.util.MathHelper;
+import net.minecraftforge.common.util.ForgeDirection;
+
+/**
+ * Created by plusplus_F on 2015/09/27.
+ */
+public class MagicBarrier extends MagicBase {
+ @Override
+ public boolean checkSuccess() {
+ float p=0.5f+0.05f*Math.max(getLvDiff(), 0);
+ return rand.nextFloat()<p;
+ }
+
+ @Override
+ public void success() {
+ int range=isSpelled?3:1;
+
+ //中心座標の決定
+ int px= MathHelper.floor_double(player.posX);
+ int py= MathHelper.floor_double(player.posY);
+ int pz= MathHelper.floor_double(player.posZ);
+
+ //メタ値の決定
+ int meta;
+ if(!isSpelled || usingStaff) meta=2+rand.nextInt(3);
+ else meta=5+rand.nextInt(2);
+
+ if(this.checkMagicCircle("fbs.barrier")){
+ range=1;
+ //魔法陣がある場合、全方位に壁を出す
+ for(int y=py;y<py+range+1;y++) {
+ Block b;
+ for (int x = px - range; x < px + range + 1; x++) {
+ b = world.getBlock(x, y, pz + 2);
+ if (b.isReplaceable(world, x, y, pz + 2)) world.setBlock(x, y, pz + 2, BlockCore.barrier, meta, 2);
+
+ b = world.getBlock(x, y, pz - 2);
+ if (b.isReplaceable(world, x, y, pz - 2)) world.setBlock(x, y, pz - 2, BlockCore.barrier, meta, 2);
+ }
+ for (int z = pz - range; z < pz + range + 1; z++) {
+ b = world.getBlock(px + 2, y, z);
+ if (b.isReplaceable(world, px + 2, y, z)) world.setBlock(px + 2, y, z, BlockCore.barrier, meta, 2);
+
+ b = world.getBlock(px - 2, y, z);
+ if (b.isReplaceable(world, px - 2, y, z)) world.setBlock(px - 2, y, z, BlockCore.barrier, meta, 2);
+ }
+ }
+ }
+ else{
+ //魔法陣がない場合、前方にのみ壁を出す
+ int l = MathHelper.floor_double((double) (player.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
+ if(l==0){
+ pz+=2;
+ for(int x=px-range;x<px+range+1;x++){
+ for(int y=py;y<py+range+1;y++){
+ Block b=world.getBlock(x,y,pz);
+ if(b.isReplaceable(world, x,y,pz)) world.setBlock(x, y, pz, BlockCore.barrier, meta, 2);
+ }
+ }
+ }
+ else if(l==1){
+ px-=2;
+ for(int z=pz-range;z<pz+range+1;z++){
+ for(int y=py;y<py+range+1;y++){
+ Block b=world.getBlock(px,y,z);
+ if(b.isReplaceable(world, px,y,z)) world.setBlock(px, y, z, BlockCore.barrier, meta, 2);
+ }
+ }
+ }
+ else if(l==2){
+ pz-=2;
+ for(int x=px-range;x<px+range+1;x++){
+ for(int y=py;y<py+range+1;y++){
+ Block b=world.getBlock(x,y,pz);
+ if(b.isReplaceable(world, x,y,pz)) world.setBlock(x, y, pz, BlockCore.barrier, meta, 2);
+ }
+ }
+ }
+ else if(l==3){
+ px+=2;
+ for(int z=pz-range;z<pz+range+1;z++){
+ for(int y=py;y<py+range+1;y++){
+ Block b=world.getBlock(px,y,z);
+ if(b.isReplaceable(world, px,y,z)) world.setBlock(px, y, z, BlockCore.barrier, meta, 2);
+ }
+ }
+ }
+ }
+ }
+
+ @Override
+ public void failure() {
+ sanity(2, 4);
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/magic/MagicContract.class b/src/main/java/jp/plusplus/fbs/magic/MagicContract.class Binary files differnew file mode 100644 index 0000000..44b2afd --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/MagicContract.class diff --git a/src/main/java/jp/plusplus/fbs/magic/MagicContract.java b/src/main/java/jp/plusplus/fbs/magic/MagicContract.java new file mode 100644 index 0000000..0e651d7 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/MagicContract.java @@ -0,0 +1,29 @@ +package jp.plusplus.fbs.magic;
+
+import jp.plusplus.fbs.api.MagicBase;
+
+/**
+ * Created by pluslus_F on 2015/11/14.
+ */
+public class MagicContract extends MagicBase {
+ @Override
+ public boolean checkSuccess() {
+ float prob=0.2f;
+ int l=getLvDiff();
+ if(l>0) prob+=0.05*prob;
+ return rand.nextFloat()<prob;
+ }
+ @Override
+ public void success() {
+
+ }
+ @Override
+ public void failure() {
+
+ }
+
+ public String getMagicCircleName(){
+ return "fbs.contract";
+ //return "null";
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/magic/MagicCopy.class b/src/main/java/jp/plusplus/fbs/magic/MagicCopy.class Binary files differnew file mode 100644 index 0000000..982da9c --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/MagicCopy.class diff --git a/src/main/java/jp/plusplus/fbs/magic/MagicCopy.java b/src/main/java/jp/plusplus/fbs/magic/MagicCopy.java new file mode 100644 index 0000000..f7608c8 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/MagicCopy.java @@ -0,0 +1,28 @@ +package jp.plusplus.fbs.magic;
+
+import jp.plusplus.fbs.api.MagicBase;
+
+/**
+ * Created by pluslus_F on 2015/06/18.
+ */
+public class MagicCopy extends MagicBase {
+ @Override
+ public boolean checkSuccess() {
+ float prob=0.2f;
+ int l=getLvDiff();
+ if(l>0) prob+=0.05*prob;
+ return rand.nextFloat()<prob;
+ }
+ @Override
+ public void success() {
+
+ }
+ @Override
+ public void failure() {
+
+ }
+
+ public String getMagicCircleName(){
+ return "fbs.copy";
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/magic/MagicDig.class b/src/main/java/jp/plusplus/fbs/magic/MagicDig.class Binary files differnew file mode 100644 index 0000000..7427b05 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/MagicDig.class diff --git a/src/main/java/jp/plusplus/fbs/magic/MagicDig.java b/src/main/java/jp/plusplus/fbs/magic/MagicDig.java new file mode 100644 index 0000000..3fabefd --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/MagicDig.java @@ -0,0 +1,30 @@ +package jp.plusplus.fbs.magic;
+
+import jp.plusplus.fbs.api.MagicBase;
+import jp.plusplus.fbs.entity.EntityMagicDig;
+
+/**
+ * Createdby pluslus_Fon 2015/06/07.
+ */
+public class MagicDig extends MagicBase {
+ @Override
+ public boolean checkSuccess() {
+ if(isSpelled) return true;
+
+ float prob=0.4f+0.03f*property.getMagicLevel();
+ return rand.nextFloat()<=prob;
+ }
+
+ @Override
+ public void success() {
+ boolean penetrate=(isSpelled && property.getMagicLevel()>=20);
+ int till=getLvDiff();
+ EntityMagicDig e=new EntityMagicDig(world, player, 0.6F, 1.0F, till, penetrate);
+ world.spawnEntityInWorld(e);
+ }
+
+ @Override
+ public void failure() {
+ sanity(1, 6);
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/magic/MagicDigTouch.class b/src/main/java/jp/plusplus/fbs/magic/MagicDigTouch.class Binary files differnew file mode 100644 index 0000000..f486207 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/MagicDigTouch.class diff --git a/src/main/java/jp/plusplus/fbs/magic/MagicDigTouch.java b/src/main/java/jp/plusplus/fbs/magic/MagicDigTouch.java new file mode 100644 index 0000000..ee44459 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/MagicDigTouch.java @@ -0,0 +1,39 @@ +package jp.plusplus.fbs.magic;
+
+import jp.plusplus.fbs.api.MagicBase;
+import net.minecraft.block.Block;
+import net.minecraft.util.Vec3;
+
+/**
+ * Created by pluslus_F on 2015/06/19.
+ */
+public class MagicDigTouch extends MagicBase {
+ @Override
+ public boolean checkSuccess() {
+ if(isSpelled) return true;
+ float prob=0.4f;
+ int l=getLvDiff();
+ if(l>0) prob+=0.05*l;
+ return rand.nextFloat()<=prob;
+ }
+
+ @Override
+ public void success() {
+ int l=getLvDiff();
+ Vec3 pos=getTouchPosition();
+ if(pos==null) return;
+
+ float hardness=30+1.0f+(l>0?0.5f*l:0);
+
+ Block b=world.getBlock((int)pos.xCoord, (int)pos.yCoord,(int)pos.zCoord);
+ float bh=b.getBlockHardness(world, (int)pos.xCoord, (int)pos.yCoord,(int)pos.zCoord);
+ if(bh!=-1 && bh<hardness){
+ world.func_147480_a((int)pos.xCoord, (int)pos.yCoord,(int)pos.zCoord, true);
+ }
+ }
+
+ @Override
+ public void failure() {
+ sanity(1, 4);
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/magic/MagicFailure.class b/src/main/java/jp/plusplus/fbs/magic/MagicFailure.class Binary files differnew file mode 100644 index 0000000..409ec11 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/MagicFailure.class diff --git a/src/main/java/jp/plusplus/fbs/magic/MagicFailure.java b/src/main/java/jp/plusplus/fbs/magic/MagicFailure.java new file mode 100644 index 0000000..03706fc --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/MagicFailure.java @@ -0,0 +1,23 @@ +package jp.plusplus.fbs.magic;
+
+import jp.plusplus.fbs.api.MagicBase;
+
+/**
+ * Createdby pluslus_Fon 2015/06/08.
+ */
+public class MagicFailure extends MagicBase {
+ @Override
+ public boolean checkSuccess() {
+ return true;
+ }
+
+ @Override
+ public void success() {
+ //player.addChatComponentMessage(new ChatComponentTranslation("info.fbs.magic.resona.failure"));
+ }
+
+ @Override
+ public void failure() {
+ //player.addChatComponentMessage(new ChatComponentTranslation("info.fbs.magic.resona.failure"));
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/magic/MagicFireBolt.class b/src/main/java/jp/plusplus/fbs/magic/MagicFireBolt.class Binary files differnew file mode 100644 index 0000000..5cf4007 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/MagicFireBolt.class diff --git a/src/main/java/jp/plusplus/fbs/magic/MagicFireBolt.java b/src/main/java/jp/plusplus/fbs/magic/MagicFireBolt.java new file mode 100644 index 0000000..f18c438 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/MagicFireBolt.java @@ -0,0 +1,59 @@ +package jp.plusplus.fbs.magic;
+
+import jp.plusplus.fbs.api.IMagicEnchant;
+import jp.plusplus.fbs.api.MagicBase;
+import jp.plusplus.fbs.entity.EntityMagicFireBolt;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLivingBase;
+
+/**
+ * Createdby pluslus_Fon 2015/06/14.
+ */
+public class MagicFireBolt extends MagicBase implements IMagicEnchant {
+ @Override
+ public boolean checkSuccess() {
+ if(isSpelled) return true;
+
+ float prob=0.4f+0.03f*property.getMagicLevel();
+ return rand.nextFloat()<=prob;
+ }
+
+ @Override
+ public void success() {
+ int d=getLvDiff();
+ float dm=isSpelled?1.5f:0.5f;
+ if(d>0) dm+=0.5f*(d/5);
+
+ Entity e=new EntityMagicFireBolt(world, player, 1.0F, 1.0F, dm);
+ world.spawnEntityInWorld(e);
+ }
+
+ @Override
+ public void failure() {
+ sanity(2, 4);
+ }
+
+ @Override
+ public void enchant(EntityLivingBase entity, boolean success) {
+ if(success) entity.setFire(10);
+ }
+
+ @Override
+ public float damageScale(EntityLivingBase entity) {
+ return 1.2f;
+ }
+
+ @Override
+ public float damageValue(EntityLivingBase entity) {
+ return 0.f;
+ }
+
+ @Override
+ public ParticleColor setParticleColor(){
+ ParticleColor col=new ParticleColor();
+ float v=0.5f+0.5f*rand.nextFloat();
+ col.blue-=v;
+ col.green-=v;
+ return col;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/magic/MagicHarvest.class b/src/main/java/jp/plusplus/fbs/magic/MagicHarvest.class Binary files differnew file mode 100644 index 0000000..e5d7eef --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/MagicHarvest.class diff --git a/src/main/java/jp/plusplus/fbs/magic/MagicHarvest.java b/src/main/java/jp/plusplus/fbs/magic/MagicHarvest.java new file mode 100644 index 0000000..1998aa8 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/MagicHarvest.java @@ -0,0 +1,92 @@ +package jp.plusplus.fbs.magic;
+
+import jp.plusplus.fbs.Registry;
+import jp.plusplus.fbs.api.MagicBase;
+import net.minecraft.enchantment.EnchantmentHelper;
+import net.minecraft.entity.item.EntityItem;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.MathHelper;
+
+import java.util.ArrayList;
+
+/**
+ * Created by plusplus_F on 2015/09/27.
+ */
+public class MagicHarvest extends MagicBase {
+ @Override
+ public boolean checkSuccess() {
+ if(!isSpelled || usingStaff) return false;
+ float r=0.15f+0.03f*Math.max(getLvDiff(), 0);
+ return rand.nextFloat()<r;
+ }
+
+ @Override
+ public void success() {
+ int ld=Math.max(getLvDiff(), 0);
+ int h=getHeight();
+
+ //抽選
+ ArrayList<Registry.ChestContent> list=Registry.GetChestContents(1);
+ int valueSum=0;
+ for(Registry.ChestContent cc : list) valueSum+=cc.weight;
+
+ //アイテムスタックのスタックサイズと数
+ int min=1+ld/2;
+ int max=3+ld;
+ int amount=6+ld/2+rand.nextInt(ld+5);
+
+ for(int i=0;i<amount;i++){
+ int r=rand.nextInt(valueSum);
+ int sum=0;
+ for(Registry.ChestContent cc : list){
+ if(r<cc.weight+sum){
+ double x=player.posX+2*(rand.nextDouble()-rand.nextDouble());
+ double z=player.posZ+2*(rand.nextDouble()-rand.nextDouble());
+
+ ItemStack item=cc.get();
+ item.stackSize=min+rand.nextInt(max-min+1);
+ if(item.stackSize>item.getMaxStackSize()) item.stackSize=item.getMaxStackSize();
+
+ if(item.isItemEnchantable() && rand.nextInt(3)==0){
+ EnchantmentHelper.addRandomEnchantment(rand, item, 3*ld+rand.nextInt(10));
+ }
+
+ EntityItem e=new EntityItem(world, x,h-1.5*rand.nextDouble(),z, item);
+ world.spawnEntityInWorld(e);
+
+ break;
+ }
+ sum+=cc.weight;
+ }
+ }
+ }
+
+ @Override
+ public void failure() {
+
+ }
+
+ @Override
+ public String getMagicCircleName(){
+ return "fbs.harvest";
+ }
+
+ public int getHeight(){
+ int x= MathHelper.floor_double(player.posX);
+ int y= MathHelper.floor_double(player.posY+player.getEyeHeight());
+ int z= MathHelper.floor_double(player.posZ);
+
+ if(world.getHeightValue(x,z)<y){
+ return y+32;
+ }
+ else{
+ int sy=y;
+ while(y-sy<34 && world.isAirBlock(x,y,z)){
+ y++;
+ }
+ y--;
+ return y;
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/magic/MagicHealingBall.class b/src/main/java/jp/plusplus/fbs/magic/MagicHealingBall.class Binary files differnew file mode 100644 index 0000000..2355df9 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/MagicHealingBall.class diff --git a/src/main/java/jp/plusplus/fbs/magic/MagicHealingBall.java b/src/main/java/jp/plusplus/fbs/magic/MagicHealingBall.java new file mode 100644 index 0000000..e011cf7 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/MagicHealingBall.java @@ -0,0 +1,30 @@ +package jp.plusplus.fbs.magic;
+
+import jp.plusplus.fbs.api.MagicBase;
+import jp.plusplus.fbs.entity.EntityMagicHealingBall;
+import net.minecraft.entity.Entity;
+
+/**
+ * Createdby pluslus_Fon 2015/06/14.
+ */
+public class MagicHealingBall extends MagicBase {
+ @Override
+ public boolean checkSuccess() {
+ if(isSpelled) return true;
+
+ float prob=0.4f+0.02f*getLvDiff();
+ return rand.nextFloat()<=prob;
+ }
+
+ @Override
+ public void success() {
+ int a = 5+getLvDiff()/4;
+ Entity e=new EntityMagicHealingBall(world, player, a);
+ world.spawnEntityInWorld(e);
+ }
+
+ @Override
+ public void failure() {
+ sanity(2, 6);
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/magic/MagicHealingSelf.class b/src/main/java/jp/plusplus/fbs/magic/MagicHealingSelf.class Binary files differnew file mode 100644 index 0000000..da570b4 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/MagicHealingSelf.class diff --git a/src/main/java/jp/plusplus/fbs/magic/MagicHealingSelf.java b/src/main/java/jp/plusplus/fbs/magic/MagicHealingSelf.java new file mode 100644 index 0000000..153bbc8 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/MagicHealingSelf.java @@ -0,0 +1,37 @@ +package jp.plusplus.fbs.magic;
+
+import jp.plusplus.fbs.api.MagicEnchantBase;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.potion.Potion;
+import net.minecraft.potion.PotionEffect;
+
+/**
+ * Createdby pluslus_Fon 2015/06/16.
+ */
+public class MagicHealingSelf extends MagicEnchantBase {
+ public MagicHealingSelf() {
+ super(4, 6);
+ }
+
+ @Override
+ public boolean checkSuccess() {
+ int d=getLvDiff();
+ float prob=isSpelled?0.35f:0.1f;
+ if(d>0) prob+=0.05f*d;
+ return rand.nextFloat()<=prob;
+ }
+
+ @Override
+ public void enchant(EntityLivingBase entity, boolean success) {
+ int d = getDuration(8, 2);
+ int a = getAmplifier(8);
+ if(success){
+ entity.addPotionEffect(new PotionEffect(Potion.regeneration.getId(), d, a));
+ entity.addPotionEffect(new PotionEffect(Potion.heal.getId(), 1, a));
+ }
+ else{
+ entity.addPotionEffect(new PotionEffect(Potion.wither.getId(), d, a));
+ entity.addPotionEffect(new PotionEffect(Potion.harm.getId(), 1, a));
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/magic/MagicLoveHurricane.class b/src/main/java/jp/plusplus/fbs/magic/MagicLoveHurricane.class Binary files differnew file mode 100644 index 0000000..bf7e683 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/MagicLoveHurricane.class diff --git a/src/main/java/jp/plusplus/fbs/magic/MagicLoveHurricane.java b/src/main/java/jp/plusplus/fbs/magic/MagicLoveHurricane.java new file mode 100644 index 0000000..f6a43ce --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/MagicLoveHurricane.java @@ -0,0 +1,54 @@ +package jp.plusplus.fbs.magic;
+
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.projectile.EntityArrow;
+import net.minecraft.item.ItemSword;
+import net.minecraft.util.DamageSource;
+import net.minecraft.util.Vec3;
+
+import java.util.List;
+
+/**
+ * Created by plusplus_F on 2015/10/01.
+ * ピンチなら
+ * 扇いでみよう
+ * 大団扇
+ */
+public class MagicLoveHurricane extends MagicVortex {
+ @Override
+ public boolean checkSuccess() {
+ return true;
+ }
+
+ @Override
+ public void success() {
+ //効果範囲
+ int size = isSpelled ? 2 : 1;
+ size += Math.max(getLvDiff(), 0) / 5;
+
+ //ダメージ
+ float d = 8.0f + 0.5f * (Math.max(getLvDiff(), 0) / 3);
+
+ //吹き飛ばし強さ
+ float knockback = 1.f + 0.08f * Math.max(getLvDiff(), 0);
+
+ //効果範囲内の全てのEntityLivingBaseへ
+ List list = getEntities(size);
+ if (!list.isEmpty()) {
+ for (int i = 0; i < list.size(); i++) {
+ EntityLivingBase e = (EntityLivingBase) list.get(i);
+ if(e.getUniqueID()==player.getUniqueID()) continue;
+
+ e.attackEntityFrom(DamageSource.causeIndirectMagicDamage(player, e), d);
+
+ //方向の決定
+ Vec3 vec = player.getPosition(1.f).subtract(e.getPosition(1.f));
+ vec.yCoord = 0;
+ vec = vec.normalize();
+
+ //飛ばす
+ e.addVelocity(knockback * vec.xCoord, 0, knockback * vec.zCoord);
+ }
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/magic/MagicReturn.class b/src/main/java/jp/plusplus/fbs/magic/MagicReturn.class Binary files differnew file mode 100644 index 0000000..14fcc13 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/MagicReturn.class diff --git a/src/main/java/jp/plusplus/fbs/magic/MagicReturn.java b/src/main/java/jp/plusplus/fbs/magic/MagicReturn.java new file mode 100644 index 0000000..633b6d1 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/MagicReturn.java @@ -0,0 +1,53 @@ +package jp.plusplus.fbs.magic;
+
+import jp.plusplus.fbs.api.MagicBase;
+import net.minecraft.block.Block;
+import net.minecraft.block.material.Material;
+import net.minecraft.init.Blocks;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.ChunkCoordinates;
+import net.minecraft.util.StatCollector;
+
+/**
+ * Createdby pluslus_Fon 2015/06/14.
+ */
+public class MagicReturn extends MagicBase {
+ @Override
+ public boolean checkSuccess() {
+ if(!isSpelled) return false;
+
+ float prob=0.4f+0.02f*property.getMagicLevel();
+ return rand.nextFloat()<=prob;
+ }
+
+ @Override
+ public void success() {
+ //EntityClientPlayerMP
+ //player.respawnPlayer();
+ ChunkCoordinates pos=player.getBedLocation(0);
+ if(pos==null){
+ pos=world.getSpawnPoint();
+ pos.posY=world.getChunkFromBlockCoords(pos.posX, pos.posZ).getHeightValue(pos.posX%16, pos.posZ%16);
+ }
+ else{
+ Block b0=world.getBlock(pos.posX+1, pos.posY, pos.posZ);
+ Block b1=world.getBlock(pos.posX, pos.posY, pos.posZ+1);
+ Block b2=world.getBlock(pos.posX-1, pos.posY, pos.posZ);
+ Block b3=world.getBlock(pos.posX, pos.posY, pos.posZ-1);
+
+ Block b4=world.getBlock(pos.posX, pos.posY+1, pos.posZ);
+
+ if((b0!=Blocks.bed && b1!=Blocks.bed && b2!=Blocks.bed && b3!=Blocks.bed) || b4.getMaterial()!=Material.air){
+ pos=world.getSpawnPoint();
+ pos.posY=world.getChunkFromBlockCoords(pos.posX, pos.posZ).getHeightValue(pos.posX%16, pos.posZ%16);
+ player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("tile.bed.notValid")));
+ }
+ }
+ player.setPositionAndUpdate(pos.posX, pos.posY+0.2, pos.posZ);
+ }
+
+ @Override
+ public void failure() {
+ sanity(2, 6);
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/magic/MagicSummonVillager.class b/src/main/java/jp/plusplus/fbs/magic/MagicSummonVillager.class Binary files differnew file mode 100644 index 0000000..2e82f6b --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/MagicSummonVillager.class diff --git a/src/main/java/jp/plusplus/fbs/magic/MagicSummonVillager.java b/src/main/java/jp/plusplus/fbs/magic/MagicSummonVillager.java new file mode 100644 index 0000000..93dd08f --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/MagicSummonVillager.java @@ -0,0 +1,66 @@ +package jp.plusplus.fbs.magic;
+
+import cpw.mods.fml.common.registry.VillagerRegistry;
+import jp.plusplus.fbs.api.MagicBase;
+import jp.plusplus.fbs.block.BlockCore;
+import jp.plusplus.fbs.entity.EntityMagicAuthor;
+import net.minecraft.block.Block;
+import net.minecraft.entity.passive.EntityVillager;
+import net.minecraft.util.MathHelper;
+
+/**
+ * Created by plusplus_F on 2015/09/27.
+ */
+public class MagicSummonVillager extends MagicBase {
+ public static final int BOOKSHELF=24;
+
+ @Override
+ public boolean checkSuccess() {
+ return false;
+ }
+
+ @Override
+ public String getMagicCircleName(){
+ return "fbs.summonVillager";
+ }
+
+ @Override
+ public void success() {
+ sanity(2,6);
+
+ //魔法陣の周囲の本棚を数える
+ int x= MathHelper.floor_double(player.posX);
+ int y= MathHelper.floor_double(player.posY);
+ int z= MathHelper.floor_double(player.posZ);
+ int count=0;
+ for(int k=0;k<2;k++){
+ for(int i=0;i<5;i++){
+ if(world.getBlock(x-2+i, y+k, z-2)==BlockCore.bookshelf) count++;
+ if(world.getBlock(x-2+i, y+k, z+2)==BlockCore.bookshelf) count++;
+ }
+ for(int i=0;i<3;i++){
+ if(world.getBlock(x-2, y+k, z-1+i)==BlockCore.bookshelf) count++;
+ if(world.getBlock(x+2, y+k, z-1+i)==BlockCore.bookshelf) count++;
+ }
+ }
+
+ //本棚が一定数以上あれば作家を湧かせる
+ if(count>=BOOKSHELF){
+ EntityMagicAuthor e=new EntityMagicAuthor(world);
+ e.setPosition(player.posX+2*rand.nextFloat(), player.posY, player.posZ+2*rand.nextFloat());
+ world.spawnEntityInWorld(e);
+ }
+ else{
+ //通常の処理
+ EntityVillager e=new EntityVillager(world, rand.nextInt(5+VillagerRegistry.getRegisteredVillagers().size()));
+ e.setPosition(player.posX+2*rand.nextFloat(), player.posY, player.posZ+2*rand.nextFloat());
+ world.spawnEntityInWorld(e);
+ }
+
+ }
+
+ @Override
+ public void failure() {
+ sanity(3, 8);
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/magic/MagicTimeAcc.class b/src/main/java/jp/plusplus/fbs/magic/MagicTimeAcc.class Binary files differnew file mode 100644 index 0000000..d28fffa --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/MagicTimeAcc.class diff --git a/src/main/java/jp/plusplus/fbs/magic/MagicTimeAcc.java b/src/main/java/jp/plusplus/fbs/magic/MagicTimeAcc.java new file mode 100644 index 0000000..4151280 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/MagicTimeAcc.java @@ -0,0 +1,49 @@ +package jp.plusplus.fbs.magic;
+
+import jp.plusplus.fbs.api.MagicBase;
+import net.minecraft.block.Block;
+import net.minecraft.block.IGrowable;
+
+/**
+ * Createdby pluslus_Fon 2015/06/14.
+ */
+public class MagicTimeAcc extends MagicBase {
+ @Override
+ public boolean checkSuccess() {
+ float prob=0.5f+0.025f*(property.getMagicLevel()-bookData.lv);
+ return rand.nextFloat()<=prob;
+ }
+
+ @Override
+ public void success() {
+ int range=isSpelled?2:1;
+ int l=getLvDiff();
+ if(l>0) range+=l/4;
+
+ int cx=(int)player.posX, cy=(int)player.posY, cz=(int)player.posZ;
+ for(int i=cx-range;i<cx+range;i++){
+ for(int k=cz-range;k<cz+range;k++){
+ for(int n=cy;n<cy+1;n++){
+ Block b=world.getBlock(i,n,k);
+ if(b instanceof IGrowable){
+ IGrowable g=(IGrowable)b;
+
+ if (g.func_149851_a(world, i, n, k, world.isRemote)){
+ if (g.func_149852_a(world, rand, i, n, k)){
+ ((IGrowable) b).func_149853_b(world, rand, i, n, k);
+ world.playAuxSFX(2005, i, n, k, 0);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ sanity(1,10);
+ }
+
+ @Override
+ public void failure() {
+ sanity(1,10);
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/magic/MagicTimeTrace.class b/src/main/java/jp/plusplus/fbs/magic/MagicTimeTrace.class Binary files differnew file mode 100644 index 0000000..dd3685e --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/MagicTimeTrace.class diff --git a/src/main/java/jp/plusplus/fbs/magic/MagicTimeTrace.java b/src/main/java/jp/plusplus/fbs/magic/MagicTimeTrace.java new file mode 100644 index 0000000..e8c6b38 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/MagicTimeTrace.java @@ -0,0 +1,49 @@ +package jp.plusplus.fbs.magic;
+
+import jp.plusplus.fbs.api.MagicBase;
+import net.minecraft.block.Block;
+import net.minecraft.block.BlockCrops;
+import net.minecraft.block.BlockSapling;
+import net.minecraft.init.Blocks;
+
+/**
+ * Createdby pluslus_Fon 2015/06/14.
+ */
+public class MagicTimeTrace extends MagicBase {
+ @Override
+ public boolean checkSuccess() {
+ float prob=0.5f+0.025f*(property.getMagicLevel()-bookData.lv);
+ return rand.nextFloat()<=prob;
+ }
+
+ @Override
+ public void success() {
+ int range=isSpelled?2:1;
+ int l=getLvDiff();
+ if(l>0) range+=l/4;
+
+ int cx=(int)player.posX, cy=(int)player.posY, cz=(int)player.posZ;
+ for(int i=cx-range;i<cx+range;i++){
+ for(int k=cz-range;k<cz+range;k++){
+ for(int n=cy;n<cy+1;n++){
+ Block b=world.getBlock(i,n,k);
+
+ if(b==Blocks.tallgrass || b==Blocks.double_plant || b==Blocks.deadbush || b==Blocks.red_flower || b==Blocks.yellow_flower){
+ world.func_147480_a(i, n, k, true);
+ }
+ else if(b instanceof BlockCrops || b instanceof BlockSapling){
+ world.setBlockMetadataWithNotify(i,n,k,0,2);
+ world.playAuxSFX(2005, i, n, k, 0);
+ }
+ }
+ }
+ }
+
+ sanity(1,10);
+ }
+
+ @Override
+ public void failure() {
+ sanity(1,10);
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/magic/MagicTouch.class b/src/main/java/jp/plusplus/fbs/magic/MagicTouch.class Binary files differnew file mode 100644 index 0000000..4baf605 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/MagicTouch.class diff --git a/src/main/java/jp/plusplus/fbs/magic/MagicTouch.java b/src/main/java/jp/plusplus/fbs/magic/MagicTouch.java new file mode 100644 index 0000000..b797715 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/MagicTouch.java @@ -0,0 +1,33 @@ +package jp.plusplus.fbs.magic;
+
+import jp.plusplus.fbs.api.MagicBase;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.util.DamageSource;
+
+/**
+ * Created by pluslus_F on 2015/06/23.
+ */
+public class MagicTouch extends MagicBase {
+ @Override
+ public boolean checkSuccess() {
+ return true;
+ }
+
+ @Override
+ public void success() {
+ Entity e=getTouchEntity();
+ if(e!=null && e instanceof EntityLivingBase){
+ float d=3.0f;
+ int lv=getLvDiff();
+ if(lv>0) d+=0.5*(lv/5);
+ if(!isSpelled) d/=2.0f;
+ e.attackEntityFrom(DamageSource.causeIndirectMagicDamage(player, (EntityLivingBase)e), d);
+ }
+ }
+
+ @Override
+ public void failure() {
+ sanity(1,4);
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/magic/MagicTouchFlexible.class b/src/main/java/jp/plusplus/fbs/magic/MagicTouchFlexible.class Binary files differnew file mode 100644 index 0000000..8b966b8 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/MagicTouchFlexible.class diff --git a/src/main/java/jp/plusplus/fbs/magic/MagicTouchFlexible.java b/src/main/java/jp/plusplus/fbs/magic/MagicTouchFlexible.java new file mode 100644 index 0000000..f665449 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/MagicTouchFlexible.java @@ -0,0 +1,83 @@ +package jp.plusplus.fbs.magic;
+
+import jp.plusplus.fbs.Registry;
+import jp.plusplus.fbs.api.IMagicEnchant;
+import jp.plusplus.fbs.api.MagicBase;
+import jp.plusplus.fbs.item.ItemCore;
+import jp.plusplus.fbs.item.ItemStaff;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.DamageSource;
+
+import java.util.LinkedList;
+
+/**
+ * Created by pluslus_F on 2015/06/23.
+ * 魔法の拳+付与魔法の汎用共鳴
+ */
+public class MagicTouchFlexible extends MagicBase {
+ @Override
+ public boolean checkSuccess() {
+ return true;
+ }
+
+ @Override
+ public void success() {
+ ItemStack item=player.getCurrentEquippedItem();
+ if(item==null || !(item.getItem() instanceof ItemStaff)) return;
+
+ int bookNum=((ItemStaff) item.getItem()).bookNum;
+ ItemStack[] items=ItemStaff.loadInventory(item);
+
+ //付与魔法のリストを作成する
+ LinkedList<Registry.MagicData> magics = new LinkedList<Registry.MagicData>();
+ for (int i = 0; i < bookNum; i++) {
+ if (items[i] != null && items[i].getItem() == ItemCore.bookSorcery) {
+ Registry.MagicData md=Registry.GetMagicDataFromItemStack(items[i]);
+ if(md==null) continue;
+ if(MagicArrow.class==md.magic) continue;
+
+ //付与魔法であればリストに追加
+ if(IMagicEnchant.class.isAssignableFrom(md.magic)){
+ magics.add(md);
+ }
+ }
+ }
+ if (magics.isEmpty()) return;
+
+ Entity e=getTouchEntity();
+ if(e instanceof EntityLivingBase){
+ float d=3.0f;
+ int lv=getLvDiff();
+ if(lv>0) d+=0.5*(lv/5);
+ if(!isSpelled) d/=2.0f;
+
+ float dValue=0.f;
+ float dScale=1.f;
+
+ //IMagicEnchantのインスタンス化
+ //スタッフによる使用なので常に詠唱破棄状態
+ IMagicEnchant[] me=new IMagicEnchant[magics.size()];
+ for(int i=0;i<me.length;i++){
+ me[i]=(IMagicEnchant)magics.get(i).getMagic(world, player, false);
+ dValue+=me[i].damageValue((EntityLivingBase)e);
+ dScale*=me[i].damageScale((EntityLivingBase)e);
+ }
+
+ //ダメージ
+ e.attackEntityFrom(DamageSource.causeIndirectMagicDamage(player, (EntityLivingBase) e), (d+dValue)*dScale);
+
+ //タッチしたEntityへの付与
+ for(int i=0;i<me.length;i++){
+ me[i].enchant((EntityLivingBase)e, true);
+ }
+ }
+ }
+
+ @Override
+ public void failure() {
+ sanity(2,4);
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/magic/MagicVortex.class b/src/main/java/jp/plusplus/fbs/magic/MagicVortex.class Binary files differnew file mode 100644 index 0000000..da16ea7 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/MagicVortex.class diff --git a/src/main/java/jp/plusplus/fbs/magic/MagicVortex.java b/src/main/java/jp/plusplus/fbs/magic/MagicVortex.java new file mode 100644 index 0000000..658d573 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/MagicVortex.java @@ -0,0 +1,65 @@ +package jp.plusplus.fbs.magic;
+
+import jp.plusplus.fbs.api.MagicBase;
+import jp.plusplus.fbs.packet.MessageMagicFlexible;
+import jp.plusplus.fbs.packet.MessageMagicVortex;
+import jp.plusplus.fbs.packet.PacketHandler;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.AxisAlignedBB;
+import net.minecraft.util.DamageSource;
+import net.minecraft.util.MathHelper;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Created by plusplus_F on 2015/10/01.
+ */
+public class MagicVortex extends MagicBase {
+ @Override
+ public boolean checkSuccess() {
+ float p=0.35f+0.05f*Math.max(getLvDiff(), 0);
+ if(isSpelled) p+=0.35f;
+ return rand.nextFloat()<p;
+ }
+
+ @Override
+ public void success() {
+ //効果範囲
+ int size=isSpelled?2:1;
+ size+=Math.max(getLvDiff(), 0)/5;
+
+ //ダメージ
+ float d=3.0f+0.5f*(Math.max(getLvDiff(), 0)/3);
+ if(!isSpelled) d/=2.f;
+
+ //効果範囲内の全てのEntityLivingBaseへ
+ List list=getEntities(size);
+ if(!list.isEmpty()){
+ for(int i=0;i<list.size();i++){
+ EntityLivingBase e=(EntityLivingBase)list.get(i);
+ if(e.getUniqueID()==player.getUniqueID()) continue;
+
+ e.attackEntityFrom(DamageSource.causeIndirectMagicDamage(player, e), d);
+ }
+ }
+
+ //エフェクト
+ PacketHandler.INSTANCE.sendToDimension(new MessageMagicVortex(player, size, new NBTTagCompound()), world.provider.dimensionId);
+ }
+
+ @Override
+ public void failure() {
+ sanity(2, 4);
+ }
+
+ public List getEntities(int size){
+ int px= MathHelper.floor_double(player.posX);
+ int py= MathHelper.floor_double(player.posY);
+ int pz= MathHelper.floor_double(player.posZ);
+
+ AxisAlignedBB aabb=AxisAlignedBB.getBoundingBox(px,py,pz, px+1, py+2, pz+1).expand(size, size, size);
+ return world.getEntitiesWithinAABB(EntityLivingBase.class, aabb);
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/magic/MagicVortexFlexible.class b/src/main/java/jp/plusplus/fbs/magic/MagicVortexFlexible.class Binary files differnew file mode 100644 index 0000000..797d8d6 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/MagicVortexFlexible.class diff --git a/src/main/java/jp/plusplus/fbs/magic/MagicVortexFlexible.java b/src/main/java/jp/plusplus/fbs/magic/MagicVortexFlexible.java new file mode 100644 index 0000000..54648ea --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/MagicVortexFlexible.java @@ -0,0 +1,103 @@ +package jp.plusplus.fbs.magic;
+
+import jp.plusplus.fbs.Registry;
+import jp.plusplus.fbs.api.IMagicEnchant;
+import jp.plusplus.fbs.api.MagicBase;
+import jp.plusplus.fbs.item.ItemCore;
+import jp.plusplus.fbs.item.ItemStaff;
+import jp.plusplus.fbs.packet.MessageMagicVortex;
+import jp.plusplus.fbs.packet.PacketHandler;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.nbt.NBTTagList;
+import net.minecraft.util.AxisAlignedBB;
+import net.minecraft.util.DamageSource;
+import net.minecraft.util.MathHelper;
+
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * Created by plusplus_F on 2015/10/01.
+ */
+public class MagicVortexFlexible extends MagicVortex {
+ @Override
+ public boolean checkSuccess() {
+ return true;
+ }
+
+ @Override
+ public void success() {
+ ItemStack item=player.getCurrentEquippedItem();
+ if(item==null || !(item.getItem() instanceof ItemStaff)) return;
+
+ int bookNum=((ItemStaff) item.getItem()).bookNum;
+ ItemStack[] items=ItemStaff.loadInventory(item);
+
+ //付与魔法のリストを作成する
+ NBTTagList tagList=new NBTTagList();
+ LinkedList<Registry.MagicData> magics = new LinkedList<Registry.MagicData>();
+ for (int i = 0; i < bookNum; i++) {
+ if (items[i] != null && items[i].getItem() == ItemCore.bookSorcery) {
+ Registry.MagicData md=Registry.GetMagicDataFromItemStack(items[i]);
+ if(md==null) continue;
+ if(MagicArrow.class==md.magic) continue;
+
+ //付与魔法であればリストに追加
+ if(IMagicEnchant.class.isAssignableFrom(md.magic)){
+ magics.add(md);
+
+ NBTTagCompound nbt1 = new NBTTagCompound();
+ nbt1.setString("MagicName", md.title);
+ tagList.appendTag(nbt1);
+ }
+ }
+ }
+ if (magics.isEmpty()) return;
+
+ //効果範囲
+ int size=isSpelled?2:1;
+ size+=Math.max(getLvDiff(), 0)/5;
+
+ //ダメージ
+ float d=3.0f+0.5f*(Math.max(getLvDiff(), 0)/3);
+ if(!isSpelled) d/=2.f;
+
+ //効果範囲内の全てのEntityLivingBaseへ
+ List list=getEntities(size);
+ if(!list.isEmpty()){
+
+ //付与魔法のインスタンス化
+ IMagicEnchant[] me=new IMagicEnchant[magics.size()];
+ for(int i=0;i<me.length;i++) {
+ me[i] = (IMagicEnchant) magics.get(i).getMagic(world, player, false);
+ }
+
+ for(int i=0;i<list.size();i++){
+ EntityLivingBase e=(EntityLivingBase)list.get(i);
+ if(e.getUniqueID()==player.getUniqueID()) continue;
+
+ //一体ずつダメージとか処理していく
+ float dScale=1.f;
+ float dValue=0.f;
+ for(int k=0;k<me.length;k++){
+ dScale*=me[k].damageScale(e);
+ dValue+=me[k].damageValue(e);
+ }
+
+ e.attackEntityFrom(DamageSource.causeIndirectMagicDamage(player, e), (d+dValue)*dScale);
+
+ //付与効果
+ for(int k=0;k<me.length;k++){
+ me[k].enchant(e, true);
+ }
+ }
+ }
+
+ //エフェクト
+ NBTTagCompound tag=new NBTTagCompound();
+ tag.setTag("EnchantMagics", tagList);
+ PacketHandler.INSTANCE.sendToDimension(new MessageMagicVortex(player, size, tag), world.provider.dimensionId);
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/magic/MagicWarp.class b/src/main/java/jp/plusplus/fbs/magic/MagicWarp.class Binary files differnew file mode 100644 index 0000000..f27536f --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/MagicWarp.class diff --git a/src/main/java/jp/plusplus/fbs/magic/MagicWarp.java b/src/main/java/jp/plusplus/fbs/magic/MagicWarp.java new file mode 100644 index 0000000..2c41606 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/MagicWarp.java @@ -0,0 +1,37 @@ +package jp.plusplus.fbs.magic;
+
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.api.MagicBase;
+import jp.plusplus.fbs.exprop.SanityManager;
+import net.minecraft.util.MathHelper;
+
+/**
+ * Created by plusplus_F on 2015/10/23.
+ */
+public class MagicWarp extends MagicBase {
+ @Override
+ public boolean checkSuccess() {
+ return true;
+ }
+
+ @Override
+ public String getMagicCircleName(){
+ return "fbs.warp";
+ //return "null";
+
+ }
+
+ @Override
+ public void success() {
+ int x=MathHelper.floor_double(player.posX);
+ int y=MathHelper.floor_double(player.posY);
+ int z=MathHelper.floor_double(player.posZ);
+ SanityManager.addDestination(player, world.provider.dimensionId, x, y, z);
+ player.openGui(FBS.instance, FBS.GUI_MAGIC_WARP_ID, world, x, y, z);
+ }
+
+ @Override
+ public void failure() {
+
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/magic/MagicWish.class b/src/main/java/jp/plusplus/fbs/magic/MagicWish.class Binary files differnew file mode 100644 index 0000000..2ef4dd1 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/MagicWish.class diff --git a/src/main/java/jp/plusplus/fbs/magic/MagicWish.java b/src/main/java/jp/plusplus/fbs/magic/MagicWish.java new file mode 100644 index 0000000..7bc2e51 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/MagicWish.java @@ -0,0 +1,28 @@ +package jp.plusplus.fbs.magic;
+
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.api.FBSEntityPropertiesAPI;
+import jp.plusplus.fbs.api.MagicBase;
+import net.minecraft.util.MathHelper;
+
+/**
+ * Created by plusplus_F on 2016/04/01.
+ */
+public class MagicWish extends MagicBase {
+ @Override
+ public boolean checkSuccess() {
+ if(!isSpelled) return false;
+ int d=getLvDiff();
+ return rand.nextFloat()<(d<0?0.05f:0.1f+0.05f*d);
+ }
+
+ @Override
+ public void success() {
+ player.openGui(FBS.instance, FBS.GUI_WISH_ID, world, MathHelper.floor_double(player.posX), MathHelper.floor_double(player.posY), MathHelper.floor_double(player.posZ));
+ }
+
+ @Override
+ public void failure() {
+ FBSEntityPropertiesAPI.LoseSanity(player, 3, 8, true);
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/magic/enchant/MagicButterfly.class b/src/main/java/jp/plusplus/fbs/magic/enchant/MagicButterfly.class Binary files differnew file mode 100644 index 0000000..b22ec4d --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/enchant/MagicButterfly.class diff --git a/src/main/java/jp/plusplus/fbs/magic/enchant/MagicButterfly.java b/src/main/java/jp/plusplus/fbs/magic/enchant/MagicButterfly.java new file mode 100644 index 0000000..07ab20c --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/enchant/MagicButterfly.java @@ -0,0 +1,64 @@ +package jp.plusplus.fbs.magic.enchant;
+
+import jp.plusplus.fbs.AchievementRegistry;
+import jp.plusplus.fbs.api.MagicEnchantBase;
+import jp.plusplus.fbs.entity.EntityButterfly;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.util.DamageSource;
+
+/**
+ * Created by plusplus_F on 2015/08/23.
+ * 重要な魔法
+ */
+public class MagicButterfly extends MagicEnchantBase {
+ public MagicButterfly() {
+ super(2, 4);
+ }
+
+ @Override
+ public void success() {
+ player.attackEntityFrom(new DamageSource("fbs.butterfly"), 10000);
+ enchant(player, true);
+ }
+
+ @Override
+ public void enchant(EntityLivingBase entity, boolean success) {
+ if(!success) return;
+
+ //死んでいれば絶対蝶になる
+ //死んでなくても蝶になる
+ boolean flag=entity.isDead;
+ if(rand.nextFloat()<0.3f){
+ entity.attackEntityFrom(new DamageSource("fbs.butterfly"), 10000);
+ flag=true;
+ }
+
+ if(flag){
+ EntityButterfly eb=new EntityButterfly(entity.worldObj, (float)entity.posX, (float)entity.posY+1, (float)entity.posZ);
+ entity.worldObj.spawnEntityInWorld(eb);
+
+ if(entity instanceof EntityPlayer){
+ ((EntityPlayer) entity).triggerAchievement(AchievementRegistry.sublimation);
+ }
+ }
+ }
+
+ @Override
+ public boolean checkSuccess() {
+ int d=getLvDiff();
+ float prob=isSpelled?0.35f:0.1f;
+ if(d>0) prob+=0.05f*d;
+ return rand.nextFloat()<=prob;
+ }
+
+ @Override
+ public ParticleColor setParticleColor(){
+ ParticleColor col=new ParticleColor();
+ float v=0.1f+0.3f*rand.nextFloat();
+ col.blue-=v;
+ col.red-=v;
+ col.green=0;
+ return col;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/magic/enchant/MagicCleverness.class b/src/main/java/jp/plusplus/fbs/magic/enchant/MagicCleverness.class Binary files differnew file mode 100644 index 0000000..f82bfdd --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/enchant/MagicCleverness.class diff --git a/src/main/java/jp/plusplus/fbs/magic/enchant/MagicCleverness.java b/src/main/java/jp/plusplus/fbs/magic/enchant/MagicCleverness.java new file mode 100644 index 0000000..ee43203 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/enchant/MagicCleverness.java @@ -0,0 +1,33 @@ +package jp.plusplus.fbs.magic.enchant;
+
+import jp.plusplus.fbs.Registry;
+import jp.plusplus.fbs.api.MagicEnchantBase;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.potion.PotionEffect;
+
+/**
+ * Createdby pluslus_Fon 2015/11/09.
+ */
+public class MagicCleverness extends MagicEnchantBase {
+ public MagicCleverness() {
+ super(1, 6);
+ }
+
+ @Override
+ public boolean checkSuccess() {
+ int d=getLvDiff();
+ float prob=isSpelled?0.5f:0.3f;
+ if(d>0) prob+=0.08f*d;
+ return rand.nextFloat()<=prob;
+ }
+ @Override
+ public void enchant(EntityLivingBase entity, boolean success) {
+ int d = getDuration(90, 0.5f);
+ int a = getAmplifier(7);
+
+ if(success){
+ if(this.isSpelled) d+=120*20;
+ entity.addPotionEffect(new PotionEffect(Registry.potionCleverness.getId(), d, a));
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/magic/enchant/MagicContemporary.class b/src/main/java/jp/plusplus/fbs/magic/enchant/MagicContemporary.class Binary files differnew file mode 100644 index 0000000..210fa11 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/enchant/MagicContemporary.class diff --git a/src/main/java/jp/plusplus/fbs/magic/enchant/MagicContemporary.java b/src/main/java/jp/plusplus/fbs/magic/enchant/MagicContemporary.java new file mode 100644 index 0000000..5d9d7a1 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/enchant/MagicContemporary.java @@ -0,0 +1,40 @@ +package jp.plusplus.fbs.magic.enchant;
+
+import jp.plusplus.fbs.api.MagicEnchantBase;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.potion.Potion;
+import net.minecraft.potion.PotionEffect;
+
+/**
+ * Createdby pluslus_Fon 2015/09/19.
+ */
+public class MagicContemporary extends MagicEnchantBase {
+ public MagicContemporary() {
+ super(3, 10);
+ }
+
+ @Override
+ public boolean checkSuccess() {
+ int d=getLvDiff();
+ float prob=isSpelled?0.6f:0.2f;
+ if(d>0) prob+=0.08f*d;
+ return rand.nextFloat()<=prob;
+ }
+ @Override
+ public void enchant(EntityLivingBase entity, boolean success) {
+ int d = getDuration(180, 1);
+ int a = getAmplifier(8);
+
+ if(success){
+ if(this.isSpelled) d+=60*20;
+ entity.addPotionEffect(new PotionEffect(Potion.fireResistance.getId(), d, a));
+ entity.addPotionEffect(new PotionEffect(Potion.resistance.getId(), d, a));
+ entity.addPotionEffect(new PotionEffect(Potion.waterBreathing.getId(), d, a));
+ }
+ else{
+ entity.addPotionEffect(new PotionEffect(Potion.weakness.getId(), d, a));
+ entity.addPotionEffect(new PotionEffect(Potion.digSlowdown.getId(), d, a));
+ entity.addPotionEffect(new PotionEffect(Potion.blindness.getId(), d, a));
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/magic/enchant/MagicContractEffect.class b/src/main/java/jp/plusplus/fbs/magic/enchant/MagicContractEffect.class Binary files differnew file mode 100644 index 0000000..5746735 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/enchant/MagicContractEffect.class diff --git a/src/main/java/jp/plusplus/fbs/magic/enchant/MagicContractEffect.java b/src/main/java/jp/plusplus/fbs/magic/enchant/MagicContractEffect.java new file mode 100644 index 0000000..392fa49 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/enchant/MagicContractEffect.java @@ -0,0 +1,34 @@ +package jp.plusplus.fbs.magic.enchant;
+
+import jp.plusplus.fbs.Registry;
+import jp.plusplus.fbs.api.MagicEnchantBase;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.potion.Potion;
+import net.minecraft.potion.PotionEffect;
+
+/**
+ * Createdby pluslus_Fon 2015/11/09.
+ */
+public class MagicContractEffect extends MagicEnchantBase {
+ public MagicContractEffect() {
+ super(3, 10);
+ }
+
+ @Override
+ public boolean checkSuccess() {
+ int d=getLvDiff();
+ float prob=isSpelled?0.5f:0.3f;
+ if(d>0) prob+=0.08f*d;
+ return rand.nextFloat()<=prob;
+ }
+ @Override
+ public void enchant(EntityLivingBase entity, boolean success) {
+ int d = getDuration(90, 0.5f);
+ int a = getAmplifier(8);
+
+ if(success){
+ if(this.isSpelled) d+=120*20;
+ entity.addPotionEffect(new PotionEffect(Registry.potionContract.getId(), d, a));
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/magic/enchant/MagicDagon.class b/src/main/java/jp/plusplus/fbs/magic/enchant/MagicDagon.class Binary files differnew file mode 100644 index 0000000..e185525 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/enchant/MagicDagon.class diff --git a/src/main/java/jp/plusplus/fbs/magic/enchant/MagicDagon.java b/src/main/java/jp/plusplus/fbs/magic/enchant/MagicDagon.java new file mode 100644 index 0000000..80dcf5c --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/enchant/MagicDagon.java @@ -0,0 +1,34 @@ +package jp.plusplus.fbs.magic.enchant;
+
+import jp.plusplus.fbs.api.MagicEnchantBase;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.potion.Potion;
+import net.minecraft.potion.PotionEffect;
+
+/**
+ * Createdby pluslus_Fon 2015/09/19.
+ */
+public class MagicDagon extends MagicEnchantBase {
+ public MagicDagon() {
+ super(4, 6);
+ }
+
+ @Override
+ public boolean checkSuccess() {
+ int d=getLvDiff();
+ float prob=isSpelled?0.5f:0.3f;
+ if(d>0) prob+=0.08f*d;
+ return rand.nextFloat()<=prob;
+ }
+ @Override
+ public void enchant(EntityLivingBase entity, boolean success) {
+ int d = getDuration(90, 0.5f);
+ int a = getAmplifier(8);
+
+ if(success){
+ if(this.isSpelled) d+=120*20;
+ entity.addPotionEffect(new PotionEffect(Potion.waterBreathing.getId(), d, a));
+ }
+ else entity.addPotionEffect(new PotionEffect(Potion.weakness.getId(), d, a));
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/magic/enchant/MagicDamageBoost.class b/src/main/java/jp/plusplus/fbs/magic/enchant/MagicDamageBoost.class Binary files differnew file mode 100644 index 0000000..76bc834 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/enchant/MagicDamageBoost.class diff --git a/src/main/java/jp/plusplus/fbs/magic/enchant/MagicDamageBoost.java b/src/main/java/jp/plusplus/fbs/magic/enchant/MagicDamageBoost.java new file mode 100644 index 0000000..73422fd --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/enchant/MagicDamageBoost.java @@ -0,0 +1,34 @@ +package jp.plusplus.fbs.magic.enchant;
+
+import jp.plusplus.fbs.api.MagicEnchantBase;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.potion.Potion;
+import net.minecraft.potion.PotionEffect;
+
+/**
+ * Createdby pluslus_Fon 2015/06/16.
+ */
+public class MagicDamageBoost extends MagicEnchantBase {
+ public MagicDamageBoost() {
+ super(4, 6);
+ }
+
+ @Override
+ public boolean checkSuccess() {
+ int d=getLvDiff();
+ float prob=isSpelled?0.5f:0.3f;
+ if(d>0) prob+=0.08f*d;
+ return rand.nextFloat()<=prob;
+ }
+ @Override
+ public void enchant(EntityLivingBase entity, boolean success) {
+ int d = getDuration(60, 0.3f);
+ int a = getAmplifier(8);
+
+ if(success){
+ if(this.isSpelled) d+=60*20;
+ entity.addPotionEffect(new PotionEffect(Potion.damageBoost.getId(), d, a));
+ }
+ else entity.addPotionEffect(new PotionEffect(Potion.weakness.getId(), d, a));
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/magic/enchant/MagicEvolutionKing.class b/src/main/java/jp/plusplus/fbs/magic/enchant/MagicEvolutionKing.class Binary files differnew file mode 100644 index 0000000..75b8880 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/enchant/MagicEvolutionKing.class diff --git a/src/main/java/jp/plusplus/fbs/magic/enchant/MagicEvolutionKing.java b/src/main/java/jp/plusplus/fbs/magic/enchant/MagicEvolutionKing.java new file mode 100644 index 0000000..546817d --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/enchant/MagicEvolutionKing.java @@ -0,0 +1,39 @@ +package jp.plusplus.fbs.magic.enchant;
+
+import jp.plusplus.fbs.api.MagicEnchantBase;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.potion.Potion;
+import net.minecraft.potion.PotionEffect;
+
+/**
+ * Createdby pluslus_Fon 2015/06/14.
+ */
+public class MagicEvolutionKing extends MagicEnchantBase {
+ public MagicEvolutionKing() {
+ super(4, 6);
+ }
+
+ @Override
+ public boolean checkSuccess() {
+ float prob=(isSpelled?0.6f:0.2f)+0.05f*(property.getMagicLevel()-bookData.lv);
+ return rand.nextFloat()<=prob;
+ }
+
+ @Override
+ public void enchant(EntityLivingBase entity, boolean success) {
+ int d = getDuration(60, 2);
+ int a = getAmplifier(5);
+
+ if(success){
+ if(this.isSpelled) d+=30*20;
+ entity.addPotionEffect(new PotionEffect(Potion.damageBoost.getId(), d, a));
+ entity.addPotionEffect(new PotionEffect(Potion.resistance.getId(), d, a));
+ entity.addPotionEffect(new PotionEffect(Potion.field_76434_w.getId(), d, a));
+ }
+ else{
+ entity.addPotionEffect(new PotionEffect(Potion.weakness.getId(), d, a));
+ entity.addPotionEffect(new PotionEffect(Potion.moveSlowdown.getId(), d, a));
+ entity.addPotionEffect(new PotionEffect(Potion.wither.getId(), d/5, a));
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/magic/enchant/MagicFireArmor.class b/src/main/java/jp/plusplus/fbs/magic/enchant/MagicFireArmor.class Binary files differnew file mode 100644 index 0000000..7e8087e --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/enchant/MagicFireArmor.class diff --git a/src/main/java/jp/plusplus/fbs/magic/enchant/MagicFireArmor.java b/src/main/java/jp/plusplus/fbs/magic/enchant/MagicFireArmor.java new file mode 100644 index 0000000..850f611 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/enchant/MagicFireArmor.java @@ -0,0 +1,42 @@ +package jp.plusplus.fbs.magic.enchant;
+
+import jp.plusplus.fbs.api.MagicEnchantBase;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.potion.Potion;
+import net.minecraft.potion.PotionEffect;
+
+/**
+ * Createdby pluslus_Fon 2015/09/19.
+ */
+public class MagicFireArmor extends MagicEnchantBase {
+ public MagicFireArmor() {
+ super(4, 6);
+ }
+
+ @Override
+ public boolean checkSuccess() {
+ int d=getLvDiff();
+ float prob=isSpelled?0.5f:0.3f;
+ if(d>0) prob+=0.08f*d;
+ return rand.nextFloat()<=prob;
+ }
+ @Override
+ public void enchant(EntityLivingBase entity, boolean success) {
+ int d = getDuration(60, 1);
+ int a = getAmplifier(8);
+
+ if(success){
+ if(this.isSpelled) d+=30*20;
+ entity.addPotionEffect(new PotionEffect(Potion.fireResistance.getId(), d, a));
+ }
+ else entity.addPotionEffect(new PotionEffect(Potion.weakness.getId(), d, a));
+ }
+
+ @Override
+ public ParticleColor setParticleColor(){
+ ParticleColor col=new ParticleColor();
+ col.green-=0.3f+0.25f*rand.nextFloat();
+ col.blue-=0.7f+0.3f*rand.nextFloat();
+ return col;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/magic/enchant/MagicInvisible.class b/src/main/java/jp/plusplus/fbs/magic/enchant/MagicInvisible.class Binary files differnew file mode 100644 index 0000000..d349c08 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/enchant/MagicInvisible.class diff --git a/src/main/java/jp/plusplus/fbs/magic/enchant/MagicInvisible.java b/src/main/java/jp/plusplus/fbs/magic/enchant/MagicInvisible.java new file mode 100644 index 0000000..41a06d8 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/enchant/MagicInvisible.java @@ -0,0 +1,37 @@ +package jp.plusplus.fbs.magic.enchant;
+
+import jp.plusplus.fbs.api.MagicEnchantBase;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.potion.Potion;
+import net.minecraft.potion.PotionEffect;
+
+/**
+ * Createdby pluslus_Fon 2015/09/19.
+ */
+public class MagicInvisible extends MagicEnchantBase {
+ public MagicInvisible() {
+ super(4, 6);
+ }
+
+ @Override
+ public boolean checkSuccess() {
+ int d=getLvDiff();
+ float prob=isSpelled?0.5f:0.3f;
+ if(d>0) prob+=0.08f*d;
+ return rand.nextFloat()<=prob;
+ }
+ @Override
+ public void enchant(EntityLivingBase entity, boolean success) {
+ int d = getDuration(60, 2);
+ int a = getAmplifier(4);
+
+ if(success){
+ if(this.isSpelled) d+=30*20;
+ entity.addPotionEffect(new PotionEffect(Potion.invisibility.getId(), d, a));
+ }
+ else{
+ entity.addPotionEffect(new PotionEffect(Potion.weakness.getId(), d, a));
+ entity.addPotionEffect(new PotionEffect(Potion.blindness.getId(), d, a));
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/magic/enchant/MagicJump.class b/src/main/java/jp/plusplus/fbs/magic/enchant/MagicJump.class Binary files differnew file mode 100644 index 0000000..100baab --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/enchant/MagicJump.class diff --git a/src/main/java/jp/plusplus/fbs/magic/enchant/MagicJump.java b/src/main/java/jp/plusplus/fbs/magic/enchant/MagicJump.java new file mode 100644 index 0000000..1f5d89a --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/enchant/MagicJump.java @@ -0,0 +1,45 @@ +package jp.plusplus.fbs.magic.enchant;
+
+import jp.plusplus.fbs.api.MagicEnchantBase;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.player.EntityPlayerMP;
+import net.minecraft.network.play.server.S12PacketEntityVelocity;
+
+/**
+ * Createdby pluslus_Fon 2015/09/18.
+ */
+public class MagicJump extends MagicEnchantBase {
+ public MagicJump() {
+ super(2, 6);
+ }
+
+ @Override
+ public boolean checkSuccess() {
+ int d=getLvDiff();
+ float prob=isSpelled?0.35f:0.1f;
+ if(d>0) prob+=0.05f*d;
+ return rand.nextFloat()<=prob;
+ }
+
+ @Override
+ public void enchant(EntityLivingBase entity, boolean success) {
+ if(!entity.onGround) return;
+
+ int v=getLvDiff();
+ double d=0.5+Math.max(0, v*0.05);
+ if(entity instanceof EntityPlayerMP){
+ if(!success) d*=2;
+ entity.addVelocity(0, d-player.motionY, 0);
+ ((EntityPlayerMP) entity).playerNetServerHandler.sendPacket(new S12PacketEntityVelocity(entity));
+ }
+ else{
+ if(!success) d*=0.5;
+ entity.addVelocity(0, d-player.motionY, 0);
+ }
+ }
+
+ @Override
+ public float damageScale(EntityLivingBase entity){
+ return 0.5f;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/magic/enchant/MagicPoison.class b/src/main/java/jp/plusplus/fbs/magic/enchant/MagicPoison.class Binary files differnew file mode 100644 index 0000000..b7f66c1 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/enchant/MagicPoison.class diff --git a/src/main/java/jp/plusplus/fbs/magic/enchant/MagicPoison.java b/src/main/java/jp/plusplus/fbs/magic/enchant/MagicPoison.java new file mode 100644 index 0000000..46c0c87 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/enchant/MagicPoison.java @@ -0,0 +1,54 @@ +package jp.plusplus.fbs.magic.enchant;
+
+import jp.plusplus.fbs.api.MagicEnchantBase;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.potion.Potion;
+import net.minecraft.potion.PotionEffect;
+
+/**
+ * Createdby pluslus_Fon 2015/10/22.
+ */
+public class MagicPoison extends MagicEnchantBase {
+ public MagicPoison() {
+ super(4, 6);
+ }
+
+ @Override
+ public boolean checkSuccess() {
+ if(!isSpelled) return false;
+
+ float prob=0.4f+0.02f*property.getMagicLevel();
+ return rand.nextFloat()<=prob;
+ }
+
+ @Override
+ public void success() {
+ Entity e=getTouchEntity();
+ if(e instanceof EntityLivingBase){
+ enchant((EntityLivingBase)e, true);
+ }
+ }
+
+
+ @Override
+ public void enchant(EntityLivingBase entity, boolean success) {
+ int d = getDuration(5, 3);
+ int a = getAmplifier(10);
+
+ if(success){
+ if(isSpelled) d+=3*20;
+ entity.addPotionEffect(new PotionEffect(Potion.poison.getId(), d, a));
+ }
+ }
+
+ @Override
+ public ParticleColor setParticleColor(){
+ ParticleColor col=new ParticleColor();
+ float v=0.1f+0.5f*rand.nextFloat();
+ col.blue-=v;
+ col.red-=v;
+ col.green=0;
+ return col;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/magic/enchant/MagicRegeneration.class b/src/main/java/jp/plusplus/fbs/magic/enchant/MagicRegeneration.class Binary files differnew file mode 100644 index 0000000..418570f --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/enchant/MagicRegeneration.class diff --git a/src/main/java/jp/plusplus/fbs/magic/enchant/MagicRegeneration.java b/src/main/java/jp/plusplus/fbs/magic/enchant/MagicRegeneration.java new file mode 100644 index 0000000..b0c5ffb --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/enchant/MagicRegeneration.java @@ -0,0 +1,35 @@ +package jp.plusplus.fbs.magic.enchant;
+
+import jp.plusplus.fbs.api.MagicEnchantBase;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.potion.Potion;
+import net.minecraft.potion.PotionEffect;
+
+/**
+ * Createdby pluslus_Fon 2015/06/16.
+ */
+public class MagicRegeneration extends MagicEnchantBase {
+ public MagicRegeneration() {
+ super(4, 6);
+ }
+
+ @Override
+ public boolean checkSuccess() {
+ int d=getLvDiff();
+ float prob=isSpelled?0.35f:0.1f;
+ if(d>0) prob+=0.05f*d;
+ return rand.nextFloat()<=prob;
+ }
+
+ @Override
+ public void enchant(EntityLivingBase entity, boolean success) {
+ int d = getDuration(10, 2);
+ int a = getAmplifier(8);
+
+ if(success){
+ if(this.isSpelled) d+=5*20;
+ entity.addPotionEffect(new PotionEffect(Potion.regeneration.getId(), d, a));
+ }
+ else entity.addPotionEffect(new PotionEffect(Potion.wither.getId(), d, a));
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/magic/enchant/MagicSpeed.class b/src/main/java/jp/plusplus/fbs/magic/enchant/MagicSpeed.class Binary files differnew file mode 100644 index 0000000..71a7997 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/enchant/MagicSpeed.class diff --git a/src/main/java/jp/plusplus/fbs/magic/enchant/MagicSpeed.java b/src/main/java/jp/plusplus/fbs/magic/enchant/MagicSpeed.java new file mode 100644 index 0000000..36cc369 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/enchant/MagicSpeed.java @@ -0,0 +1,47 @@ +package jp.plusplus.fbs.magic.enchant;
+
+import jp.plusplus.fbs.api.MagicEnchantBase;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.potion.Potion;
+import net.minecraft.potion.PotionEffect;
+
+/**
+ * Createdby pluslus_Fon 2015/06/08.
+ */
+public class MagicSpeed extends MagicEnchantBase {
+ public MagicSpeed() {
+ super(4, 6);
+ }
+
+ @Override
+ public boolean checkSuccess() {
+ if(!isSpelled) return false;
+
+ float prob=0.4f+0.02f*property.getMagicLevel();
+ return rand.nextFloat()<=prob;
+ }
+
+ @Override
+ public void enchant(EntityLivingBase entity, boolean success) {
+ int d = getDuration(30, 1);
+ int a = getAmplifier(8);
+
+ if(success){
+ if(isSpelled) d+=120*20;
+ entity.addPotionEffect(new PotionEffect(Potion.moveSpeed.getId(), d, a));
+ entity.addPotionEffect(new PotionEffect(Potion.jump.getId(), d, a));
+ }
+ else{
+ entity.addPotionEffect(new PotionEffect(Potion.moveSlowdown.getId(), d, a));
+ }
+ }
+
+ @Override
+ public ParticleColor setParticleColor(){
+ ParticleColor col=new ParticleColor();
+ float v=0.1f+0.5f*rand.nextFloat();
+ col.blue-=v;
+ col.red-=v;
+ return col;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/magic/enchant/MagicWedge.class b/src/main/java/jp/plusplus/fbs/magic/enchant/MagicWedge.class Binary files differnew file mode 100644 index 0000000..f560bb9 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/enchant/MagicWedge.class diff --git a/src/main/java/jp/plusplus/fbs/magic/enchant/MagicWedge.java b/src/main/java/jp/plusplus/fbs/magic/enchant/MagicWedge.java new file mode 100644 index 0000000..eefe3bd --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/enchant/MagicWedge.java @@ -0,0 +1,71 @@ +package jp.plusplus.fbs.magic.enchant;
+
+import jp.plusplus.fbs.api.IMagicEnchant;
+import jp.plusplus.fbs.api.MagicBase;
+import jp.plusplus.fbs.entity.EntityMagicWedge;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.potion.Potion;
+import net.minecraft.potion.PotionEffect;
+
+/**
+ * Createdby pluslus_Fon 2015/06/14.
+ */
+public class MagicWedge extends MagicBase implements IMagicEnchant {
+ @Override
+ public boolean checkSuccess() {
+ if(isSpelled) return true;
+
+ float prob=0.4f+0.03f*property.getMagicLevel();
+ return rand.nextFloat()<=prob;
+ }
+
+ @Override
+ public void success() {
+ int l=getLvDiff();
+ int eLv=1;
+ int eDu=20*(isSpelled?20:10);
+ float dm=isSpelled?1.0f:0.5f;
+ if(l>0){
+ eLv+=l/5;
+ eDu+=20*(l/2);
+ dm+=0.5f*(l/8);
+ }
+
+ Entity e=new EntityMagicWedge(world, player, 1.0F, 1.0F, dm, eLv, eDu);
+ world.spawnEntityInWorld(e);
+ }
+
+ @Override
+ public void failure() {
+ sanity(1,6);
+ }
+
+ @Override
+ public void enchant(EntityLivingBase entity, boolean success) {
+ int l=getLvDiff();
+ int eLv=1;
+ int eDu=20*(isSpelled?20:10);
+ if(l>0){
+ eLv+=l/5;
+ eDu+=20*(l/2);
+ }
+
+ entity.addPotionEffect(new PotionEffect(Potion.weakness.getId(), eDu, eLv));
+ }
+
+ @Override
+ public float damageScale(EntityLivingBase entity) {
+ return 0.75f;
+ }
+
+ @Override
+ public float damageValue(EntityLivingBase entity) {
+ return 0.f;
+ }
+
+ @Override
+ public ParticleColor setParticleColor() {
+ return new ParticleColor();
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/magic/resonance/FlexibleResonance.class b/src/main/java/jp/plusplus/fbs/magic/resonance/FlexibleResonance.class Binary files differnew file mode 100644 index 0000000..f7045b1 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/resonance/FlexibleResonance.class diff --git a/src/main/java/jp/plusplus/fbs/magic/resonance/FlexibleResonance.java b/src/main/java/jp/plusplus/fbs/magic/resonance/FlexibleResonance.java new file mode 100644 index 0000000..65b89b1 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/resonance/FlexibleResonance.java @@ -0,0 +1,83 @@ +package jp.plusplus.fbs.magic.resonance;
+
+import jp.plusplus.fbs.Registry;
+import jp.plusplus.fbs.api.IMagicEnchant;
+import jp.plusplus.fbs.api.IResonance;
+import net.minecraft.util.StatCollector;
+
+import java.util.LinkedList;
+
+/**
+ * Created by pluslus_F on 2015/06/23.
+ * 特定の魔導書+付与魔法1個以上による共鳴
+ * 付与魔法が複数ある場合は全てに対して動作するように魔法は実装してね
+ */
+public class FlexibleResonance implements IResonance {
+ public String type; //ベースとなる魔法のタイプ
+
+ public LinkedList<Registry.MagicData> enchants=new LinkedList<Registry.MagicData>();
+ public Registry.MagicData base;
+
+ public FlexibleResonance(String type){
+ this.type=type;
+ }
+
+
+ @Override
+ public IResonance copy() {
+ return new FlexibleResonance(type);
+ }
+
+ @Override
+ public boolean isMatch(Registry.MagicData[] magics) {
+ boolean foundBase=false;
+ boolean foundEnchant=false;
+ for(Registry.MagicData md : magics){
+
+ //ベースとなる魔法の判定。ベースが2つ以上あればfalse
+ if(md.title.equals(type)){
+ if(foundBase) return false;
+ foundBase=true;
+ }
+
+ //付与魔法ならフラグを立てる
+ if(IMagicEnchant.class.isAssignableFrom(md.magic)){
+ foundEnchant=true;
+ }
+ }
+
+ return foundBase && foundEnchant;
+ }
+
+ @Override
+ public String getResonanceMagicName() {
+ return "resonance."+type;
+ }
+
+ @Override
+ public String getDisplayMagicName(String[] titles){
+ String sss=StatCollector.translateToLocal("magic.suffix."+type);
+ String ppp=null;
+
+ for(int i=0;i<titles.length;i++){
+ if(titles==null) continue;
+ Registry.MagicData md=Registry.GetMagic(titles[i]);
+ if(IMagicEnchant.class.isAssignableFrom(md.magic)){
+ ppp=StatCollector.translateToLocal("magic.prefix."+md.title);
+ break;
+ }
+ }
+
+ if(StatCollector.canTranslate("locale.fbs.jp")){
+ return ppp+sss;
+ }
+ else{
+ return ppp+" "+sss;
+ }
+ }
+
+ @Override
+ public int priority() {
+ return 0;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/magic/resonance/ShapedResonance.class b/src/main/java/jp/plusplus/fbs/magic/resonance/ShapedResonance.class Binary files differnew file mode 100644 index 0000000..f6bcb08 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/resonance/ShapedResonance.class diff --git a/src/main/java/jp/plusplus/fbs/magic/resonance/ShapedResonance.java b/src/main/java/jp/plusplus/fbs/magic/resonance/ShapedResonance.java new file mode 100644 index 0000000..0a44354 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/magic/resonance/ShapedResonance.java @@ -0,0 +1,68 @@ +package jp.plusplus.fbs.magic.resonance;
+
+import jp.plusplus.fbs.Registry;
+import jp.plusplus.fbs.api.IResonance;
+
+import java.util.Iterator;
+import java.util.LinkedList;
+
+/**
+ * Created by pluslus_F on 2015/06/23.
+ * 固定された魔導書同士での共鳴
+ */
+public class ShapedResonance implements IResonance {
+ public String[] books;
+ public String title;
+
+ public ShapedResonance(String title, String ... books){
+ this.title=title;
+ this.books=new String[books.length];
+ for(int i=0;i<books.length;i++){
+ this.books[i]=books[i];
+ }
+ }
+
+ @Override
+ public IResonance copy() {
+ return new ShapedResonance(title, books);
+ }
+
+ @Override
+ public boolean isMatch(Registry.MagicData[] magics) {
+ LinkedList<String> list=new LinkedList<String>();
+ for(int i=0;i<this.books.length;i++){
+ list.add(this.books[i]);
+ }
+
+ for(Registry.MagicData bd : magics){
+ boolean find=false;
+ Iterator<String> it=list.iterator();
+ while(it.hasNext()){
+ String t=it.next();
+ if(t.equals(bd.title)){
+ find=true;
+ it.remove();
+ break;
+ }
+ }
+
+ if(!find) return false;
+ }
+
+ return list.isEmpty();
+ }
+
+ @Override
+ public String getResonanceMagicName() {
+ return title;
+ }
+ @Override
+ public String getDisplayMagicName(String[] titles){
+ return Registry.GetLocalizedBookTitle(title);
+ }
+
+ @Override
+ public int priority() {
+ return 100;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/mod/ForIR3.class b/src/main/java/jp/plusplus/fbs/mod/ForIR3.class Binary files differnew file mode 100644 index 0000000..2699651 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/mod/ForIR3.class diff --git a/src/main/java/jp/plusplus/fbs/mod/ForIR3.java b/src/main/java/jp/plusplus/fbs/mod/ForIR3.java new file mode 100644 index 0000000..f3fa647 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/mod/ForIR3.java @@ -0,0 +1,78 @@ +package jp.plusplus.fbs.mod;
+
+import jp.plusplus.fbs.block.BlockCore;
+import jp.plusplus.fbs.block.BlockHerb;
+import jp.plusplus.fbs.item.ItemCore;
+import jp.plusplus.ir2.Recipes;
+import jp.plusplus.ir2.api.IR3RecipeAPI;
+import jp.plusplus.ir2.api.ItemCrystalUnit;
+import net.minecraft.item.ItemStack;
+
+/**
+ * Created by plusplus_F on 2016/02/24.
+ */
+public class ForIR3 {
+ public static void setup(){
+ for(int i=0;i<16;i++) IR3RecipeAPI.AddComposition(IR3RecipeAPI.COMPOSITION_MAGIC, new ItemStack(ItemCore.charm, 1, i), 1, 30);
+ IR3RecipeAPI.AddComposition(IR3RecipeAPI.COMPOSITION_MAGIC, new ItemStack(ItemCore.stoneInactive), 20, 20);
+ IR3RecipeAPI.AddComposition(IR3RecipeAPI.COMPOSITION_MAGIC, new ItemStack(ItemCore.stoneActive), 20, 1);
+ IR3RecipeAPI.AddComposition(IR3RecipeAPI.COMPOSITION_MAGIC, new ItemStack(ItemCore.stoneActiveMale), 20, 1);
+ IR3RecipeAPI.AddComposition(IR3RecipeAPI.COMPOSITION_MAGIC, new ItemStack(ItemCore.stoneActiveFemale), 20, 1);
+ IR3RecipeAPI.AddComposition(IR3RecipeAPI.COMPOSITION_MAGIC, new ItemStack(ItemCore.membership), 5, 30);
+ IR3RecipeAPI.AddComposition(IR3RecipeAPI.COMPOSITION_MAGIC, new ItemStack(ItemCore.monocle), 15, 20);
+ IR3RecipeAPI.AddComposition(IR3RecipeAPI.COMPOSITION_MAGIC, new ItemStack(ItemCore.cloak), 80, 8);
+ IR3RecipeAPI.AddComposition(IR3RecipeAPI.COMPOSITION_MAGIC, new ItemStack(ItemCore.bookBroken), 1, 30);
+ IR3RecipeAPI.AddComposition(IR3RecipeAPI.COMPOSITION_MAGIC, new ItemStack(ItemCore.bookWhite), 10, 20);
+ IR3RecipeAPI.AddComposition(IR3RecipeAPI.COMPOSITION_MAGIC, new ItemStack(ItemCore.bookmark), 3, 30);
+ IR3RecipeAPI.AddComposition(IR3RecipeAPI.COMPOSITION_MAGIC, new ItemStack(BlockCore.magicCore), 5, 30);
+ IR3RecipeAPI.AddComposition(IR3RecipeAPI.COMPOSITION_MAGIC, new ItemStack(BlockCore.mirror), 20, 5);
+ IR3RecipeAPI.AddComposition(IR3RecipeAPI.COMPOSITION_MAGIC, new ItemStack(BlockCore.plank), 1, 30);
+ IR3RecipeAPI.AddComposition(IR3RecipeAPI.COMPOSITION_MAGIC, new ItemStack(BlockCore.workbench), 3, 1);
+ IR3RecipeAPI.AddComposition(IR3RecipeAPI.COMPOSITION_MAGIC, new ItemStack(BlockCore.extractingFurnace), 3, 1);
+ IR3RecipeAPI.AddComposition(IR3RecipeAPI.COMPOSITION_MAGIC, new ItemStack(BlockCore.fillingTable), 3, 1);
+ IR3RecipeAPI.AddComposition(IR3RecipeAPI.COMPOSITION_MAGIC, new ItemStack(ItemCore.enchantScroll), 3, 1);
+ IR3RecipeAPI.AddComposition(IR3RecipeAPI.COMPOSITION_MAGIC, new ItemStack(ItemCore.staff1_1), 10, 1);
+ IR3RecipeAPI.AddComposition(IR3RecipeAPI.COMPOSITION_MAGIC, new ItemStack(ItemCore.staff1_2), 12, 1);
+ IR3RecipeAPI.AddComposition(IR3RecipeAPI.COMPOSITION_MAGIC, new ItemStack(ItemCore.staff1_3), 14, 1);
+ IR3RecipeAPI.AddComposition(IR3RecipeAPI.COMPOSITION_MAGIC, new ItemStack(ItemCore.staff1_4), 16, 1);
+ IR3RecipeAPI.AddComposition(IR3RecipeAPI.COMPOSITION_MAGIC, new ItemStack(ItemCore.staff1_5), 18, 1);
+ IR3RecipeAPI.AddComposition(IR3RecipeAPI.COMPOSITION_MAGIC, new ItemStack(ItemCore.staff2_1), 14, 1);
+ IR3RecipeAPI.AddComposition(IR3RecipeAPI.COMPOSITION_MAGIC, new ItemStack(ItemCore.staff2_2), 18, 1);
+ IR3RecipeAPI.AddComposition(IR3RecipeAPI.COMPOSITION_MAGIC, new ItemStack(ItemCore.staff2_3), 22, 1);
+ IR3RecipeAPI.AddComposition(IR3RecipeAPI.COMPOSITION_MAGIC, new ItemStack(ItemCore.staff2_4), 26, 1);
+ IR3RecipeAPI.AddComposition(IR3RecipeAPI.COMPOSITION_MAGIC, new ItemStack(ItemCore.staffHead1), 6, 25);
+ IR3RecipeAPI.AddComposition(IR3RecipeAPI.COMPOSITION_MAGIC, new ItemStack(ItemCore.staffHead2), 8, 25);
+ IR3RecipeAPI.AddComposition(IR3RecipeAPI.COMPOSITION_MAGIC, new ItemStack(ItemCore.staffHead3), 10, 25);
+ IR3RecipeAPI.AddComposition(IR3RecipeAPI.COMPOSITION_MAGIC, new ItemStack(ItemCore.staffHead4), 12, 25);
+ IR3RecipeAPI.AddComposition(IR3RecipeAPI.COMPOSITION_MAGIC, new ItemStack(ItemCore.staffHead5), 14, 25);
+ IR3RecipeAPI.AddComposition(IR3RecipeAPI.COMPOSITION_MAGIC, new ItemStack(BlockCore.portal2), 5, 1);
+ IR3RecipeAPI.AddComposition(IR3RecipeAPI.COMPOSITION_MAGIC, new ItemStack(BlockCore.alchemyCauldron), 20, 1);
+ IR3RecipeAPI.AddComposition(IR3RecipeAPI.COMPOSITION_MAGIC, new ItemStack(BlockCore.tableAlchemist), 12, 1);
+
+ IR3RecipeAPI.AddComposition(IR3RecipeAPI.COMPOSITION_PLANT, new ItemStack(ItemCore.lavender), 3, 20);
+ IR3RecipeAPI.AddComposition(IR3RecipeAPI.COMPOSITION_PLANT, new ItemStack(ItemCore.seedLavender), 3, 20);
+ IR3RecipeAPI.AddComposition(IR3RecipeAPI.COMPOSITION_PLANT, new ItemStack(ItemCore.redLily), 3, 20);
+ IR3RecipeAPI.AddComposition(IR3RecipeAPI.COMPOSITION_PLANT, new ItemStack(ItemCore.seedRedLily), 3, 20);
+ for(int i=0;i<9;i++) IR3RecipeAPI.AddComposition(IR3RecipeAPI.COMPOSITION_PLANT, new ItemStack(BlockCore.harvestableHerb, 1, i), 20, 20);
+ for(int i=0;i<3;i++) IR3RecipeAPI.AddComposition(IR3RecipeAPI.COMPOSITION_PLANT, new ItemStack(BlockCore.harvestableMushroom, 1, i), 20, 20);
+ IR3RecipeAPI.AddComposition(IR3RecipeAPI.COMPOSITION_PLANT, new ItemStack(BlockCore.harvestableGrass), 20, 20);
+
+ IR3RecipeAPI.AddComposition(IR3RecipeAPI.COMPOSITION_TOOL, new ItemStack(ItemCore.shovel), 18, 50);
+ IR3RecipeAPI.AddComposition(IR3RecipeAPI.COMPOSITION_TOOL, new ItemStack(ItemCore.foldingFan), 22, 50);
+ IR3RecipeAPI.AddComposition(IR3RecipeAPI.COMPOSITION_TOOL, new ItemStack(ItemCore.luckyDagger), 64, 30);
+ }
+
+ public static boolean isCrystalUnit(ItemStack itemStack){
+ return itemStack.getItem() instanceof ItemCrystalUnit;
+ }
+ public static void repairCrystalUnit(ItemStack itemStack, float percent){
+ ItemCrystalUnit icu=(ItemCrystalUnit)itemStack.getItem();
+ double d=icu.getDamageNBT(itemStack);
+ if(d==0) return;
+ if(percent>1) percent=1;
+ if(percent<0) percent=0;
+
+ d=Math.max(0, d-icu.maxDamageNBT*percent);
+ icu.setDamageNBT(itemStack, d);
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/mod/ForSS2.class b/src/main/java/jp/plusplus/fbs/mod/ForSS2.class Binary files differnew file mode 100644 index 0000000..d282b72 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/mod/ForSS2.class diff --git a/src/main/java/jp/plusplus/fbs/mod/ForSS2.java b/src/main/java/jp/plusplus/fbs/mod/ForSS2.java new file mode 100644 index 0000000..00fd076 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/mod/ForSS2.java @@ -0,0 +1,21 @@ +package jp.plusplus.fbs.mod;
+
+import net.minecraft.item.ItemStack;
+import shift.sextiarysector.api.recipe.RecipeAPI;
+
+/**
+ * Created by plusplus_F on 2016/02/28.
+ */
+public class ForSS2 {
+ public static void setup(){
+
+ }
+
+ public static boolean canTimeTrace(ItemStack itemStack){
+ return RecipeAPI.timeMachine.getResult(itemStack)!=null;
+ }
+
+ public static ItemStack getTimeTraced(ItemStack itemStack){
+ return RecipeAPI.timeMachine.getResult(itemStack);
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/mod/ShopAuthor$1.class b/src/main/java/jp/plusplus/fbs/mod/ShopAuthor$1.class Binary files differnew file mode 100644 index 0000000..b7e6a57 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/mod/ShopAuthor$1.class diff --git a/src/main/java/jp/plusplus/fbs/mod/ShopAuthor.class b/src/main/java/jp/plusplus/fbs/mod/ShopAuthor.class Binary files differnew file mode 100644 index 0000000..ff1c695 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/mod/ShopAuthor.class diff --git a/src/main/java/jp/plusplus/fbs/mod/ShopAuthor.java b/src/main/java/jp/plusplus/fbs/mod/ShopAuthor.java new file mode 100644 index 0000000..e437d60 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/mod/ShopAuthor.java @@ -0,0 +1,86 @@ +package jp.plusplus.fbs.mod;
+
+import com.ibm.icu.util.Calendar;
+import jp.plusplus.fbs.Registry;
+import jp.plusplus.fbs.exprop.FBSEntityProperties;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.world.World;
+import shift.mceconomy2.api.shop.IProduct;
+import shift.mceconomy2.api.shop.IShop;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.Random;
+
+/**
+ * Created by plusplus_F on 2016/02/24.
+ */
+public class ShopAuthor implements IShop {
+ int lastDate=-1;
+ ArrayList<IProduct> cachedProductList=null;
+ ArrayList<String> cachedBooks=null;
+
+ @Override
+ public String getShopName(World world, EntityPlayer player) {
+ return "Spell Book Author";
+ }
+
+ @Override
+ public void addProduct(IProduct product) {
+ }
+
+ @Override
+ public ArrayList<IProduct> getProductList(World world, EntityPlayer player) {
+ ArrayList<IProduct> list=new ArrayList<IProduct>();
+ ArrayList<String> books= FBSEntityProperties.get(player).getDecodedBooks();
+ int date=world.getCurrentDate().get(Calendar.DATE);
+ Random rand=new Random(date);
+
+ //日付と解読済み書物が一致する場合、商品のキャッシュを返す
+ if(lastDate==date && cachedBooks!=null && cachedBooks.equals(books) && cachedProductList!=null){
+ return cachedProductList;
+ }
+
+ //ソート用BookDataリスト生成
+ Registry.BookData[] bds=new Registry.BookData[books.size()];
+ for(int i=0;i<bds.length;i++){
+ bds[i]=Registry.GetBook(books.get(i));
+ }
+ Arrays.sort(bds, new Comparator<Registry.BookData>() {
+ @Override
+ public int compare(Registry.BookData o1, Registry.BookData o2) {
+ return o1.lv-o2.lv;
+ }
+ });
+
+ //魔法の矢は必ずリストに入る
+ list.add(new TFKProductItem(Registry.GetBookItemStack("fbs.arrow"), (int)((1800+150*3)*(0.75f+0.5f*rand.nextFloat()))));
+ //解読したこのある書物を全てリストに入れる(値段は日替わり)
+ for(Registry.BookData bd : bds){
+ if(bd.isMagic && !bd.title.equals("fbs.arrow")){
+ list.add(new TFKProductItem(Registry.GetBookItemStack(bd.title), (int)((1800+150*bd.lv)*(0.75f+0.5f*rand.nextFloat()))));
+ }
+ }
+
+ //Lvが10より高い場合、1/4でリストから除外される(日替わり)
+ for(int i=0;i<list.size();){
+ IProduct p=list.get(i);
+ ItemStack itemStack=p.getItem(null, null, null);
+
+ if(Registry.GetBookDataFromItemStack(itemStack).lv>10 && rand.nextInt(4)==0){
+ list.remove(i);
+ continue;
+ }
+ i++;
+ }
+
+ //キャッシュを取っておく
+ lastDate=date;
+ cachedBooks=new ArrayList<String>(books);
+ cachedProductList=list;
+
+ return list;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/mod/ShopWitch.class b/src/main/java/jp/plusplus/fbs/mod/ShopWitch.class Binary files differnew file mode 100644 index 0000000..2cfa22f --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/mod/ShopWitch.class diff --git a/src/main/java/jp/plusplus/fbs/mod/ShopWitch.java b/src/main/java/jp/plusplus/fbs/mod/ShopWitch.java new file mode 100644 index 0000000..c565985 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/mod/ShopWitch.java @@ -0,0 +1,62 @@ +package jp.plusplus.fbs.mod;
+
+import jp.plusplus.fbs.api.FBSEntityPropertiesAPI;
+import jp.plusplus.fbs.block.BlockCore;
+import jp.plusplus.fbs.item.ItemCore;
+import jp.plusplus.fbs.item.ItemFoldingFan;
+import jp.plusplus.fbs.item.ItemShovel;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.world.World;
+import shift.mceconomy2.api.shop.IProduct;
+import shift.mceconomy2.api.shop.IShop;
+
+import java.util.ArrayList;
+
+/**
+ * Created by plusplus_F on 2015/11/02.
+ */
+public class ShopWitch implements IShop {
+ @Override
+ public String getShopName(World world, EntityPlayer player) {
+ return "Witch's Shop";
+ }
+
+ @Override
+ public void addProduct(IProduct product) {
+
+ }
+
+ @Override
+ public ArrayList<IProduct> getProductList(World world, EntityPlayer player) {
+ ArrayList<IProduct> list=new ArrayList<IProduct>();
+
+ int mLv= FBSEntityPropertiesAPI.GetMagicLevelRaw(player);
+
+ //レベルに合わせて商品を変える
+ list.add(new TFKProductItem(new ItemStack(ItemCore.alchemyRecipe, 1, 2), 1500));
+ list.add(new TFKProductItem(new ItemStack(ItemCore.alchemyRecipe, 1, 9), 1500));
+ list.add(new TFKProductItem(new ItemStack(ItemCore.alchemyRecipe, 1, 10), 1500));
+ list.add(new TFKProductItem(new ItemStack(ItemCore.alchemyRecipe, 1, 3), 3000));
+ list.add(new TFKProductItem(new ItemStack(ItemCore.alchemyRecipe, 1, 0), 5000));
+ if(mLv>=2) list.add(new TFKProductItem(new ItemStack(ItemCore.alchemyRecipe, 1, 4), 4000));
+ if(mLv>=2) list.add(new TFKProductItem(new ItemStack(ItemCore.alchemyRecipe, 1, 5), 5000));
+ if(mLv>=5) list.add(new TFKProductItem(new ItemStack(ItemCore.alchemyRecipe, 1, 1), 8000));
+ if(mLv>=5) list.add(new TFKProductItem(new ItemStack(ItemCore.alchemyRecipe, 1, 8), 6000));
+ if(mLv>=8) list.add(new TFKProductItem(new ItemStack(ItemCore.alchemyRecipe, 1, 6), 12000));
+ if(mLv>=12) list.add(new TFKProductItem(new ItemStack(ItemCore.alchemyRecipe, 1, 7), 20000));
+
+ //このへんは固定
+ list.add(new TFKProductItem(new ItemStack(ItemCore.stick), 250));
+ list.add(new TFKProductItem(new ItemStack(BlockCore.magicCore), 1000));
+ list.add(new TFKProductItem(new ItemStack(ItemCore.instantMana), 3000));
+ list.add(new TFKProductItem(ItemShovel.GetItemStack(), 3000));
+ list.add(new TFKProductItem(ItemFoldingFan.GetItemStack(), 3000));
+ list.add(new TFKProductItem(new ItemStack(ItemCore.potionSan), 6000));
+ list.add(new TFKProductItem(new ItemStack(ItemCore.potionOblivion), 12000));
+ list.add(new TFKProductItem(new ItemStack(ItemCore.stoneInactive), 50000));
+ for(int i=0;i<16;i++) list.add(new TFKProductItem(new ItemStack(ItemCore.charm, 1, i), 200));
+
+ return list;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/mod/TFKProductItem.class b/src/main/java/jp/plusplus/fbs/mod/TFKProductItem.class Binary files differnew file mode 100644 index 0000000..6da576b --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/mod/TFKProductItem.class diff --git a/src/main/java/jp/plusplus/fbs/mod/TFKProductItem.java b/src/main/java/jp/plusplus/fbs/mod/TFKProductItem.java new file mode 100644 index 0000000..41cd8dd --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/mod/TFKProductItem.java @@ -0,0 +1,35 @@ +package jp.plusplus.fbs.mod;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.world.World;
+import shift.mceconomy2.api.shop.IProduct;
+import shift.mceconomy2.api.shop.IShop;
+
+/**
+ * Created by plusplus_F on 2015/11/02.
+ */
+public class TFKProductItem implements IProduct {
+ protected ItemStack product;
+ protected int cost;
+
+ public TFKProductItem(ItemStack p, int c){
+ product=p;
+ cost=c;
+ }
+
+ @Override
+ public ItemStack getItem(IShop shop, World world, EntityPlayer player) {
+ return product;
+ }
+
+ @Override
+ public int getCost(IShop shop, World world, EntityPlayer player) {
+ return cost;
+ }
+
+ @Override
+ public boolean canBuy(IShop shop, World world, EntityPlayer player) {
+ return true;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/model/ModelButterfly.class b/src/main/java/jp/plusplus/fbs/model/ModelButterfly.class Binary files differnew file mode 100644 index 0000000..bb596a3 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/model/ModelButterfly.class diff --git a/src/main/java/jp/plusplus/fbs/model/ModelButterfly.java b/src/main/java/jp/plusplus/fbs/model/ModelButterfly.java new file mode 100644 index 0000000..a65a9de --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/model/ModelButterfly.java @@ -0,0 +1,246 @@ +package jp.plusplus.fbs.model;
+
+import net.minecraft.client.model.ModelBase;
+import net.minecraft.client.model.ModelRenderer;
+import net.minecraft.entity.Entity;
+
+/**
+ * Created by pluslus_F on 2015/06/25.
+ */
+public class ModelButterfly extends ModelBase {
+ //fields
+ ModelRenderer head;
+ ModelRenderer belly;
+ ModelRenderer wingL0;
+ ModelRenderer wingL1;
+ ModelRenderer wingL2;
+ ModelRenderer wingL3;
+ ModelRenderer wingL4;
+ ModelRenderer wingL11;
+ ModelRenderer wingL12;
+ ModelRenderer wingL13;
+ ModelRenderer wingL14;
+ ModelRenderer wingR3;
+ ModelRenderer wingR0;
+ ModelRenderer wingR1;
+ ModelRenderer wingR2;
+ ModelRenderer wingR11;
+ ModelRenderer wingR12;
+ ModelRenderer wingR13;
+ ModelRenderer wingR14;
+ ModelRenderer wingL15;
+ ModelRenderer wingR15;
+ ModelRenderer wingR4;
+
+ public ModelButterfly() {
+ textureWidth = 64;
+ textureHeight = 32;
+
+ head = new ModelRenderer(this, 0, 0);
+ head.addBox(0F, 0F, -1F, 1, 1, 3);
+ head.setRotationPoint(0F, 0F, 0F);
+ head.setTextureSize(64, 32);
+ head.mirror = true;
+ setRotation(head, 0F, 0F, 0F);
+
+ belly = new ModelRenderer(this, 0, 4);
+ belly.addBox(0F, 0F, 2F, 1, 1, 5);
+ belly.setRotationPoint(0F, 0F, 0F);
+ belly.setTextureSize(64, 32);
+ belly.mirror = true;
+ setRotation(belly, 0F, 0F, 0F);
+
+ wingL0 = new ModelRenderer(this, 27, 2);
+ wingL0.addBox(3F, 0F, -2F, 6, 0, 1);
+ wingL0.setRotationPoint(0F, 0F, 0F);
+ wingL0.setTextureSize(64, 32);
+ wingL0.mirror = true;
+ setRotation(wingL0, 0F, 0F, 0F);
+
+ wingL1 = new ModelRenderer(this, 28, 3);
+ wingL1.addBox(2F, 0F, -1F, 6, 0, 1);
+ wingL1.setRotationPoint(0F, 0F, 0F);
+ wingL1.setTextureSize(64, 32);
+ wingL1.mirror = true;
+ setRotation(wingL1, 0F, 0F, 0F);
+
+ wingL2 = new ModelRenderer(this, 26, 4);
+ wingL2.addBox(1F, 0F, 0F, 7, 0, 2);
+ wingL2.setRotationPoint(0F, 0F, 0F);
+ wingL2.setTextureSize(64, 32);
+ wingL2.mirror = true;
+ setRotation(wingL2, 0F, 0F, 0F);
+
+ wingL3 = new ModelRenderer(this, 29, 1);
+ wingL3.addBox(4F, 0F, -3F, 4, 0, 1);
+ wingL3.setRotationPoint(0F, 0F, 0F);
+ wingL3.setTextureSize(64, 32);
+ wingL3.mirror = true;
+ setRotation(wingL3, 0F, 0F, 0F);
+
+ wingL4 = new ModelRenderer(this, 31, 0);
+ wingL4.addBox(5F, 0F, -4F, 2, 0, 1);
+ wingL4.setRotationPoint(0F, 0F, 0F);
+ wingL4.setTextureSize(64, 32);
+ wingL4.mirror = true;
+ setRotation(wingL4, 0F, 0F, 0F);
+
+ wingL11 = new ModelRenderer(this, 31, 6);
+ wingL11.addBox(1F, 0F, 2F, 5, 0, 1);
+ wingL11.setRotationPoint(0F, 0F, 0F);
+ wingL11.setTextureSize(64, 32);
+ wingL11.mirror = true;
+ setRotation(wingL11, 0F, 0F, 0F);
+
+ wingL12 = new ModelRenderer(this, 30, 7);
+ wingL12.addBox(2F, 0F, 3F, 5, 0, 1);
+ wingL12.setRotationPoint(0F, 0F, 0F);
+ wingL12.setTextureSize(64, 32);
+ wingL12.mirror = true;
+ setRotation(wingL12, 0F, 0F, 0F);
+
+ wingL13 = new ModelRenderer(this, 29, 8);
+ wingL13.addBox(3F, 0F, 4F, 5, 0, 2);
+ wingL13.setRotationPoint(0F, 0F, 0F);
+ wingL13.setTextureSize(64, 32);
+ wingL13.mirror = true;
+ setRotation(wingL13, 0F, 0F, 0F);
+
+ wingL14 = new ModelRenderer(this, 30, 10);
+ wingL14.addBox(3F, 0F, 6F, 4, 0, 2);
+ wingL14.setRotationPoint(0F, 0F, 0F);
+ wingL14.setTextureSize(64, 32);
+ wingL14.mirror = true;
+ setRotation(wingL14, 0F, 0F, 0F);
+
+ wingR3 = new ModelRenderer(this, 29, 1);
+ wingR3.addBox(-7F, 0F, -3F, 4, 0, 1);
+ wingR3.setRotationPoint(0F, 0F, 0F);
+ wingR3.setTextureSize(64, 32);
+ wingR3.mirror = true;
+ setRotation(wingR3, 0F, 0F, 0F);
+
+ wingR0 = new ModelRenderer(this, 27, 2);
+ wingR0.addBox(-8F, 0F, -2F, 6, 0, 1);
+ wingR0.setRotationPoint(0F, 0F, 0F);
+ wingR0.setTextureSize(64, 32);
+ wingR0.mirror = true;
+ setRotation(wingR0, 0F, 0F, 0F);
+ wingR0.mirror = false;
+
+ wingR1 = new ModelRenderer(this, 28, 3);
+ wingR1.addBox(-7F, 0F, -1F, 6, 0, 1);
+ wingR1.setRotationPoint(0F, 0F, 0F);
+ wingR1.setTextureSize(64, 32);
+ wingR1.mirror = true;
+ setRotation(wingR1, 0F, 0F, 0F);
+ wingR1.mirror = false;
+
+ wingR2 = new ModelRenderer(this, 26, 4);
+ wingR2.addBox(-7F, 0F, 0F, 7, 0, 2);
+ wingR2.setRotationPoint(0F, 0F, 0F);
+ wingR2.setTextureSize(64, 32);
+ wingR2.mirror = true;
+ setRotation(wingR2, 0F, 0F, 0F);
+ wingR2.mirror = false;
+
+ wingR11 = new ModelRenderer(this, 31, 6);
+ wingR11.addBox(-5F, 0F, 2F, 5, 0, 1);
+ wingR11.setRotationPoint(0F, 0F, 0F);
+ wingR11.setTextureSize(64, 32);
+ wingR11.mirror = true;
+ setRotation(wingR11, 0F, 0F, 0F);
+ wingR11.mirror = false;
+
+ wingR12 = new ModelRenderer(this, 30, 7);
+ wingR12.addBox(-6F, 0F, 3F, 5, 0, 1);
+ wingR12.setRotationPoint(0F, 0F, 0F);
+ wingR12.setTextureSize(64, 32);
+ wingR12.mirror = true;
+ setRotation(wingR12, 0F, 0F, 0F);
+ wingR12.mirror = false;
+
+ wingR13 = new ModelRenderer(this, 29, 8);
+ wingR13.addBox(-7F, 0F, 4F, 5, 0, 2);
+ wingR13.setRotationPoint(0F, 0F, 0F);
+ wingR13.setTextureSize(64, 32);
+ wingR13.mirror = true;
+ setRotation(wingR13, 0F, 0F, 0F);
+ wingR13.mirror = false;
+
+ wingR14 = new ModelRenderer(this, 30, 10);
+ wingR14.addBox(-6F, 0F, 6F, 4, 0, 2);
+ wingR14.setRotationPoint(0F, 0F, 0F);
+ wingR14.setTextureSize(64, 32);
+ wingR14.mirror = true;
+ setRotation(wingR14, 0F, 0F, 0F);
+ wingR14.mirror = false;
+
+ wingL15 = new ModelRenderer(this, 31, 12);
+ wingL15.addBox(5F, 0F, 8F, 1, 0, 1);
+ wingL15.setRotationPoint(0F, 0F, 0F);
+ wingL15.setTextureSize(64, 32);
+ wingL15.mirror = true;
+ setRotation(wingL15, 0F, 0F, 0F);
+
+ wingR15 = new ModelRenderer(this, 31, 12);
+ wingR15.addBox(-5F, 0F, 8F, 1, 0, 1);
+ wingR15.setRotationPoint(0F, 0F, 0F);
+ wingR15.setTextureSize(64, 32);
+ wingR15.mirror = true;
+ setRotation(wingR15, 0F, 0F, 0F);
+
+ wingR4 = new ModelRenderer(this, 31, 0);
+ wingR4.addBox(-6F, 0F, -4F, 2, 0, 1);
+ wingR4.setRotationPoint(0F, 0F, 0F);
+ wingR4.setTextureSize(64, 32);
+ wingR4.mirror = true;
+ setRotation(wingR4, 0F, 0F, 0F);
+ wingR4.mirror = false;
+ }
+
+ @Override
+ public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
+ super.render(entity, f, f1, f2, f3, f4, f5);
+ setRotationAngles(f, f1, f2, f3, f4, f5, entity);
+ head.render(f5);
+ belly.render(f5);
+ }
+
+ public void renderWingsR(float f5) {
+ wingR3.render(f5);
+ wingR0.render(f5);
+ wingR1.render(f5);
+ wingR2.render(f5);
+ wingR11.render(f5);
+ wingR12.render(f5);
+ wingR13.render(f5);
+ wingR14.render(f5);
+ wingR15.render(f5);
+ wingR4.render(f5);
+ }
+
+ public void renderWingsL(float f5) {
+ wingL0.render(f5);
+ wingL1.render(f5);
+ wingL2.render(f5);
+ wingL3.render(f5);
+ wingL4.render(f5);
+ wingL11.render(f5);
+ wingL12.render(f5);
+ wingL13.render(f5);
+ wingL14.render(f5);
+ wingL15.render(f5);
+ }
+
+ private void setRotation(ModelRenderer model, float x, float y, float z) {
+ model.rotateAngleX = x;
+ model.rotateAngleY = y;
+ model.rotateAngleZ = z;
+ }
+
+ @Override
+ public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity e) {
+ super.setRotationAngles(f, f1, f2, f3, f4, f5, e);
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/model/ModelMagicBall.class b/src/main/java/jp/plusplus/fbs/model/ModelMagicBall.class Binary files differnew file mode 100644 index 0000000..26e51a0 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/model/ModelMagicBall.class diff --git a/src/main/java/jp/plusplus/fbs/model/ModelMagicBall.java b/src/main/java/jp/plusplus/fbs/model/ModelMagicBall.java new file mode 100644 index 0000000..8edf8d8 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/model/ModelMagicBall.java @@ -0,0 +1,20 @@ +package jp.plusplus.fbs.model;
+
+import net.minecraft.client.model.ModelBase;
+import net.minecraft.client.model.ModelRenderer;
+import net.minecraft.entity.Entity;
+
+/**
+ * Createdby pluslus_Fon 2015/06/14.
+ */
+public class ModelMagicBall extends ModelMagicBase {
+ public ModelMagicBall(int offX, int offY){
+ super(offX, offY);
+ model = new ModelRenderer(this, offX, offY);
+ model.addBox(-2F, -2F, -2F, 4, 4, 4);
+ model.setRotationPoint(0F, 0F, 0F);
+ model.setTextureSize(64, 32);
+ //model.mirror = true;
+ setRotation(model, 0F, 0F, 0F);
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/model/ModelMagicBase.class b/src/main/java/jp/plusplus/fbs/model/ModelMagicBase.class Binary files differnew file mode 100644 index 0000000..abc610c --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/model/ModelMagicBase.class diff --git a/src/main/java/jp/plusplus/fbs/model/ModelMagicBase.java b/src/main/java/jp/plusplus/fbs/model/ModelMagicBase.java new file mode 100644 index 0000000..a53d3c4 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/model/ModelMagicBase.java @@ -0,0 +1,40 @@ +package jp.plusplus.fbs.model;
+
+import net.minecraft.client.model.ModelBase;
+import net.minecraft.client.model.ModelRenderer;
+import net.minecraft.client.model.ModelSquid;
+import net.minecraft.entity.Entity;
+
+/**
+ * Createdby pluslus_Fon 2015/06/07.
+ */
+public class ModelMagicBase extends ModelBase {
+ protected ModelRenderer model;
+
+ public ModelMagicBase(int offX, int offY){
+ model = new ModelRenderer(this, offX, offY);
+ model.addBox(-1.5F, -1.5F, -2.5F, 3, 3, 5);
+ model.setRotationPoint(0.0F, 0.0F, 2.5F);
+ //model.setRotationPoint(0F, 0F, 0F);
+ model.setTextureSize(64, 32);
+ //model.mirror = true;
+ setRotation(model, 0F, 0F, 0F);
+ }
+
+ @Override
+ public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
+ super.render(entity, f, f1, f2, f3, f4, f5);
+ setRotationAngles(f, f1, f2, f3, f4, f5, entity);
+ model.render(f5);
+ }
+
+ protected void setRotation(ModelRenderer model, float x, float y, float z) {
+ model.rotateAngleX = x;
+ model.rotateAngleY = y;
+ model.rotateAngleZ = z;
+ }
+
+ public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) {
+ super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/model/ModelMirror.class b/src/main/java/jp/plusplus/fbs/model/ModelMirror.class Binary files differnew file mode 100644 index 0000000..737a485 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/model/ModelMirror.class diff --git a/src/main/java/jp/plusplus/fbs/model/ModelMirror.java b/src/main/java/jp/plusplus/fbs/model/ModelMirror.java new file mode 100644 index 0000000..c4b167c --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/model/ModelMirror.java @@ -0,0 +1,29 @@ +package jp.plusplus.fbs.model;
+
+import net.minecraft.client.model.ModelBase;
+import net.minecraft.client.model.ModelRenderer;
+import net.minecraft.entity.Entity;
+
+/**
+ * Created by pluslus_F on 2015/06/24.
+ */
+public class ModelMirror extends ModelBase {
+ //variables init:
+ public ModelRenderer box;
+
+ //constructor:
+ public ModelMirror(){
+ box = new ModelRenderer(this, 0, 0);
+ box.addBox(-6F, 0F, -2f, 12, 30, 1);
+ box.rotateAngleX = 6.1086523819801535F;
+ box.setTextureSize(64, 32);
+ }
+
+ public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
+ super.render(entity, f, f1, f2, f3, f4, f5);
+ setRotationAngles(f, f1, f2, f3, f4, f5, entity);
+
+ //render:
+ box.render(f5);
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/nei/AppraisalHandler$CachedAppraisalRecipe.class b/src/main/java/jp/plusplus/fbs/nei/AppraisalHandler$CachedAppraisalRecipe.class Binary files differnew file mode 100644 index 0000000..b2cefcc --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/nei/AppraisalHandler$CachedAppraisalRecipe.class diff --git a/src/main/java/jp/plusplus/fbs/nei/AppraisalHandler.class b/src/main/java/jp/plusplus/fbs/nei/AppraisalHandler.class Binary files differnew file mode 100644 index 0000000..2becbb6 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/nei/AppraisalHandler.class diff --git a/src/main/java/jp/plusplus/fbs/nei/AppraisalHandler.java b/src/main/java/jp/plusplus/fbs/nei/AppraisalHandler.java new file mode 100644 index 0000000..a6130c1 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/nei/AppraisalHandler.java @@ -0,0 +1,105 @@ +package jp.plusplus.fbs.nei;
+
+import codechicken.lib.gui.GuiDraw;
+import codechicken.nei.NEIClientUtils;
+import codechicken.nei.PositionedStack;
+import codechicken.nei.recipe.TemplateRecipeHandler;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.Registry;
+import jp.plusplus.fbs.alchemy.AlchemyRegistry;
+import jp.plusplus.fbs.gui.GuiExtractingFurnace;
+import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.item.ItemStack;
+import org.lwjgl.opengl.GL11;
+
+import java.awt.*;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+/**
+ * Created by pluslus_F on 2015/06/24.
+ */
+public class AppraisalHandler extends TemplateRecipeHandler {
+ @Override
+ public void loadTransferRects() {
+ this.transferRects.add(new RecipeTransferRect(new Rectangle(68, 35, 22, 15), "fbs.appraisal", new Object[0]));
+ }
+
+ @Override
+ public String getOverlayIdentifier() {
+ return "fbs.appraisal";
+ }
+
+ @Override
+ public void drawBackground(int recipe) {
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ GuiDraw.changeTexture(this.getGuiTexture());
+ GuiDraw.drawTexturedModalRect(0, 0, 5, 11, 139-5, 65);
+ }
+ @Override
+ public void drawExtras(int recipe) {
+ }
+
+ @Override
+ public void loadCraftingRecipes(String outputId, Object... results) {
+ if(outputId.equals("fbs.appraisal") && this.getClass() == AppraisalHandler.class) {
+ for(AlchemyRegistry.ItemPair ip : AlchemyRegistry.GetAlllAppraisal()) {
+ arecipes.add(new CachedAppraisalRecipe(ip.getItem1(), ip.getItem2()));
+ }
+ } else {
+ super.loadCraftingRecipes(outputId, results);
+ }
+
+ }
+
+ @Override
+ public void loadCraftingRecipes(ItemStack result) {
+ //登録済みアイテムから探す
+ for(AlchemyRegistry.ItemPair ip : AlchemyRegistry.GetAlllAppraisal()){
+ if(ip.getItem2().isItemEqual(result)){
+ arecipes.add(new CachedAppraisalRecipe(ip.getItem1(), result));
+ }
+ }
+ }
+
+ @Override
+ public void loadUsageRecipes(ItemStack ingredient) {
+ //登録済みアイテムから探す
+ for(AlchemyRegistry.ItemPair ip : AlchemyRegistry.GetAlllAppraisal()){
+ if(ip.getItem1().isItemEqual(ingredient)){
+ arecipes.add(new CachedAppraisalRecipe(ingredient, ip.getItem2()));
+ }
+ }
+ }
+
+ @Override
+ public String getGuiTexture() {
+ return FBS.MODID+":textures/gui/appraisal.png";
+ }
+
+ @Override
+ public String getRecipeName() {
+ return NEIClientUtils.translate("recipe.fbs.appraisal", new Object[0]);
+ }
+
+ public class CachedAppraisalRecipe extends CachedRecipe {
+ public ArrayList<PositionedStack> ingredients=new ArrayList<PositionedStack>();
+ public PositionedStack result;
+
+ public CachedAppraisalRecipe(ItemStack in, ItemStack out){
+ ingredients.add(new PositionedStack(in, 56-5, 35-11));
+ result=new PositionedStack(out, 115-5,35-11);
+ }
+
+ @Override
+ public java.util.List<PositionedStack> getIngredients() {
+ return getCycledIngredients(AppraisalHandler.this.cycleticks / 20, ingredients);
+ }
+
+ @Override
+ public PositionedStack getResult() {
+ return result;
+ }
+
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/nei/FBSExtractingHandler$CachedExtractingRecipe.class b/src/main/java/jp/plusplus/fbs/nei/FBSExtractingHandler$CachedExtractingRecipe.class Binary files differnew file mode 100644 index 0000000..ced8b98 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/nei/FBSExtractingHandler$CachedExtractingRecipe.class diff --git a/src/main/java/jp/plusplus/fbs/nei/FBSExtractingHandler.class b/src/main/java/jp/plusplus/fbs/nei/FBSExtractingHandler.class Binary files differnew file mode 100644 index 0000000..c55b8ae --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/nei/FBSExtractingHandler.class diff --git a/src/main/java/jp/plusplus/fbs/nei/FBSExtractingHandler.java b/src/main/java/jp/plusplus/fbs/nei/FBSExtractingHandler.java new file mode 100644 index 0000000..52ee5d0 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/nei/FBSExtractingHandler.java @@ -0,0 +1,190 @@ +package jp.plusplus.fbs.nei;
+
+import codechicken.core.ReflectionManager;
+import codechicken.lib.gui.GuiDraw;
+import codechicken.nei.NEIClientConfig;
+import codechicken.nei.NEIClientUtils;
+import codechicken.nei.NEIServerUtils;
+import codechicken.nei.PositionedStack;
+import codechicken.nei.api.DefaultOverlayRenderer;
+import codechicken.nei.api.IOverlayHandler;
+import codechicken.nei.api.IRecipeOverlayRenderer;
+import codechicken.nei.api.IStackPositioner;
+import codechicken.nei.recipe.RecipeInfo;
+import codechicken.nei.recipe.TemplateRecipeHandler;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.Registry;
+import jp.plusplus.fbs.block.BlockCore;
+import jp.plusplus.fbs.gui.GuiExtractingFurnace;
+import jp.plusplus.fbs.gui.GuiWorkbench;
+import jp.plusplus.fbs.item.ItemCore;
+import jp.plusplus.fbs.tileentity.TileEntityExtractingFurnace;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.client.renderer.texture.TextureMap;
+import net.minecraft.item.ItemStack;
+import net.minecraft.item.crafting.IRecipe;
+import net.minecraft.item.crafting.ShapedRecipes;
+import net.minecraft.util.IIcon;
+import net.minecraftforge.oredict.ShapedOreRecipe;
+import org.lwjgl.opengl.GL11;
+import org.lwjgl.opengl.GL12;
+
+import java.awt.*;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.LinkedList;
+
+/**
+ * Created by pluslus_F on 2015/06/24.
+ */
+public class FBSExtractingHandler extends TemplateRecipeHandler {
+ protected LinkedList<Registry.ItemManaContainer> items=new LinkedList<Registry.ItemManaContainer>();
+
+ @Override
+ public void loadTransferRects() {
+ this.transferRects.add(new RecipeTransferRect(new Rectangle(68, 35, 22, 15), "fbs.extracting", new Object[0]));
+ }
+
+ @Override
+ public String getOverlayIdentifier() {
+ return "fbs.extracting";
+ }
+
+ @Override
+ public Class<? extends GuiContainer> getGuiClass() {
+ return GuiExtractingFurnace.class;
+ }
+
+ @Override
+ public void drawBackground(int recipe) {
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ GuiDraw.changeTexture(this.getGuiTexture());
+ GuiDraw.drawTexturedModalRect(0, 0, 5, 11, 132-5, 65);
+ }
+ @Override
+ public void drawExtras(int recipe) {
+ int a=items.get(recipe).amount;
+ String str="";
+ if(a!=-1) str=""+a+" mb";
+ else str="??? mb";
+ GuiDraw.fontRenderer.drawString(str, 79 - (GuiDraw.fontRenderer.getStringWidth(str)) / 2 - 5, 51 - 11, 0x404040);
+
+ //流体の描画
+ int scale = 52 * a / TileEntityExtractingFurnace.TANK_CAPACITY;
+ if(scale<=0) scale=1;
+
+ int x=98-5, y=69-11-scale, w=34, h=scale;
+ IIcon icon=BlockCore.mana.getIcon();
+
+ GL11.glPushMatrix();
+ GL11.glEnable(GL12.GL_RESCALE_NORMAL);
+ GL11.glEnable(GL11.GL_BLEND);
+ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
+ GL11.glColor4f(2.0F, 2.0F, 2.0F, 0.75F);
+
+ GuiDraw.changeTexture(TextureMap.locationBlocksTexture);
+
+ int sx, sy;
+ for (sy = 0; h - sy * 16 > 16; sy++) {
+ for (sx = 0; w - sx * 16 > 16; sx++) {
+ GuiDraw.gui.drawTexturedModelRectFromIcon(x + sx * 16, y + sy * 16, icon, 16, 16);
+ }
+ GuiDraw.gui.drawTexturedModelRectFromIcon(x + sx * 16, y + sy * 16, icon, w - sx * 16, 16);
+ }
+ for (sx = 0; w - sx * 16 > 16; sx++) {
+ GuiDraw.gui.drawTexturedModelRectFromIcon(x + sx * 16, y + sy * 16, icon, 16, h - sy * 16);
+ }
+ GuiDraw.gui.drawTexturedModelRectFromIcon(x + sx * 16, y + sy * 16, icon, w - sx * 16, h - sy * 16);
+
+ GL11.glDisable(GL12.GL_RESCALE_NORMAL);
+ GL11.glDisable(GL11.GL_BLEND);
+ GL11.glPopMatrix();
+
+ GuiDraw.changeTexture(this.getGuiTexture());
+ }
+
+ @Override
+ public void loadCraftingRecipes(String outputId, Object... results) {
+ if(outputId.equals("fbs.extracting") && this.getClass() == FBSExtractingHandler.class) {
+ Registry.ItemManaContainer rp;
+ Iterator i$ = Registry.GetManaContainers().iterator();
+
+ //書物
+ rp=new Registry.ItemManaContainer(new ItemStack(ItemCore.bookOld), -1);
+ arecipes.add(new FBSExtractingHandler.CachedExtractingRecipe(rp));
+ items.add(rp);
+ rp=new Registry.ItemManaContainer(new ItemStack(ItemCore.bookSorcery), -1);
+ arecipes.add(new FBSExtractingHandler.CachedExtractingRecipe(rp));
+ items.add(rp);
+
+ //登録済みアイテム
+ while(i$.hasNext()) {
+ rp=(Registry.ItemManaContainer)i$.next();
+ arecipes.add(new FBSExtractingHandler.CachedExtractingRecipe(rp));
+ items.add(rp);
+ }
+ } else {
+ super.loadCraftingRecipes(outputId, results);
+ }
+
+ }
+
+ @Override
+ public void loadCraftingRecipes(ItemStack result) {}
+
+ @Override
+ public void loadUsageRecipes(ItemStack ingredient) {
+ if(ingredient.getItem()==ItemCore.bookOld){
+ items.add(new Registry.ItemManaContainer(ingredient.copy(), -1));
+ return;
+ }
+ if(ingredient.getItem()==ItemCore.bookSorcery){
+ items.add(new Registry.ItemManaContainer(ingredient.copy(), -1));
+ return;
+ }
+
+ //登録済みアイテムから探す
+ Iterator i$ = Registry.GetManaContainers().iterator();
+ while(i$.hasNext()) {
+ Registry.ItemManaContainer rp=(Registry.ItemManaContainer)i$.next();
+ if(rp.item.isItemEqual(ingredient)) {
+ this.arecipes.add(new FBSExtractingHandler.CachedExtractingRecipe(rp));
+ items.add(rp);
+ }
+ }
+ }
+
+ @Override
+ public String getGuiTexture() {
+ return FBS.MODID+":textures/gui/extractingFurnace.png";
+ }
+
+ @Override
+ public String getRecipeName() {
+ return NEIClientUtils.translate("recipe.fbs.extracting", new Object[0]);
+ }
+
+ public class CachedExtractingRecipe extends CachedRecipe {
+ public ArrayList<PositionedStack> ingredients=new ArrayList<PositionedStack>();
+ public PositionedStack result;
+ public PositionedStack input;
+ public int amount;
+
+ public CachedExtractingRecipe(Registry.ItemManaContainer im){
+ ingredients.add(new PositionedStack(im.item, 44-5, 35-11));
+ amount=im.amount;
+ }
+
+ @Override
+ public java.util.List<PositionedStack> getIngredients() {
+ return getCycledIngredients(FBSExtractingHandler.this.cycleticks / 20, ingredients);
+ }
+
+ @Override
+ public PositionedStack getResult() {
+ return null;
+ }
+
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/nei/FBSShapedRecipeHandler$CachedShapedRecipe.class b/src/main/java/jp/plusplus/fbs/nei/FBSShapedRecipeHandler$CachedShapedRecipe.class Binary files differnew file mode 100644 index 0000000..779256a --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/nei/FBSShapedRecipeHandler$CachedShapedRecipe.class diff --git a/src/main/java/jp/plusplus/fbs/nei/FBSShapedRecipeHandler.class b/src/main/java/jp/plusplus/fbs/nei/FBSShapedRecipeHandler.class Binary files differnew file mode 100644 index 0000000..cc4cb04 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/nei/FBSShapedRecipeHandler.class diff --git a/src/main/java/jp/plusplus/fbs/nei/FBSShapedRecipeHandler.java b/src/main/java/jp/plusplus/fbs/nei/FBSShapedRecipeHandler.java new file mode 100644 index 0000000..69c9f97 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/nei/FBSShapedRecipeHandler.java @@ -0,0 +1,241 @@ +package jp.plusplus.fbs.nei;
+
+import codechicken.core.ReflectionManager;
+import codechicken.lib.gui.GuiDraw;
+import codechicken.nei.NEIClientConfig;
+import codechicken.nei.NEIClientUtils;
+import codechicken.nei.NEIServerUtils;
+import codechicken.nei.PositionedStack;
+import codechicken.nei.api.DefaultOverlayRenderer;
+import codechicken.nei.api.IOverlayHandler;
+import codechicken.nei.api.IRecipeOverlayRenderer;
+import codechicken.nei.api.IStackPositioner;
+import codechicken.nei.recipe.RecipeInfo;
+import codechicken.nei.recipe.TemplateRecipeHandler;
+import jp.plusplus.fbs.Registry;
+import jp.plusplus.fbs.gui.GuiWorkbench;
+import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.client.gui.inventory.GuiCrafting;
+import net.minecraft.inventory.*;
+import net.minecraft.item.ItemStack;
+import net.minecraft.item.crafting.CraftingManager;
+import net.minecraft.item.crafting.IRecipe;
+import net.minecraft.item.crafting.ShapedRecipes;
+import net.minecraftforge.oredict.ShapedOreRecipe;
+
+import java.awt.*;
+import java.awt.List;
+import java.util.*;
+
+/**
+ * Createdby pluslus_Fon 2015/06/15.
+ */
+public class FBSShapedRecipeHandler extends TemplateRecipeHandler {
+ protected LinkedList<Integer> manas=new LinkedList<Integer>();
+
+ public void loadTransferRects() {
+ this.transferRects.add(new RecipeTransferRect(new Rectangle(90, 35, 22, 15), "fbs.crafting", new Object[0]));
+ }
+
+ public Class<? extends GuiContainer> getGuiClass() {
+ return GuiWorkbench.class;
+ }
+
+ public String getRecipeName() {
+ return NEIClientUtils.translate("recipe.fbs.shaped", new Object[0]);
+ }
+
+ public void drawExtras(int recipe) {
+ String str=""+manas.get(recipe)+"mb";
+ GuiDraw.fontRenderer.drawString(str, (196-GuiDraw.fontRenderer.getStringWidth(str))/2, 45, 0x404040);
+ }
+
+ public void loadCraftingRecipes(String outputId, Object... results) {
+ if(outputId.equals("fbs.crafting") && this.getClass() == FBSShapedRecipeHandler.class) {
+ Iterator i$ = Registry.getCraftingRecipes().iterator();
+
+ while(i$.hasNext()) {
+ Registry.RecipePair rp=((Registry.RecipePair)i$.next());
+ IRecipe irecipe = rp.recipe;
+ FBSShapedRecipeHandler.CachedShapedRecipe recipe = null;
+ if(irecipe instanceof ShapedRecipes) {
+ recipe = new FBSShapedRecipeHandler.CachedShapedRecipe((ShapedRecipes)irecipe);
+ } else if(irecipe instanceof ShapedOreRecipe) {
+ recipe = this.forgeShapedRecipe((ShapedOreRecipe)irecipe);
+ }
+
+ if(recipe != null) {
+ recipe.computeVisuals();
+ this.arecipes.add(recipe);
+ manas.add(rp.mana);
+ }
+ }
+ } else {
+ super.loadCraftingRecipes(outputId, results);
+ }
+
+ }
+
+ public void loadCraftingRecipes(ItemStack result) {
+ Iterator i$ = Registry.getCraftingRecipes().iterator();
+
+ while(i$.hasNext()) {
+ Registry.RecipePair rp=((Registry.RecipePair)i$.next());
+ IRecipe irecipe = rp.recipe;
+ if(NEIServerUtils.areStacksSameTypeCrafting(irecipe.getRecipeOutput(), result)) {
+ FBSShapedRecipeHandler.CachedShapedRecipe recipe = null;
+ if(irecipe instanceof ShapedRecipes) {
+ recipe = new FBSShapedRecipeHandler.CachedShapedRecipe((ShapedRecipes)irecipe);
+ } else if(irecipe instanceof ShapedOreRecipe) {
+ recipe = this.forgeShapedRecipe((ShapedOreRecipe)irecipe);
+ }
+
+ if(recipe != null) {
+ recipe.computeVisuals();
+ this.arecipes.add(recipe);
+ manas.add(rp.mana);
+ }
+ }
+ }
+
+ }
+
+ public void loadUsageRecipes(ItemStack ingredient) {
+ Iterator i$ = Registry.getCraftingRecipes().iterator();
+
+ while(i$.hasNext()) {
+ Registry.RecipePair rp=((Registry.RecipePair)i$.next());
+ IRecipe irecipe = rp.recipe;
+ FBSShapedRecipeHandler.CachedShapedRecipe recipe = null;
+ if(irecipe instanceof ShapedRecipes) {
+ recipe = new FBSShapedRecipeHandler.CachedShapedRecipe((ShapedRecipes)irecipe);
+ } else if(irecipe instanceof ShapedOreRecipe) {
+ recipe = this.forgeShapedRecipe((ShapedOreRecipe)irecipe);
+ }
+
+ if(recipe != null && recipe.contains(recipe.ingredients, ingredient.getItem())) {
+ recipe.computeVisuals();
+ if(recipe.contains(recipe.ingredients, ingredient)) {
+ recipe.setIngredientPermutation(recipe.ingredients, ingredient);
+ this.arecipes.add(recipe);
+ manas.add(rp.mana);
+ }
+ }
+ }
+
+ }
+
+ public FBSShapedRecipeHandler.CachedShapedRecipe forgeShapedRecipe(ShapedOreRecipe recipe) {
+ int width;
+ int height;
+ try {
+ width = ((Integer) ReflectionManager.getField(ShapedOreRecipe.class, Integer.class, recipe, 4)).intValue();
+ height = ((Integer)ReflectionManager.getField(ShapedOreRecipe.class, Integer.class, recipe, 5)).intValue();
+ } catch (Exception var9) {
+ NEIClientConfig.logger.error("Error loading recipe", var9);
+ return null;
+ }
+
+ Object[] items = recipe.getInput();
+ Object[] arr$ = items;
+ int len$ = items.length;
+
+ for(int i$ = 0; i$ < len$; ++i$) {
+ Object item = arr$[i$];
+ if(item instanceof java.util.List && ((java.util.List)item).isEmpty()) {
+ return null;
+ }
+ }
+
+ return new FBSShapedRecipeHandler.CachedShapedRecipe(width, height, items, recipe.getRecipeOutput());
+ }
+
+ public String getGuiTexture() {
+ return "textures/gui/container/crafting_table.png";
+ }
+
+ public String getOverlayIdentifier() {
+ return "fbs.crafting.shaped";
+ }
+
+ public boolean hasOverlay(GuiContainer gui, net.minecraft.inventory.Container container, int recipe) {
+ return super.hasOverlay(gui, container, recipe) || this.isRecipe2x2(recipe) && RecipeInfo.hasDefaultOverlay(gui, "crafting2x2");
+ }
+
+ public IRecipeOverlayRenderer getOverlayRenderer(GuiContainer gui, int recipe) {
+ IRecipeOverlayRenderer renderer = super.getOverlayRenderer(gui, recipe);
+ if(renderer != null) {
+ return renderer;
+ } else {
+ IStackPositioner positioner = RecipeInfo.getStackPositioner(gui, "crafting2x2");
+ return positioner == null?null:new DefaultOverlayRenderer(this.getIngredientStacks(recipe), positioner);
+ }
+ }
+
+ public IOverlayHandler getOverlayHandler(GuiContainer gui, int recipe) {
+ IOverlayHandler handler = super.getOverlayHandler(gui, recipe);
+ return handler != null?handler:RecipeInfo.getOverlayHandler(gui, "crafting2x2");
+ }
+
+ public boolean isRecipe2x2(int recipe) {
+ Iterator i$ = this.getIngredientStacks(recipe).iterator();
+
+ PositionedStack stack;
+ do {
+ if(!i$.hasNext()) {
+ return true;
+ }
+
+ stack = (PositionedStack)i$.next();
+ } while(stack.relx <= 43 && stack.rely <= 24);
+
+ return false;
+ }
+
+ public class CachedShapedRecipe extends CachedRecipe {
+ public ArrayList<PositionedStack> ingredients;
+ public PositionedStack result;
+
+ public CachedShapedRecipe(int width, int height, Object[] items, ItemStack out) {
+ //super(FBSShapedRecipeHandler.this);
+ this.result = new PositionedStack(out, 119, 24);
+ this.ingredients = new ArrayList();
+ this.setIngredients(width, height, items);
+ }
+
+ public CachedShapedRecipe(ShapedRecipes recipe) {
+ this(recipe.recipeWidth, recipe.recipeHeight, recipe.recipeItems, recipe.getRecipeOutput());
+ }
+
+ public void setIngredients(int width, int height, Object[] items) {
+ for(int x = 0; x < width; ++x) {
+ for(int y = 0; y < height; ++y) {
+ if(items[y * width + x] != null) {
+ PositionedStack stack = new PositionedStack(items[y * width + x], 25 + x * 18, 6 + y * 18, false);
+ stack.setMaxSize(1);
+ this.ingredients.add(stack);
+ }
+ }
+ }
+
+ }
+
+ public java.util.List<PositionedStack> getIngredients() {
+ return this.getCycledIngredients(FBSShapedRecipeHandler.this.cycleticks / 20, this.ingredients);
+ }
+
+ public PositionedStack getResult() {
+ return this.result;
+ }
+
+ public void computeVisuals() {
+ Iterator i$ = this.ingredients.iterator();
+
+ while(i$.hasNext()) {
+ PositionedStack p = (PositionedStack)i$.next();
+ p.generatePermutations();
+ }
+
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/nei/FBSShapelessRecipeHandler$CachedShapelessRecipe.class b/src/main/java/jp/plusplus/fbs/nei/FBSShapelessRecipeHandler$CachedShapelessRecipe.class Binary files differnew file mode 100644 index 0000000..7fab582 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/nei/FBSShapelessRecipeHandler$CachedShapelessRecipe.class diff --git a/src/main/java/jp/plusplus/fbs/nei/FBSShapelessRecipeHandler.class b/src/main/java/jp/plusplus/fbs/nei/FBSShapelessRecipeHandler.class Binary files differnew file mode 100644 index 0000000..1c939d6 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/nei/FBSShapelessRecipeHandler.class diff --git a/src/main/java/jp/plusplus/fbs/nei/FBSShapelessRecipeHandler.java b/src/main/java/jp/plusplus/fbs/nei/FBSShapelessRecipeHandler.java new file mode 100644 index 0000000..950c1fb --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/nei/FBSShapelessRecipeHandler.java @@ -0,0 +1,173 @@ +package jp.plusplus.fbs.nei;
+
+import codechicken.nei.NEIClientUtils;
+import codechicken.nei.NEIServerUtils;
+import codechicken.nei.PositionedStack;
+import codechicken.nei.recipe.ShapedRecipeHandler;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.Registry;
+import net.minecraft.item.ItemStack;
+import net.minecraft.item.crafting.CraftingManager;
+import net.minecraft.item.crafting.IRecipe;
+import net.minecraft.item.crafting.ShapelessRecipes;
+import net.minecraftforge.oredict.ShapelessOreRecipe;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * Createdby pluslus_Fon 2015/06/15.
+ */
+public class FBSShapelessRecipeHandler extends FBSShapedRecipeHandler {
+ public int[][] stackorder = new int[][]{{0, 0}, {1, 0}, {0, 1}, {1, 1}, {0, 2}, {1, 2}, {2, 0}, {2, 1}, {2, 2}};
+
+ public FBSShapelessRecipeHandler() {
+ }
+
+ public String getRecipeName() {
+ return NEIClientUtils.translate("recipe.fbs.shapeless", new Object[0]);
+ }
+
+ public void loadCraftingRecipes(String outputId, Object... results) {
+ if(outputId.equals("fbs.crafting") && this.getClass() == FBSShapelessRecipeHandler.class) {
+ Iterator i$ = Registry.getCraftingRecipes().iterator();
+
+ while(i$.hasNext()) {
+ Registry.RecipePair rp=((Registry.RecipePair)i$.next());
+ IRecipe irecipe = rp.recipe;
+ FBSShapelessRecipeHandler.CachedShapelessRecipe recipe = null;
+ if(irecipe instanceof ShapelessRecipes) {
+ recipe = this.shapelessRecipe((ShapelessRecipes)irecipe);
+ } else if(irecipe instanceof ShapelessOreRecipe) {
+ recipe = this.forgeShapelessRecipe((ShapelessOreRecipe)irecipe);
+ }
+
+ if(recipe != null) {
+ this.arecipes.add(recipe);
+ manas.add(rp.mana);
+ }
+ }
+ } else {
+ super.loadCraftingRecipes(outputId, results);
+ }
+
+ }
+
+ public void loadCraftingRecipes(ItemStack result) {
+ Iterator i$ = Registry.getCraftingRecipes().iterator();
+
+ while(i$.hasNext()) {
+ Registry.RecipePair rp=((Registry.RecipePair)i$.next());
+ IRecipe irecipe = rp.recipe;
+ if(NEIServerUtils.areStacksSameTypeCrafting(irecipe.getRecipeOutput(), result)) {
+ FBSShapelessRecipeHandler.CachedShapelessRecipe recipe = null;
+ if(irecipe instanceof ShapelessRecipes) {
+ recipe = this.shapelessRecipe((ShapelessRecipes)irecipe);
+ } else if(irecipe instanceof ShapelessOreRecipe) {
+ recipe = this.forgeShapelessRecipe((ShapelessOreRecipe)irecipe);
+ }
+
+ if(recipe != null) {
+ this.arecipes.add(recipe);
+ manas.add(rp.mana);
+ }
+ }
+ }
+
+ }
+
+ public void loadUsageRecipes(ItemStack ingredient) {
+ Iterator i$ = Registry.getCraftingRecipes().iterator();
+
+ while(i$.hasNext()) {
+ Registry.RecipePair rp=((Registry.RecipePair)i$.next());
+ IRecipe irecipe = rp.recipe;
+ FBSShapelessRecipeHandler.CachedShapelessRecipe recipe = null;
+ if(irecipe instanceof ShapelessRecipes) {
+ recipe = this.shapelessRecipe((ShapelessRecipes)irecipe);
+ } else if(irecipe instanceof ShapelessOreRecipe) {
+ recipe = this.forgeShapelessRecipe((ShapelessOreRecipe)irecipe);
+ }
+
+ if(recipe != null && recipe.contains(recipe.ingredients, ingredient)) {
+ recipe.setIngredientPermutation(recipe.ingredients, ingredient);
+ this.arecipes.add(recipe);
+ manas.add(rp.mana);
+ }
+ }
+
+ }
+
+ private FBSShapelessRecipeHandler.CachedShapelessRecipe shapelessRecipe(ShapelessRecipes recipe) {
+ return recipe.recipeItems == null?null:new FBSShapelessRecipeHandler.CachedShapelessRecipe(recipe.recipeItems, recipe.getRecipeOutput());
+ }
+
+ public FBSShapelessRecipeHandler.CachedShapelessRecipe forgeShapelessRecipe(ShapelessOreRecipe recipe) {
+ ArrayList items = recipe.getInput();
+ Iterator i$ = items.iterator();
+
+ Object item;
+ do {
+ if(!i$.hasNext()) {
+ return new FBSShapelessRecipeHandler.CachedShapelessRecipe(items, recipe.getRecipeOutput());
+ }
+
+ item = i$.next();
+ } while(!(item instanceof List) || !((List)item).isEmpty());
+
+ return null;
+ }
+
+ public boolean isRecipe2x2(int recipe) {
+ return this.getIngredientStacks(recipe).size() <= 4;
+ }
+
+ public class CachedShapelessRecipe extends CachedRecipe {
+ public ArrayList<PositionedStack> ingredients;
+ public PositionedStack result;
+
+ public CachedShapelessRecipe() {
+ //super(FBSShapelessRecipeHandler.this);
+ this.ingredients = new ArrayList();
+ }
+
+ public CachedShapelessRecipe(ItemStack output) {
+ this();
+ this.setResult(output);
+ }
+
+ public CachedShapelessRecipe(Object[] input, ItemStack output) {
+ this((List) Arrays.asList(input), output);
+ }
+
+ public CachedShapelessRecipe(List input, ItemStack output) {
+ this(output);
+ this.setIngredients(input);
+ }
+
+ public void setIngredients(List<?> items) {
+ this.ingredients.clear();
+
+ for(int ingred = 0; ingred < items.size(); ++ingred) {
+ PositionedStack stack = new PositionedStack(items.get(ingred), 25 + FBSShapelessRecipeHandler.this.stackorder[ingred][0] * 18, 6 + FBSShapelessRecipeHandler.this.stackorder[ingred][1] * 18);
+ stack.setMaxSize(1);
+ this.ingredients.add(stack);
+ }
+
+ }
+
+ public void setResult(ItemStack output) {
+ this.result = new PositionedStack(output, 119, 24);
+ }
+
+ public List<PositionedStack> getIngredients() {
+ return this.getCycledIngredients(FBSShapelessRecipeHandler.this.cycleticks / 20, this.ingredients);
+ }
+
+ public PositionedStack getResult() {
+ return this.result;
+ }
+ }
+}
\ No newline at end of file diff --git a/src/main/java/jp/plusplus/fbs/nei/NEILoader.class b/src/main/java/jp/plusplus/fbs/nei/NEILoader.class Binary files differnew file mode 100644 index 0000000..65b4150 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/nei/NEILoader.class diff --git a/src/main/java/jp/plusplus/fbs/nei/NEILoader.java b/src/main/java/jp/plusplus/fbs/nei/NEILoader.java new file mode 100644 index 0000000..735f10d --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/nei/NEILoader.java @@ -0,0 +1,43 @@ +package jp.plusplus.fbs.nei;
+
+import codechicken.nei.api.API;
+import jp.plusplus.fbs.gui.GuiExtractingFurnace;
+import jp.plusplus.fbs.pottery.GuiPottersWheel;
+import jp.plusplus.fbs.gui.GuiWorkbench;
+
+/**
+ * Created by plusplus_F on 2015/06/15.
+ */
+public class NEILoader {
+ public static FBSShapedRecipeHandler shapedRecipe;
+ public static FBSShapelessRecipeHandler shapelessRecipe;
+ public static FBSExtractingHandler extractingRecipe;
+ public static PotteryCraftHandler pch;
+ public static AppraisalHandler ah;
+
+ public static void LoadNEI(){
+ shapedRecipe=new FBSShapedRecipeHandler();
+ API.registerRecipeHandler(shapedRecipe);
+ API.registerUsageHandler(shapedRecipe);
+ API.registerGuiOverlay(GuiWorkbench.class, shapedRecipe.getOverlayIdentifier(), 0, 0);
+
+ shapelessRecipe=new FBSShapelessRecipeHandler();
+ API.registerRecipeHandler(shapelessRecipe);
+ API.registerUsageHandler(shapelessRecipe);
+ API.registerGuiOverlay(GuiWorkbench.class, shapelessRecipe.getOverlayIdentifier(), 0, 0);
+
+ extractingRecipe=new FBSExtractingHandler();
+ API.registerRecipeHandler(extractingRecipe);
+ API.registerUsageHandler(extractingRecipe);
+ API.registerGuiOverlay(GuiExtractingFurnace.class, extractingRecipe.getOverlayIdentifier(), 0, 0);
+
+ pch=new PotteryCraftHandler();
+ API.registerRecipeHandler(pch);
+ API.registerUsageHandler(pch);
+ API.registerGuiOverlay(GuiPottersWheel.class, pch.getOverlayIdentifier(), 0, 0);
+
+ ah=new AppraisalHandler();
+ API.registerRecipeHandler(ah);
+ API.registerUsageHandler(ah);
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/nei/PotteryCraftHandler$CachedPottery.class b/src/main/java/jp/plusplus/fbs/nei/PotteryCraftHandler$CachedPottery.class Binary files differnew file mode 100644 index 0000000..4662900 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/nei/PotteryCraftHandler$CachedPottery.class diff --git a/src/main/java/jp/plusplus/fbs/nei/PotteryCraftHandler.class b/src/main/java/jp/plusplus/fbs/nei/PotteryCraftHandler.class Binary files differnew file mode 100644 index 0000000..9d6ab32 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/nei/PotteryCraftHandler.class diff --git a/src/main/java/jp/plusplus/fbs/nei/PotteryCraftHandler.java b/src/main/java/jp/plusplus/fbs/nei/PotteryCraftHandler.java new file mode 100644 index 0000000..3c94acc --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/nei/PotteryCraftHandler.java @@ -0,0 +1,143 @@ +package jp.plusplus.fbs.nei;
+
+import codechicken.lib.gui.GuiDraw;
+import codechicken.nei.NEIClientUtils;
+import codechicken.nei.PositionedStack;
+import codechicken.nei.recipe.TemplateRecipeHandler;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.Registry;
+import jp.plusplus.fbs.pottery.GuiPottersWheel;
+import jp.plusplus.fbs.item.ItemCore;
+import jp.plusplus.fbs.pottery.PotteryRegistry;
+import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.init.Blocks;
+import net.minecraft.init.Items;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import org.lwjgl.opengl.GL11;
+
+import java.awt.*;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+/**
+ * Created by pluslus_F on 2015/06/24.
+ */
+public class PotteryCraftHandler extends TemplateRecipeHandler {
+
+ @Override
+ public int recipiesPerPage(){
+ return 1;
+ }
+
+ @Override
+ public void loadTransferRects() {
+ this.transferRects.add(new RecipeTransferRect(new Rectangle(106, 53, 22, 15), "fbs.pottery", new Object[0]));
+ }
+
+ @Override
+ public String getOverlayIdentifier() {
+ return "fbs.pottery";
+ }
+
+ @Override
+ public Class<? extends GuiContainer> getGuiClass() {
+ return GuiPottersWheel.class;
+ }
+
+ @Override
+ public void drawBackground(int recipe) {
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ GuiDraw.changeTexture(this.getGuiTexture());
+ GuiDraw.drawTexturedModalRect(0, 0, 5, 11, 162-5, 102);
+ }
+ @Override
+ public void drawExtras(int recipe) {}
+
+ @Override
+ public void loadCraftingRecipes(String outputId, Object... results) {
+ if(outputId.equals("fbs.pottery") && this.getClass() == PotteryCraftHandler.class) {
+ Iterator i$ = PotteryRegistry.GetPotteryCrafting().iterator();
+
+ while(i$.hasNext()) {
+ PotteryRegistry.PotteryPair r=(PotteryRegistry.PotteryPair)i$.next();
+ arecipes.add(new CachedPottery(r));
+ }
+ } else {
+ super.loadCraftingRecipes(outputId, results);
+ }
+ }
+
+ @Override
+ public void loadCraftingRecipes(ItemStack result) {
+ Iterator i$ = PotteryRegistry.GetPotteryCrafting().iterator();
+
+ while(i$.hasNext()) {
+ PotteryRegistry.PotteryPair rp=(PotteryRegistry.PotteryPair)i$.next();
+ if(rp.product.isItemEqual(result)) arecipes.add(new CachedPottery(rp));
+ }
+ }
+
+ @Override
+ public void loadUsageRecipes(ItemStack ingredient) {
+ Iterator i$ = PotteryRegistry.GetPotteryCrafting().iterator();
+
+ while(i$.hasNext()) {
+ PotteryRegistry.PotteryPair rp=(PotteryRegistry.PotteryPair)i$.next();
+
+ boolean flag=false;
+ for(int i=0;i<rp.materials.length;i++){
+ ItemStack item=null;
+ if(rp.materials[i]=='c') flag=ingredient.getItem()==ItemCore.clayWet;
+ else if(rp.materials[i]=='g') flag=ingredient.getItem()==ItemCore.clayGlow;
+ else if(rp.materials[i]=='f'){
+ Item it=ingredient.getItem();
+ flag=(it==Item.getItemFromBlock(Blocks.red_flower) || it==Item.getItemFromBlock(Blocks.yellow_flower));
+ }
+ else if(rp.materials[i]=='s') flag=ingredient.getItem()==Items.stick;
+ else if(rp.materials[i]=='b') flag=ingredient.getItem()==Item.getItemFromBlock(Blocks.iron_bars);
+
+ }
+ if(flag) arecipes.add(new CachedPottery(rp));
+ }
+ }
+
+ @Override
+ public String getGuiTexture() {
+ return FBS.MODID+":textures/gui/pottersWheel.png";
+ }
+
+ @Override
+ public String getRecipeName() {
+ return NEIClientUtils.translate("recipe.fbs.pottery", new Object[0]);
+ }
+
+ public class CachedPottery extends CachedRecipe {
+ public ArrayList<PositionedStack> ingredients=new ArrayList<PositionedStack>();
+ public PositionedStack result;
+ public CachedPottery(PotteryRegistry.PotteryPair rp){
+ for(int i=0;i<rp.materials.length;i++){
+ ItemStack item=null;
+ if(rp.materials[i]=='c') item=new ItemStack(ItemCore.clayWet);
+ else if(rp.materials[i]=='g') item=new ItemStack(ItemCore.clayGlow);
+ else if(rp.materials[i]=='f') item=new ItemStack(Blocks.red_flower);
+ else if(rp.materials[i]=='s') item=new ItemStack(Items.stick);
+ else if(rp.materials[i]=='b') item=new ItemStack(Blocks.iron_bars);
+
+ if(item!=null) ingredients.add(new PositionedStack(item, 8-5+18*(i%5), 17-11+18*(i/5)));
+ }
+ result=new PositionedStack(rp.product, 140-5, 54-11);
+ }
+
+ @Override
+ public java.util.List<PositionedStack> getIngredients() {
+ return getCycledIngredients(PotteryCraftHandler.this.cycleticks / 20, ingredients);
+ }
+
+ @Override
+ public PositionedStack getResult() {
+ return result;
+ }
+
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/packet/MessageGuiButton$Handler.class b/src/main/java/jp/plusplus/fbs/packet/MessageGuiButton$Handler.class Binary files differnew file mode 100644 index 0000000..f991f87 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/packet/MessageGuiButton$Handler.class diff --git a/src/main/java/jp/plusplus/fbs/packet/MessageGuiButton.class b/src/main/java/jp/plusplus/fbs/packet/MessageGuiButton.class Binary files differnew file mode 100644 index 0000000..3dd092d --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/packet/MessageGuiButton.class diff --git a/src/main/java/jp/plusplus/fbs/packet/MessageGuiButton.java b/src/main/java/jp/plusplus/fbs/packet/MessageGuiButton.java new file mode 100644 index 0000000..bc58920 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/packet/MessageGuiButton.java @@ -0,0 +1,107 @@ +package jp.plusplus.fbs.packet;
+
+import cpw.mods.fml.common.network.ByteBufUtils;
+import cpw.mods.fml.common.network.simpleimpl.IMessage;
+import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
+import cpw.mods.fml.common.network.simpleimpl.MessageContext;
+import io.netty.buffer.ByteBuf;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.container.ContainerAlchemyCauldron;
+import jp.plusplus.fbs.container.ContainerTFKEnchantment;
+import jp.plusplus.fbs.container.ContainerWarp;
+import jp.plusplus.fbs.container.spirit.ContainerSpiritLearn;
+import jp.plusplus.fbs.container.spirit.ContainerSpiritMain;
+import jp.plusplus.fbs.exprop.FBSEntityProperties;
+import jp.plusplus.fbs.exprop.SanityManager;
+import jp.plusplus.fbs.spirit.SpiritManager;
+import jp.plusplus.fbs.spirit.SpiritStatus;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.Container;
+import net.minecraft.util.MathHelper;
+
+/**
+ * Created by plusplus_F on 2015/10/21.
+ */
+public class MessageGuiButton implements IMessage {
+ protected int buttonId;
+
+ public MessageGuiButton(){}
+ public MessageGuiButton(int id){
+ buttonId=id;
+ }
+
+ @Override
+ public void fromBytes(ByteBuf buf) {
+ buttonId= ByteBufUtils.readVarInt(buf, 4);
+ }
+
+ @Override
+ public void toBytes(ByteBuf buf) {
+ ByteBufUtils.writeVarInt(buf, buttonId, 4);
+ }
+
+ public static class Handler implements IMessageHandler<MessageGuiButton, IMessage>{
+
+ @Override
+ public IMessage onMessage(MessageGuiButton message, MessageContext ctx) {
+ Container con=ctx.getServerHandler().playerEntity.openContainer;
+
+ if(con instanceof ContainerTFKEnchantment){
+ //エンチャントできそうならエンチャントする
+ ContainerTFKEnchantment c=(ContainerTFKEnchantment)con;
+ if(c.canEnchant()){
+ c.tryEnchant();
+ }
+ }
+ else if(con instanceof ContainerAlchemyCauldron){
+ ContainerAlchemyCauldron c=(ContainerAlchemyCauldron)con;
+ if(c.entity.canCompounding()){
+ c.entity.tryCompounding(ctx.getServerHandler().playerEntity);
+ }
+ }
+ else if(con instanceof ContainerSpiritMain){
+ ContainerSpiritMain c=(ContainerSpiritMain)con;
+ EntityPlayer player=ctx.getServerHandler().playerEntity;
+ int x= MathHelper.floor_double(player.posX);
+ int y=MathHelper.floor_double(player.posY);
+ int z=MathHelper.floor_double(player.posZ);
+
+ if(c.type==0){
+ switch (message.buttonId){
+ case 0:
+ player.openGui(FBS.instance, FBS.GUI_SPIRIT_SKILL_ID, player.worldObj, x,y,z);
+ break;
+
+ case 1:
+ player.openGui(FBS.instance, FBS.GUI_SPIRIT_LEARN_ID, player.worldObj, x,y,z);
+ break;
+
+ case 2:
+ SpiritManager.bless(player, SpiritManager.findSpiritTool(player));
+ break;
+
+ case 3:
+ SpiritManager.repair(player, SpiritManager.findSpiritTool(player), -1);
+ break;
+
+ case 5:
+ player.openGui(FBS.instance, FBS.GUI_SPIRIT_CONFIG_ID, player.worldObj, x,y,z);
+ break;
+
+ default:
+ break;
+ }
+ }
+ }
+ else if(con instanceof ContainerSpiritLearn){
+ EntityPlayer player=ctx.getServerHandler().playerEntity;
+ int x= MathHelper.floor_double(player.posX);
+ int y=MathHelper.floor_double(player.posY);
+ int z=MathHelper.floor_double(player.posZ);
+ player.openGui(FBS.instance, FBS.GUI_SPIRIT_MAIN_ID, player.worldObj, x,y,z);
+ }
+
+ return null;
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/packet/MessageGuiButtonDecide$Handler.class b/src/main/java/jp/plusplus/fbs/packet/MessageGuiButtonDecide$Handler.class Binary files differnew file mode 100644 index 0000000..6b01e4e --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/packet/MessageGuiButtonDecide$Handler.class diff --git a/src/main/java/jp/plusplus/fbs/packet/MessageGuiButtonDecide.class b/src/main/java/jp/plusplus/fbs/packet/MessageGuiButtonDecide.class Binary files differnew file mode 100644 index 0000000..b232fcb --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/packet/MessageGuiButtonDecide.class diff --git a/src/main/java/jp/plusplus/fbs/packet/MessageGuiButtonDecide.java b/src/main/java/jp/plusplus/fbs/packet/MessageGuiButtonDecide.java new file mode 100644 index 0000000..cf203de --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/packet/MessageGuiButtonDecide.java @@ -0,0 +1,109 @@ +package jp.plusplus.fbs.packet;
+
+import cpw.mods.fml.common.network.ByteBufUtils;
+import cpw.mods.fml.common.network.simpleimpl.IMessage;
+import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
+import cpw.mods.fml.common.network.simpleimpl.MessageContext;
+import io.netty.buffer.ByteBuf;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.block.BlockCore;
+import jp.plusplus.fbs.container.ContainerWarp;
+import jp.plusplus.fbs.exprop.FBSEntityProperties;
+import jp.plusplus.fbs.item.ItemBookSorcery;
+import jp.plusplus.fbs.tileentity.TileEntityPortalWarp;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.MathHelper;
+import net.minecraft.world.World;
+
+import java.util.Random;
+
+/**
+ * Created by plusplus_F on 2015/10/22.
+ */
+public class MessageGuiButtonDecide implements IMessage {
+ public FBSEntityProperties.WarpPosition destination;
+ public EntityPlayer player;
+
+ public MessageGuiButtonDecide(){}
+ public MessageGuiButtonDecide(EntityPlayer ep, FBSEntityProperties.WarpPosition dest){
+ player=ep;
+ destination=dest;
+ }
+
+ @Override
+ public void fromBytes(ByteBuf buf) {
+
+ destination=new FBSEntityProperties.WarpPosition(ByteBufUtils.readTag(buf));
+ }
+
+ @Override
+ public void toBytes(ByteBuf buf) {
+ NBTTagCompound nbt=new NBTTagCompound();
+ destination.writeToNBT(nbt);
+ ByteBufUtils.writeTag(buf, nbt);
+ }
+
+ public static class Handler implements IMessageHandler<MessageGuiButtonDecide, IMessage> {
+ protected Random rand=new Random();
+ @Override
+ public IMessage onMessage(MessageGuiButtonDecide message, MessageContext ctx) {
+ EntityPlayer ep=ctx.getServerHandler().playerEntity;
+ World w=ctx.getServerHandler().playerEntity.worldObj;
+
+ if(ep.openContainer instanceof ContainerWarp){
+ ContainerWarp con=(ContainerWarp)ep.openContainer;
+
+ //ポータルの生成
+ if(!w.isRemote){
+ FBSEntityProperties.WarpPosition wp=message.destination;
+
+ int x=MathHelper.floor_double(ep.posX);
+ int y=MathHelper.floor_double(ep.posY);
+ int z=MathHelper.floor_double(ep.posZ);
+ int rx=(rand.nextBoolean()?1:-1)*(1+rand.nextInt(2));
+ int ry=0;
+ int rz=(rand.nextBoolean()?1:-1)*(1+rand.nextInt(2));
+ int meta=0;
+
+ if(MathHelper.abs_int(rx)>MathHelper.abs_int(rz)){
+ meta=(meta|8);
+ }
+ if(wp.dimId==FBS.dimensionCrackId && wp.x==-1 && wp.y==-1 && wp.z==-1){
+ //狭間生成用
+ meta=(meta|4);
+ }
+
+ rx+=x;
+ ry+=y;
+ rz+=z;
+ for(int i=0;i<2;i++){
+ w.setBlock(rx, ry+i, rz, BlockCore.portal1, meta+i, 2);
+ TileEntity te=w.getTileEntity(rx,ry+i,rz);
+ if(te instanceof TileEntityPortalWarp){
+ ((TileEntityPortalWarp) te).destination=message.destination;
+ te.markDirty();
+ }
+ }
+ }
+
+ //魔導書の使用回数を減らす
+ if(!ep.capabilities.isCreativeMode){
+ ItemStack item=ep.getCurrentEquippedItem();
+ if(item != null && item.getItem() instanceof ItemBookSorcery){
+ ItemBookSorcery.reduceMagicMaxUse(item);
+ }
+ }
+
+ //GUI閉じる
+ con.close=true;
+ }
+
+ //
+
+ return null;
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/packet/MessageGuiButtonWithNBT$Handler.class b/src/main/java/jp/plusplus/fbs/packet/MessageGuiButtonWithNBT$Handler.class Binary files differnew file mode 100644 index 0000000..874a1f0 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/packet/MessageGuiButtonWithNBT$Handler.class diff --git a/src/main/java/jp/plusplus/fbs/packet/MessageGuiButtonWithNBT.class b/src/main/java/jp/plusplus/fbs/packet/MessageGuiButtonWithNBT.class Binary files differnew file mode 100644 index 0000000..8068b49 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/packet/MessageGuiButtonWithNBT.class diff --git a/src/main/java/jp/plusplus/fbs/packet/MessageGuiButtonWithNBT.java b/src/main/java/jp/plusplus/fbs/packet/MessageGuiButtonWithNBT.java new file mode 100644 index 0000000..3f30062 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/packet/MessageGuiButtonWithNBT.java @@ -0,0 +1,78 @@ +package jp.plusplus.fbs.packet;
+
+import cpw.mods.fml.common.network.ByteBufUtils;
+import cpw.mods.fml.common.network.simpleimpl.IMessage;
+import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
+import cpw.mods.fml.common.network.simpleimpl.MessageContext;
+import io.netty.buffer.ByteBuf;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.container.ContainerAlchemyCauldron;
+import jp.plusplus.fbs.container.ContainerTFKEnchantment;
+import jp.plusplus.fbs.container.spirit.ContainerSpiritMain;
+import jp.plusplus.fbs.spirit.SpiritManager;
+import jp.plusplus.fbs.spirit.SpiritStatus;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.Container;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.MathHelper;
+
+/**
+ * Created by plusplus_F on 2015/10/21.
+ */
+public class MessageGuiButtonWithNBT implements IMessage {
+ protected int buttonId;
+ protected NBTTagCompound nbt;
+
+ public MessageGuiButtonWithNBT(){}
+ public MessageGuiButtonWithNBT(int id, NBTTagCompound nbt){
+ buttonId=id;
+ this.nbt=nbt;
+ }
+
+ @Override
+ public void fromBytes(ByteBuf buf) {
+ buttonId= ByteBufUtils.readVarInt(buf, 4);
+ nbt=ByteBufUtils.readTag(buf);
+ }
+
+ @Override
+ public void toBytes(ByteBuf buf) {
+ ByteBufUtils.writeVarInt(buf, buttonId, 4);
+ ByteBufUtils.writeTag(buf, nbt);
+ }
+
+ public static class Handler implements IMessageHandler<MessageGuiButtonWithNBT, IMessage>{
+
+ @Override
+ public IMessage onMessage(MessageGuiButtonWithNBT message, MessageContext ctx) {
+ EntityPlayer player=ctx.getServerHandler().playerEntity;
+ Container con=player.openContainer;
+ int x= MathHelper.floor_double(player.posX);
+ int y=MathHelper.floor_double(player.posY);
+ int z=MathHelper.floor_double(player.posZ);
+
+ if(con instanceof ContainerSpiritMain){
+ int type=((ContainerSpiritMain) con).type;
+ if(type==1){
+ if(message.buttonId==0){
+ //OKの場合、設定を反映する
+ int index=SpiritManager.findSpiritToolIndex(player);
+ if(index!=-1){
+ ItemStack itemStack= player.inventory.getStackInSlot(index);
+ SpiritStatus ss=SpiritStatus.readFromNBT(itemStack.getTagCompound());
+ ss.getConfiguration().readFromNBT(message.nbt);
+
+ NBTTagCompound nbt1=new NBTTagCompound();
+ SpiritStatus.writeToNBT(ss, nbt1);
+ itemStack.setTagCompound(nbt1);
+ }
+ }
+ player.openGui(FBS.instance, FBS.GUI_SPIRIT_MAIN_ID, player.worldObj, x,y,z);
+ }
+ }
+
+ return null;
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/packet/MessageGuiButtonWithString$Handler.class b/src/main/java/jp/plusplus/fbs/packet/MessageGuiButtonWithString$Handler.class Binary files differnew file mode 100644 index 0000000..9ec420d --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/packet/MessageGuiButtonWithString$Handler.class diff --git a/src/main/java/jp/plusplus/fbs/packet/MessageGuiButtonWithString.class b/src/main/java/jp/plusplus/fbs/packet/MessageGuiButtonWithString.class Binary files differnew file mode 100644 index 0000000..093a7ea --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/packet/MessageGuiButtonWithString.class diff --git a/src/main/java/jp/plusplus/fbs/packet/MessageGuiButtonWithString.java b/src/main/java/jp/plusplus/fbs/packet/MessageGuiButtonWithString.java new file mode 100644 index 0000000..2df2b77 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/packet/MessageGuiButtonWithString.java @@ -0,0 +1,68 @@ +package jp.plusplus.fbs.packet;
+
+import cpw.mods.fml.common.network.ByteBufUtils;
+import cpw.mods.fml.common.network.simpleimpl.IMessage;
+import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
+import cpw.mods.fml.common.network.simpleimpl.MessageContext;
+import io.netty.buffer.ByteBuf;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.container.ContainerContract;
+import jp.plusplus.fbs.container.ContainerWarp;
+import jp.plusplus.fbs.container.spirit.ContainerSpiritLearn;
+import jp.plusplus.fbs.exprop.FBSEntityProperties;
+import jp.plusplus.fbs.exprop.SanityManager;
+import jp.plusplus.fbs.spirit.SpiritManager;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.Container;
+
+/**
+ * Created by plusplus_F on 2015/10/23.
+ */
+public class MessageGuiButtonWithString implements IMessage {
+ protected int index;
+ protected String name;
+
+ public MessageGuiButtonWithString(){}
+ public MessageGuiButtonWithString(int index, String str){
+ this.index=index;
+ this.name=str;
+ }
+
+ @Override
+ public void fromBytes(ByteBuf buf) {
+ index= ByteBufUtils.readVarInt(buf, 4);
+ name=ByteBufUtils.readUTF8String(buf);
+ }
+
+ @Override
+ public void toBytes(ByteBuf buf) {
+ ByteBufUtils.writeVarInt(buf, index, 4);
+ ByteBufUtils.writeUTF8String(buf, name);
+ }
+
+ public static class Handler implements IMessageHandler<MessageGuiButtonWithString, IMessage>{
+ @Override
+ public IMessage onMessage(MessageGuiButtonWithString message, MessageContext ctx) {
+ Container con=ctx.getServerHandler().playerEntity.openContainer;
+ EntityPlayer player=ctx.getServerHandler().playerEntity;
+
+ if(con instanceof ContainerWarp){
+ //時空間の航行
+ FBSEntityProperties prop=FBSEntityProperties.get(player);
+ prop.getDestinations().get(message.index).setName(message.name);
+ SanityManager.sendPacket(player);
+ }
+ else if(con instanceof ContainerContract){
+ //精霊との契約
+ String ch=((ContainerContract) con).contract(message.name, player);
+ }
+ else if(con instanceof ContainerSpiritLearn){
+ ContainerSpiritLearn c=(ContainerSpiritLearn)con;
+ //FBS.logger.info(message.name);
+ c.learn(message.name);
+ }
+
+ return null;
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/packet/MessageMagicFlexible.class b/src/main/java/jp/plusplus/fbs/packet/MessageMagicFlexible.class Binary files differnew file mode 100644 index 0000000..a6e2905 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/packet/MessageMagicFlexible.class diff --git a/src/main/java/jp/plusplus/fbs/packet/MessageMagicFlexible.java b/src/main/java/jp/plusplus/fbs/packet/MessageMagicFlexible.java new file mode 100644 index 0000000..f9a581a --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/packet/MessageMagicFlexible.java @@ -0,0 +1,40 @@ +package jp.plusplus.fbs.packet;
+
+import cpw.mods.fml.common.network.ByteBufUtils;
+import cpw.mods.fml.common.network.simpleimpl.IMessage;
+import io.netty.buffer.ByteBuf;
+import jp.plusplus.fbs.entity.EntityMagicArrowFlexible;
+import net.minecraft.nbt.NBTTagCompound;
+
+import java.util.UUID;
+
+/**
+ * Created by plusplus_F on 2015/10/17.
+ */
+public class MessageMagicFlexible implements IMessage {
+ public int shooterId;
+ public int entityId;
+ public NBTTagCompound data;
+
+ public MessageMagicFlexible(){}
+ public MessageMagicFlexible(EntityMagicArrowFlexible entity){
+ shooterId=entity.shootingEntity.getEntityId();
+ entityId=entity.getEntityId();
+ data=new NBTTagCompound();
+ entity.writeMagicsToNBT(data);
+ }
+
+ @Override
+ public void fromBytes(ByteBuf buf) {
+ shooterId=ByteBufUtils.readVarInt(buf, 4);
+ entityId=ByteBufUtils.readVarInt(buf, 4);
+ data = ByteBufUtils.readTag(buf);
+ }
+
+ @Override
+ public void toBytes(ByteBuf buf) {
+ ByteBufUtils.writeVarInt(buf, shooterId, 4);
+ ByteBufUtils.writeVarInt(buf, entityId, 4);
+ ByteBufUtils.writeTag(buf, data);
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/packet/MessageMagicFlexibleHandler.class b/src/main/java/jp/plusplus/fbs/packet/MessageMagicFlexibleHandler.class Binary files differnew file mode 100644 index 0000000..1054bde --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/packet/MessageMagicFlexibleHandler.class diff --git a/src/main/java/jp/plusplus/fbs/packet/MessageMagicFlexibleHandler.java b/src/main/java/jp/plusplus/fbs/packet/MessageMagicFlexibleHandler.java new file mode 100644 index 0000000..c699e8f --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/packet/MessageMagicFlexibleHandler.java @@ -0,0 +1,28 @@ +package jp.plusplus.fbs.packet;
+
+import cpw.mods.fml.common.network.simpleimpl.IMessage;
+import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
+import cpw.mods.fml.common.network.simpleimpl.MessageContext;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.entity.EntityMagicArrowFlexible;
+import net.minecraft.entity.Entity;
+import net.minecraft.world.World;
+
+import java.util.List;
+
+/**
+ * Created by plusplus_F on 2015/10/17.
+ */
+public class MessageMagicFlexibleHandler implements IMessageHandler<MessageMagicFlexible, IMessage> {
+ @Override
+ public IMessage onMessage(MessageMagicFlexible message, MessageContext ctx) {
+ World w=FBS.proxy.getClientWorld();
+
+ Entity e=w.getEntityByID(message.entityId);
+ if(e instanceof EntityMagicArrowFlexible){
+ ((EntityMagicArrowFlexible) e).shootingEntity=w.getEntityByID(message.shooterId);
+ ((EntityMagicArrowFlexible) e).readMagicsFromNBT(message.data);
+ }
+ return null;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/packet/MessageMagicVortex$Handler.class b/src/main/java/jp/plusplus/fbs/packet/MessageMagicVortex$Handler.class Binary files differnew file mode 100644 index 0000000..46ebc00 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/packet/MessageMagicVortex$Handler.class diff --git a/src/main/java/jp/plusplus/fbs/packet/MessageMagicVortex.class b/src/main/java/jp/plusplus/fbs/packet/MessageMagicVortex.class Binary files differnew file mode 100644 index 0000000..d7ef61d --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/packet/MessageMagicVortex.class diff --git a/src/main/java/jp/plusplus/fbs/packet/MessageMagicVortex.java b/src/main/java/jp/plusplus/fbs/packet/MessageMagicVortex.java new file mode 100644 index 0000000..f9642d5 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/packet/MessageMagicVortex.java @@ -0,0 +1,104 @@ +package jp.plusplus.fbs.packet;
+
+import cpw.mods.fml.client.FMLClientHandler;
+import cpw.mods.fml.common.network.ByteBufUtils;
+import cpw.mods.fml.common.network.simpleimpl.IMessage;
+import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
+import cpw.mods.fml.common.network.simpleimpl.MessageContext;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import io.netty.buffer.ByteBuf;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.Registry;
+import jp.plusplus.fbs.api.IMagicEnchant;
+import jp.plusplus.fbs.entity.EntityMagicArrowFlexible;
+import jp.plusplus.fbs.particle.EntityVortexFX;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.nbt.NBTTagList;
+import net.minecraft.world.World;
+
+import java.util.Random;
+
+/**
+ * Created by plusplus_F on 2015/10/20.
+ */
+public class MessageMagicVortex implements IMessage {
+ private int shooterId;
+ private double range;
+ private NBTTagCompound data;
+
+ public MessageMagicVortex(){}
+ public MessageMagicVortex(EntityPlayer ep, double range, NBTTagCompound magics){
+ shooterId=ep.getEntityId();
+ this.range=range;
+ data=magics;
+ }
+
+ @Override
+ public void fromBytes(ByteBuf buf) {
+ shooterId= ByteBufUtils.readVarInt(buf, 4);
+ range=ByteBufUtils.readVarInt(buf, 4)/100.0;
+ data=ByteBufUtils.readTag(buf);
+ }
+
+ @Override
+ public void toBytes(ByteBuf buf) {
+ ByteBufUtils.writeVarInt(buf, shooterId, 4);
+ ByteBufUtils.writeVarInt(buf, (int)(range*100), 4);
+ ByteBufUtils.writeTag(buf, data);
+ }
+
+ public static class Handler implements IMessageHandler<MessageMagicVortex, IMessage>{
+ @Override
+ public IMessage onMessage(MessageMagicVortex message, MessageContext ctx) {
+ World w= FBS.proxy.getClientWorld();
+
+ if(w!=null){
+ Entity e=w.getEntityByID(message.shooterId);
+ if(e!=null){
+ if(message.data.hasKey("EnchantMagics")){
+ //1.魔法のリストを生成
+ NBTTagList nbttaglist = (NBTTagList)message.data.getTag("EnchantMagics");
+ IMagicEnchant[] magics=new IMagicEnchant[nbttaglist.tagCount()];
+ for(int i=0;i<nbttaglist.tagCount();i++){
+ NBTTagCompound nbt1 = nbttaglist.getCompoundTagAt(i);
+ magics[i]=(IMagicEnchant)Registry.GetMagic(nbt1.getString("MagicName")).getMagic(w, (EntityPlayer)e, false);
+ }
+
+ //2.ループする
+ Random rand=new Random();
+ IMagicEnchant.ParticleColor col;
+ for(int i=0;i<5;i++){
+ for(int k=0;k<8;k++){
+ col=magics[rand.nextInt(magics.length)].setParticleColor();
+ spawnParticle(w, e.posX, e.posY+e.getEyeHeight()/2, e.posZ, i, message.range, col.red, col.green, col.blue);
+ }
+ }
+ }
+ else{
+ //通常のやつ
+ for(int i=0;i<5;i++){
+ for(int k=0;k<8;k++){
+ spawnParticle(w, e.posX, e.posY+e.getEyeHeight()/2, e.posZ, i, message.range, 1.f, 1.f, 1.f);
+ }
+ }
+ }
+ }
+
+ if(e instanceof EntityMagicArrowFlexible){
+ ((EntityMagicArrowFlexible) e).shootingEntity=w.getEntityByID(message.shooterId);
+ ((EntityMagicArrowFlexible) e).readMagicsFromNBT(message.data);
+ }
+ }
+ return null;
+ }
+
+ @SideOnly(Side.CLIENT)
+ private void spawnParticle(World w, double x, double y, double z, int d, double r, float red, float green, float blue){
+ EntityVortexFX fx=new EntityVortexFX(w, x, y, z, d, r, red, green, blue, 1.f);
+ FMLClientHandler.instance().getClient().effectRenderer.addEffect(fx);
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/packet/MessagePlayerJoinInAnnouncement.class b/src/main/java/jp/plusplus/fbs/packet/MessagePlayerJoinInAnnouncement.class Binary files differnew file mode 100644 index 0000000..4585258 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/packet/MessagePlayerJoinInAnnouncement.class diff --git a/src/main/java/jp/plusplus/fbs/packet/MessagePlayerJoinInAnnouncement.java b/src/main/java/jp/plusplus/fbs/packet/MessagePlayerJoinInAnnouncement.java new file mode 100644 index 0000000..70c8ce8 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/packet/MessagePlayerJoinInAnnouncement.java @@ -0,0 +1,37 @@ +package jp.plusplus.fbs.packet;
+
+import cpw.mods.fml.common.network.ByteBufUtils;
+import cpw.mods.fml.common.network.simpleimpl.IMessage;
+import io.netty.buffer.ByteBuf;
+import net.minecraft.entity.player.EntityPlayer;
+
+/**
+ * Createdby pluslus_Fon 2015/06/05.
+ */
+public class MessagePlayerJoinInAnnouncement implements IMessage {
+
+ private String uuid;
+
+ public MessagePlayerJoinInAnnouncement(){}
+ public MessagePlayerJoinInAnnouncement(EntityPlayer player) {
+ this.uuid = player.getGameProfile().getId().toString();
+ }
+
+ @Override
+ public void fromBytes(ByteBuf buf) {
+ this.uuid = ByteBufUtils.readUTF8String(buf);
+ }
+
+ @Override
+ public void toBytes(ByteBuf buf) {
+ ByteBufUtils.writeUTF8String(buf, this.uuid);
+ }
+
+ public String getUuid() {
+ return uuid;
+ }
+
+ public void setUuid(String uuid) {
+ this.uuid = uuid;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/packet/MessagePlayerJoinInAnoucementHandler.class b/src/main/java/jp/plusplus/fbs/packet/MessagePlayerJoinInAnoucementHandler.class Binary files differnew file mode 100644 index 0000000..439ffac --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/packet/MessagePlayerJoinInAnoucementHandler.class diff --git a/src/main/java/jp/plusplus/fbs/packet/MessagePlayerJoinInAnoucementHandler.java b/src/main/java/jp/plusplus/fbs/packet/MessagePlayerJoinInAnoucementHandler.java new file mode 100644 index 0000000..100f41b --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/packet/MessagePlayerJoinInAnoucementHandler.java @@ -0,0 +1,20 @@ +package jp.plusplus.fbs.packet;
+
+import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
+import cpw.mods.fml.common.network.simpleimpl.MessageContext;
+import net.minecraft.entity.player.EntityPlayer;
+
+/**
+ * Createdby pluslus_Fon 2015/06/05.
+ */
+public class MessagePlayerJoinInAnoucementHandler implements IMessageHandler<MessagePlayerJoinInAnnouncement, MessagePlayerProperties> {
+ @Override
+ public MessagePlayerProperties onMessage(MessagePlayerJoinInAnnouncement message, MessageContext ctx) {
+ String uuidString = message.getUuid();
+ EntityPlayer player = ctx.getServerHandler().playerEntity;
+ if (player.getGameProfile().getId().toString().equals(uuidString)) {
+ return new MessagePlayerProperties(player);
+ }
+ return null;
+ }
+}
\ No newline at end of file diff --git a/src/main/java/jp/plusplus/fbs/packet/MessagePlayerProperties.class b/src/main/java/jp/plusplus/fbs/packet/MessagePlayerProperties.class Binary files differnew file mode 100644 index 0000000..dd532b5 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/packet/MessagePlayerProperties.class diff --git a/src/main/java/jp/plusplus/fbs/packet/MessagePlayerProperties.java b/src/main/java/jp/plusplus/fbs/packet/MessagePlayerProperties.java new file mode 100644 index 0000000..7e1eefa --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/packet/MessagePlayerProperties.java @@ -0,0 +1,31 @@ +package jp.plusplus.fbs.packet;
+
+import cpw.mods.fml.common.network.ByteBufUtils;
+import cpw.mods.fml.common.network.simpleimpl.IMessage;
+import io.netty.buffer.ByteBuf;
+import jp.plusplus.fbs.exprop.FBSEntityProperties;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.nbt.NBTTagCompound;
+
+/**
+ * Createdby pluslus_Fon 2015/06/05.
+ */
+public class MessagePlayerProperties implements IMessage {
+ public NBTTagCompound data;
+
+ public MessagePlayerProperties(){}
+ public MessagePlayerProperties(EntityPlayer entityPlayer) {
+ this.data = new NBTTagCompound();
+ FBSEntityProperties.get(entityPlayer).saveNBTData(data);
+ }
+
+ @Override
+ public void fromBytes(ByteBuf buf) {
+ data = ByteBufUtils.readTag(buf);
+ }
+
+ @Override
+ public void toBytes(ByteBuf buf) {
+ ByteBufUtils.writeTag(buf, data);
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/packet/MessagePlayerPropertiesHandler.class b/src/main/java/jp/plusplus/fbs/packet/MessagePlayerPropertiesHandler.class Binary files differnew file mode 100644 index 0000000..41cc364 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/packet/MessagePlayerPropertiesHandler.class diff --git a/src/main/java/jp/plusplus/fbs/packet/MessagePlayerPropertiesHandler.java b/src/main/java/jp/plusplus/fbs/packet/MessagePlayerPropertiesHandler.java new file mode 100644 index 0000000..86cdc7c --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/packet/MessagePlayerPropertiesHandler.java @@ -0,0 +1,18 @@ +package jp.plusplus.fbs.packet;
+
+import cpw.mods.fml.common.network.simpleimpl.IMessage;
+import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
+import cpw.mods.fml.common.network.simpleimpl.MessageContext;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.exprop.FBSEntityProperties;
+
+/**
+ * Createdby pluslus_Fon 2015/06/05.
+ */
+public class MessagePlayerPropertiesHandler implements IMessageHandler<MessagePlayerProperties, IMessage> {
+ @Override
+ public IMessage onMessage(MessagePlayerProperties message, MessageContext ctx) {
+ FBSEntityProperties.get(FBS.proxy.getEntityPlayerInstance()).loadNBTData(message.data);
+ return null;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/packet/MessageWish$Handler.class b/src/main/java/jp/plusplus/fbs/packet/MessageWish$Handler.class Binary files differnew file mode 100644 index 0000000..792663c --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/packet/MessageWish$Handler.class diff --git a/src/main/java/jp/plusplus/fbs/packet/MessageWish.class b/src/main/java/jp/plusplus/fbs/packet/MessageWish.class Binary files differnew file mode 100644 index 0000000..6822ac9 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/packet/MessageWish.class diff --git a/src/main/java/jp/plusplus/fbs/packet/MessageWish.java b/src/main/java/jp/plusplus/fbs/packet/MessageWish.java new file mode 100644 index 0000000..d9c6623 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/packet/MessageWish.java @@ -0,0 +1,42 @@ +package jp.plusplus.fbs.packet;
+
+import cpw.mods.fml.common.network.ByteBufUtils;
+import cpw.mods.fml.common.network.simpleimpl.IMessage;
+import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
+import cpw.mods.fml.common.network.simpleimpl.MessageContext;
+import io.netty.buffer.ByteBuf;
+import jp.plusplus.fbs.event.wish.WishHandler;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.network.play.client.C01PacketChatMessage;
+
+/**
+ * Created by plusplus_F on 2016/03/31.
+ */
+public class MessageWish implements IMessage {
+ public String wish;
+
+ public MessageWish(){}
+ public MessageWish(String wish){
+ this.wish=wish;
+ }
+
+ @Override
+ public void fromBytes(ByteBuf buf) {
+ wish=ByteBufUtils.readUTF8String(buf);
+ }
+
+ @Override
+ public void toBytes(ByteBuf buf) {
+ ByteBufUtils.writeUTF8String(buf, wish);
+ }
+
+ public static class Handler implements IMessageHandler<MessageWish, IMessage>{
+ @Override
+ public IMessage onMessage(MessageWish message, MessageContext ctx) {
+ EntityPlayer ep=ctx.getServerHandler().playerEntity;
+ ctx.getServerHandler().processChatMessage(new C01PacketChatMessage(message.wish+"!!!"));
+ WishHandler.handleWish(ep, message.wish);
+ return null;
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/packet/PacketHandler.class b/src/main/java/jp/plusplus/fbs/packet/PacketHandler.class Binary files differnew file mode 100644 index 0000000..530b3ec --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/packet/PacketHandler.class diff --git a/src/main/java/jp/plusplus/fbs/packet/PacketHandler.java b/src/main/java/jp/plusplus/fbs/packet/PacketHandler.java new file mode 100644 index 0000000..5fd2ce0 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/packet/PacketHandler.java @@ -0,0 +1,31 @@ +package jp.plusplus.fbs.packet;
+
+import cpw.mods.fml.common.network.NetworkRegistry;
+import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper;
+import cpw.mods.fml.relauncher.Side;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.storage.MessageMealTerminal;
+import jp.plusplus.fbs.storage.MessageMealTerminalScroll;
+
+/**
+ * Createdby pluslus_Fon 2015/06/05.
+ */
+public class PacketHandler {
+ public static final SimpleNetworkWrapper INSTANCE = NetworkRegistry.INSTANCE.newSimpleChannel(FBS.MODID);
+
+ public static void init() {
+ INSTANCE.registerMessage(MessagePlayerPropertiesHandler.class, MessagePlayerProperties.class, 0, Side.CLIENT);
+ INSTANCE.registerMessage(MessagePlayerJoinInAnoucementHandler.class, MessagePlayerJoinInAnnouncement.class, 1, Side.SERVER);
+ INSTANCE.registerMessage(MessageMagicFlexibleHandler.class, MessageMagicFlexible.class, 2, Side.CLIENT);
+ INSTANCE.registerMessage(MessageMagicVortex.Handler.class, MessageMagicVortex.class, 3, Side.CLIENT);
+ INSTANCE.registerMessage(MessageGuiButton.Handler.class, MessageGuiButton.class, 4, Side.SERVER);
+ INSTANCE.registerMessage(MessageGuiButtonWithString.Handler.class, MessageGuiButtonWithString.class, 5, Side.SERVER);
+ INSTANCE.registerMessage(MessageGuiButtonDecide.Handler.class, MessageGuiButtonDecide.class, 6, Side.SERVER);
+ INSTANCE.registerMessage(MessageGuiButtonWithNBT.Handler.class, MessageGuiButtonWithNBT.class, 7, Side.SERVER);
+ INSTANCE.registerMessage(MessageMealTerminal.Handler.class, MessageMealTerminal.class, 8, Side.SERVER);
+ INSTANCE.registerMessage(MessageMealTerminal.HandlerClient.class, MessageMealTerminal.class, 9, Side.CLIENT);
+ INSTANCE.registerMessage(MessageMealTerminalScroll.Handler.class, MessageMealTerminalScroll.class, 10, Side.SERVER);
+ INSTANCE.registerMessage(MessageWish.Handler.class, MessageWish.class, 11, Side.SERVER);
+
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/particle/EntityGlowFX.class b/src/main/java/jp/plusplus/fbs/particle/EntityGlowFX.class Binary files differnew file mode 100644 index 0000000..170deb0 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/particle/EntityGlowFX.class diff --git a/src/main/java/jp/plusplus/fbs/particle/EntityGlowFX.java b/src/main/java/jp/plusplus/fbs/particle/EntityGlowFX.java new file mode 100644 index 0000000..2094520 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/particle/EntityGlowFX.java @@ -0,0 +1,85 @@ +package jp.plusplus.fbs.particle;
+
+import cpw.mods.fml.client.FMLClientHandler;
+import net.minecraft.client.multiplayer.WorldClient;
+import net.minecraft.client.particle.EntityFX;
+import net.minecraft.client.particle.EntityReddustFX;
+import net.minecraft.client.renderer.RenderGlobal;
+import net.minecraft.client.renderer.Tessellator;
+import net.minecraft.client.renderer.texture.TextureMap;
+import net.minecraft.world.World;
+
+import java.util.Random;
+
+/**
+ * Createdby pluslus_Fon 2015/06/06.
+ */
+public class EntityGlowFX extends EntityFX {
+ public EntityGlowFX(World p_i1218_1_, double p_i1218_2_, double p_i1218_4_, double p_i1218_6_) {
+ super(p_i1218_1_, p_i1218_2_, p_i1218_4_, p_i1218_6_);
+ Random r=p_i1218_1_.rand;
+
+ particleAge = 0;
+ particleMaxAge = (int) (8.0D / (Math.random() * 0.8D + 0.2D));
+ particleScale *= 0.75F;
+ noClip = false;
+
+ particleRed = 0.8f + r.nextFloat() * 0.2f;
+ particleGreen = 0;
+ particleBlue = 0.8f + r.nextFloat() * 0.2f;
+
+ motionX = (r.nextFloat()-r.nextFloat()) * 0.02f;
+ motionY = (r.nextFloat()-r.nextFloat()) * 0.02f;
+ motionZ = (r.nextFloat()-r.nextFloat()) * 0.02f;
+ }
+
+ @Override
+ public void onUpdate() {
+ this.prevPosX = this.posX;
+ this.prevPosY = this.posY;
+ this.prevPosZ = this.posZ;
+
+ if (this.particleAge++ >= this.particleMaxAge) {
+ this.setDead();
+ }
+
+ this.setParticleTextureIndex(7 - this.particleAge * 8 / this.particleMaxAge);
+ this.moveEntity(this.motionX, this.motionY, this.motionZ);
+
+ if (this.posY == this.prevPosY) {
+ this.motionX *= 1.1D;
+ this.motionZ *= 1.1D;
+ }
+
+ this.motionX *= 0.9599999785423279D;
+ this.motionY *= 0.9599999785423279D;
+ this.motionZ *= 0.9599999785423279D;
+
+ if (this.onGround){
+ this.motionX *= 0.699999988079071D;
+ this.motionZ *= 0.699999988079071D;
+ }
+ }
+
+ @Override
+ public int getFXLayer() {
+ return 0;
+ }
+ @Override
+ public void renderParticle(Tessellator p_70539_1_, float p_70539_2_, float p_70539_3_, float p_70539_4_, float p_70539_5_, float p_70539_6_, float p_70539_7_){
+ float f6 = ((float)this.particleAge + p_70539_2_) / (float)this.particleMaxAge * 32.0F;
+
+ if (f6 < 0.0F) f6 = 0.0F;
+ if (f6 > 1.0F) f6 = 1.0F;
+
+ this.particleScale *= f6;
+ super.renderParticle(p_70539_1_, p_70539_2_, p_70539_3_, p_70539_4_, p_70539_5_, p_70539_6_, p_70539_7_);
+ }
+
+ /*
+ public static void SpawnParticle(World world, double x, double y, double z){
+ EntityGlowFX e=new EntityGlowFX(world, x,y,z);
+ FMLClientHandler.instance().getClient().effectRenderer.addEffect(e);
+ }
+ */
+}
diff --git a/src/main/java/jp/plusplus/fbs/particle/EntitySpellCircleFX.class b/src/main/java/jp/plusplus/fbs/particle/EntitySpellCircleFX.class Binary files differnew file mode 100644 index 0000000..c666370 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/particle/EntitySpellCircleFX.class diff --git a/src/main/java/jp/plusplus/fbs/particle/EntitySpellCircleFX.java b/src/main/java/jp/plusplus/fbs/particle/EntitySpellCircleFX.java new file mode 100644 index 0000000..1fbd56b --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/particle/EntitySpellCircleFX.java @@ -0,0 +1,99 @@ +package jp.plusplus.fbs.particle;
+
+import jp.plusplus.fbs.FBS;
+import net.minecraft.client.particle.EntityFX;
+import net.minecraft.client.renderer.Tessellator;
+import net.minecraft.util.MathHelper;
+import net.minecraft.world.World;
+import net.minecraftforge.common.MinecraftForge;
+
+/**
+ * Created by plusplus_F on 2016/03/20.
+ */
+public class EntitySpellCircleFX extends EntityFX{
+ private double firstX;
+ private double firstY;
+ private double firstZ;
+
+ private double radius;
+ private float angle;
+ private float rps;
+
+ public EntitySpellCircleFX(World world, double x, double y, double z, double radius, float angle) {
+ super(world, x, y, z, 0,0,0);
+ this.firstX = this.posX = x;
+ this.firstY = this.posY = y;
+ this.firstZ = this.posZ = z;
+ this.radius=radius;
+ this.angle=angle;
+ this.particleScale = this.rand.nextFloat() * 0.4F + 0.4F;
+ this.particleAlpha=this.particleRed = this.particleGreen = this.particleBlue = 1.0F;
+ this.particleMaxAge = (int) (Math.random() * 20.0D) + 60;
+ this.noClip = true;
+ this.setParticleTextureIndex(rand.nextInt(26));
+
+ posX=firstX-radius* MathHelper.sin((float)angle);
+ posZ=firstZ+radius*MathHelper.cos((float)angle);
+
+ rps=(float)(2*Math.PI/40.0f);
+ }
+
+ @Override
+ public int getBrightnessForRender(float p_70070_1_) {
+ return 0xffffff;
+ }
+
+ @Override
+ public float getBrightness(float p_70013_1_) {
+ return 1.f;
+ }
+
+ @Override
+ public void onUpdate() {
+ this.prevPosX = this.posX;
+ this.prevPosY = this.posY;
+ this.prevPosZ = this.posZ;
+
+ //螺旋運動
+ posX=firstX-radius*MathHelper.sin((float)angle);
+ posY+=2.2f/particleMaxAge;
+ posZ=firstZ+radius*MathHelper.cos((float)angle);
+
+ angle+=rps;
+ radius*=0.98f;
+
+
+ if (this.particleAge++ >= this.particleMaxAge) {
+ this.setDead();
+ }
+ }
+
+ @Override
+ public int getFXLayer() {
+ return 2;
+ }
+
+ @Override
+ public void setParticleTextureIndex(int p_70536_1_) {
+ this.particleTextureIndexX = p_70536_1_ % 16;
+ this.particleTextureIndexY = p_70536_1_ / 16;
+ }
+
+ @Override
+ public void renderParticle(Tessellator p_70539_1_, float p_70539_2_, float p_70539_3_, float p_70539_4_, float p_70539_5_, float p_70539_6_, float p_70539_7_) {
+ float f10 = 0.1F * this.particleScale;
+ float f6=particleIcon.getMinU()+(2*particleTextureIndexX)/128.f;
+ float f7=f6+2f/128.0f;
+ float f8=particleIcon.getMinV()+(2*particleTextureIndexY)/128.f;
+ float f9=f8+2f/128.0f;
+
+ float f11 = (float) (this.prevPosX + (this.posX - this.prevPosX) * (double) p_70539_2_ - interpPosX);
+ float f12 = (float) (this.prevPosY + (this.posY - this.prevPosY) * (double) p_70539_2_ - interpPosY);
+ float f13 = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * (double) p_70539_2_ - interpPosZ);
+ p_70539_1_.setColorRGBA_F(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha);
+ p_70539_1_.addVertexWithUV((double) (f11 - p_70539_3_ * f10 - p_70539_6_ * f10), (double) (f12 - p_70539_4_ * f10), (double) (f13 - p_70539_5_ * f10 - p_70539_7_ * f10), (double) f7, (double) f9);
+ p_70539_1_.addVertexWithUV((double) (f11 - p_70539_3_ * f10 + p_70539_6_ * f10), (double) (f12 + p_70539_4_ * f10), (double) (f13 - p_70539_5_ * f10 + p_70539_7_ * f10), (double) f7, (double) f8);
+ p_70539_1_.addVertexWithUV((double) (f11 + p_70539_3_ * f10 + p_70539_6_ * f10), (double) (f12 + p_70539_4_ * f10), (double) (f13 + p_70539_5_ * f10 + p_70539_7_ * f10), (double) f6, (double) f8);
+ p_70539_1_.addVertexWithUV((double) (f11 + p_70539_3_ * f10 - p_70539_6_ * f10), (double) (f12 - p_70539_4_ * f10), (double) (f13 + p_70539_5_ * f10 - p_70539_7_ * f10), (double) f6, (double) f9);
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/particle/EntitySpellFX.class b/src/main/java/jp/plusplus/fbs/particle/EntitySpellFX.class Binary files differnew file mode 100644 index 0000000..c2ff2dd --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/particle/EntitySpellFX.class diff --git a/src/main/java/jp/plusplus/fbs/particle/EntitySpellFX.java b/src/main/java/jp/plusplus/fbs/particle/EntitySpellFX.java new file mode 100644 index 0000000..9bffd37 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/particle/EntitySpellFX.java @@ -0,0 +1,88 @@ +package jp.plusplus.fbs.particle;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import net.minecraft.client.particle.EntityFX;
+import net.minecraft.client.renderer.Tessellator;
+import net.minecraft.util.MathHelper;
+import net.minecraft.world.World;
+
+/**
+ * Created by plusplus_F on 2015/09/27.
+ */
+public class EntitySpellFX extends EntityFX {
+ private double firstX;
+ private double firstY;
+ private double firstZ;
+
+ public EntitySpellFX(World world, double x, double y, double z, double mX, double mY, double mZ) {
+ super(world, x, y, z, mX, mY, mZ);
+ this.motionX = mX;
+ this.motionY = mY;
+ this.motionZ = mZ;
+ this.firstX = this.posX = x;
+ this.firstY = this.posY = y;
+ this.firstZ = this.posZ = z;
+ this.particleScale = this.rand.nextFloat() * 0.5F + 0.2F;
+ this.particleRed = this.particleGreen = this.particleBlue = 1.0F;
+ this.particleMaxAge = (int) (Math.random() * 10.0D) + 30;
+ this.noClip = true;
+ this.setParticleTextureIndex(rand.nextInt(26));
+ }
+
+ @Override
+ public int getBrightnessForRender(float p_70070_1_) {
+ return 0xffffff;
+ }
+
+ @Override
+ public float getBrightness(float p_70013_1_) {
+ return 1.f;
+ }
+
+ @Override
+ public void onUpdate() {
+ this.prevPosX = this.posX;
+ this.prevPosY = this.posY;
+ this.prevPosZ = this.posZ;
+ float f = (float) this.particleAge / (float) this.particleMaxAge;
+ f = 1.0F - f;
+
+ this.posX = this.firstX + this.motionX * (double) f;
+ this.posY = this.firstY + this.motionY * (double) f;
+ this.posZ = this.firstZ + this.motionZ * (double) f;
+
+ if (this.particleAge++ >= this.particleMaxAge) {
+ this.setDead();
+ }
+ }
+
+ @Override
+ public int getFXLayer() {
+ return 2;
+ }
+
+ @Override
+ public void setParticleTextureIndex(int p_70536_1_) {
+ this.particleTextureIndexX = p_70536_1_ % 16;
+ this.particleTextureIndexY = p_70536_1_ / 16;
+ }
+
+ @Override
+ public void renderParticle(Tessellator p_70539_1_, float p_70539_2_, float p_70539_3_, float p_70539_4_, float p_70539_5_, float p_70539_6_, float p_70539_7_) {
+ float f10 = 0.1F * this.particleScale;
+ float f6=particleIcon.getMinU()+(2*particleTextureIndexX)/128.f;
+ float f7=f6+2f/128.0f;
+ float f8=particleIcon.getMinV()+(2*particleTextureIndexY)/128.f;
+ float f9=f8+2f/128.0f;
+
+ float f11 = (float) (this.prevPosX + (this.posX - this.prevPosX) * (double) p_70539_2_ - interpPosX);
+ float f12 = (float) (this.prevPosY + (this.posY - this.prevPosY) * (double) p_70539_2_ - interpPosY);
+ float f13 = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * (double) p_70539_2_ - interpPosZ);
+ p_70539_1_.setColorRGBA_F(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha);
+ p_70539_1_.addVertexWithUV((double) (f11 - p_70539_3_ * f10 - p_70539_6_ * f10), (double) (f12 - p_70539_4_ * f10), (double) (f13 - p_70539_5_ * f10 - p_70539_7_ * f10), (double) f7, (double) f9);
+ p_70539_1_.addVertexWithUV((double) (f11 - p_70539_3_ * f10 + p_70539_6_ * f10), (double) (f12 + p_70539_4_ * f10), (double) (f13 - p_70539_5_ * f10 + p_70539_7_ * f10), (double) f7, (double) f8);
+ p_70539_1_.addVertexWithUV((double) (f11 + p_70539_3_ * f10 + p_70539_6_ * f10), (double) (f12 + p_70539_4_ * f10), (double) (f13 + p_70539_5_ * f10 + p_70539_7_ * f10), (double) f6, (double) f8);
+ p_70539_1_.addVertexWithUV((double) (f11 + p_70539_3_ * f10 - p_70539_6_ * f10), (double) (f12 - p_70539_4_ * f10), (double) (f13 + p_70539_5_ * f10 - p_70539_7_ * f10), (double) f6, (double) f9);
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/particle/EntityTracksFX.class b/src/main/java/jp/plusplus/fbs/particle/EntityTracksFX.class Binary files differnew file mode 100644 index 0000000..1a3cd96 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/particle/EntityTracksFX.class diff --git a/src/main/java/jp/plusplus/fbs/particle/EntityTracksFX.java b/src/main/java/jp/plusplus/fbs/particle/EntityTracksFX.java new file mode 100644 index 0000000..9c9b047 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/particle/EntityTracksFX.java @@ -0,0 +1,81 @@ +package jp.plusplus.fbs.particle;
+
+import net.minecraft.client.particle.EntityFX;
+import net.minecraft.client.renderer.Tessellator;
+import net.minecraft.world.World;
+
+/**
+ * Created by plusplus_F on 2015/10/15.
+ */
+public class EntityTracksFX extends EntityFX {
+ protected float initialParticleScale;
+
+ public EntityTracksFX(World world, double x, double y, double z, double mx, double my, double mz, float red, float green, float blue) {
+ this(world, x, y, z, mx, my, mz, 1.0F, red, green, blue);
+ }
+
+ public EntityTracksFX(World world, double x, double y, double z, double mx, double my, double mz, float red, float green, float blue, float scale) {
+ super(world, x, y, z, 0.0D, 0.0D, 0.0D);
+ this.motionX *= 0.10000000149011612D;
+ this.motionY *= 0.10000000149011612D;
+ this.motionZ *= 0.10000000149011612D;
+ this.motionX += mx * 0.4D;
+ this.motionY += my * 0.4D;
+ this.motionZ += mz * 0.4D;
+ this.particleRed = this.particleGreen = this.particleBlue = (float) (Math.random() * 0.30000001192092896D + 0.6000000238418579D);
+ this.particleScale *= 0.75F;
+ this.particleScale *= scale;
+ this.initialParticleScale = this.particleScale;
+ this.particleMaxAge = (int) (6.0D / (Math.random() * 0.8D + 0.6D));
+ this.particleMaxAge = (int) ((float) this.particleMaxAge * scale);
+ this.noClip = false;
+
+ particleRed = red;
+ particleGreen = green;
+ particleBlue = blue;
+
+ this.setParticleTextureIndex(65);
+ this.onUpdate();
+ }
+
+ public void renderParticle(Tessellator p_70539_1_, float p_70539_2_, float p_70539_3_, float p_70539_4_, float p_70539_5_, float p_70539_6_, float p_70539_7_) {
+ float f6 = ((float) this.particleAge + p_70539_2_) / (float) this.particleMaxAge * 32.0F;
+
+ if (f6 < 0.0F) {
+ f6 = 0.0F;
+ }
+
+ if (f6 > 1.0F) {
+ f6 = 1.0F;
+ }
+
+ this.particleScale = this.initialParticleScale * f6;
+ super.renderParticle(p_70539_1_, p_70539_2_, p_70539_3_, p_70539_4_, p_70539_5_, p_70539_6_, p_70539_7_);
+ }
+
+ /**
+ * Called to update the entity's position/logic.
+ */
+ public void onUpdate() {
+ this.prevPosX = this.posX;
+ this.prevPosY = this.posY;
+ this.prevPosZ = this.posZ;
+
+ if (this.particleAge++ >= this.particleMaxAge) {
+ this.setDead();
+ }
+
+ this.moveEntity(this.motionX, this.motionY, this.motionZ);
+ //this.particleGreen = (float) ((double) this.particleGreen * 0.96D);
+ //this.particleBlue = (float) ((double) this.particleBlue * 0.9D);
+ this.motionX *= 0.699999988079071D;
+ this.motionY *= 0.699999988079071D;
+ this.motionZ *= 0.699999988079071D;
+ this.motionY -= 0.019999999552965164D;
+
+ if (this.onGround) {
+ this.motionX *= 0.699999988079071D;
+ this.motionZ *= 0.699999988079071D;
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/particle/EntityTrajectoryFX.class b/src/main/java/jp/plusplus/fbs/particle/EntityTrajectoryFX.class Binary files differnew file mode 100644 index 0000000..9836a0b --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/particle/EntityTrajectoryFX.class diff --git a/src/main/java/jp/plusplus/fbs/particle/EntityTrajectoryFX.java b/src/main/java/jp/plusplus/fbs/particle/EntityTrajectoryFX.java new file mode 100644 index 0000000..2e098f0 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/particle/EntityTrajectoryFX.java @@ -0,0 +1,153 @@ +package jp.plusplus.fbs.particle;
+
+import jp.plusplus.fbs.FBS;
+import net.minecraft.block.material.Material;
+import net.minecraft.client.particle.EntityFX;
+import net.minecraft.client.renderer.Tessellator;
+import net.minecraft.util.MathHelper;
+import net.minecraft.world.World;
+import org.lwjgl.opengl.GL11;
+
+/**
+ * Created by nori on 2016/03/11.
+ */
+public class EntityTrajectoryFX extends EntityFX {
+ public double[][] plane=new double[4][3];
+
+ public EntityTrajectoryFX(World world, double x, double y, double z, double mX, double mY, double mZ) {
+ super(world, x, y, z, mX, mY, mZ);
+ this.motionX = mX;
+ this.motionY = mY;
+ this.motionZ = mZ;
+ this.prevPosX=this.posX = x;
+ this.prevPosY=this.posY = y;
+ this.prevPosZ=this.posZ = z;
+ this.particleScale = 0.2F;
+ this.particleRed = this.particleGreen = this.particleBlue =this.particleAlpha= 1.0F;
+ this.particleMaxAge = 6;
+ this.noClip = true;
+
+ particleTextureIndexX=0;
+ particleTextureIndexY=2;
+
+ //FBS.logger.info("spawn");
+
+ double mmsize=Math.sqrt(motionX*motionX+motionY*motionY+motionZ*motionZ);
+
+ float rotYaw=(float)Math.atan2(motionX, motionZ)+(float)Math.PI/2.f;
+ float rotPitch=(float)Math.asin(-motionY / mmsize);
+
+ float r=2.25f;
+ float minx=-r, maxx=r, miny=-r, maxy=r;
+ double[][] t=new double[][]{
+ {0,miny,minx},
+ {0,maxy,minx},
+ {0,maxy,maxx},
+ {0,miny,maxx}
+ };
+ double[][] t2=new double[4][3];
+
+ double cx=MathHelper.cos(rotYaw), sx=MathHelper.sin(rotYaw);
+ double cy=MathHelper.cos(rotPitch), sy=MathHelper.sin(rotPitch);
+
+ for(int i=0;i<4;i++){
+ t2[i][0]=cy*t[i][0]-sy*t[i][1];
+ t2[i][1]=sy*t[i][0]+cy*t[i][1];
+ t2[i][2]=t[i][2];
+ }
+ for(int i=0;i<4;i++){
+ plane[i][0]=cx*t2[i][0]+sx*t2[i][2];
+ plane[i][1]=t2[i][1];
+ plane[i][2]=-sx*t2[i][0]+cx*t2[i][2];
+ }
+
+
+ //this.setParticleTextureIndex(rand.nextInt(26));
+ }
+
+ @Override
+ public int getBrightnessForRender(float p_70070_1_) {
+ return 0xffffff;
+ }
+
+ @Override
+ public float getBrightness(float p_70013_1_) {
+
+ /*
+ float f1 = super.getBrightness(p_70013_1_);
+ float f2 = (float) this.particleAge / (float) this.particleMaxAge;
+ f2 *= f2;
+ f2 *= f2;
+ return f1 * (1.0F - f2) + f2;
+ */
+ return 1.f;
+ }
+
+ @Override
+ public void onUpdate() {
+ this.prevPosX = this.posX;
+ this.prevPosY = this.posY;
+ this.prevPosZ = this.posZ;
+
+ particleScale=0.2f+1.8f*particleAge/particleMaxAge;
+
+ if (this.particleAge++ >= this.particleMaxAge) {
+ this.setDead();
+ }
+ }
+
+ @Override
+ public int getFXLayer() {
+ return 2;
+ }
+
+ @Override
+ public void setParticleTextureIndex(int p_70536_1_) {
+ this.particleTextureIndexX = p_70536_1_ % 16;
+ this.particleTextureIndexY = p_70536_1_ / 16;
+ }
+
+ @Override
+ public void renderParticle(Tessellator tessellator, float partialTick, float rotX, float rotXZ, float rotZ, float rotYZ, float rotXY) {
+ float f10 = 0.2F * this.particleScale;
+ float f6 = particleIcon.getMinU() + (particleTextureIndexX) / 128.f;
+ float f7 = f6 + 4f / 128.0f;
+ float f8 = particleIcon.getMinV() + (2 * particleTextureIndexY) / 128.f;
+ float f9 = f8 + 4f / 128.0f;
+
+ float f11 = (float) (this.prevPosX - interpPosX);
+ float f12 = (float) (this.prevPosY - interpPosY);
+ float f13 = (float) (this.prevPosZ - interpPosZ);
+
+ tessellator.setColorRGBA_F(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha);
+ tessellator.addVertexWithUV(f11 + f10 * plane[0][0], f12 + f10 * plane[0][1], f13 + f10 * plane[0][2], f7, f9);
+ tessellator.addVertexWithUV(f11 + f10 * plane[1][0], f12 + f10 * plane[1][1], f13 + f10 * plane[1][2], f7, f8);
+ tessellator.addVertexWithUV(f11 + f10 * plane[2][0], f12 + f10 * plane[2][1], f13 + f10 * plane[2][2], f6, f8);
+ tessellator.addVertexWithUV(f11 + f10 * plane[3][0], f12 + f10 * plane[3][1], f13 + f10 * plane[3][2], f6, f9);
+ tessellator.draw();
+ tessellator.startDrawingQuads();
+ tessellator.addVertexWithUV(f11 + f10 * plane[3][0], f12 + f10 * plane[3][1], f13 + f10 * plane[3][2], f6, f9);
+ tessellator.addVertexWithUV(f11 + f10 * plane[2][0], f12 + f10 * plane[2][1], f13 + f10 * plane[2][2], f6, f8);
+ tessellator.addVertexWithUV(f11 + f10 * plane[1][0], f12 + f10 * plane[1][1], f13 + f10 * plane[1][2], f7, f8);
+ tessellator.addVertexWithUV(f11 + f10 * plane[0][0], f12 + f10 * plane[0][1], f13 + f10 * plane[0][2], f7, f9);
+ }
+
+ @Override
+ protected void fall(float p_70069_1_) {}
+
+ @Override
+ public boolean isWet() {
+ return false;
+ }
+
+ @Override
+ public boolean isInWater()
+ {
+ return false;
+ }
+
+ @Override
+ public boolean handleWaterMovement() {
+ return false;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/particle/EntityVortexFX.class b/src/main/java/jp/plusplus/fbs/particle/EntityVortexFX.class Binary files differnew file mode 100644 index 0000000..2358d1d --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/particle/EntityVortexFX.class diff --git a/src/main/java/jp/plusplus/fbs/particle/EntityVortexFX.java b/src/main/java/jp/plusplus/fbs/particle/EntityVortexFX.java new file mode 100644 index 0000000..95e85ae --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/particle/EntityVortexFX.java @@ -0,0 +1,75 @@ +package jp.plusplus.fbs.particle;
+
+import net.minecraft.client.particle.EntityFX;
+import net.minecraft.client.renderer.Tessellator;
+import net.minecraft.util.MathHelper;
+import net.minecraft.world.World;
+
+/**
+ * Created by plusplus_F on 2015/10/18.
+ */
+public class EntityVortexFX extends EntityFX{
+ public static final double spd=0.4;
+
+ protected int delay;
+ protected float spinPitch;
+ protected float spinYaw;
+ protected float radius;
+ protected double firstX, firstY, firstZ;
+
+ public EntityVortexFX(World w, double x, double y, double z, int d, double r, float red, float green, float blue, float scale) {
+ super(w, x, y, z);
+ firstX=x;
+ firstY=y;
+ firstZ=z;
+ rotationPitch=2*(float)Math.PI*rand.nextFloat();
+ rotationYaw=2*(float)Math.PI*rand.nextFloat();
+
+ float a=2*(float)Math.PI*rand.nextFloat();
+ spinPitch=2*(float)Math.PI/9.f* MathHelper.cos(a);
+ spinYaw=2*(float)Math.PI/9.f* MathHelper.sin(a);
+
+ delay=d;
+ radius=0;
+ particleRed=red;
+ particleGreen=green;
+ particleBlue=blue;
+ particleAlpha=0.f;
+ particleScale=scale;
+ particleMaxAge=MathHelper.floor_double(r/spd)+delay;
+ this.noClip = false;
+
+ this.setParticleTextureIndex(65);
+ this.onUpdate();
+ }
+
+ @Override
+ public void onUpdate() {
+ this.prevPosX = this.posX;
+ this.prevPosY = this.posY;
+ this.prevPosZ = this.posZ;
+
+ if (this.particleAge++ >= this.particleMaxAge) {
+ this.setDead();
+ }
+
+ if(particleAge>=delay){
+ //座標の決定
+ posX=firstX-radius*MathHelper.cos(-rotationPitch)*MathHelper.sin(-rotationYaw);
+ posY=firstY+radius*MathHelper.sin(-rotationPitch);
+ posZ=firstZ-radius*MathHelper.cos(-rotationPitch)*MathHelper.cos(-rotationYaw);
+
+ rotationPitch+=spinPitch;
+ rotationYaw+=spinYaw;
+ radius+=spd;
+
+ particleAlpha=1.f;
+ }
+ }
+
+ @Override
+ public void renderParticle(Tessellator p_70539_1_, float p_70539_2_, float p_70539_3_, float p_70539_4_, float p_70539_5_, float p_70539_6_, float p_70539_7_) {
+ if(particleAge<delay) return;
+ super.renderParticle(p_70539_1_, p_70539_2_, p_70539_3_, p_70539_4_, p_70539_5_, p_70539_6_, p_70539_7_);
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/potion/PotionCleverness.class b/src/main/java/jp/plusplus/fbs/potion/PotionCleverness.class Binary files differnew file mode 100644 index 0000000..24d9048 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/potion/PotionCleverness.class diff --git a/src/main/java/jp/plusplus/fbs/potion/PotionCleverness.java b/src/main/java/jp/plusplus/fbs/potion/PotionCleverness.java new file mode 100644 index 0000000..185cf9e --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/potion/PotionCleverness.java @@ -0,0 +1,42 @@ +package jp.plusplus.fbs.potion;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.render.RendererGameOverlay;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.potion.Potion;
+import net.minecraft.potion.PotionEffect;
+import net.minecraft.util.ResourceLocation;
+
+/**
+ * Created by plusplus_F on 2015/11/09.
+ */
+public class PotionCleverness extends Potion {
+ public PotionCleverness(int id) {
+ super(id, false, 0xbb00bb);
+ setPotionName("potions.fbs.cleverness");
+ }
+
+ @Override
+ public void performEffect(EntityLivingBase p_76394_1_, int p_76394_2_) {
+
+ }
+
+ @Override
+ public void affectEntity(EntityLivingBase shooter, EntityLivingBase target, int lv, double effect) {
+
+ }
+
+ @SideOnly(Side.CLIENT)
+ public boolean hasStatusIcon() {
+ return false;
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void renderInventoryEffect(int x, int y, PotionEffect effect, net.minecraft.client.Minecraft mc) {
+ mc.renderEngine.bindTexture(RendererGameOverlay.icons);
+ mc.currentScreen.drawTexturedModalRect(x+6,y+7, 18, 16, 18, 18);
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/potion/PotionContract.class b/src/main/java/jp/plusplus/fbs/potion/PotionContract.class Binary files differnew file mode 100644 index 0000000..701929c --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/potion/PotionContract.class diff --git a/src/main/java/jp/plusplus/fbs/potion/PotionContract.java b/src/main/java/jp/plusplus/fbs/potion/PotionContract.java new file mode 100644 index 0000000..601c50a --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/potion/PotionContract.java @@ -0,0 +1,43 @@ +package jp.plusplus.fbs.potion;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.render.RendererGameOverlay;
+import net.minecraft.client.renderer.InventoryEffectRenderer;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.potion.Potion;
+import net.minecraft.potion.PotionEffect;
+import net.minecraft.util.ResourceLocation;
+
+/**
+ * Created by plusplus_F on 2015/11/09.
+ */
+public class PotionContract extends Potion {
+ public PotionContract(int id) {
+ super(id, false, 0xffffff);
+ setPotionName("potions.fbs.contract");
+ }
+
+ @Override
+ public void performEffect(EntityLivingBase p_76394_1_, int p_76394_2_) {
+
+ }
+
+ @Override
+ public void affectEntity(EntityLivingBase shooter, EntityLivingBase target, int lv, double effect) {
+
+ }
+
+ @SideOnly(Side.CLIENT)
+ public boolean hasStatusIcon() {
+ return false;
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void renderInventoryEffect(int x, int y, PotionEffect effect, net.minecraft.client.Minecraft mc) {
+ mc.renderEngine.bindTexture(RendererGameOverlay.icons);
+ mc.currentScreen.drawTexturedModalRect(x+6,y+7, 0, 16, 18, 18);
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/potion/PotionHailstorm.class b/src/main/java/jp/plusplus/fbs/potion/PotionHailstorm.class Binary files differnew file mode 100644 index 0000000..a49485e --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/potion/PotionHailstorm.class diff --git a/src/main/java/jp/plusplus/fbs/potion/PotionHailstorm.java b/src/main/java/jp/plusplus/fbs/potion/PotionHailstorm.java new file mode 100644 index 0000000..ca9fd4b --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/potion/PotionHailstorm.java @@ -0,0 +1,41 @@ +package jp.plusplus.fbs.potion;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.render.RendererGameOverlay;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.potion.Potion;
+import net.minecraft.potion.PotionEffect;
+
+/**
+ * Created by plusplus_F on 2016/03/18.
+ */
+public class PotionHailstorm extends Potion {
+ public PotionHailstorm(int id) {
+ super(id, false, 0x000000);
+ setPotionName("potions.fbs.hailstorm");
+ }
+
+ @Override
+ public void performEffect(EntityLivingBase p_76394_1_, int p_76394_2_) {
+
+ }
+
+ @Override
+ public void affectEntity(EntityLivingBase shooter, EntityLivingBase target, int lv, double effect) {
+
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public boolean hasStatusIcon() {
+ return false;
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void renderInventoryEffect(int x, int y, PotionEffect effect, net.minecraft.client.Minecraft mc) {
+ mc.renderEngine.bindTexture(RendererGameOverlay.icons);
+ mc.currentScreen.drawTexturedModalRect(x+6,y+7, 0, 34, 18, 18);
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/potion/PotionMagnet.class b/src/main/java/jp/plusplus/fbs/potion/PotionMagnet.class Binary files differnew file mode 100644 index 0000000..35b1853 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/potion/PotionMagnet.class diff --git a/src/main/java/jp/plusplus/fbs/potion/PotionMagnet.java b/src/main/java/jp/plusplus/fbs/potion/PotionMagnet.java new file mode 100644 index 0000000..68743f7 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/potion/PotionMagnet.java @@ -0,0 +1,41 @@ +package jp.plusplus.fbs.potion;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.render.RendererGameOverlay;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.potion.Potion;
+import net.minecraft.potion.PotionEffect;
+
+/**
+ * Created by plusplus_F on 2016/03/18.
+ */
+public class PotionMagnet extends Potion {
+ public PotionMagnet(int id) {
+ super(id, false, 0x000000);
+ setPotionName("potions.fbs.hailstorm");
+ }
+
+ @Override
+ public void performEffect(EntityLivingBase p_76394_1_, int p_76394_2_) {
+
+ }
+
+ @Override
+ public void affectEntity(EntityLivingBase shooter, EntityLivingBase target, int lv, double effect) {
+
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public boolean hasStatusIcon() {
+ return false;
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void renderInventoryEffect(int x, int y, PotionEffect effect, net.minecraft.client.Minecraft mc) {
+ mc.renderEngine.bindTexture(RendererGameOverlay.icons);
+ mc.currentScreen.drawTexturedModalRect(x+6,y+7, 0, 34, 18, 18);
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/pottery/BlockJar.class b/src/main/java/jp/plusplus/fbs/pottery/BlockJar.class Binary files differnew file mode 100644 index 0000000..b0df811 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/BlockJar.class diff --git a/src/main/java/jp/plusplus/fbs/pottery/BlockJar.java b/src/main/java/jp/plusplus/fbs/pottery/BlockJar.java new file mode 100644 index 0000000..6d25d6f --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/BlockJar.java @@ -0,0 +1,37 @@ +package jp.plusplus.fbs.pottery;
+
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.pottery.model.ModelJarLarge;
+import net.minecraft.client.model.ModelBase;
+import net.minecraft.util.ResourceLocation;
+
+/**
+ * Created by plusplus_F on 2015/08/26.
+ */
+public abstract class BlockJar extends BlockPotteryBase {
+ public static final ResourceLocation rlSmall =new ResourceLocation(FBS.MODID+":textures/models/pot00.png");
+ public static final ResourceLocation rlMedium =new ResourceLocation(FBS.MODID+":textures/models/pot00.png");
+ public static final ResourceLocation rlLarge=new ResourceLocation(FBS.MODID+":textures/models/pot00.png");
+ public static final ModelJarLarge mjLarge=new ModelJarLarge();
+
+ public BlockJar(int value) {
+ super("jar", value);
+ }
+
+
+ @Override
+ public ResourceLocation getResourceLocation(int metadata) {
+ metadata=((metadata>>12)&0xf);
+ if(metadata==0) return rlSmall;
+ else if(metadata==1) return rlMedium;
+ else return rlLarge;
+ }
+
+ @Override
+ public ModelBase getModel(int metadata) {
+ metadata=((metadata>>8)&0xf);
+ if(metadata==0) return mjLarge;
+ else if(metadata==1) return mjLarge;
+ else return mjLarge;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/pottery/BlockKiln.class b/src/main/java/jp/plusplus/fbs/pottery/BlockKiln.class Binary files differnew file mode 100644 index 0000000..b100d27 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/BlockKiln.class diff --git a/src/main/java/jp/plusplus/fbs/pottery/BlockKiln.java b/src/main/java/jp/plusplus/fbs/pottery/BlockKiln.java new file mode 100644 index 0000000..b73d120 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/BlockKiln.java @@ -0,0 +1,215 @@ +package jp.plusplus.fbs.pottery;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.block.BlockBase;
+import jp.plusplus.fbs.block.BlockCore;
+import net.minecraft.block.Block;
+import net.minecraft.block.ITileEntityProvider;
+import net.minecraft.block.material.Material;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.item.EntityItem;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.IIcon;
+import net.minecraft.util.MathHelper;
+import net.minecraft.world.World;
+
+import java.util.Random;
+
+/**
+ * Created by pluslus_F on 2015/08/29.
+ */
+public class BlockKiln extends BlockBase implements ITileEntityProvider{
+ private IIcon iconFTop;
+ private IIcon iconFBottom;
+ private IIcon iconFSide;
+ private boolean isActive;
+ private static boolean dontDrop;
+
+ public BlockKiln(boolean flag) {
+ super(Material.rock);
+ isActive=flag;
+ setBlockName("kiln");
+ setBlockTextureName("kiln" + (isActive ? "Active" : ""));
+ setHardness(3.5F);
+ setStepSound(soundTypePiston);
+ setCreativeTab(FBS.tabPottery);
+ infoName="kiln";
+ infoRow=1;
+ }
+
+ @Override
+ public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
+ return new TileEntityKiln();
+ }
+ @Override
+ public boolean canPlaceTorchOnTop(World par1World, int par2, int par3, int par4){
+ return false;
+ }
+
+ @Override
+ public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
+ TileEntity e=par1World.getTileEntity(par2, par3, par4);
+ if(!par1World.isRemote && e instanceof TileEntityKiln){
+ par5EntityPlayer.openGui(FBS.instance, -1, par1World, par2, par3, par4);
+ }
+ return true;
+ }
+ public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack item) {
+ int l = MathHelper.floor_double((double) (entity.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
+
+ if (l == 0) {
+ world.setBlockMetadataWithNotify(x, y, z, 2, 2);
+ }
+
+ if (l == 1) {
+ world.setBlockMetadataWithNotify(x, y, z, 5, 2);
+ }
+
+ if (l == 2) {
+ world.setBlockMetadataWithNotify(x, y, z, 3, 2);
+ }
+
+ if (l == 3) {
+ world.setBlockMetadataWithNotify(x, y, z, 4, 2);
+ }
+ }
+
+ @Override
+ public void breakBlock(World world, int x, int y, int z, Block block, int par6) {
+ if (!dontDrop) {
+ TileEntity tileentity = world.getTileEntity(x, y, z);
+
+ if(tileentity==null){
+ super.breakBlock(world, x, y, z, block, par6);
+ return;
+ }
+
+ if(tileentity instanceof IInventory){
+ IInventory inv=(IInventory)tileentity;
+
+ for (int j1 = 0; j1 < inv.getSizeInventory(); j1++){
+ ItemStack itemstack = inv.getStackInSlot(j1);
+
+ if (itemstack != null){
+ float f = this.rand.nextFloat() * 0.8F + 0.1F;
+ float f1 = this.rand.nextFloat() * 0.8F + 0.1F;
+ float f2 = this.rand.nextFloat() * 0.8F + 0.1F;
+
+ while (itemstack.stackSize > 0){
+ int k1 = this.rand.nextInt(21) + 10;
+
+ if (k1 > itemstack.stackSize){
+ k1 = itemstack.stackSize;
+ }
+
+ itemstack.stackSize -= k1;
+ EntityItem entityitem = new EntityItem(world, (double)((float)x + f), (double)((float)y + f1), (double)((float)z + f2), new ItemStack(itemstack.getItem(), k1, itemstack.getItemDamage()));
+
+ if (itemstack.hasTagCompound()){
+ entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy());
+ }
+
+ float f3 = 0.05F;
+ entityitem.motionX = (double)((float)this.rand.nextGaussian() * f3);
+ entityitem.motionY = (double)((float)this.rand.nextGaussian() * f3 + 0.2F);
+ entityitem.motionZ = (double)((float)this.rand.nextGaussian() * f3);
+ world.spawnEntityInWorld(entityitem);
+ }
+ }
+ }
+ //par1World.func_96440_m(x, y, z, block);
+ }
+ }
+
+ if (hasTileEntity(par6)){
+ world.removeTileEntity(x,y,z);
+ }
+ }
+
+ public static void updateFurnaceBlockState(boolean s, World world, int x, int y, int z) {
+ int l = world.getBlockMetadata(x, y, z);
+ TileEntity tileentity = world.getTileEntity(x, y, z);
+ dontDrop = true;
+
+ if (s) {
+ world.setBlock(x, y, z, BlockCore.kilnActive);
+ } else {
+ world.setBlock(x, y, z, BlockCore.kiln);
+ }
+
+ dontDrop = false;
+ world.setBlockMetadataWithNotify(x, y, z, l, 2);
+
+ if (tileentity != null) {
+ tileentity.validate();
+ world.setTileEntity(x, y, z, tileentity);
+ }
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void randomDisplayTick(World world, int x, int y, int z, Random p_149734_5_) {
+ if (isActive) {
+ int l = world.getBlockMetadata(x, y, z);
+ float f = (float) x + 0.5F;
+ float f1 = (float) y + 0.0F + p_149734_5_.nextFloat() * 6.0F / 16.0F;
+ float f2 = (float) z + 0.5F;
+ float f3 = 0.52F;
+ float f4 = p_149734_5_.nextFloat() * 0.6F - 0.3F;
+
+ if (l == 4) {
+ world.spawnParticle("smoke", (double) (f - f3), (double) f1, (double) (f2 + f4), 0.0D, 0.0D, 0.0D);
+ world.spawnParticle("flame", (double) (f - f3), (double) f1, (double) (f2 + f4), 0.0D, 0.0D, 0.0D);
+ } else if (l == 5) {
+ world.spawnParticle("smoke", (double) (f + f3), (double) f1, (double) (f2 + f4), 0.0D, 0.0D, 0.0D);
+ world.spawnParticle("flame", (double) (f + f3), (double) f1, (double) (f2 + f4), 0.0D, 0.0D, 0.0D);
+ } else if (l == 2) {
+ world.spawnParticle("smoke", (double) (f + f4), (double) f1, (double) (f2 - f3), 0.0D, 0.0D, 0.0D);
+ world.spawnParticle("flame", (double) (f + f4), (double) f1, (double) (f2 - f3), 0.0D, 0.0D, 0.0D);
+ } else if (l == 3) {
+ world.spawnParticle("smoke", (double) (f + f4), (double) f1, (double) (f2 + f3), 0.0D, 0.0D, 0.0D);
+ world.spawnParticle("flame", (double) (f + f4), (double) f1, (double) (f2 + f3), 0.0D, 0.0D, 0.0D);
+ }
+ }
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void registerBlockIcons(IIconRegister p_149651_1_) {
+ super.registerBlockIcons(p_149651_1_);
+ iconFTop = p_149651_1_.registerIcon("furnace_top");
+ iconFBottom = p_149651_1_.registerIcon("furnace_top");
+ iconFSide = p_149651_1_.registerIcon("furnace_side");
+ }
+ @Override
+ public IIcon getIcon(int side, int meta){
+ if(side==0) return iconFBottom;
+ if(side==1) return iconFTop;
+ if(side==meta) return blockIcon;
+ return iconFSide;
+ }
+
+ @Override
+ public int getRenderType(){
+ return FBS.renderDirectionalId;
+ }
+ @Override
+ public boolean renderAsNormalBlock(){
+ return false;
+ }
+
+ public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_){
+ return Item.getItemFromBlock(BlockCore.kiln);
+ }
+
+ @SideOnly(Side.CLIENT)
+ public Item getItem(World p_149694_1_, int p_149694_2_, int p_149694_3_, int p_149694_4_) {
+ return Item.getItemFromBlock(BlockCore.kiln);
+ }
+}
\ No newline at end of file diff --git a/src/main/java/jp/plusplus/fbs/pottery/BlockPot.class b/src/main/java/jp/plusplus/fbs/pottery/BlockPot.class Binary files differnew file mode 100644 index 0000000..be0a92e --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/BlockPot.class diff --git a/src/main/java/jp/plusplus/fbs/pottery/BlockPot.java b/src/main/java/jp/plusplus/fbs/pottery/BlockPot.java new file mode 100644 index 0000000..3ff357d --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/BlockPot.java @@ -0,0 +1,127 @@ +package jp.plusplus.fbs.pottery;
+
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.api.IPottery;
+import jp.plusplus.fbs.pottery.model.ModelPotLarge;
+import jp.plusplus.fbs.pottery.model.ModelPotMedium;
+import jp.plusplus.fbs.pottery.model.ModelPotSmall;
+import jp.plusplus.fbs.pottery.usable.PotteryBase;
+import net.minecraft.client.model.ModelBase;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.ResourceLocation;
+
+import java.util.ArrayList;
+import java.util.Random;
+
+/**
+ * Created by plusplus_F on 2015/08/26.
+ */
+public class BlockPot extends BlockPotteryBase {
+ public static final ResourceLocation rlSmall =new ResourceLocation(FBS.MODID+":textures/models/PotSmall.png");
+ public static final ResourceLocation rlMedium =new ResourceLocation(FBS.MODID+":textures/models/PotMedium.png");
+ public static final ResourceLocation rlMedium1 =new ResourceLocation(FBS.MODID+":textures/models/PotMedium1.png");
+ public static final ResourceLocation rlLarge[]=new ResourceLocation[]{
+ new ResourceLocation(FBS.MODID+":textures/models/PotLarge0.png"),
+ new ResourceLocation(FBS.MODID+":textures/models/PotLarge1.png"),
+ new ResourceLocation(FBS.MODID+":textures/models/PotLarge2.png"),
+ new ResourceLocation(FBS.MODID+":textures/models/PotLarge3.png")
+ };
+ public static final ModelPotSmall[] mpSmall=new ModelPotSmall[]{
+ new ModelPotSmall(0), new ModelPotSmall(6), new ModelPotSmall(12), new ModelPotSmall(18)
+ };
+ public static final ModelPotMedium[] mpMedium=new ModelPotMedium[]{
+ new ModelPotMedium(0), new ModelPotMedium(9), new ModelPotMedium(18)
+ };
+ public static final ModelPotLarge mpLarge=new ModelPotLarge();
+
+ public static final String[] EFFECTS={
+ "pottery.fbs.pot.keep",
+ "pottery.fbs.pot.senaka",
+ "pottery.fbs.pot.void",
+ "pottery.fbs.pot.change",
+ "pottery.fbs.pot.monster",
+ "pottery.fbs.pot.lottery",
+ "pottery.fbs.pot.taboo",
+ "pottery.fbs.pot.unbreakable",
+ "pottery.fbs.pot.enchant",
+ "pottery.fbs.pot.taboo",
+ "pottery.fbs.pot.furnace",
+ "pottery.fbs.pot.appraisal"
+ };
+
+ public BlockPot(int value) {
+ super("pot", value);
+ textureName="flower_pot";
+ }
+
+ @Override
+ public ResourceLocation getResourceLocation(int metadata) {
+ int pat=metadata&0xf;
+ PotterySize size=PotterySize.Get((metadata>>4)&3);
+
+ if(pat<0) pat=0;
+
+ if(size==PotterySize.SMALL) return rlSmall;
+ if(size==PotterySize.MEDIUM) return pat>=3?rlMedium1:rlMedium;
+ return rlLarge[pat%rlLarge.length];
+ }
+
+ @Override
+ public ModelBase getModel(int metadata) {
+ int pat=metadata&0xf;
+ PotterySize size=PotterySize.Get((metadata >> 4) & 3);
+
+ if(pat<0) pat=0;
+
+ if(size==PotterySize.SMALL) return mpSmall[pat%mpSmall.length];
+ if(size==PotterySize.MEDIUM) return mpMedium[pat%mpMedium.length];
+ return mpLarge;
+ }
+
+ @Override
+ public ItemStack getEnchantedItemStack(ItemStack itemStack, Random rand){
+ ItemBlockPottery ipub=(ItemBlockPottery) Item.getItemFromBlock(this);
+
+ ItemStack ret=new ItemStack(ipub, itemStack.stackSize, itemStack.getItemDamage());
+ ret.setTagCompound((NBTTagCompound)itemStack.getTagCompound().copy());
+
+ setEffect(ret, true);
+ int id=PotteryRegistry.getPotteryEffectId(EFFECTS[rand.nextInt(EFFECTS.length)]);
+ ret.getTagCompound().setInteger(EFFECT_ID, id);
+ PotteryBase pb=PotteryRegistry.getPotteryEffect(id);
+ pb.onBaked(ret);
+
+ return ret;
+ }
+
+ @Override
+ public ArrayList<ItemStack> getAllPattern() {
+ ArrayList<ItemStack> list = super.getAllPattern();
+
+ for (int i = 0; i < EFFECTS.length; i++) {
+ for (int k = 0; k < 3; k++) {
+ int id=PotteryRegistry.getPotteryEffectId(EFFECTS[i]);
+
+ NBTTagCompound nbt = new NBTTagCompound();
+ nbt.setByte("state", IPottery.PotteryState.BAKED.getValue());
+ nbt.setByte("grade", (byte) 1);
+ nbt.setByte("size", (byte) k);
+ nbt.setByte("pattern", (byte) 0);
+ nbt.setInteger(EFFECT_ID, id);
+
+ ItemStack tmp = new ItemStack(this, 1, getMetadata(nbt));
+ tmp.setTagCompound(nbt);
+ setEffect(tmp, true);
+
+ PotteryRegistry.getPotteryEffect(id).onBaked(tmp);
+
+ list.add(tmp);
+ }
+ }
+
+ return list;
+ }
+
+}
diff --git a/src/main/java/jp/plusplus/fbs/pottery/BlockPottersWheel.class b/src/main/java/jp/plusplus/fbs/pottery/BlockPottersWheel.class Binary files differnew file mode 100644 index 0000000..28c8af1 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/BlockPottersWheel.class diff --git a/src/main/java/jp/plusplus/fbs/pottery/BlockPottersWheel.java b/src/main/java/jp/plusplus/fbs/pottery/BlockPottersWheel.java new file mode 100644 index 0000000..6b61887 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/BlockPottersWheel.java @@ -0,0 +1,150 @@ +package jp.plusplus.fbs.pottery;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.block.BlockBase;
+import net.minecraft.block.Block;
+import net.minecraft.block.ITileEntityProvider;
+import net.minecraft.block.material.Material;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.entity.item.EntityItem;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.AxisAlignedBB;
+import net.minecraft.util.IIcon;
+import net.minecraft.world.IBlockAccess;
+import net.minecraft.world.World;
+
+/**
+ * Createdby pluslus_Fon 2015/06/14.
+ */
+public class BlockPottersWheel extends BlockBase implements ITileEntityProvider {
+ private IIcon iconFTop;
+ private IIcon iconFBottom;
+
+ public BlockPottersWheel() {
+ super(Material.rock);
+ setBlockName("pottersWheel");
+ setBlockTextureName("pottersWheel");
+ setHardness(3.5F);
+ setStepSound(soundTypeWood);
+ setCreativeTab(FBS.tabPottery);
+ infoName = "pottersWheel";
+ infoRow = 1;
+ }
+
+ @Override
+ public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
+ return new TileEntityPottersWheel();
+ }
+
+ @Override
+ public boolean canPlaceTorchOnTop(World par1World, int par2, int par3, int par4) {
+ return false;
+ }
+
+ @Override
+ public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
+ TileEntity e = par1World.getTileEntity(par2, par3, par4);
+ if (!par1World.isRemote) {
+ par5EntityPlayer.openGui(FBS.instance, -1, par1World, par2, par3, par4);
+ }
+ return true;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void registerBlockIcons(IIconRegister p_149651_1_) {
+ blockIcon = p_149651_1_.registerIcon(FBS.MODID + ":pottersWheelSide");
+ iconFTop = p_149651_1_.registerIcon("stonebrick_carved");
+ iconFBottom = p_149651_1_.registerIcon("furnace_top");
+ }
+
+ @Override
+ public IIcon getIcon(int side, int meta) {
+ if (side == 0) return iconFBottom;
+ if (side == 1) return iconFTop;
+ return blockIcon;
+ }
+
+ @Override
+ public int getRenderType(){
+ return FBS.renderPottersWheelId;
+ }
+ @Override
+ public boolean renderAsNormalBlock(){
+ return false;
+ }
+ @Override
+ public boolean isOpaqueCube() {
+ return false;
+ }
+ @SideOnly(Side.CLIENT)
+ public boolean shouldSideBeRendered(IBlockAccess p_149646_1_, int p_149646_2_, int p_149646_3_, int p_149646_4_, int p_149646_5_) {
+ return true;
+ }
+
+ @Override
+ public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) {
+ setBlockBounds(0,0,0,1,12.0f/16.0f,1);
+ }
+
+ @Override
+ public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int x, int y, int z) {
+ return AxisAlignedBB.getBoundingBox(x,y,z, x+1, y+12.0/16.0, z+1);
+ }
+
+ @Override
+ public void breakBlock(World world, int x, int y, int z, Block block, int par6) {
+ TileEntity tileentity = world.getTileEntity(x, y, z);
+
+ if (tileentity == null) {
+ super.breakBlock(world, x, y, z, block, par6);
+ return;
+ }
+
+ if (tileentity instanceof IInventory) {
+ IInventory inv = (IInventory) tileentity;
+
+ for (int j1 = 0; j1 < inv.getSizeInventory(); j1++) {
+ if(j1==25) continue;
+ ItemStack itemstack = inv.getStackInSlot(j1);
+
+ if (itemstack != null) {
+ float f = this.rand.nextFloat() * 0.8F + 0.1F;
+ float f1 = this.rand.nextFloat() * 0.8F + 0.1F;
+ float f2 = this.rand.nextFloat() * 0.8F + 0.1F;
+
+ while (itemstack.stackSize > 0) {
+ int k1 = this.rand.nextInt(21) + 10;
+
+ if (k1 > itemstack.stackSize) {
+ k1 = itemstack.stackSize;
+ }
+
+ itemstack.stackSize -= k1;
+ EntityItem entityitem = new EntityItem(world, (double) ((float) x + f), (double) ((float) y + f1), (double) ((float) z + f2), new ItemStack(itemstack.getItem(), k1, itemstack.getItemDamage()));
+
+ if (itemstack.hasTagCompound()) {
+ entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy());
+ }
+
+ float f3 = 0.05F;
+ entityitem.motionX = (double) ((float) this.rand.nextGaussian() * f3);
+ entityitem.motionY = (double) ((float) this.rand.nextGaussian() * f3 + 0.2F);
+ entityitem.motionZ = (double) ((float) this.rand.nextGaussian() * f3);
+ world.spawnEntityInWorld(entityitem);
+ }
+ }
+ }
+ //par1World.func_96440_m(x, y, z, block);
+ }
+
+ if (hasTileEntity(par6)){
+ world.removeTileEntity(x, y, z);
+ }
+ }
+}
\ No newline at end of file diff --git a/src/main/java/jp/plusplus/fbs/pottery/BlockPotteryBase$1.class b/src/main/java/jp/plusplus/fbs/pottery/BlockPotteryBase$1.class Binary files differnew file mode 100644 index 0000000..35dcdd6 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/BlockPotteryBase$1.class diff --git a/src/main/java/jp/plusplus/fbs/pottery/BlockPotteryBase.class b/src/main/java/jp/plusplus/fbs/pottery/BlockPotteryBase.class Binary files differnew file mode 100644 index 0000000..6d5cd2f --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/BlockPotteryBase.class diff --git a/src/main/java/jp/plusplus/fbs/pottery/BlockPotteryBase.java b/src/main/java/jp/plusplus/fbs/pottery/BlockPotteryBase.java new file mode 100644 index 0000000..9c95030 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/BlockPotteryBase.java @@ -0,0 +1,361 @@ +package jp.plusplus.fbs.pottery;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.api.IPottery;
+import jp.plusplus.fbs.block.BlockBase;
+import jp.plusplus.fbs.block.BlockCore;
+import jp.plusplus.fbs.pottery.usable.PotteryBase;
+import net.minecraft.block.Block;
+import net.minecraft.block.ITileEntityProvider;
+import net.minecraft.block.material.Material;
+import net.minecraft.client.model.ModelBase;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.MovingObjectPosition;
+import net.minecraft.util.ResourceLocation;
+import net.minecraft.util.StatCollector;
+import net.minecraft.world.IBlockAccess;
+import net.minecraft.world.World;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Random;
+
+/**
+ * Created by plusplus_F on 2015/08/26.
+ *
+ * INT型8byteのうち、
+ * 0xVWXYZZ
+ * V:hasEffect
+ * W:state
+ * X:grade
+ * Y:size
+ * Z:pattern
+ *
+ */
+public abstract class BlockPotteryBase extends BlockBase implements IPottery,ITileEntityProvider{
+
+ public static final String EFFECT_ID ="PotteryID";
+ public String typeName;
+ public int baseValue;
+
+ public BlockPotteryBase(String t, int value) {
+ super(Material.glass);
+ typeName="pottery.fbs."+t;
+ baseValue=value;
+
+ setBlockName(t);
+ setBlockTextureName("flower_pot");
+ setCreativeTab(FBS.tabPottery);
+ }
+
+ @Override
+ public int getRenderType(){
+ return FBS.renderJarId;
+ }
+ @Override
+ public boolean renderAsNormalBlock(){
+ return false;
+ }
+ @Override
+ public boolean isOpaqueCube() {
+ return false;
+ }
+ @SideOnly(Side.CLIENT)
+ public boolean shouldSideBeRendered(IBlockAccess p_149646_1_, int p_149646_2_, int p_149646_3_, int p_149646_4_, int p_149646_5_) {
+ return true;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void getSubBlocks(Item item, CreativeTabs tab, List list) {
+ ArrayList<ItemStack> meta=getAllPattern();
+ for(ItemStack m : meta){
+ list.add(m);
+ }
+ }
+
+ @Override
+ public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
+ return new TileEntityPottery();
+ }
+
+ @Override
+ public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
+ ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
+
+ TileEntity entity=world.getTileEntity(x,y,z);
+ if(entity instanceof TileEntityPottery){
+ TileEntityPottery te=(TileEntityPottery)entity;
+ ItemStack item=new ItemStack(Item.getItemFromBlock(this), 1, te.getMetadata());
+ NBTTagCompound nbt=new NBTTagCompound();
+ te.writePotteryData(nbt);
+ item.setTagCompound(nbt);
+ ret.add(item);
+ }
+
+ return ret;
+ }
+
+ @Override
+ public void breakBlock(World world, int x, int y, int z, Block block, int p_149749_6_) {
+
+ TileEntity entity=world.getTileEntity(x,y,z);
+ if(entity instanceof TileEntityPottery){
+ TileEntityPottery te=(TileEntityPottery)entity;
+ dropBlockAsItemWithChance(world, x, y, z, te.getMetadata(), 1.0f, 0);
+ //ret.add(new ItemStack(Item.getItemFromBlock(this), 1, te.potteryMetadata));
+ }
+
+ //p_149749_1_.func_147480_a()
+ super.breakBlock(world, x, y, z, block, p_149749_6_);
+ }
+
+ @Override
+ public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player) {
+ TileEntity entity=world.getTileEntity(x,y,z);
+ if(entity instanceof TileEntityPottery){
+ TileEntityPottery te=(TileEntityPottery)entity;
+ ItemStack ret=new ItemStack(Item.getItemFromBlock(this), 1, te.getMetadata());
+ te.writePotteryData(getNBT(ret));
+ return ret;
+ }
+ return new ItemStack(Item.getItemFromBlock(this));
+ }
+
+ /**
+ * Gradeによる価格補正倍率を得る
+ * @param grade
+ * @return
+ */
+ public float getRateWithGrade(PotteryGrade grade){
+ float ext;
+ switch (grade){
+ case BAD: ext=0.75f; break;
+ case GOOD: ext=1.5f; break;
+ case GREAT: ext=4.0f; break;
+ case SOULFUL: ext=12.0f; break;
+ default: ext=1.f; break;
+ }
+ return ext;
+ }
+
+ /**
+ * Sizeによる価格補正倍率を得る
+ * @param size
+ * @return
+ */
+ public float getRateWithSize(PotterySize size){
+ float ext;
+ switch (size){
+ case SMALL: ext=0.5f; break;
+ case LARGE: ext=2.0f; break;
+ default: ext=1.f; break;
+ }
+ return ext;
+ }
+
+ public String getPrefixWithPattern(int pattern){
+ String str;
+ switch (pattern){
+ case 1: str=StatCollector.translateToLocal("pottery.fbs.linear"); break;
+ case 2: str=StatCollector.translateToLocal("pottery.fbs.mesh"); break;
+ case 3: str=StatCollector.translateToLocal("pottery.fbs.flower"); break;
+ default: str=StatCollector.translateToLocal("pottery.fbs.plain"); break;
+ }
+ return str;
+ }
+
+ //継承用
+ public String getPotteryName(NBTTagCompound nbt){
+ return StatCollector.translateToLocal(typeName);
+ }
+
+ public NBTTagCompound getNBT(ItemStack itemStack){
+ if(!itemStack.hasTagCompound()) itemStack.setTagCompound(new NBTTagCompound());
+ return itemStack.getTagCompound();
+ }
+
+ //------------------------------- IPottery ----------------------------------------
+ @Override
+ public ItemStack getItemStack(PotteryState state, PotteryGrade grade, PotterySize size, byte pattern, boolean hasEffect){
+ ItemStack dummy=new ItemStack(this);
+ setState(dummy, state);
+ setGrade(dummy, grade);
+ setSize(dummy, size);
+ setPattern(dummy, pattern);
+ setEffect(dummy, hasEffect);
+ dummy.setItemDamage(getMetadata(dummy.getTagCompound()));
+ return dummy;
+ }
+
+ @Override
+ public void setSize(ItemStack itemStack, PotterySize size){
+ NBTTagCompound nbt=getNBT(itemStack);
+ if(nbt.hasKey("size")) nbt.removeTag("size");
+ nbt.setByte("size", size.getValue());
+ }
+ @Override
+ public PotterySize getSize(NBTTagCompound nbt) {
+ if(!nbt.hasKey("size")) return PotterySize.MEDIUM;
+ return PotterySize.Get(nbt.getByte("size"));
+ }
+
+ @Override
+ public void setGrade(ItemStack itemStack, PotteryGrade grade){
+ NBTTagCompound nbt=getNBT(itemStack);
+ if(nbt.hasKey("grade")) nbt.removeTag("grade");
+ nbt.setByte("grade", grade.getValue());
+ }
+ @Override
+ public void setGrade(ItemStack itemStack, Random rand){
+ float r=rand.nextFloat();
+ PotteryGrade g;
+
+ if(r<=0.05f) g=PotteryGrade.SOULFUL;
+ else if(r<=0.05f+0.10f) g=PotteryGrade.GREAT;
+ else if(r<=0.15f+0.25f) g=PotteryGrade.GOOD;
+ else if(r<=0.40f+0.15f) g=PotteryGrade.BAD;
+ else g=PotteryGrade.NORMAL;
+
+ setGrade(itemStack, g);
+ }
+ @Override
+ public PotteryGrade getGrade(NBTTagCompound nbt){
+ if(!nbt.hasKey("grade")) return PotteryGrade.NORMAL;
+ return PotteryGrade.Get(nbt.getByte("grade"));
+ }
+
+ @Override
+ public void setPattern(ItemStack itemStack, byte pattern){
+ NBTTagCompound nbt=getNBT(itemStack);
+ nbt.setByte("pattern", pattern);
+ }
+ @Override
+ public byte getPattern(NBTTagCompound nbt){
+ if(!nbt.hasKey("pattern")) return 0;
+ return nbt.getByte("pattern");
+ }
+
+ @Override
+ public void setState(ItemStack itemStack, PotteryState state){
+ NBTTagCompound nbt=getNBT(itemStack);
+ if(nbt.hasKey("state")) nbt.removeTag("state");
+ nbt.setByte("state", state.getValue());
+ }
+ @Override
+ public PotteryState getState(NBTTagCompound nbt){
+ if(!nbt.hasKey("state")) return PotteryState.BAKED;
+ return PotteryState.Get(nbt.getByte("state"));
+ }
+
+ @Override
+ public void setEffect(ItemStack itemStack, boolean eff){
+ NBTTagCompound nbt=getNBT(itemStack);
+ if(nbt.hasKey("hasEffect")) nbt.removeTag("hasEffect");
+ nbt.setBoolean("hasEffect", eff);
+ }
+ @Override
+ public boolean hasEffect(NBTTagCompound nbt){
+ if(!nbt.hasKey("hasEffect")) return false;
+ return nbt.getBoolean("hasEffect");
+ }
+
+ @Override
+ public abstract ResourceLocation getResourceLocation(int metadata);
+
+ @Override
+ public abstract ModelBase getModel(int metadata);
+
+ @Override
+ public Block getBlockType() {
+ return this;
+ }
+
+ @Override
+ public int getDrySec(NBTTagCompound nbt){
+ PotterySize size=getSize(nbt);
+ if(size==PotterySize.SMALL) return 5*60;
+ if(size==PotterySize.LARGE) return 20*60;
+ return 12*60;
+ }
+
+ @Override
+ public int getMP(ItemStack itemStack) {
+ NBTTagCompound nbt=getNBT(itemStack);
+ if(getState(nbt)!=PotteryState.BAKED) return 0;
+ return (int)(getRateWithGrade(getGrade(nbt))*getRateWithSize(getSize(nbt))*baseValue);
+ }
+
+ @Override
+ public int getMetadata(NBTTagCompound nbt){
+ int meta=(nbt.getByte("pattern")%0xf);
+ meta=(meta|(nbt.getByte("state")<<6));
+ meta=(meta|(nbt.getByte("size")<<4));
+ meta=(meta|(nbt.getByte("grade")<<8));
+ return meta;
+ }
+
+ @Override
+ public String getLocalizedName(NBTTagCompound nbt) {
+ PotteryState state=getState(nbt);
+ String stString=PotteryState.GetLocalizedPrefix(state);
+ String grade=PotteryGrade.GetLocalizedPrefix(getGrade(nbt));
+ String size=PotterySize.GetLocalizedPrefix(getSize(nbt));
+ String pattern=getPrefixWithPattern(getPattern(nbt));
+
+ if(StatCollector.canTranslate("locale.fbs.jp")){
+ if(state==PotteryState.BAKED) return stString+grade+pattern+size;
+ return stString+pattern+size;
+ }
+ else{
+ if(state==PotteryState.BAKED) return (grade.isEmpty()?"":grade+" ")+pattern+" "+(size.isEmpty()?"":size+" ");
+ return stString+" "+pattern+" "+(size.isEmpty()?"":size+" ");
+ }
+ }
+
+ @Override
+ public ArrayList<ItemStack> getAllPattern() {
+ ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
+
+ for (int g = 1; g < 2; g++) {
+ for (int p = 0; p < 4; p++) {
+ for (int s = 0; s < 3; s++) {
+ NBTTagCompound nbt = new NBTTagCompound();
+ nbt.setByte("state", PotteryState.BAKED.getValue());
+ nbt.setByte("grade", (byte) g);
+ nbt.setByte("size", (byte) s);
+ nbt.setByte("pattern", (byte) p);
+
+ ItemStack tmp = new ItemStack(this, 1, getMetadata(nbt));
+ tmp.setTagCompound(nbt);
+ ret.add(tmp);
+ //ret.add(((g<<12)|(s<<8)|p));
+ }
+ }
+ }
+ return ret;
+ }
+
+ @Override
+ public float getCrashProbability(ItemStack itemStack){
+ NBTTagCompound nbt=BlockCore.pot.getNBT(itemStack);
+
+ //割れない壺は割れない
+ if(hasEffect(nbt) && getState(nbt)==PotteryState.BAKED){
+ PotteryBase pb=PotteryRegistry.getPotteryEffect(nbt.getInteger(EFFECT_ID));
+ if(pb.getUnlocalizedName().equals("pottery.fbs.pot.unbreakable")) return 0;
+ }
+
+ //壺の大きさで割れやすさが変わる
+ PotterySize size = getSize(nbt);
+ if (size == PotterySize.SMALL) return 0.05f;
+ if (size == PotterySize.LARGE) return 0.35f;
+ return 0.15f;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/pottery/GuiKiln.class b/src/main/java/jp/plusplus/fbs/pottery/GuiKiln.class Binary files differnew file mode 100644 index 0000000..d2ad30f --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/GuiKiln.class diff --git a/src/main/java/jp/plusplus/fbs/pottery/GuiKiln.java b/src/main/java/jp/plusplus/fbs/pottery/GuiKiln.java new file mode 100644 index 0000000..b11882c --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/GuiKiln.java @@ -0,0 +1,50 @@ +package jp.plusplus.fbs.pottery;
+
+import jp.plusplus.fbs.FBS;
+import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.client.resources.I18n;
+import net.minecraft.inventory.Container;
+import net.minecraft.util.ResourceLocation;
+import org.lwjgl.opengl.GL11;
+
+/**
+ * Createdby pluslus_Fon 2015/06/14.
+ */
+public class GuiKiln extends GuiContainer {
+ private TileEntityKiln entity;
+
+ public GuiKiln(Container p_i1072_1_, TileEntityKiln t) {
+ super(p_i1072_1_);
+ entity =t;
+ ySize=197;
+ }
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(int par1, int par2){
+ String s=entity.getInventoryName();
+ this.fontRendererObj.drawString(s, this.xSize / 2 - this.fontRendererObj.getStringWidth(s) / 2, 6, 0x404040);
+ this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 0x404040);
+ }
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float v, int i, int i1) {
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+
+ this.mc.getTextureManager().bindTexture(new ResourceLocation(FBS.MODID, "textures/gui/kiln.png"));
+
+ int k = (this.width - this.xSize) / 2;
+ int l = (this.height - this.ySize) / 2;
+ this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
+
+ if (entity.isBurning()) {
+ int ss = entity.getBurnTimeRemainingScaled(13);
+ this.drawTexturedModalRect(k + 81, l + 77 + 12 - ss, 176, 15+12 - ss, 14, ss + 1);
+
+ for(int n=0;n<9;n++){
+ if(entity.progress[n]>0){
+ ss=entity.getCookProgressScaled(n, 14);
+ this.drawTexturedModalRect(k+8+18*n, l+41+14-ss, 176, 14-ss, 16, ss+1);
+ }
+ }
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/pottery/GuiPottersWheel.class b/src/main/java/jp/plusplus/fbs/pottery/GuiPottersWheel.class Binary files differnew file mode 100644 index 0000000..ddf9a58 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/GuiPottersWheel.class diff --git a/src/main/java/jp/plusplus/fbs/pottery/GuiPottersWheel.java b/src/main/java/jp/plusplus/fbs/pottery/GuiPottersWheel.java new file mode 100644 index 0000000..15f23df --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/GuiPottersWheel.java @@ -0,0 +1,38 @@ +package jp.plusplus.fbs.pottery;
+
+import jp.plusplus.fbs.FBS;
+import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.client.resources.I18n;
+import net.minecraft.inventory.Container;
+import net.minecraft.util.ResourceLocation;
+import org.lwjgl.opengl.GL11;
+
+/**
+ * Createdby pluslus_Fon 2015/08/29.
+ */
+public class GuiPottersWheel extends GuiContainer {
+ private TileEntityPottersWheel entity;
+
+ public GuiPottersWheel(Container p_i1072_1_, TileEntityPottersWheel t) {
+ super(p_i1072_1_);
+ entity =t;
+ ySize=202;
+ }
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(int par1, int par2){
+ String s=entity.getInventoryName();
+ this.fontRendererObj.drawString(s, this.xSize / 2 - this.fontRendererObj.getStringWidth(s) / 2, 6, 0x404040);
+ this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 0x404040);
+ }
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float v, int i, int i1) {
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+
+ this.mc.getTextureManager().bindTexture(new ResourceLocation(FBS.MODID, "textures/gui/pottersWheel.png"));
+
+ int k = (this.width - this.xSize) / 2;
+ int l = (this.height - this.ySize) / 2;
+ this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/pottery/ItemBlockPottery.class b/src/main/java/jp/plusplus/fbs/pottery/ItemBlockPottery.class Binary files differnew file mode 100644 index 0000000..3070b3c --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/ItemBlockPottery.class diff --git a/src/main/java/jp/plusplus/fbs/pottery/ItemBlockPottery.java b/src/main/java/jp/plusplus/fbs/pottery/ItemBlockPottery.java new file mode 100644 index 0000000..d7ae5fd --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/ItemBlockPottery.java @@ -0,0 +1,118 @@ +package jp.plusplus.fbs.pottery;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.api.IPottery;
+import jp.plusplus.fbs.pottery.usable.PotteryBase;
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemBlock;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.IIcon;
+import net.minecraft.util.StatCollector;
+import net.minecraft.world.World;
+
+/**
+ * Created by plusplus_F on 2015/08/26.
+ * 陶芸品用
+ */
+public class ItemBlockPottery extends ItemBlock {
+ protected IPottery pottery;
+
+ public ItemBlockPottery(Block p_i45328_1_) {
+ super(p_i45328_1_);
+ setMaxDamage(0);
+ setHasSubtypes(true);
+ setMaxStackSize(1);
+
+ pottery=(IPottery)p_i45328_1_;
+ }
+
+ public static void setId(ItemStack itemStack, int id){
+ if(!itemStack.hasTagCompound()) itemStack.setTagCompound(new NBTTagCompound());
+ NBTTagCompound nbt=itemStack.getTagCompound();
+ nbt.setInteger(BlockPotteryBase.EFFECT_ID, id);
+ }
+
+ public static int getId(ItemStack itemStack){
+ if(!itemStack.hasTagCompound()) itemStack.setTagCompound(new NBTTagCompound());
+ NBTTagCompound nbt=itemStack.getTagCompound();
+ return nbt.getInteger(BlockPotteryBase.EFFECT_ID);
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public IIcon getIconFromDamage(int p_77617_1_)
+ {
+ return this.field_150939_a.getIcon(2, p_77617_1_);
+ }
+
+ @Override
+ public int getMetadata(int p_77647_1_)
+ {
+ return p_77647_1_;
+ }
+
+ @Override
+ public String getItemStackDisplayName(ItemStack itemStack) {
+ BlockPotteryBase bpb=(BlockPotteryBase)field_150939_a;
+ NBTTagCompound nbt=itemStack.getTagCompound();
+ if(nbt==null) return bpb.getLocalizedName();
+
+ if(pottery.hasEffect(nbt) && pottery.getState(nbt)==IPottery.PotteryState.BAKED){
+ PotteryBase pb=PotteryRegistry.getPotteryEffect(getId(itemStack));
+ return bpb.getLocalizedName(bpb.getNBT(itemStack))+StatCollector.translateToLocal(pb.getUnlocalizedName())+pb.getNameModifier(itemStack);
+ }
+ return bpb.getLocalizedName(bpb.getNBT(itemStack))+bpb.getLocalizedName();
+ }
+
+ @Override
+ public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer player) {
+ NBTTagCompound nbt=item.getTagCompound();
+
+ //魔法の壺の場合
+ if(pottery.hasEffect(nbt) && pottery.getState(nbt)==IPottery.PotteryState.BAKED){
+ PotteryBase pb=PotteryRegistry.getPotteryEffect(getId(item));
+ if (pb.canUse(player, item)) {
+ return pb.onUse(player, item);
+ }
+ return item;
+ }
+
+ return super.onItemRightClick(item, world, player);
+ }
+
+ @Override
+ public boolean onItemUse(ItemStack itemStack, EntityPlayer player, World world, int p_77648_4_, int p_77648_5_, int p_77648_6_, int p_77648_7_, float p_77648_8_, float p_77648_9_, float p_77648_10_) {
+ //魔法の壺は置けない
+ NBTTagCompound nbt=itemStack.getTagCompound();
+ if(pottery.hasEffect(nbt) && pottery.getState(nbt)==IPottery.PotteryState.BAKED){
+ return false;
+ }
+ return super.onItemUse(itemStack, player, world, p_77648_4_, p_77648_5_, p_77648_6_, p_77648_7_, p_77648_8_, p_77648_9_, p_77648_10_);
+ }
+
+ @Override
+ public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata) {
+ //魔法の壺は置けない
+ NBTTagCompound nbt=stack.getTagCompound();
+ if(pottery.hasEffect(nbt) && pottery.getState(nbt)==IPottery.PotteryState.BAKED){
+ return false;
+ }
+ else{
+ boolean flag=super.placeBlockAt(stack, player, world, x, y, z, side, hitX, hitY, hitZ, metadata);
+ if(flag){
+ TileEntity entity=world.getTileEntity(x,y,z);
+ if(entity instanceof TileEntityPottery){
+ TileEntityPottery te=(TileEntityPottery)entity;
+ te.setData(stack);
+ te.markDirty();
+ //((TileEntityPottery) te).potteryMetadata=metadata;
+ }
+ }
+ return flag;
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/pottery/PotteryRegistry$PotteryPair.class b/src/main/java/jp/plusplus/fbs/pottery/PotteryRegistry$PotteryPair.class Binary files differnew file mode 100644 index 0000000..401f561 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/PotteryRegistry$PotteryPair.class diff --git a/src/main/java/jp/plusplus/fbs/pottery/PotteryRegistry.class b/src/main/java/jp/plusplus/fbs/pottery/PotteryRegistry.class Binary files differnew file mode 100644 index 0000000..90f070f --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/PotteryRegistry.class diff --git a/src/main/java/jp/plusplus/fbs/pottery/PotteryRegistry.java b/src/main/java/jp/plusplus/fbs/pottery/PotteryRegistry.java new file mode 100644 index 0000000..8cc6ae7 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/PotteryRegistry.java @@ -0,0 +1,220 @@ +package jp.plusplus.fbs.pottery;
+
+import cpw.mods.fml.common.FMLLog;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.api.IPottery;
+import jp.plusplus.fbs.block.BlockCore;
+import jp.plusplus.fbs.item.ItemCore;
+import jp.plusplus.fbs.pottery.usable.*;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.Blocks;
+import net.minecraft.init.Items;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+
+import java.util.ArrayList;
+
+/**
+ * Created by plusplus_F on 2016/03/30.
+ */
+public class PotteryRegistry {
+ private static PotteryRegistry instance=new PotteryRegistry();
+
+ private ArrayList<PotteryPair> potteries=new ArrayList<PotteryRegistry.PotteryPair>();
+ private ArrayList<PotteryBase> potteryEffects=new ArrayList<PotteryBase>();
+ private PotteryBase cachedPotteryEffect;
+ public PotteryPair cachedPottery;
+
+
+ public static void register(){
+
+ //------------------------------------陶芸----------------------------------------------
+
+ RegisterPotteryCrafting(BlockCore.pot.getItemStack(IPottery.PotteryState.MOLDED, IPottery.PotteryGrade.NORMAL, IPottery.PotterySize.SMALL, (byte)0, false), "","",""," c c "," c ");
+ RegisterPotteryCrafting(BlockCore.pot.getItemStack(IPottery.PotteryState.MOLDED, IPottery.PotteryGrade.NORMAL, IPottery.PotterySize.SMALL, (byte)1, false), "","",""," csc "," c ");
+ RegisterPotteryCrafting(BlockCore.pot.getItemStack(IPottery.PotteryState.MOLDED, IPottery.PotteryGrade.NORMAL, IPottery.PotterySize.SMALL, (byte)2, false), "","",""," cbc "," c ");
+ RegisterPotteryCrafting(BlockCore.pot.getItemStack(IPottery.PotteryState.MOLDED, IPottery.PotteryGrade.NORMAL, IPottery.PotterySize.SMALL, (byte)3, false), "","",""," cfc "," c ");
+
+ RegisterPotteryCrafting(BlockCore.pot.getItemStack(IPottery.PotteryState.MOLDED, IPottery.PotteryGrade.NORMAL, IPottery.PotterySize.SMALL, (byte)0, true), "","",""," g g "," g ");
+ RegisterPotteryCrafting(BlockCore.pot.getItemStack(IPottery.PotteryState.MOLDED, IPottery.PotteryGrade.NORMAL, IPottery.PotterySize.SMALL, (byte)1, true), "","",""," gsg "," g ");
+ RegisterPotteryCrafting(BlockCore.pot.getItemStack(IPottery.PotteryState.MOLDED, IPottery.PotteryGrade.NORMAL, IPottery.PotterySize.SMALL, (byte)2, true), "","",""," gbg "," g ");
+ RegisterPotteryCrafting(BlockCore.pot.getItemStack(IPottery.PotteryState.MOLDED, IPottery.PotteryGrade.NORMAL, IPottery.PotterySize.SMALL, (byte)3, true), "","",""," gfg "," g ");
+
+ RegisterPotteryCrafting(BlockCore.pot.getItemStack(IPottery.PotteryState.MOLDED, IPottery.PotteryGrade.NORMAL, IPottery.PotterySize.MEDIUM, (byte)0, false), "",""," c c "," c c "," ccc ");
+ RegisterPotteryCrafting(BlockCore.pot.getItemStack(IPottery.PotteryState.MOLDED, IPottery.PotteryGrade.NORMAL, IPottery.PotterySize.MEDIUM, (byte)1, false), "",""," c c "," csc "," ccc ");
+ RegisterPotteryCrafting(BlockCore.pot.getItemStack(IPottery.PotteryState.MOLDED, IPottery.PotteryGrade.NORMAL, IPottery.PotterySize.MEDIUM, (byte)2, false), "",""," c c "," cbc "," ccc ");
+ RegisterPotteryCrafting(BlockCore.pot.getItemStack(IPottery.PotteryState.MOLDED, IPottery.PotteryGrade.NORMAL, IPottery.PotterySize.MEDIUM, (byte)3, false), "",""," c c "," cfc "," ccc ");
+
+ RegisterPotteryCrafting(BlockCore.pot.getItemStack(IPottery.PotteryState.MOLDED, IPottery.PotteryGrade.NORMAL, IPottery.PotterySize.MEDIUM, (byte)0, true), "",""," g g "," g g "," ggg ");
+ RegisterPotteryCrafting(BlockCore.pot.getItemStack(IPottery.PotteryState.MOLDED, IPottery.PotteryGrade.NORMAL, IPottery.PotterySize.MEDIUM, (byte)1, true), "",""," g g "," gsg "," ggg ");
+ RegisterPotteryCrafting(BlockCore.pot.getItemStack(IPottery.PotteryState.MOLDED, IPottery.PotteryGrade.NORMAL, IPottery.PotterySize.MEDIUM, (byte)2, true), "",""," g g "," gbg "," ggg ");
+ RegisterPotteryCrafting(BlockCore.pot.getItemStack(IPottery.PotteryState.MOLDED, IPottery.PotteryGrade.NORMAL, IPottery.PotterySize.MEDIUM, (byte)3, true), "",""," g g "," gfg "," ggg ");
+
+ RegisterPotteryCrafting(BlockCore.pot.getItemStack(IPottery.PotteryState.MOLDED, IPottery.PotteryGrade.NORMAL, IPottery.PotterySize.LARGE, (byte)0, false), " c c "," c c ","c c","c c"," ccc ");
+ RegisterPotteryCrafting(BlockCore.pot.getItemStack(IPottery.PotteryState.MOLDED, IPottery.PotteryGrade.NORMAL, IPottery.PotterySize.LARGE, (byte)1, false), " c c "," c c ","c c","c s c"," ccc ");
+ RegisterPotteryCrafting(BlockCore.pot.getItemStack(IPottery.PotteryState.MOLDED, IPottery.PotteryGrade.NORMAL, IPottery.PotterySize.LARGE, (byte)2, false), " c c "," c c ","c c","c b c"," ccc ");
+ RegisterPotteryCrafting(BlockCore.pot.getItemStack(IPottery.PotteryState.MOLDED, IPottery.PotteryGrade.NORMAL, IPottery.PotterySize.LARGE, (byte)3, false), " c c "," c c ","c c","c f c"," ccc ");
+
+ RegisterPotteryCrafting(BlockCore.pot.getItemStack(IPottery.PotteryState.MOLDED, IPottery.PotteryGrade.NORMAL, IPottery.PotterySize.LARGE, (byte)0, true), " g g "," g g ","g g","g g"," ggg ");
+ RegisterPotteryCrafting(BlockCore.pot.getItemStack(IPottery.PotteryState.MOLDED, IPottery.PotteryGrade.NORMAL, IPottery.PotterySize.LARGE, (byte)1, true), " g g "," g g ","g g","g s g"," ggg ");
+ RegisterPotteryCrafting(BlockCore.pot.getItemStack(IPottery.PotteryState.MOLDED, IPottery.PotteryGrade.NORMAL, IPottery.PotterySize.LARGE, (byte)2, true), " g g "," g g ","g g","g b g"," ggg ");
+ RegisterPotteryCrafting(BlockCore.pot.getItemStack(IPottery.PotteryState.MOLDED, IPottery.PotteryGrade.NORMAL, IPottery.PotterySize.LARGE, (byte)3, true), " g g "," g g ","g g","g f g"," ggg ");
+
+ registerPotteryEffect(new PotteryKeep());
+ registerPotteryEffect(new PotterySenaka());
+ registerPotteryEffect(new PotteryVoid());
+ registerPotteryEffect(new PotteryChange());
+ registerPotteryEffect(new PotteryCrucible());
+ registerPotteryEffect(new PotteryLottery());
+ registerPotteryEffect(new PotteryTaboo());
+ registerPotteryEffect(new PotteryUnbreakable());
+ registerPotteryEffect(new PotteryEnchantment());
+ registerPotteryEffect(new PotteryTaboo());
+ registerPotteryEffect(new PotteryFurnace());
+ registerPotteryEffect(new PotteryAppraisal());
+ }
+
+ /*
+ ####################################################
+ Potter's Wheel
+
+ クラフト処理は現在クソ以外の何者でもない(Registry.PotteryPair.isMatch参照)ですが仮実装なので・・・
+ 要望があればキチンとした感じに作り直します
+ ####################################################
+ */
+
+ public static void RegisterPotteryCrafting(ItemStack prod, String ... str){
+ instance.potteries.add(new PotteryRegistry.PotteryPair(prod, str));
+ }
+ public static ItemStack GetPotteryCrafting(ItemStack[] r){
+ if(instance.cachedPottery!=null && instance.cachedPottery.isMatch(r)){
+ return instance.cachedPottery.product;
+ }
+
+ for(PotteryRegistry.PotteryPair pp : instance.potteries){
+ if(pp.isMatch(r)){
+ instance.cachedPottery=pp;
+ return pp.product;
+ }
+ }
+ return null;
+ }
+ public static ArrayList<PotteryRegistry.PotteryPair> GetPotteryCrafting(){ return instance.potteries; }
+
+
+ public static int registerPotteryEffect(PotteryBase p){
+ instance.potteryEffects.add(p);
+ return instance.potteryEffects.size()-1;
+ }
+ public static PotteryBase getPotteryEffect(int id){
+ return instance.potteryEffects.get(id);
+ }
+ public static PotteryBase getPotteryEffect(String unlocalizedName){
+ if(instance.cachedPotteryEffect!=null && instance.cachedPotteryEffect.getUnlocalizedName().equals(unlocalizedName)){
+ return instance.cachedPotteryEffect;
+ }
+
+ for(PotteryBase pb : instance.potteryEffects){
+ if(pb.getUnlocalizedName().equals(unlocalizedName)){
+ instance.cachedPotteryEffect=pb;
+ return pb;
+ }
+ }
+ return null;
+ }
+ public static int getPotteryEffectId(String unlocalizedName){
+ int s=instance.potteryEffects.size();
+ for(int i=0;i<s;i++){
+ PotteryBase pb=instance.potteryEffects.get(i);
+ if(pb.getUnlocalizedName().equals(unlocalizedName)){
+ instance.cachedPotteryEffect=pb;
+ return i;
+ }
+ }
+ return -1;
+ }
+
+
+ public static class PotteryPair{
+ public ItemStack product;
+ public boolean[] clays=new boolean[25];
+ public char[] materials=new char[25];
+ public boolean isEnable;
+
+ public PotteryPair(ItemStack prod, String ... str){
+ product=prod;
+ isEnable=true;
+
+ if(str==null || str.length!=5){
+ FMLLog.severe("Failed to parse Pottery Recipe : Craft Matrix has invalid size");
+ isEnable=false;
+ return;
+ }
+ for(int k=0;k<str.length;k++){
+ if(str[k].length()==0){
+ for(int i=0;i<5;i++) materials[k*5+i]=' ';
+ continue;
+ }
+
+ if(str[k].length()!=5){
+ FMLLog.severe("Failed to parse Pottery Recipe : Craft Matrix has invalid size");
+ isEnable=false;
+ return;
+ }
+
+ for(int i=0;i<str[k].length();i++){
+ char c=str[k].charAt(i);
+ clays[k*5+i]=(c!=' ');
+ materials[k*5+i]=c;
+ }
+ }
+ }
+ public boolean isMatch(ItemStack[] r){
+ if(!isEnable || r.length!=25) return false;
+ for(int i=0;i<25;i++){
+ if(materials[i]==' '){
+ if(r[i]!=null) return false;
+ continue;
+ }
+ else{
+ //何か文句があれば変える
+ if(materials[i]=='c'){
+ if(r[i]==null) return false;
+ Item item=r[i].getItem();
+ if(item!= ItemCore.clayWet) return false;
+ }
+ else if(materials[i]=='g'){
+ if(r[i]==null) return false;
+ Item item=r[i].getItem();
+ if(item!=ItemCore.clayGlow) return false;
+ }
+ else if(materials[i]=='f'){
+ if(r[i]==null) return false;
+ Item item=r[i].getItem();
+ if(item!=Item.getItemFromBlock(Blocks.red_flower) && item!=Item.getItemFromBlock(Blocks.yellow_flower)) return false;
+ }
+ else if(materials[i]=='s'){
+ if(r[i]==null) return false;
+ Item item=r[i].getItem();
+ if(item!= Items.stick) return false;
+ }
+ else if(materials[i]=='b'){
+ if(r[i]==null) return false;
+ Item item=r[i].getItem();
+ if(item!=Item.getItemFromBlock(Blocks.iron_bars)) return false;
+ }
+
+ }
+ /*
+ if(clays[i]){
+ if(r[i]==null) return false;
+ Item item=r[i].getItem();
+ if(item!=ItemCore.clayWet && item!=ItemCore.clayGlow) return false;
+ }
+ else if(r[i]!=null) return false;
+ */
+ }
+ return true;
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/pottery/RenderPottersWheel.class b/src/main/java/jp/plusplus/fbs/pottery/RenderPottersWheel.class Binary files differnew file mode 100644 index 0000000..bced338 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/RenderPottersWheel.class diff --git a/src/main/java/jp/plusplus/fbs/pottery/RenderPottersWheel.java b/src/main/java/jp/plusplus/fbs/pottery/RenderPottersWheel.java new file mode 100644 index 0000000..7bca2cc --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/RenderPottersWheel.java @@ -0,0 +1,171 @@ +package jp.plusplus.fbs.pottery;
+
+import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
+import jp.plusplus.fbs.FBS;
+import net.minecraft.block.Block;
+import net.minecraft.client.renderer.RenderBlocks;
+import net.minecraft.client.renderer.Tessellator;
+import net.minecraft.util.IIcon;
+import net.minecraft.world.IBlockAccess;
+import org.lwjgl.opengl.GL11;
+
+/**
+ * Created by plusplus_F on 2015/08/31.
+ *
+ * renderInventoryBlockではてってれーたワイワイしないといけないの、最高に○ソ
+ * いちいちめんどくさいんだよ反省しろ
+ *
+ */
+public class RenderPottersWheel implements ISimpleBlockRenderingHandler {
+ private float f1=9.0f/16.0f;
+ private float f2=10.0f/16.0f;
+ private float f3=12.0f/16.0f;
+
+ private float f11=6.0f/16.0f;
+ private float f12=11.0f/16.0f;
+
+ @Override
+ public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
+ if(modelId==getRenderId()){
+ IIcon tSide=block.getIcon(2,0);
+ IIcon tTop=block.getIcon(1,0);
+ IIcon tBottom=block.getIcon(0,0);
+
+ GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
+
+ Tessellator tessellator = Tessellator.instance;
+ block.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
+
+ //----------------------------土台---------------------------------------
+ renderer.setRenderBounds(0,0,0,1,f1,1);
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(0.0F, -1F, 0.0F);
+ renderer.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, tBottom);
+ tessellator.draw();
+
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(0.0F, 1.0F, 0.0F);
+ renderer.renderFaceYPos(block, 0.0d, 0.0d, 0.0d, tTop);
+ tessellator.draw();
+
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(0.0F, 0.0F, -1F);
+ renderer.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, tSide);
+ tessellator.draw();
+
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(0.0F, 0.0F, 1.0F);
+ renderer.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, tSide);
+ tessellator.draw();
+
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(-1F, 0.0F, 0.0F);
+ renderer.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, tSide);
+ tessellator.draw();
+
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(1.0F, 0.0F, 0.0F);
+ renderer.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, tSide);
+ tessellator.draw();
+ //------------------------------------------------------------------------
+
+ //----------------------------真ん中---------------------------------------
+ renderer.setRenderBounds(f11,f1,f11,f12,f2,f12);
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(0.0F, -1F, 0.0F);
+ renderer.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, tBottom);
+ tessellator.draw();
+
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(0.0F, 1.0F, 0.0F);
+ renderer.renderFaceYPos(block, 0.0d, 0.0d, 0.0d, tTop);
+ tessellator.draw();
+
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(0.0F, 0.0F, -1F);
+ renderer.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, tSide);
+ tessellator.draw();
+
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(0.0F, 0.0F, 1.0F);
+ renderer.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, tSide);
+ tessellator.draw();
+
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(-1F, 0.0F, 0.0F);
+ renderer.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, tSide);
+ tessellator.draw();
+
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(1.0F, 0.0F, 0.0F);
+ renderer.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, tSide);
+ tessellator.draw();
+ //------------------------------------------------------------------------
+
+ //----------------------------一番上(マジで○ね)---------------------------------------
+ renderer.setRenderBounds(0,f2,0,1,f3,1);
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(0.0F, -1F, 0.0F);
+ renderer.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, tBottom);
+ tessellator.draw();
+
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(0.0F, 1.0F, 0.0F);
+ renderer.renderFaceYPos(block, 0.0d, 0.0d, 0.0d, tTop);
+ tessellator.draw();
+
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(0.0F, 0.0F, -1F);
+ renderer.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, tSide);
+ tessellator.draw();
+
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(0.0F, 0.0F, 1.0F);
+ renderer.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, tSide);
+ tessellator.draw();
+
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(-1F, 0.0F, 0.0F);
+ renderer.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, tSide);
+ tessellator.draw();
+
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(1.0F, 0.0F, 0.0F);
+ renderer.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, tSide);
+ tessellator.draw();
+ //------------------------------------------------------------------------
+
+ renderer.setRenderBounds(0,0,0,1,1,1);
+
+ GL11.glTranslatef(0.5F, 0.5F, 0.5F);
+ }
+ }
+
+ @Override
+ public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
+ if(modelId==getRenderId()){
+ renderer.setRenderBounds(0,0,0,1,f1,1);
+ renderer.renderStandardBlock(block, x,y,z);
+
+ renderer.setRenderBounds(f11,f1,f11,f12,f2,f12);
+ renderer.renderStandardBlock(block, x,y,z);
+
+ renderer.setRenderBounds(0,f2,0,1,f3,1);
+ renderer.renderStandardBlock(block, x,y,z);
+
+ renderer.setRenderBounds(0,0,0,1,1,1);
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public boolean shouldRender3DInInventory(int modelId) {
+ return true;
+ }
+
+ @Override
+ public int getRenderId() {
+ return FBS.renderPottersWheelId;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/pottery/RenderPottery.class b/src/main/java/jp/plusplus/fbs/pottery/RenderPottery.class Binary files differnew file mode 100644 index 0000000..64d6dc0 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/RenderPottery.class diff --git a/src/main/java/jp/plusplus/fbs/pottery/RenderPottery.java b/src/main/java/jp/plusplus/fbs/pottery/RenderPottery.java new file mode 100644 index 0000000..f824f4d --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/RenderPottery.java @@ -0,0 +1,96 @@ +package jp.plusplus.fbs.pottery;
+
+import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.api.IPottery;
+import net.minecraft.block.Block;
+import net.minecraft.client.renderer.RenderBlocks;
+import net.minecraft.client.renderer.texture.TextureMap;
+import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.world.IBlockAccess;
+import org.lwjgl.opengl.GL11;
+import org.lwjgl.opengl.GL12;
+
+/**
+ * Created by plusplus_F on 2015/08/26.
+ */
+public class RenderPottery extends TileEntitySpecialRenderer implements ISimpleBlockRenderingHandler {
+
+ @Override
+ public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
+ if(modelId!=getRenderId() || !(block instanceof IPottery)) return;
+ IPottery ip=(IPottery)block;
+
+ GL11.glPushMatrix();
+ GL11.glTranslatef(0.5f, 1.5f, 0.5f);
+ GL11.glTranslatef(0, -0.25f, 0);
+ GL11.glRotatef(180, 0, 0, 1);
+
+ IPottery.PotteryState state= IPottery.PotteryState.Get((metadata>>6)&3);
+ if(state== IPottery.PotteryState.DRY) GL11.glColor3b((byte) (240/2), (byte) (235/2), (byte) (212/2));
+ else if(state==IPottery.PotteryState.MOLDED) GL11.glColor3b((byte) (218/2), (byte) (203/2), (byte) (144/2));
+ else GL11.glColor3b((byte) (73/2), (byte) (37/2), (byte) (12/2));
+
+ float scale = 0.0625f;
+ GL11.glScalef(scale, scale, scale);
+
+ bindTexture(ip.getResourceLocation(metadata));
+ ip.getModel(metadata).render(null, 0, 0, 0, 0, 0, 1.0f);
+ bindTexture(TextureMap.locationBlocksTexture);
+
+ GL11.glColor3b((byte)127,(byte)127,(byte)127);
+ GL11.glScalef(1f, 1f, 1f);
+ GL11.glPopMatrix();
+ }
+
+ @Override
+ public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
+ if (modelId == getRenderId()) {
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public boolean shouldRender3DInInventory(int modelId) {
+ return true;
+ }
+
+ @Override
+ public int getRenderId() {
+ return FBS.renderJarId;
+ }
+
+ @Override
+ public void renderTileEntityAt(TileEntity entity, double x, double y, double z, float p_147500_8_) {
+ Block b=entity.getBlockType();
+
+ if(!(entity instanceof TileEntityPottery)) return;
+ TileEntityPottery te=(TileEntityPottery)entity;
+ //int meta=entity.getWorldObj().getBlockMetadata(entity.xCoord, entity.yCoord, entity.zCoord);
+ int meta=te.getMetadata();
+
+ if(!(b instanceof IPottery)) return;
+ IPottery ip=(IPottery)b;
+ IPottery.PotteryState state=te.state;
+
+ GL11.glPushMatrix();
+ GL11.glEnable(GL12.GL_RESCALE_NORMAL);
+ GL11.glTranslatef((float) x + 0.5f, (float) y + 1.5f, (float) z + 0.5f);
+ GL11.glRotatef(180, 0, 0, 1);
+
+ if(state== IPottery.PotteryState.DRY) GL11.glColor3b((byte) (240/2), (byte) (235/2), (byte) (212/2));
+ else if(state==IPottery.PotteryState.MOLDED) GL11.glColor3b((byte) (218/2), (byte) (203/2), (byte) (144/2));
+ else GL11.glColor3b((byte) (73/2), (byte) (37/2), (byte) (12/2));
+
+ float scale = 0.0625f;
+ GL11.glScalef(scale, scale, scale);
+
+ bindTexture(ip.getResourceLocation(meta));
+ ip.getModel(meta).render(null, 0, 0, 0, 0, 0, 1.0f);
+
+ GL11.glDisable(GL12.GL_RESCALE_NORMAL);
+ GL11.glPopMatrix();
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/pottery/TileEntityKiln.class b/src/main/java/jp/plusplus/fbs/pottery/TileEntityKiln.class Binary files differnew file mode 100644 index 0000000..f749f0e --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/TileEntityKiln.class diff --git a/src/main/java/jp/plusplus/fbs/pottery/TileEntityKiln.java b/src/main/java/jp/plusplus/fbs/pottery/TileEntityKiln.java new file mode 100644 index 0000000..8f40ed6 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/TileEntityKiln.java @@ -0,0 +1,315 @@ +package jp.plusplus.fbs.pottery;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.block.BlockCore;
+import jp.plusplus.fbs.pottery.BlockKiln;
+import jp.plusplus.fbs.api.IPottery;
+import jp.plusplus.fbs.pottery.ItemBlockPottery;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.Items;
+import net.minecraft.inventory.ISidedInventory;
+import net.minecraft.item.*;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.nbt.NBTTagList;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.tileentity.TileEntityFurnace;
+
+import java.util.Random;
+
+/**
+ * Created by plusplus_F on 2015/08/27.
+ * 焼き物窯
+ */
+public class TileEntityKiln extends TileEntity implements ISidedInventory {
+ public static final int[] slotsMaterial = new int[]{0,1,2,3,4,5,6,7,8};
+ public static final int[] slotsProduct = new int[]{10,11,12,13,14,15,16,17,18, 9};
+ public static final int[] slotsFuel = new int[]{9};
+ public static final int PROGRESS_MAX=20*80*4;
+ //public static final int PROGRESS_MAX=20*5;
+
+ public ItemStack[] itemStacks = new ItemStack[19];
+ public int furnaceBurnTime;
+ public int currentItemBurnTime;
+ public int[] progress=new int[9];
+ public Random rand=new Random();
+
+ public void readFromNBT(NBTTagCompound p_145839_1_) {
+ super.readFromNBT(p_145839_1_);
+
+ for(int i=0;i<progress.length;i++){
+ progress[i]=p_145839_1_.getShort("Progress"+i);
+ }
+
+ NBTTagList nbttaglist = p_145839_1_.getTagList("Items", 10);
+ this.itemStacks = new ItemStack[this.getSizeInventory()];
+ for (int i = 0; i < nbttaglist.tagCount(); ++i) {
+ NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i);
+ byte b0 = nbttagcompound1.getByte("Slot");
+
+ if (b0 >= 0 && b0 < this.itemStacks.length) {
+ this.itemStacks[b0] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
+ }
+ }
+
+ this.furnaceBurnTime = p_145839_1_.getShort("BurnTime");
+ this.currentItemBurnTime = TileEntityFurnace.getItemBurnTime(this.itemStacks[slotsFuel[0]]);
+ }
+
+ public void writeToNBT(NBTTagCompound p_145841_1_) {
+ super.writeToNBT(p_145841_1_);
+ p_145841_1_.setShort("BurnTime", (short) this.furnaceBurnTime);
+
+ for(int i=0;i<progress.length;i++){
+ p_145841_1_.setShort("Progress"+i, (short)progress[i]);
+ }
+
+ NBTTagList nbttaglist = new NBTTagList();
+ for (int i = 0; i < this.itemStacks.length; ++i) {
+ if (this.itemStacks[i] != null) {
+ NBTTagCompound nbttagcompound1 = new NBTTagCompound();
+ nbttagcompound1.setByte("Slot", (byte) i);
+ this.itemStacks[i].writeToNBT(nbttagcompound1);
+ nbttaglist.appendTag(nbttagcompound1);
+ }
+ }
+ p_145841_1_.setTag("Items", nbttaglist);
+ }
+
+ @SideOnly(Side.CLIENT)
+ public int getCookProgressScaled(int i, int ext) {
+ if(i<0 || i>=progress.length) return 0;
+ return progress[i] * ext / PROGRESS_MAX;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public int getBurnTimeRemainingScaled(int p_145955_1_) {
+ if (this.currentItemBurnTime == 0) {
+ this.currentItemBurnTime = 200;
+ }
+
+ return this.furnaceBurnTime * p_145955_1_ / this.currentItemBurnTime;
+ }
+
+ public boolean isBurning() {
+ return this.furnaceBurnTime > 0;
+ }
+
+ public void updateEntity() {
+ boolean flag = this.furnaceBurnTime > 0;
+ boolean flag1 = false;
+
+ //燃料燃やすカウンタ
+ if (this.furnaceBurnTime > 0) {
+ --this.furnaceBurnTime;
+ }
+
+ if (!this.worldObj.isRemote) {
+ boolean fuelNotNull=(itemStacks[slotsFuel[0]]!=null);
+ boolean materialNotNull=false;
+ for(int i=0;i<slotsMaterial.length;i++){
+ if(itemStacks[slotsMaterial[i]]!=null){
+ materialNotNull=true;
+ break;
+ }
+ }
+
+ if (this.furnaceBurnTime != 0 || (fuelNotNull && materialNotNull)) {
+ boolean smelt=false;
+ boolean[] smelt2=new boolean[slotsMaterial.length];
+ for(int i=0;i<slotsMaterial.length;i++){
+ smelt2[i]=false;
+ if(itemStacks[slotsMaterial[i]]==null) continue;
+ if(canSmelt(i)){
+ smelt2[i]=smelt=true;
+ }
+ }
+
+ //FBS.logger.info("furnace:"+furnaceBurnTime+","+smelt);
+
+ if (this.furnaceBurnTime == 0 && smelt) {
+ //1つのスロットでも焼ける場合は燃料の更新
+ this.currentItemBurnTime = this.furnaceBurnTime = TileEntityFurnace.getItemBurnTime(this.itemStacks[slotsFuel[0]]);
+
+ if (this.furnaceBurnTime > 0) {
+ flag1 = true;
+ if (this.itemStacks[slotsFuel[0]] != null) {
+ --this.itemStacks[slotsFuel[0]].stackSize;
+ if (this.itemStacks[slotsFuel[0]].stackSize == 0) {
+ this.itemStacks[slotsFuel[0]] = itemStacks[slotsFuel[0]].getItem().getContainerItem(itemStacks[slotsFuel[0]]);
+ }
+ }
+ }
+ }
+
+ if (this.isBurning() && smelt) {
+ for(int i=0;i<slotsMaterial.length;i++){
+ if(!smelt2[i]){
+ progress[i]=0;
+ continue;
+ }
+ progress[i]++;
+ if(progress[i]>=PROGRESS_MAX){
+ progress[i]=0;
+ smeltItem(i);
+ flag1=true;
+ }
+ }
+ } else {
+ for(int i=0;i<slotsMaterial.length;i++){
+ progress[i]=0;
+ }
+ }
+ }
+
+ if (flag != this.furnaceBurnTime > 0) {
+ flag1 = true;
+ BlockKiln.updateFurnaceBlockState(this.furnaceBurnTime > 0, this.worldObj, this.xCoord, this.yCoord, this.zCoord);
+ }
+ }
+
+ if (flag1) {
+ this.markDirty();
+ }
+ }
+
+ private boolean canSmelt(int i) {
+ ItemStack stack=itemStacks[slotsMaterial[i]];
+ if(stack==null) return false;
+
+ //Pottery以外は弾く
+ Item item=stack.getItem();
+ if(!(item instanceof ItemBlockPottery)) return false;
+
+ //DRY以外のものは弾く
+ IPottery ip=(IPottery)((ItemBlockPottery) item).field_150939_a;
+ if(ip.getState(BlockCore.pot.getNBT(stack))!=IPottery.PotteryState.DRY) return false;
+
+ //完成品スロットが開いていたらtrue
+ return itemStacks[slotsProduct[i]]==null;
+ }
+
+ public void smeltItem(int i) {
+ if (this.canSmelt(i)) {
+ //完成品
+ ItemStack product=itemStacks[slotsMaterial[i]].copy();
+ IPottery ip=(IPottery)(((ItemBlock)product.getItem()).field_150939_a);
+
+ //段階を進めて品質をセット
+ //product=ip.raiseState(product);
+ ip.setState(product, IPottery.PotteryState.BAKED);
+ ip.setGrade(product, rand);
+ product.setItemDamage(ip.getMetadata(BlockCore.pot.getNBT(product)));
+
+ //魔法の効果
+ if(ip.hasEffect(BlockCore.pot.getNBT(product))){
+ product=ip.getEnchantedItemStack(product, rand);
+ }
+
+ itemStacks[slotsProduct[i]]=product;
+
+ //材料消費
+ --this.itemStacks[slotsMaterial[i]].stackSize;
+ if (this.itemStacks[slotsMaterial[i]].stackSize <= 0) {
+ this.itemStacks[slotsMaterial[i]] = null;
+ }
+ }
+ }
+
+ //-------------------------------------ISidedInventory---------------------------------------------
+ @Override
+ public int getInventoryStackLimit() {
+ return 64;
+ }
+
+ @Override
+ public int getSizeInventory() {
+ return this.itemStacks.length;
+ }
+ @Override
+ public ItemStack getStackInSlot(int p_70301_1_) {
+ return this.itemStacks[p_70301_1_];
+ }
+ @Override
+ public ItemStack decrStackSize(int p_70298_1_, int p_70298_2_) {
+ if (this.itemStacks[p_70298_1_] != null) {
+ ItemStack itemstack;
+
+ if (this.itemStacks[p_70298_1_].stackSize <= p_70298_2_) {
+ itemstack = this.itemStacks[p_70298_1_];
+ this.itemStacks[p_70298_1_] = null;
+ return itemstack;
+ } else {
+ itemstack = this.itemStacks[p_70298_1_].splitStack(p_70298_2_);
+
+ if (this.itemStacks[p_70298_1_].stackSize == 0) {
+ this.itemStacks[p_70298_1_] = null;
+ }
+
+ return itemstack;
+ }
+ } else {
+ return null;
+ }
+ }
+ @Override
+ public ItemStack getStackInSlotOnClosing(int p_70304_1_) {
+ if (this.itemStacks[p_70304_1_] != null) {
+ ItemStack itemstack = this.itemStacks[p_70304_1_];
+ this.itemStacks[p_70304_1_] = null;
+ return itemstack;
+ } else {
+ return null;
+ }
+ }
+ @Override
+ public void setInventorySlotContents(int p_70299_1_, ItemStack p_70299_2_) {
+ this.itemStacks[p_70299_1_] = p_70299_2_;
+
+ if (p_70299_2_ != null && p_70299_2_.stackSize > this.getInventoryStackLimit()) {
+ p_70299_2_.stackSize = this.getInventoryStackLimit();
+ }
+ }
+ @Override
+ public String getInventoryName() {
+ return BlockCore.kiln.getLocalizedName();
+ }
+ @Override
+ public boolean hasCustomInventoryName() {
+ return false;
+ }
+
+ @Override
+ public boolean isUseableByPlayer(EntityPlayer p_70300_1_) {
+ return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) != this ? false : p_70300_1_.getDistanceSq((double) this.xCoord + 0.5D, (double) this.yCoord + 0.5D, (double) this.zCoord + 0.5D) <= 64.0D;
+ }
+
+ @Override
+ public void openInventory() {}
+ @Override
+ public void closeInventory() {}
+
+ @Override
+ public boolean isItemValidForSlot(int p_94041_1_, ItemStack p_94041_2_) {
+ if(p_94041_1_<10) return false;
+ if(p_94041_1_==9) return TileEntityFurnace.isItemFuel(p_94041_2_);
+ return p_94041_2_.getItem() instanceof ItemBlockPottery;
+ }
+
+ @Override
+ public int[] getAccessibleSlotsFromSide(int p_94128_1_) {
+ return p_94128_1_ == 0 ? slotsProduct : (p_94128_1_ == 1 ? slotsMaterial : slotsFuel);
+ }
+
+ @Override
+ public boolean canInsertItem(int p_102007_1_, ItemStack p_102007_2_, int p_102007_3_) {
+ return this.isItemValidForSlot(p_102007_1_, p_102007_2_);
+ }
+
+ @Override
+ public boolean canExtractItem(int p_102008_1_, ItemStack p_102008_2_, int p_102008_3_) {
+ if (p_102008_1_ < 9) return false;
+ if (p_102008_1_ == 9) return p_102008_2_.getItem() == Items.bucket;
+ return true;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/pottery/TileEntityPottersWheel.class b/src/main/java/jp/plusplus/fbs/pottery/TileEntityPottersWheel.class Binary files differnew file mode 100644 index 0000000..f211e3f --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/TileEntityPottersWheel.class diff --git a/src/main/java/jp/plusplus/fbs/pottery/TileEntityPottersWheel.java b/src/main/java/jp/plusplus/fbs/pottery/TileEntityPottersWheel.java new file mode 100644 index 0000000..d196df2 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/TileEntityPottersWheel.java @@ -0,0 +1,188 @@ +package jp.plusplus.fbs.pottery;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.Registry;
+import jp.plusplus.fbs.block.BlockCore;
+import jp.plusplus.fbs.container.ContainerDummy;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.Container;
+import net.minecraft.inventory.ISidedInventory;
+import net.minecraft.inventory.InventoryCrafting;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.nbt.NBTTagList;
+import net.minecraft.network.NetworkManager;
+import net.minecraft.network.Packet;
+import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.IIcon;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.*;
+
+/**
+ * Created by pluslus_F on 2015/08/29.
+ */
+public class TileEntityPottersWheel extends TileEntity implements ISidedInventory {
+ private static final int[] slotsMaterial=new int[]{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24};
+ private static final int[] slotsProduct=new int[]{25};
+ public ItemStack[] itemStacks=new ItemStack[26];
+
+ @Override
+ public void readFromNBT(NBTTagCompound par1NBTTagCompound){
+ super.readFromNBT(par1NBTTagCompound);
+
+ NBTTagList nbttaglist = (NBTTagList)par1NBTTagCompound.getTag("Items");
+ itemStacks = new ItemStack[getSizeInventory()];
+ for (int i=0;i<nbttaglist.tagCount();i++){
+ NBTTagCompound nbt = nbttaglist.getCompoundTagAt(i);
+ byte b0 = nbt.getByte("Slot");
+
+ if (b0>=0 && b0<itemStacks.length){
+ itemStacks[b0] = ItemStack.loadItemStackFromNBT(nbt);
+ }
+ }
+
+ onInventoryChange();
+ }
+ @Override
+ public void writeToNBT(NBTTagCompound par1NBTTagCompound){
+ super.writeToNBT(par1NBTTagCompound);
+
+ NBTTagList nbttaglist = new NBTTagList();
+ for (int i=0;i<itemStacks.length;i++){
+ if (itemStacks[i] != null){
+ NBTTagCompound nbt = new NBTTagCompound();
+ nbt.setByte("Slot", (byte) i);
+ itemStacks[i].writeToNBT(nbt);
+ nbttaglist.appendTag(nbt);
+ }
+ }
+ par1NBTTagCompound.setTag("Items", nbttaglist);
+ }
+
+ @Override
+ public Packet getDescriptionPacket() {
+ NBTTagCompound nbtTagCompound = new NBTTagCompound();
+ this.writeToNBT(nbtTagCompound);
+ return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 1, nbtTagCompound);
+ }
+
+ @Override
+ public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
+ this.readFromNBT(pkt.func_148857_g());
+ }
+
+ public void onInventoryChange() {
+ ItemStack[] r=new ItemStack[25];
+ for(int i=0;i<25;i++){
+ r[i]=itemStacks[i];
+ }
+ ItemStack ret=PotteryRegistry.GetPotteryCrafting(r);
+ if(ret!=null) itemStacks[25]=ret.copy();
+ else itemStacks[25]=null;
+ }
+
+ //------------------------------------------------------------------
+ @Override
+ public int getSizeInventory() {
+ return itemStacks.length;
+ }
+ @Override
+ public ItemStack getStackInSlot(int i) {
+ return itemStacks[i];
+ }
+ @Override
+ public ItemStack decrStackSize(int i, int j) {
+ if (itemStacks[i] != null){
+ ItemStack itemstack;
+
+ if (itemStacks[i].stackSize <= j){
+ itemstack = itemStacks[i];
+ itemStacks[i] = null;
+
+ onInventoryChange();
+
+ markDirty();
+ return itemstack;
+ }
+ else{
+ itemstack = itemStacks[i].splitStack(j);
+
+ if (itemStacks[i].stackSize == 0){
+ itemStacks[i] = null;
+ }
+
+ onInventoryChange();
+
+ markDirty();
+ return itemstack;
+ }
+ }
+ else{
+ return null;
+ }
+ }
+ @Override
+ public ItemStack getStackInSlotOnClosing(int i) {
+ if (itemStacks[i] != null){
+ ItemStack itemstack = itemStacks[i];
+ itemStacks[i] = null;
+ markDirty();
+ return itemstack;
+ }
+ else{
+ return null;
+ }
+ }
+ @Override
+ public void setInventorySlotContents(int i, ItemStack itemStack) {
+ itemStacks[i] = itemStack;
+ if (itemStack != null && itemStack.stackSize > this.getInventoryStackLimit()){
+ itemStack.stackSize = getInventoryStackLimit();
+ }
+ if(i!=slotsProduct[0]) onInventoryChange();
+ markDirty();
+ }
+ @Override
+ public String getInventoryName() {
+ return BlockCore.pottersWheel.getLocalizedName();
+ }
+ @Override
+ public boolean hasCustomInventoryName() {
+ return false;
+ }
+ @Override
+ public int getInventoryStackLimit() {
+ return 64;
+ }
+ @Override
+ public boolean isUseableByPlayer(EntityPlayer entityPlayer) {
+ return worldObj.getTileEntity(xCoord, yCoord, zCoord) != this ? false : entityPlayer.getDistanceSq((double)xCoord+0.5D, (double)yCoord+0.5D, (double)zCoord+0.5D) <= 64.0D;
+ }
+ @Override
+ public void openInventory() {
+ }
+ @Override
+ public void closeInventory() {
+ }
+ @Override
+ public boolean isItemValidForSlot(int i, ItemStack itemstack) {
+ return false;
+ }
+
+ @Override
+ public int[] getAccessibleSlotsFromSide(int p_94128_1_) {
+ return slotsProduct;
+ }
+
+ @Override
+ public boolean canInsertItem(int p_102007_1_, ItemStack p_102007_2_, int p_102007_3_) {
+ return false;
+ }
+
+ @Override
+ public boolean canExtractItem(int p_102008_1_, ItemStack p_102008_2_, int p_102008_3_) {
+ return p_102008_1_==slotsProduct[0];
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/pottery/TileEntityPottery.class b/src/main/java/jp/plusplus/fbs/pottery/TileEntityPottery.class Binary files differnew file mode 100644 index 0000000..7a72032 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/TileEntityPottery.class diff --git a/src/main/java/jp/plusplus/fbs/pottery/TileEntityPottery.java b/src/main/java/jp/plusplus/fbs/pottery/TileEntityPottery.java new file mode 100644 index 0000000..08dbda9 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/TileEntityPottery.java @@ -0,0 +1,162 @@ +package jp.plusplus.fbs.pottery;
+
+import com.google.common.collect.ImmutableList;
+import jp.plusplus.fbs.api.IPottery;
+import net.minecraft.block.Block;
+import net.minecraft.item.ItemBlock;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.network.NetworkManager;
+import net.minecraft.network.Packet;
+import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.world.biome.BiomeGenBase;
+import net.minecraftforge.common.BiomeManager;
+
+/**
+ * Created by plusplus_F on 2015/08/26.
+ * レンダラのための無機能
+ */
+public class TileEntityPottery extends TileEntity {
+ public static int PROGRESS_MAX=10*20*60*20;
+
+ public IPottery.PotteryState state= IPottery.PotteryState.INVALID_VALUE;
+ public IPottery.PotterySize size;
+ public IPottery.PotteryGrade grade;
+ public byte pattern;
+ public boolean hasEffect;
+
+ public int progress;
+
+ public NBTTagCompound dummyNBT;
+
+ public void setData(ItemStack itemStack){
+ IPottery ip=(IPottery)((ItemBlock) itemStack.getItem()).field_150939_a;
+
+ NBTTagCompound nbt=itemStack.getTagCompound();
+ if(nbt==null) return;
+
+ state=ip.getState(nbt);
+ size=ip.getSize(nbt);
+ grade=ip.getGrade(nbt);
+ pattern=ip.getPattern(nbt);
+ hasEffect=ip.hasEffect(nbt);
+ }
+ public int getMetadata(){
+ int meta=(pattern%0xf);
+ meta=(meta|((state.getValue())<<6));
+ meta=(meta|((size.getValue())<<4));
+ meta=(meta|((grade.getValue())<<8));
+ return meta;
+ }
+
+ public void writePotteryData(NBTTagCompound nbt){
+ nbt.setByte("state", state.getValue());
+ nbt.setByte("size", size.getValue());
+ nbt.setByte("grade", grade.getValue());
+ nbt.setByte("pattern", pattern);
+ nbt.setBoolean("hasEffect", hasEffect);
+ }
+
+ @Override
+ public void readFromNBT(NBTTagCompound par1NBTTagCompound){
+ super.readFromNBT(par1NBTTagCompound);
+ progress=par1NBTTagCompound.getInteger("Progress");
+
+ state= IPottery.PotteryState.Get(par1NBTTagCompound.getByte("pState"));
+ size= IPottery.PotterySize.Get(par1NBTTagCompound.getByte("pSize"));
+ grade= IPottery.PotteryGrade.Get(par1NBTTagCompound.getByte("pGrade"));
+ pattern=par1NBTTagCompound.getByte("pPattern");
+ hasEffect=par1NBTTagCompound.getBoolean("pEffect");
+
+ dummyNBT=new NBTTagCompound();
+ writePotteryData(dummyNBT);
+ }
+ @Override
+ public void writeToNBT(NBTTagCompound par1NBTTagCompound){
+ super.writeToNBT(par1NBTTagCompound);
+ par1NBTTagCompound.setInteger("Progress", progress);
+
+ par1NBTTagCompound.setByte("pState", state.getValue());
+ par1NBTTagCompound.setByte("pSize", size.getValue());
+ par1NBTTagCompound.setByte("pGrade", grade.getValue());
+ par1NBTTagCompound.setByte("pPattern", pattern);
+ par1NBTTagCompound.setBoolean("pEffect", hasEffect);
+ }
+
+ @Override
+ public Packet getDescriptionPacket() {
+ NBTTagCompound nbtTagCompound = new NBTTagCompound();
+ this.writeToNBT(nbtTagCompound);
+ return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 1, nbtTagCompound);
+ }
+
+ @Override
+ public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
+ this.readFromNBT(pkt.func_148857_g());
+ }
+
+ @Override
+ public void updateEntity() {
+ //--------------------------IPotteryを得る-------------------------------
+ Block b = getBlockType();
+ IPottery ip;
+ if (b instanceof IPottery) {
+ ip = (IPottery) b;
+ } else {
+ //なんか妙だったら即破壊
+ if(!worldObj.isRemote) worldObj.func_147480_a(xCoord, yCoord, zCoord, true);
+ return;
+ }
+
+ /*
+ //--------------------------Stateを得る-------------------------------
+ if (state == IPottery.PotteryState.INVALID_VALUE) {
+ state = ip.getState(potteryMetadata);
+ }
+ */
+
+ //--------------------------乾燥-------------------------------
+ if(state== IPottery.PotteryState.MOLDED){
+ int base=10;
+
+ //乾燥地帯なら乾燥は早い
+ BiomeGenBase bgb=worldObj.getBiomeGenForCoords(xCoord, zCoord);
+ ImmutableList<BiomeManager.BiomeEntry> list=BiomeManager.getBiomes(BiomeManager.BiomeType.DESERT);
+ for(BiomeManager.BiomeEntry be : list){
+ if(bgb==be.biome){
+ base*=2;
+ break;
+ }
+ }
+
+ //雨が降るバイームでかつ雨なら乾燥は遅くなる
+ if(worldObj.isRaining() && bgb.canSpawnLightningBolt()){
+ if(yCoord==worldObj.getHeightValue(xCoord, zCoord)){
+ //雨で直接濡れていようものなら・・・
+ base=0;
+ }
+ else{
+ base/=2;
+ }
+ }
+
+ if(dummyNBT==null){
+ dummyNBT=new NBTTagCompound();
+ writePotteryData(dummyNBT);
+ }
+
+ progress+=base;
+ if(progress>=10*20*ip.getDrySec(dummyNBT)){
+ progress=0;
+
+ ItemStack tmp=new ItemStack(getBlockType(), 1, 0);
+ ip.setState(tmp, IPottery.PotteryState.DRY);
+ state=ip.getState(tmp.getTagCompound());
+ markDirty();
+ worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
+ }
+ }
+
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/pottery/model/ModelJarLarge.class b/src/main/java/jp/plusplus/fbs/pottery/model/ModelJarLarge.class Binary files differnew file mode 100644 index 0000000..41c67e8 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/model/ModelJarLarge.class diff --git a/src/main/java/jp/plusplus/fbs/pottery/model/ModelJarLarge.java b/src/main/java/jp/plusplus/fbs/pottery/model/ModelJarLarge.java new file mode 100644 index 0000000..0e16df6 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/model/ModelJarLarge.java @@ -0,0 +1,178 @@ +// Date: 2015/08/26 12:11:59 +// Template version 1.1 +// Java generated by Techne +// Keep in mind that you still need to fill in some blanks +// - ZeuX + + + + + + +package jp.plusplus.fbs.pottery.model; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +public class ModelJarLarge extends ModelBase { + //fields + ModelRenderer Shape1; + ModelRenderer Shape2; + ModelRenderer Shape2b; + ModelRenderer Shape2c; + ModelRenderer Shape2d; + ModelRenderer Shape3; + ModelRenderer Shape3b; + ModelRenderer Shape3c; + ModelRenderer Shape3d; + ModelRenderer Shape4; + ModelRenderer Shape4b; + ModelRenderer Shape4c; + ModelRenderer Shape4d; + ModelRenderer Shape5; + ModelRenderer Shape5b; + ModelRenderer Shape5c; + ModelRenderer Shape5d; + + public ModelJarLarge() { + textureWidth = 64; + textureHeight = 32; + + Shape1 = new ModelRenderer(this, 0, 0); + Shape1.addBox(-6F, 7F, -6F, 12, 1, 12); + Shape1.setRotationPoint(0F, 16F, 0F); + Shape1.setTextureSize(64, 32); + Shape1.mirror = true; + setRotation(Shape1, 0F, 0F, 0F); + Shape2 = new ModelRenderer(this, 36, 0); + Shape2.addBox(-6F, 5F, -7F, 13, 2, 1); + Shape2.setRotationPoint(0F, 16F, 0F); + Shape2.setTextureSize(64, 32); + Shape2.mirror = true; + setRotation(Shape2, 0F, 0F, 0F); + Shape2b = new ModelRenderer(this, 36, 0); + Shape2b.addBox(-6F, 5F, -7F, 13, 2, 1); + Shape2b.setRotationPoint(0F, 16F, 0F); + Shape2b.setTextureSize(64, 32); + Shape2b.mirror = true; + setRotation(Shape2b, 0F, -1.570796F, 0F); + Shape2c = new ModelRenderer(this, 36, 0); + Shape2c.addBox(-6F, 5F, -7F, 13, 2, 1); + Shape2c.setRotationPoint(0F, 16F, 0F); + Shape2c.setTextureSize(64, 32); + Shape2c.mirror = true; + setRotation(Shape2c, 0F, 1.570796F, 0F); + Shape2d = new ModelRenderer(this, 36, 0); + Shape2d.addBox(-6F, 5F, -7F, 13, 2, 1); + Shape2d.setRotationPoint(0F, 16F, 0F); + Shape2d.setTextureSize(64, 32); + Shape2d.mirror = true; + setRotation(Shape2d, 0F, 3.141593F, 0F); + Shape3 = new ModelRenderer(this, 0, 13); + Shape3.addBox(-7F, -5F, -8F, 15, 10, 1); + Shape3.setRotationPoint(0F, 16F, 0F); + Shape3.setTextureSize(64, 32); + Shape3.mirror = true; + setRotation(Shape3, 0F, 0F, 0F); + Shape3b = new ModelRenderer(this, 0, 13); + Shape3b.addBox(-7F, -5F, -8F, 15, 10, 1); + Shape3b.setRotationPoint(0F, 16F, 0F); + Shape3b.setTextureSize(64, 32); + Shape3b.mirror = true; + setRotation(Shape3b, 0F, -1.570796F, 0F); + Shape3c = new ModelRenderer(this, 0, 13); + Shape3c.addBox(-7F, -5F, -8F, 15, 10, 1); + Shape3c.setRotationPoint(0F, 16F, 0F); + Shape3c.setTextureSize(64, 32); + Shape3c.mirror = true; + setRotation(Shape3c, 0F, 1.570796F, 0F); + Shape3d = new ModelRenderer(this, 0, 13); + Shape3d.addBox(-7F, -5F, -8F, 15, 10, 1); + Shape3d.setRotationPoint(0F, 16F, 0F); + Shape3d.setTextureSize(64, 32); + Shape3d.mirror = true; + setRotation(Shape3d, 0F, 3.141593F, 0F); + Shape4 = new ModelRenderer(this, 36, 3); + Shape4.addBox(-6F, -7F, -7F, 13, 2, 1); + Shape4.setRotationPoint(0F, 16F, 0F); + Shape4.setTextureSize(64, 32); + Shape4.mirror = true; + setRotation(Shape4, 0F, 0F, 0F); + Shape4b = new ModelRenderer(this, 36, 3); + Shape4b.addBox(-6F, -7F, -7F, 13, 2, 1); + Shape4b.setRotationPoint(0F, 16F, 0F); + Shape4b.setTextureSize(64, 32); + Shape4b.mirror = true; + setRotation(Shape4b, 0F, -1.570796F, 0F); + Shape4c = new ModelRenderer(this, 36, 3); + Shape4c.addBox(-6F, -7F, -7F, 13, 2, 1); + Shape4c.setRotationPoint(0F, 16F, 0F); + Shape4c.setTextureSize(64, 32); + Shape4c.mirror = true; + setRotation(Shape4c, 0F, 1.570796F, 0F); + Shape4d = new ModelRenderer(this, 36, 3); + Shape4d.addBox(-6F, -7F, -7F, 13, 2, 1); + Shape4d.setRotationPoint(0F, 16F, 0F); + Shape4d.setTextureSize(64, 32); + Shape4d.mirror = true; + setRotation(Shape4d, 0F, 3.141593F, 0F); + Shape5 = new ModelRenderer(this, 30, 13); + Shape5.addBox(-6F, -8F, -8F, 14, 1, 2); + Shape5.setRotationPoint(0F, 16F, 0F); + Shape5.setTextureSize(64, 32); + Shape5.mirror = true; + setRotation(Shape5, 0F, 0F, 0F); + Shape5b = new ModelRenderer(this, 30, 13); + Shape5b.addBox(-6F, -8F, -8F, 14, 1, 2); + Shape5b.setRotationPoint(0F, 16F, 0F); + Shape5b.setTextureSize(64, 32); + Shape5b.mirror = true; + setRotation(Shape5b, 0F, -1.570796F, 0F); + Shape5c = new ModelRenderer(this, 30, 13); + Shape5c.addBox(-6F, -8F, -8F, 14, 1, 2); + Shape5c.setRotationPoint(0F, 16F, 0F); + Shape5c.setTextureSize(64, 32); + Shape5c.mirror = true; + setRotation(Shape5c, 0F, 1.570796F, 0F); + Shape5d = new ModelRenderer(this, 30, 13); + Shape5d.addBox(-6F, -8F, -8F, 14, 1, 2); + Shape5d.setRotationPoint(0F, 16F, 0F); + Shape5d.setTextureSize(64, 32); + Shape5d.mirror = true; + setRotation(Shape5d, 0F, 3.141593F, 0F); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + setRotationAngles(f, f1, f2, f3, f4, f5); + Shape1.render(f5); + Shape2.render(f5); + Shape2b.render(f5); + Shape2c.render(f5); + Shape2d.render(f5); + Shape3.render(f5); + Shape3b.render(f5); + Shape3c.render(f5); + Shape3d.render(f5); + Shape4.render(f5); + Shape4b.render(f5); + Shape4c.render(f5); + Shape4d.render(f5); + Shape5.render(f5); + Shape5b.render(f5); + Shape5c.render(f5); + Shape5d.render(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + + public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5) { + super.setRotationAngles(f, f1, f2, f3, f4, f5, null); + } + +} diff --git a/src/main/java/jp/plusplus/fbs/pottery/model/ModelPotLarge.class b/src/main/java/jp/plusplus/fbs/pottery/model/ModelPotLarge.class Binary files differnew file mode 100644 index 0000000..ca4032c --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/model/ModelPotLarge.class diff --git a/src/main/java/jp/plusplus/fbs/pottery/model/ModelPotLarge.java b/src/main/java/jp/plusplus/fbs/pottery/model/ModelPotLarge.java new file mode 100644 index 0000000..b626ff3 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/model/ModelPotLarge.java @@ -0,0 +1,269 @@ +// Date: 2015/08/26 23:20:57 +// Template version 1.1 +// Java generated by Techne +// Keep in mind that you still need to fill in some blanks +// - ZeuX + +package jp.plusplus.fbs.pottery.model; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +public class ModelPotLarge extends ModelBase { + //fields + ModelRenderer Shape1; + ModelRenderer Shape2; + ModelRenderer Shape2b; + ModelRenderer Shape2c; + ModelRenderer Shape2d; + ModelRenderer Shape3; + ModelRenderer Shape3b; + ModelRenderer Shape3c; + ModelRenderer Shape3d; + ModelRenderer Shape4; + ModelRenderer Shape4b; + ModelRenderer Shape4c; + ModelRenderer Shape4d; + ModelRenderer Shape5; + ModelRenderer Shape5b; + ModelRenderer Shape5c; + ModelRenderer Shape5d; + ModelRenderer Shape6; + ModelRenderer Shape6b; + ModelRenderer Shape6c; + ModelRenderer Shape6d; + ModelRenderer Shape7; + ModelRenderer Shape7b; + ModelRenderer Shape7c; + ModelRenderer Shape7d; + ModelRenderer Shape8; + ModelRenderer Shape8b; + ModelRenderer Shape8c; + ModelRenderer Shape8d; + + public ModelPotLarge() { + textureWidth = 64; + textureHeight = 32; + + Shape1 = new ModelRenderer(this, 0, 0); + Shape1.addBox(-5F, 7F, -5F, 10, 1, 10); + Shape1.setRotationPoint(0F, 16F, 0F); + Shape1.setTextureSize(64, 32); + Shape1.mirror = true; + setRotation(Shape1, 0F, 0F, 0F); + Shape2 = new ModelRenderer(this, 30, 0); + Shape2.addBox(-5F, 5F, -6F, 11, 3, 1); + Shape2.setRotationPoint(0F, 15F, 0F); + Shape2.setTextureSize(64, 32); + Shape2.mirror = true; + setRotation(Shape2, 0F, 0F, 0F); + Shape2b = new ModelRenderer(this, 30, 0); + Shape2b.addBox(-5F, 5F, -6F, 11, 3, 1); + Shape2b.setRotationPoint(0F, 15F, 0F); + Shape2b.setTextureSize(64, 32); + Shape2b.mirror = true; + setRotation(Shape2b, 0F, -1.570796F, 0F); + Shape2c = new ModelRenderer(this, 30, 0); + Shape2c.addBox(-5F, 5F, -6F, 11, 3, 1); + Shape2c.setRotationPoint(0F, 15F, 0F); + Shape2c.setTextureSize(64, 32); + Shape2c.mirror = true; + setRotation(Shape2c, 0F, 1.570796F, 0F); + Shape2d = new ModelRenderer(this, 30, 0); + Shape2d.addBox(-5F, 5F, -6F, 11, 3, 1); + Shape2d.setRotationPoint(0F, 15F, 0F); + Shape2d.setTextureSize(64, 32); + Shape2d.mirror = true; + setRotation(Shape2d, 0F, 3.141593F, 0F); + Shape3 = new ModelRenderer(this, 30, 4); + Shape3.addBox(-6F, 1F, -7F, 13, 3, 1); + Shape3.setRotationPoint(0F, 16F, 0F); + Shape3.setTextureSize(64, 32); + Shape3.mirror = true; + setRotation(Shape3, 0F, 0F, 0F); + Shape3b = new ModelRenderer(this, 30, 4); + Shape3b.addBox(-6F, 1F, -7F, 13, 3, 1); + Shape3b.setRotationPoint(0F, 16F, 0F); + Shape3b.setTextureSize(64, 32); + Shape3b.mirror = true; + setRotation(Shape3b, 0F, -1.570796F, 0F); + Shape3c = new ModelRenderer(this, 30, 4); + Shape3c.addBox(-6F, 1F, -7F, 13, 3, 1); + Shape3c.setRotationPoint(0F, 16F, 0F); + Shape3c.setTextureSize(64, 32); + Shape3c.mirror = true; + setRotation(Shape3c, 0F, 1.570796F, 0F); + Shape3d = new ModelRenderer(this, 30, 4); + Shape3d.addBox(-6F, 1F, -7F, 13, 3, 1); + Shape3d.setRotationPoint(0F, 16F, 0F); + Shape3d.setTextureSize(64, 32); + Shape3d.mirror = true; + setRotation(Shape3d, 0F, 3.141593F, 0F); + Shape4 = new ModelRenderer(this, 0, 11); + Shape4.addBox(-7F, -2F, -8F, 15, 3, 1); + Shape4.setRotationPoint(0F, 16F, 0F); + Shape4.setTextureSize(64, 32); + Shape4.mirror = true; + setRotation(Shape4, 0F, 0F, 0F); + Shape4b = new ModelRenderer(this, 0, 11); + Shape4b.addBox(-7F, -2F, -8F, 15, 3, 1); + Shape4b.setRotationPoint(0F, 16F, 0F); + Shape4b.setTextureSize(64, 32); + Shape4b.mirror = true; + setRotation(Shape4b, 0F, -1.570796F, 0F); + Shape4c = new ModelRenderer(this, 0, 11); + Shape4c.addBox(-7F, -2F, -8F, 15, 3, 1); + Shape4c.setRotationPoint(0F, 16F, 0F); + Shape4c.setTextureSize(64, 32); + Shape4c.mirror = true; + setRotation(Shape4c, 0F, 1.570796F, 0F); + Shape4d = new ModelRenderer(this, 0, 11); + Shape4d.addBox(-7F, -2F, -8F, 15, 3, 1); + Shape4d.setRotationPoint(0F, 16F, 0F); + Shape4d.setTextureSize(64, 32); + Shape4d.mirror = true; + setRotation(Shape4d, 0F, 3.141593F, 0F); + Shape5 = new ModelRenderer(this, 34, 11); + Shape5.addBox(-6F, -4F, -7F, 13, 2, 1); + Shape5.setRotationPoint(0F, 16F, 0F); + Shape5.setTextureSize(64, 32); + Shape5.mirror = true; + setRotation(Shape5, 0F, 0F, 0F); + Shape5b = new ModelRenderer(this, 34, 11); + Shape5b.addBox(-6F, -4F, -7F, 13, 2, 1); + Shape5b.setRotationPoint(0F, 16F, 0F); + Shape5b.setTextureSize(64, 32); + Shape5b.mirror = true; + setRotation(Shape5b, 0F, -1.570796F, 0F); + Shape5c = new ModelRenderer(this, 34, 11); + Shape5c.addBox(-6F, -4F, -7F, 13, 2, 1); + Shape5c.setRotationPoint(0F, 16F, 0F); + Shape5c.setTextureSize(64, 32); + Shape5c.mirror = true; + setRotation(Shape5c, 0F, 1.570796F, 0F); + Shape5d = new ModelRenderer(this, 34, 11); + Shape5d.addBox(-6F, -4F, -7F, 13, 2, 1); + Shape5d.setRotationPoint(0F, 16F, 0F); + Shape5d.setTextureSize(64, 32); + Shape5d.mirror = true; + setRotation(Shape5d, 0F, 3.141593F, 0F); + Shape6 = new ModelRenderer(this, 0, 15); + Shape6.addBox(-2F, -5F, -6F, 8, 1, 4); + Shape6.setRotationPoint(0F, 16F, 0F); + Shape6.setTextureSize(64, 32); + Shape6.mirror = true; + setRotation(Shape6, 0F, 0F, 0F); + Shape6b = new ModelRenderer(this, 0, 15); + Shape6b.addBox(-2F, -5F, -6F, 8, 1, 4); + Shape6b.setRotationPoint(0F, 16F, 0F); + Shape6b.setTextureSize(64, 32); + Shape6b.mirror = true; + setRotation(Shape6b, 0F, -1.570796F, 0F); + Shape6c = new ModelRenderer(this, 0, 15); + Shape6c.addBox(-2F, -5F, -6F, 8, 1, 4); + Shape6c.setRotationPoint(0F, 16F, 0F); + Shape6c.setTextureSize(64, 32); + Shape6c.mirror = true; + setRotation(Shape6c, 0F, 1.570796F, 0F); + Shape6d = new ModelRenderer(this, 0, 15); + Shape6d.addBox(-2F, -5F, -6F, 8, 1, 4); + Shape6d.setRotationPoint(0F, 16F, 0F); + Shape6d.setTextureSize(64, 32); + Shape6d.mirror = true; + setRotation(Shape6d, 0F, 3.141593F, 0F); + Shape7 = new ModelRenderer(this, 0, 0); + Shape7.addBox(-1F, -7F, -2F, 3, 2, 1); + Shape7.setRotationPoint(0F, 16F, 0F); + Shape7.setTextureSize(64, 32); + Shape7.mirror = true; + setRotation(Shape7, 0F, 0F, 0F); + Shape7b = new ModelRenderer(this, 0, 0); + Shape7b.addBox(-1F, -7F, -2F, 3, 2, 1); + Shape7b.setRotationPoint(0F, 16F, 0F); + Shape7b.setTextureSize(64, 32); + Shape7b.mirror = true; + setRotation(Shape7b, 0F, -1.570796F, 0F); + Shape7c = new ModelRenderer(this, 0, 0); + Shape7c.addBox(-1F, -7F, -2F, 3, 2, 1); + Shape7c.setRotationPoint(0F, 16F, 0F); + Shape7c.setTextureSize(64, 32); + Shape7c.mirror = true; + setRotation(Shape7c, 0F, 1.570796F, 0F); + Shape7d = new ModelRenderer(this, 0, 0); + Shape7d.addBox(-1F, -7F, -2F, 3, 2, 1); + Shape7d.setRotationPoint(0F, 16F, 0F); + Shape7d.setTextureSize(64, 32); + Shape7d.mirror = true; + setRotation(Shape7d, 0F, 3.141593F, 0F); + Shape8 = new ModelRenderer(this, 30, 8); + Shape8.addBox(-2F, -8F, -3F, 5, 1, 1); + Shape8.setRotationPoint(0F, 16F, 0F); + Shape8.setTextureSize(64, 32); + Shape8.mirror = true; + setRotation(Shape8, 0F, 0F, 0F); + Shape8b = new ModelRenderer(this, 30, 8); + Shape8b.addBox(-2F, -8F, -3F, 5, 1, 1); + Shape8b.setRotationPoint(0F, 16F, 0F); + Shape8b.setTextureSize(64, 32); + Shape8b.mirror = true; + setRotation(Shape8b, 0F, -1.570796F, 0F); + Shape8c = new ModelRenderer(this, 30, 8); + Shape8c.addBox(-2F, -8F, -3F, 5, 1, 1); + Shape8c.setRotationPoint(0F, 16F, 0F); + Shape8c.setTextureSize(64, 32); + Shape8c.mirror = true; + setRotation(Shape8c, 0F, 1.570796F, 0F); + Shape8d = new ModelRenderer(this, 30, 8); + Shape8d.addBox(-2F, -8F, -3F, 5, 1, 1); + Shape8d.setRotationPoint(0F, 16F, 0F); + Shape8d.setTextureSize(64, 32); + Shape8d.mirror = true; + setRotation(Shape8d, 0F, 3.141593F, 0F); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + setRotationAngles(f, f1, f2, f3, f4, f5); + Shape1.render(f5); + Shape2.render(f5); + Shape2b.render(f5); + Shape2c.render(f5); + Shape2d.render(f5); + Shape3.render(f5); + Shape3b.render(f5); + Shape3c.render(f5); + Shape3d.render(f5); + Shape4.render(f5); + Shape4b.render(f5); + Shape4c.render(f5); + Shape4d.render(f5); + Shape5.render(f5); + Shape5b.render(f5); + Shape5c.render(f5); + Shape5d.render(f5); + Shape6.render(f5); + Shape6b.render(f5); + Shape6c.render(f5); + Shape6d.render(f5); + Shape7.render(f5); + Shape7b.render(f5); + Shape7c.render(f5); + Shape7d.render(f5); + Shape8.render(f5); + Shape8b.render(f5); + Shape8c.render(f5); + Shape8d.render(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + + public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5) { + super.setRotationAngles(f, f1, f2, f3, f4, f5, null); + } + +} diff --git a/src/main/java/jp/plusplus/fbs/pottery/model/ModelPotMedium.class b/src/main/java/jp/plusplus/fbs/pottery/model/ModelPotMedium.class Binary files differnew file mode 100644 index 0000000..e03d4e5 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/model/ModelPotMedium.class diff --git a/src/main/java/jp/plusplus/fbs/pottery/model/ModelPotMedium.java b/src/main/java/jp/plusplus/fbs/pottery/model/ModelPotMedium.java new file mode 100644 index 0000000..b378011 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/model/ModelPotMedium.java @@ -0,0 +1,274 @@ +// Date: 2015/08/26 21:38:22 +// Template version 1.1 +// Java generated by Techne +// Keep in mind that you still need to fill in some blanks +// - ZeuX + + + + + + +package jp.plusplus.fbs.pottery.model; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +public class ModelPotMedium extends ModelBase { + //fields + ModelRenderer Shape1; + ModelRenderer Shape2; + ModelRenderer Shape2b; + ModelRenderer Shape2c; + ModelRenderer Shape2d; + ModelRenderer Shape3; + ModelRenderer Shape3b; + ModelRenderer Shape3c; + ModelRenderer Shape3d; + ModelRenderer Shape4; + ModelRenderer Shape4b; + ModelRenderer Shape4c; + ModelRenderer Shape4d; + ModelRenderer Shape5; + ModelRenderer Shape5b; + ModelRenderer Shape5c; + ModelRenderer Shape5d; + ModelRenderer Shape6; + ModelRenderer Shape6b; + ModelRenderer Shape6c; + ModelRenderer Shape6d; + ModelRenderer Shape7; + ModelRenderer Shape7b; + ModelRenderer Shape7c; + ModelRenderer Shape7d; + ModelRenderer Shape8; + ModelRenderer Shape8b; + ModelRenderer Shape8c; + ModelRenderer Shape8d; + + public ModelPotMedium(int offY) { + textureWidth = 64; + textureHeight = 32; + + Shape1 = new ModelRenderer(this, 0, 0 + offY); + Shape1.addBox(-3F, 7F, -3F, 6, 1, 6); + Shape1.setRotationPoint(0F, 16F, 0F); + Shape1.setTextureSize(64, 32); + Shape1.mirror = true; + setRotation(Shape1, 0F, 0F, 0F); + Shape2 = new ModelRenderer(this, 18, 0 + offY); + Shape2.addBox(-3F, 5F, -4F, 7, 2, 1); + Shape2.setRotationPoint(0F, 16F, 0F); + Shape2.setTextureSize(64, 32); + Shape2.mirror = true; + setRotation(Shape2, 0F, 0F, 0F); + Shape2b = new ModelRenderer(this, 18, 0 + offY); + Shape2b.addBox(-3F, 5F, -4F, 7, 2, 1); + Shape2b.setRotationPoint(0F, 16F, 0F); + Shape2b.setTextureSize(64, 32); + Shape2b.mirror = true; + setRotation(Shape2b, 0F, -1.570796F, 0F); + Shape2c = new ModelRenderer(this, 18, 0 + offY); + Shape2c.addBox(-3F, 5F, -4F, 7, 2, 1); + Shape2c.setRotationPoint(0F, 16F, 0F); + Shape2c.setTextureSize(64, 32); + Shape2c.mirror = true; + setRotation(Shape2c, 0F, 1.570796F, 0F); + Shape2d = new ModelRenderer(this, 18, 0 + offY); + Shape2d.addBox(-3F, 5F, -4F, 7, 2, 1); + Shape2d.setRotationPoint(0F, 16F, 0F); + Shape2d.setTextureSize(64, 32); + Shape2d.mirror = true; + setRotation(Shape2d, 0F, 3.141593F, 0F); + Shape3 = new ModelRenderer(this, 42, 5 + offY); + Shape3.addBox(-4F, 3F, -5F, 9, 2, 1); + Shape3.setRotationPoint(0F, 16F, 0F); + Shape3.setTextureSize(64, 32); + Shape3.mirror = true; + setRotation(Shape3, 0F, 0F, 0F); + Shape3b = new ModelRenderer(this, 42, 5 + offY); + Shape3b.addBox(-4F, 3F, -5F, 9, 2, 1); + Shape3b.setRotationPoint(0F, 16F, 0F); + Shape3b.setTextureSize(64, 32); + Shape3b.mirror = true; + setRotation(Shape3b, 0F, -1.570796F, 0F); + Shape3c = new ModelRenderer(this, 42, 5 + offY); + Shape3c.addBox(-4F, 3F, -5F, 9, 2, 1); + Shape3c.setRotationPoint(0F, 16F, 0F); + Shape3c.setTextureSize(64, 32); + Shape3c.mirror = true; + setRotation(Shape3c, 0F, 1.570796F, 0F); + Shape3d = new ModelRenderer(this, 42, 5 + offY); + Shape3d.addBox(-4F, 3F, -5F, 9, 2, 1); + Shape3d.setRotationPoint(0F, 16F, 0F); + Shape3d.setTextureSize(64, 32); + Shape3d.mirror = true; + setRotation(Shape3d, 0F, 3.141593F, 0F); + Shape4 = new ModelRenderer(this, 34, 0 + offY); + Shape4.addBox(-5F, -1F, -6F, 11, 4, 1); + Shape4.setRotationPoint(0F, 16F, 0F); + Shape4.setTextureSize(64, 32); + Shape4.mirror = true; + setRotation(Shape4, 0F, 0F, 0F); + Shape4b = new ModelRenderer(this, 34, 0 + offY); + Shape4b.addBox(-5F, -1F, -6F, 11, 4, 1); + Shape4b.setRotationPoint(0F, 16F, 0F); + Shape4b.setTextureSize(64, 32); + Shape4b.mirror = true; + setRotation(Shape4b, 0F, -1.570796F, 0F); + Shape4c = new ModelRenderer(this, 34, 0 + offY); + Shape4c.addBox(-5F, -1F, -6F, 11, 4, 1); + Shape4c.setRotationPoint(0F, 16F, 0F); + Shape4c.setTextureSize(64, 32); + Shape4c.mirror = true; + setRotation(Shape4c, 0F, 1.570796F, 0F); + Shape4d = new ModelRenderer(this, 34, 0 + offY); + Shape4d.addBox(-5F, -1F, -6F, 11, 4, 1); + Shape4d.setRotationPoint(0F, 16F, 0F); + Shape4d.setTextureSize(64, 32); + Shape4d.mirror = true; + setRotation(Shape4d, 0F, 3.141593F, 0F); + Shape5 = new ModelRenderer(this, 16, 7 + offY); + Shape5.addBox(-4F, -2F, -5F, 9, 1, 1); + Shape5.setRotationPoint(0F, 16F, 0F); + Shape5.setTextureSize(64, 32); + Shape5.mirror = true; + setRotation(Shape5, 0F, 0F, 0F); + Shape5b = new ModelRenderer(this, 16, 7 + offY); + Shape5b.addBox(-4F, -2F, -5F, 9, 1, 1); + Shape5b.setRotationPoint(0F, 16F, 0F); + Shape5b.setTextureSize(64, 32); + Shape5b.mirror = true; + setRotation(Shape5b, 0F, -1.570796F, 0F); + Shape5c = new ModelRenderer(this, 16, 7 + offY); + Shape5c.addBox(-4F, -2F, -5F, 9, 1, 1); + Shape5c.setRotationPoint(0F, 16F, 0F); + Shape5c.setTextureSize(64, 32); + Shape5c.mirror = true; + setRotation(Shape5c, 0F, 1.570796F, 0F); + Shape5d = new ModelRenderer(this, 16, 7 + offY); + Shape5d.addBox(-4F, -2F, -5F, 9, 1, 1); + Shape5d.setRotationPoint(0F, 16F, 0F); + Shape5d.setTextureSize(64, 32); + Shape5d.mirror = true; + setRotation(Shape5d, 0F, 3.141593F, 0F); + Shape6 = new ModelRenderer(this, 0, 7 + offY); + Shape6.addBox(-3F, -3F, -4F, 7, 1, 1); + Shape6.setRotationPoint(0F, 16F, 0F); + Shape6.setTextureSize(64, 32); + Shape6.mirror = true; + setRotation(Shape6, 0F, 0F, 0F); + Shape6b = new ModelRenderer(this, 0, 7 + offY); + Shape6b.addBox(-3F, -3F, -4F, 7, 1, 1); + Shape6b.setRotationPoint(0F, 16F, 0F); + Shape6b.setTextureSize(64, 32); + Shape6b.mirror = true; + setRotation(Shape6b, 0F, -1.570796F, 0F); + Shape6c = new ModelRenderer(this, 0, 7 + offY); + Shape6c.addBox(-3F, -3F, -4F, 7, 1, 1); + Shape6c.setRotationPoint(0F, 16F, 0F); + Shape6c.setTextureSize(64, 32); + Shape6c.mirror = true; + setRotation(Shape6c, 0F, 1.570796F, 0F); + Shape6d = new ModelRenderer(this, 0, 7 + offY); + Shape6d.addBox(-3F, -3F, -4F, 7, 1, 1); + Shape6d.setRotationPoint(0F, 16F, 0F); + Shape6d.setTextureSize(64, 32); + Shape6d.mirror = true; + setRotation(Shape6d, 0F, 3.141593F, 0F); + Shape7 = new ModelRenderer(this, 18, 3 + offY); + Shape7.addBox(-2F, -4F, -3F, 5, 1, 1); + Shape7.setRotationPoint(0F, 16F, 0F); + Shape7.setTextureSize(64, 32); + Shape7.mirror = true; + setRotation(Shape7, 0F, 0F, 0F); + Shape7b = new ModelRenderer(this, 18, 3 + offY); + Shape7b.addBox(-2F, -4F, -3F, 5, 1, 1); + Shape7b.setRotationPoint(0F, 16F, 0F); + Shape7b.setTextureSize(64, 32); + Shape7b.mirror = true; + setRotation(Shape7b, 0F, -1.570796F, 0F); + Shape7c = new ModelRenderer(this, 18, 3 + offY); + Shape7c.addBox(-2F, -4F, -3F, 5, 1, 1); + Shape7c.setRotationPoint(0F, 16F, 0F); + Shape7c.setTextureSize(64, 32); + Shape7c.mirror = true; + setRotation(Shape7c, 0F, 1.570796F, 0F); + Shape7d = new ModelRenderer(this, 18, 3 + offY); + Shape7d.addBox(-2F, -4F, -3F, 5, 1, 1); + Shape7d.setRotationPoint(0F, 16F, 0F); + Shape7d.setTextureSize(64, 32); + Shape7d.mirror = true; + setRotation(Shape7d, 0F, 3.141593F, 0F); + Shape8 = new ModelRenderer(this, 24, 5 + offY); + Shape8.addBox(-3F, -5F, -4F, 7, 1, 1); + Shape8.setRotationPoint(0F, 16F, 0F); + Shape8.setTextureSize(64, 32); + Shape8.mirror = true; + setRotation(Shape8, 0F, 0F, 0F); + Shape8b = new ModelRenderer(this, 24, 5 + offY); + Shape8b.addBox(-3F, -5F, -4F, 7, 1, 1); + Shape8b.setRotationPoint(0F, 16F, 0F); + Shape8b.setTextureSize(64, 32); + Shape8b.mirror = true; + setRotation(Shape8b, 0F, -1.570796F, 0F); + Shape8c = new ModelRenderer(this, 24, 5 + offY); + Shape8c.addBox(-3F, -5F, -4F, 7, 1, 1); + Shape8c.setRotationPoint(0F, 16F, 0F); + Shape8c.setTextureSize(64, 32); + Shape8c.mirror = true; + setRotation(Shape8c, 0F, 1.570796F, 0F); + Shape8d = new ModelRenderer(this, 24, 5 + offY); + Shape8d.addBox(-3F, -5F, -4F, 7, 1, 1); + Shape8d.setRotationPoint(0F, 16F, 0F); + Shape8d.setTextureSize(64, 32); + Shape8d.mirror = true; + setRotation(Shape8d, 0F, 3.141593F, 0F); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + setRotationAngles(f, f1, f2, f3, f4, f5); + Shape1.render(f5); + Shape2.render(f5); + Shape2b.render(f5); + Shape2c.render(f5); + Shape2d.render(f5); + Shape3.render(f5); + Shape3b.render(f5); + Shape3c.render(f5); + Shape3d.render(f5); + Shape4.render(f5); + Shape4b.render(f5); + Shape4c.render(f5); + Shape4d.render(f5); + Shape5.render(f5); + Shape5b.render(f5); + Shape5c.render(f5); + Shape5d.render(f5); + Shape6.render(f5); + Shape6b.render(f5); + Shape6c.render(f5); + Shape6d.render(f5); + Shape7.render(f5); + Shape7b.render(f5); + Shape7c.render(f5); + Shape7d.render(f5); + Shape8.render(f5); + Shape8b.render(f5); + Shape8c.render(f5); + Shape8d.render(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + + public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5) { + super.setRotationAngles(f, f1, f2, f3, f4, f5, null); + } + +} diff --git a/src/main/java/jp/plusplus/fbs/pottery/model/ModelPotSmall.class b/src/main/java/jp/plusplus/fbs/pottery/model/ModelPotSmall.class Binary files differnew file mode 100644 index 0000000..ad1b677 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/model/ModelPotSmall.class diff --git a/src/main/java/jp/plusplus/fbs/pottery/model/ModelPotSmall.java b/src/main/java/jp/plusplus/fbs/pottery/model/ModelPotSmall.java new file mode 100644 index 0000000..92f5b48 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/model/ModelPotSmall.java @@ -0,0 +1,178 @@ +// Date: 2015/08/26 16:55:15 +// Template version 1.1 +// Java generated by Techne +// Keep in mind that you still need to fill in some blanks +// - ZeuX + + + + + + +package jp.plusplus.fbs.pottery.model; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +public class ModelPotSmall extends ModelBase { + //fields + ModelRenderer Shape1; + ModelRenderer Shape2; + ModelRenderer Shape3; + ModelRenderer Shape4; + ModelRenderer Shape5; + ModelRenderer Shape6; + ModelRenderer Shape7; + ModelRenderer Shape8; + ModelRenderer Shape9; + ModelRenderer Shape10; + ModelRenderer Shape11; + ModelRenderer Shape12; + ModelRenderer Shape13; + ModelRenderer Shape14; + ModelRenderer Shape15; + ModelRenderer Shape16; + ModelRenderer Shape17; + + public ModelPotSmall(int offY) { + textureWidth = 64; + textureHeight = 32; + + Shape1 = new ModelRenderer(this, 0, 0 + offY); + Shape1.addBox(-2F, 7F, -2F, 4, 1, 4); + Shape1.setRotationPoint(0F, 16F, 0F); + Shape1.setTextureSize(64, 32); + Shape1.mirror = true; + setRotation(Shape1, 0F, 0F, 0F); + Shape2 = new ModelRenderer(this, 48, 0 + offY); + Shape2.addBox(-2F, 6F, -3F, 5, 1, 1); + Shape2.setRotationPoint(0F, 16F, 0F); + Shape2.setTextureSize(64, 32); + Shape2.mirror = true; + setRotation(Shape2, 0F, 0F, 0F); + Shape3 = new ModelRenderer(this, 48, 0 + offY); + Shape3.addBox(-2F, 6F, -3F, 5, 1, 1); + Shape3.setRotationPoint(0F, 16F, 0F); + Shape3.setTextureSize(64, 32); + Shape3.mirror = true; + setRotation(Shape3, 0F, 1.570796F, 0F); + Shape4 = new ModelRenderer(this, 48, 0 + offY); + Shape4.addBox(-2F, 6F, -3F, 5, 1, 1); + Shape4.setRotationPoint(0F, 16F, 0F); + Shape4.setTextureSize(64, 32); + Shape4.mirror = true; + setRotation(Shape4, 0F, 3.141593F, 0F); + Shape5 = new ModelRenderer(this, 48, 0 + offY); + Shape5.addBox(-2F, 6F, -3F, 5, 1, 1); + Shape5.setRotationPoint(0F, 16F, 0F); + Shape5.setTextureSize(64, 32); + Shape5.mirror = true; + setRotation(Shape5, 0F, -1.570796F, 0F); + Shape6 = new ModelRenderer(this, 16, 0 + offY); + Shape6.addBox(-4F, 1F, -4F, 7, 5, 1); + Shape6.setRotationPoint(0F, 16F, 0F); + Shape6.setTextureSize(64, 32); + Shape6.mirror = true; + setRotation(Shape6, 0F, 0F, 0F); + Shape7 = new ModelRenderer(this, 16, 0 + offY); + Shape7.addBox(-4F, 1F, -4F, 7, 5, 1); + Shape7.setRotationPoint(0F, 16F, 0F); + Shape7.setTextureSize(64, 32); + Shape7.mirror = true; + setRotation(Shape7, 0F, 1.570796F, 0F); + Shape8 = new ModelRenderer(this, 16, 0 + offY); + Shape8.addBox(-4F, 1F, -4F, 7, 5, 1); + Shape8.setRotationPoint(0F, 16F, 0F); + Shape8.setTextureSize(64, 32); + Shape8.mirror = true; + setRotation(Shape8, 0F, 3.141593F, 0F); + Shape9 = new ModelRenderer(this, 16, 0 + offY); + Shape9.addBox(-4F, 1F, -4F, 7, 5, 1); + Shape9.setRotationPoint(0F, 16F, 0F); + Shape9.setTextureSize(64, 32); + Shape9.mirror = true; + setRotation(Shape9, 0F, -1.570796F, 0F); + Shape10 = new ModelRenderer(this, 48, 2 + offY); + Shape10.addBox(-2F, 0F, -3F, 5, 1, 1); + Shape10.setRotationPoint(0F, 16F, 0F); + Shape10.setTextureSize(64, 32); + Shape10.mirror = true; + setRotation(Shape10, 0F, 0F, 0F); + Shape11 = new ModelRenderer(this, 48, 2 + offY); + Shape11.addBox(-2F, 0F, -3F, 5, 1, 1); + Shape11.setRotationPoint(0F, 16F, 0F); + Shape11.setTextureSize(64, 32); + Shape11.mirror = true; + setRotation(Shape11, 0F, 1.570796F, 0F); + Shape12 = new ModelRenderer(this, 48, 2 + offY); + Shape12.addBox(-2F, 0F, -3F, 5, 1, 1); + Shape12.setRotationPoint(0F, 16F, 0F); + Shape12.setTextureSize(64, 32); + Shape12.mirror = true; + setRotation(Shape12, 0F, 3.141593F, 0F); + Shape13 = new ModelRenderer(this, 48, 2 + offY); + Shape13.addBox(-2F, 0F, -3F, 5, 1, 1); + Shape13.setRotationPoint(0F, 16F, 0F); + Shape13.setTextureSize(64, 32); + Shape13.mirror = true; + setRotation(Shape13, 0F, -1.570796F, 0F); + Shape14 = new ModelRenderer(this, 32, 0 + offY); + Shape14.addBox(-4F, -1F, 2F, 6, 1, 2); + Shape14.setRotationPoint(0F, 16F, 0F); + Shape14.setTextureSize(64, 32); + Shape14.mirror = true; + setRotation(Shape14, 0F, 0F, 0F); + Shape15 = new ModelRenderer(this, 32, 0 + offY); + Shape15.addBox(-4F, -1F, 2F, 6, 1, 2); + Shape15.setRotationPoint(0F, 16F, 0F); + Shape15.setTextureSize(64, 32); + Shape15.mirror = true; + setRotation(Shape15, 0F, -1.570796F, 0F); + Shape16 = new ModelRenderer(this, 32, 0 + offY); + Shape16.addBox(-4F, -1F, 2F, 6, 1, 2); + Shape16.setRotationPoint(0F, 16F, 0F); + Shape16.setTextureSize(64, 32); + Shape16.mirror = true; + setRotation(Shape16, 0F, 1.570796F, 0F); + Shape17 = new ModelRenderer(this, 32, 0 + offY); + Shape17.addBox(-4F, -1F, 2F, 6, 1, 2); + Shape17.setRotationPoint(0F, 16F, 0F); + Shape17.setTextureSize(64, 32); + Shape17.mirror = true; + setRotation(Shape17, 0F, 3.141593F, 0F); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + setRotationAngles(f, f1, f2, f3, f4, f5); + Shape1.render(f5); + Shape2.render(f5); + Shape3.render(f5); + Shape4.render(f5); + Shape5.render(f5); + Shape6.render(f5); + Shape7.render(f5); + Shape8.render(f5); + Shape9.render(f5); + Shape10.render(f5); + Shape11.render(f5); + Shape12.render(f5); + Shape13.render(f5); + Shape14.render(f5); + Shape15.render(f5); + Shape16.render(f5); + Shape17.render(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + + public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5) { + super.setRotationAngles(f, f1, f2, f3, f4, f5, null); + } + +} diff --git a/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryAppraisal.class b/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryAppraisal.class Binary files differnew file mode 100644 index 0000000..da08fcd --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryAppraisal.class diff --git a/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryAppraisal.java b/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryAppraisal.java new file mode 100644 index 0000000..62cc097 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryAppraisal.java @@ -0,0 +1,40 @@ +package jp.plusplus.fbs.pottery.usable;
+
+import jp.plusplus.fbs.alchemy.AlchemyRegistry;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.item.crafting.FurnaceRecipes;
+
+import javax.annotation.Nullable;
+
+/**
+ * Created by plusplus_F on 2016/04/02.
+ */
+public class PotteryAppraisal extends PotteryKeep {
+ @Override
+ public String getUnlocalizedName() {
+ return "pottery.fbs.pot.appraisal";
+ }
+
+ @Override
+ public float getPriceScale(ItemStack pottery){
+ return 1.5f;
+ }
+
+ @Override
+ public ItemStack onInventoryClosing(EntityPlayer player, ItemStack pottery, int index, @Nullable ItemStack itemStack){
+ if(itemStack!=null && !pottery.getTagCompound().getBoolean(CHANGED_INDEXES+index) && AlchemyRegistry.CanAppraisal(itemStack)){
+ ItemStack ret=AlchemyRegistry.GetRandomAppraisal(itemStack);
+ if(ret!=null){
+ ret.stackSize=Math.min(itemStack.stackSize, ret.getMaxStackSize());
+ return ret;
+ }
+ }
+ return itemStack;
+ }
+
+ @Override
+ public boolean canTakeStack(EntityPlayer player, ItemStack pottery, int index, ItemStack itemStack){
+ return !pottery.getTagCompound().getBoolean(CHANGED_INDEXES+index);
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryBase$1.class b/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryBase$1.class Binary files differnew file mode 100644 index 0000000..90c8c4e --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryBase$1.class diff --git a/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryBase.class b/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryBase.class Binary files differnew file mode 100644 index 0000000..fbff80e --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryBase.class diff --git a/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryBase.java b/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryBase.java new file mode 100644 index 0000000..ba0ed3f --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryBase.java @@ -0,0 +1,157 @@ +package jp.plusplus.fbs.pottery.usable;
+
+import jp.plusplus.fbs.api.IPottery;
+import net.minecraft.entity.item.EntityItem;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemBlock;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.nbt.NBTTagList;
+import net.minecraft.world.World;
+
+import javax.annotation.Nullable;
+
+/**
+ * Created by plusplus_F on 2016/03/30.
+ * 魔法の壺の基底クラス
+ */
+public abstract class PotteryBase {
+ public static final String ITEM_STACKS="ItemStacks";
+
+ public NBTTagCompound getPotteryNBT(ItemStack pottery){
+ if(!pottery.hasTagCompound()){
+ pottery.setTagCompound(new NBTTagCompound());
+ }
+ return pottery.getTagCompound();
+ }
+
+ /**
+ * 壺のUnlocalizedNameを返す<br>
+ * ここで返した文字列がそのままローカライズに使用される
+ * @return UnlocalizedName
+ */
+ public abstract String getUnlocalizedName();
+
+ /**
+ * 名前の後ろにつく付加的な情報を返す
+ * @param pottery 壺のアイテムスタック
+ * @return
+ */
+ public String getNameModifier(ItemStack pottery){
+ IPottery ip=(IPottery)((ItemBlock)pottery.getItem()).field_150939_a;
+
+ int slot;
+ switch (ip.getSize(pottery.getTagCompound())){
+ case SMALL: slot=9; break;
+ case LARGE: slot=27; break;
+ default: slot=18; break;
+ }
+
+ if(pottery.getTagCompound().hasKey(ITEM_STACKS)){
+ NBTTagList list=(NBTTagList)pottery.getTagCompound().getTag(ITEM_STACKS);
+ slot-=list.tagCount();
+ }
+
+ return "["+slot+"]";
+ }
+
+ /**
+ * 売却値にかかる補正を返す
+ * @param pottery 壺のアイテムスタック
+ * @return 売却値補正
+ */
+ public float getPriceScale(ItemStack pottery){
+ return 1.f;
+ }
+
+ /**
+ * 壺が焼かれた時に呼び出される
+ * @param pottery 壺のアイテムスタック
+ */
+ public void onBaked(ItemStack pottery){}
+
+ /**
+ * この壺が使用できるか判定する
+ * @param player 所有者
+ * @param pottery 壺のアイテムスタック
+ * @return
+ */
+ public boolean canUse(EntityPlayer player, ItemStack pottery){
+ return true;
+ }
+
+ /**
+ * 壺を使用したときの処理
+ * @param player 所有者
+ * @param pottery 壺のアイテムスタック
+ * @return
+ */
+ public abstract ItemStack onUse(EntityPlayer player, ItemStack pottery);
+
+ /**
+ * 壺が破壊されたときの処理
+ * @param player 所有者
+ * @param pottery 壺のアイテムスタック
+ */
+ public void onCrash(EntityPlayer player, ItemStack pottery){
+ NBTTagCompound nbt=getPotteryNBT(pottery);
+
+ if(nbt.hasKey(ITEM_STACKS)){
+ NBTTagList list=(NBTTagList)nbt.getTag(ITEM_STACKS);
+ for(int i=0;i<list.tagCount();i++){
+ NBTTagCompound tag=list.getCompoundTagAt(i);
+ ItemStack itemStack=ItemStack.loadItemStackFromNBT(tag);
+ player.entityDropItem(itemStack, player.getEyeHeight());
+ }
+ }
+ }
+
+ /**
+ * 魔法の壺のインベントリが開く際に全てのスロットに対して行われる処理
+ * @param player 所有者
+ * @param pottery 壺のアイテムスタック
+ * @param index スロットインデックス
+ * @param itemStack 何か処理するアイテムスタック
+ * @return スロットに格納されるItemStack
+ */
+ public ItemStack onInventoryOpening(EntityPlayer player, ItemStack pottery, int index, @Nullable ItemStack itemStack){
+ return itemStack;
+ }
+
+ /**
+ * 魔法の壺のインベントリが閉じる際に全てのスロットに対して行われる処理
+ * @param player 所有者
+ * @param pottery 壺のアイテムスタック
+ * @param index スロットインデックス
+ * @param itemStack 何か処理するアイテムスタック
+ * @return NBTに書き込まれるItemStack
+ */
+ public ItemStack onInventoryClosing(EntityPlayer player, ItemStack pottery, int index, @Nullable ItemStack itemStack){
+ return itemStack;
+ }
+
+ /**
+ * 魔法の壺のインベントリがそのアイテムが適しているか
+ * @param player 所有者
+ * @param pottery 壺のアイテムスタック
+ * @param index スロットインデックス
+ * @param itemStack 判定アイテムスタック
+ * @return スロットに入るかどうか
+ */
+ public boolean isItemValid(EntityPlayer player, ItemStack pottery, int index, ItemStack itemStack){
+ return true;
+ }
+
+ /**
+ * 魔法の壺のインベントリからそのアイテムを取り出せるか
+ * @param player 所有者
+ * @param pottery 壺のアイテムスタック
+ * @param index スロットインデックス
+ * @param itemStack 判定アイテムスタック
+ * @return 取り出せるかどうか
+ */
+ public boolean canTakeStack(EntityPlayer player, ItemStack pottery, int index, ItemStack itemStack){
+ return true;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryChange.class b/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryChange.class Binary files differnew file mode 100644 index 0000000..da74aa2 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryChange.class diff --git a/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryChange.java b/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryChange.java new file mode 100644 index 0000000..3fe76f1 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryChange.java @@ -0,0 +1,74 @@ +package jp.plusplus.fbs.pottery.usable;
+
+import com.google.common.collect.Maps;
+import cpw.mods.fml.common.registry.GameData;
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemBlock;
+import net.minecraft.item.ItemStack;
+
+import javax.annotation.Nullable;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.Random;
+
+/**
+ * Created by plusplus_F on 2016/03/30.
+ */
+public class PotteryChange extends PotteryKeep {
+
+ private static Integer[] itemIds;
+
+ private Random rand=new Random();
+
+ @Override
+ public String getUnlocalizedName() {
+ return "pottery.fbs.pot.change";
+ }
+
+ @Override
+ public float getPriceScale(ItemStack pottery){
+ return 5.0f;
+ }
+
+ @Override
+ public ItemStack onInventoryClosing(EntityPlayer player, ItemStack pottery, int index, @Nullable ItemStack itemStack){
+ if(itemStack!=null && !pottery.getTagCompound().getBoolean(CHANGED_INDEXES+index)){
+ if(itemIds==null){
+ Map<String,Integer> idMapping = Maps.newHashMap();
+ GameData.itemRegistry.serializeInto(idMapping);
+ itemIds=new Integer[idMapping.size()];
+ idMapping.values().toArray(itemIds);
+ }
+
+ for(int i=0;i<10;i++){
+ Item item=Item.getItemById(rand.nextInt(itemIds.length));
+ if(item==null) continue;
+
+ if(item instanceof ItemBlock){
+ Block b=((ItemBlock) item).field_150939_a;
+ Item d=b.getItemDropped(0, rand, 0);
+ if(d==null || d==Item.getItemById(0) || b.quantityDropped(0, 0, rand)==0){
+ continue;
+ }
+ }
+
+ ArrayList<ItemStack> list=new ArrayList<ItemStack>();
+ item.getSubItems(item, item.getCreativeTab(), list);
+
+ if(!list.isEmpty()){
+ ItemStack ret=list.get(rand.nextInt(list.size()));
+ ret.stackSize=Math.min(ret.getMaxStackSize(), itemStack.stackSize);
+ return ret;
+ }
+ }
+ }
+ return itemStack;
+ }
+
+ @Override
+ public boolean canTakeStack(EntityPlayer player, ItemStack pottery, int index, ItemStack itemStack){
+ return !pottery.getTagCompound().getBoolean(CHANGED_INDEXES+index);
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryCrucible.class b/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryCrucible.class Binary files differnew file mode 100644 index 0000000..efc7d21 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryCrucible.class diff --git a/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryCrucible.java b/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryCrucible.java new file mode 100644 index 0000000..ef37d9d --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryCrucible.java @@ -0,0 +1,107 @@ +package jp.plusplus.fbs.pottery.usable;
+
+import net.minecraft.entity.EntityList;
+import net.minecraft.entity.EntityLiving;
+import net.minecraft.entity.monster.EntityCreeper;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.nbt.NBTTagList;
+import net.minecraft.world.World;
+
+import javax.annotation.Nullable;
+import java.util.ArrayList;
+
+/**
+ * Created by plusplus_F on 2016/04/02.
+ */
+public class PotteryCrucible extends PotteryUsableLimitted {
+ public static ArrayList<String> mobNames=new ArrayList<String>();
+
+ public PotteryCrucible(){
+ if(mobNames.isEmpty()){
+ mobNames.add("Zombie");
+ mobNames.add("Skeleton");
+ mobNames.add("Spider");
+ mobNames.add("Creeper");
+ mobNames.add("Enderman");
+ mobNames.add("Blaze");
+ mobNames.add("PigZombie");
+ mobNames.add("Slime");
+ mobNames.add("Ghast");
+ mobNames.add("CaveSpider");
+ mobNames.add("Silverfish");
+ mobNames.add("LavaSlime");
+ mobNames.add("Bat");
+ mobNames.add("Witch");
+ }
+ }
+
+ @Override
+ public String getUnlocalizedName() {
+ return "pottery.fbs.pot.monster";
+ }
+
+ @Override
+ public void effect(EntityPlayer player, ItemStack pottery) {
+ World w=player.worldObj;
+
+ if(!w.isRemote){
+ int mobC = 1;
+ int count = 0;
+ int max = mobNames.size();
+ for (int i = 0; i < 100 && count < mobC; i++) {
+ int n = rand.nextInt(max);
+ if (spawnEntityLiving(mobNames.get(n), w, player.posX, player.posY, player.posZ)) {
+ count++;
+ }
+ }
+ }
+ }
+
+ @Override
+ public void onCrash(EntityPlayer player, ItemStack pottery){
+ NBTTagCompound nbt=getPotteryNBT(pottery);
+ if(!player.worldObj.isRemote){
+ int mobC = nbt.getInteger(USE_COUNT);
+ int count = 0;
+ int max = mobNames.size();
+ for (int i = 0; i < 100 && count < mobC; i++) {
+ int n = rand.nextInt(max);
+ if (spawnEntityLiving(mobNames.get(n), player.worldObj, player.posX, player.posY, player.posZ)) {
+ count++;
+ }
+ }
+ }
+ }
+
+ private boolean spawnEntityLiving(String name, World world, double x, double y, double z){
+ EntityLiving entity = (EntityLiving) EntityList.createEntityByName(name, world);
+ if (entity == null) return false;
+ entity.onSpawnWithEgg(null);
+
+
+ boolean flag=false;
+ for(int i=0;i<30;i++) {
+ double x1 = x + 0.5 + (rand.nextDouble() - rand.nextDouble()) * 3;
+ double y1 = y+rand.nextInt(3);
+ double z1 = z + 0.5 + (rand.nextDouble() - rand.nextDouble()) * 3;
+ float a = rand.nextFloat() * 360.0F;
+ entity.setLocationAndAngles(x1, y1, z1, a, 0);
+
+ world.spawnEntityInWorld(entity);
+ entity.spawnExplosionParticle();
+ entity.playLivingSound();
+ flag=true;
+ break;
+ }
+
+ if(flag){
+ if(entity instanceof EntityCreeper && rand.nextFloat()<0.25f) {
+ entity.getDataWatcher().updateObject(17, new Byte((byte)1));
+ }
+ return true;
+ }
+ return false;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryEnchantment$1.class b/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryEnchantment$1.class Binary files differnew file mode 100644 index 0000000..0e6df6e --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryEnchantment$1.class diff --git a/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryEnchantment.class b/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryEnchantment.class Binary files differnew file mode 100644 index 0000000..c7a020f --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryEnchantment.class diff --git a/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryEnchantment.java b/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryEnchantment.java new file mode 100644 index 0000000..451e0ff --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryEnchantment.java @@ -0,0 +1,61 @@ +package jp.plusplus.fbs.pottery.usable;
+
+import com.google.common.collect.Maps;
+import cpw.mods.fml.common.registry.GameData;
+import jp.plusplus.fbs.api.IPottery;
+import net.minecraft.block.Block;
+import net.minecraft.enchantment.EnchantmentHelper;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemBlock;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+
+import javax.annotation.Nullable;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.Random;
+
+/**
+ * Created by plusplus_F on 2016/03/30.
+ */
+public class PotteryEnchantment extends PotteryKeep {
+ private Random rand=new Random();
+
+ @Override
+ public String getUnlocalizedName() {
+ return "pottery.fbs.pot.enchant";
+ }
+
+ @Override
+ public float getPriceScale(ItemStack pottery){
+ return 3.5f;
+ }
+
+ @Override
+ public ItemStack onInventoryClosing(EntityPlayer player, ItemStack pottery, int index, @Nullable ItemStack itemStack){
+ NBTTagCompound nbt=pottery.getTagCompound();
+
+ if(itemStack!=null && !nbt.getBoolean(CHANGED_INDEXES + index)){
+ if(!itemStack.isItemEnchanted() && itemStack.isItemEnchantable()){
+ IPottery ip=(IPottery)((ItemBlock)pottery.getItem()).field_150939_a;
+
+ int lv;
+ switch (ip.getGrade(nbt)){
+ case BAD: lv=5; break;
+ case GOOD: lv=20; break;
+ case GREAT: lv=30; break;
+ case SOULFUL: lv=40; break;
+ default: lv=10; break;
+ }
+ return EnchantmentHelper.addRandomEnchantment(rand, itemStack, lv);
+ }
+ }
+ return itemStack;
+ }
+
+ @Override
+ public boolean canTakeStack(EntityPlayer player, ItemStack pottery, int index, ItemStack itemStack){
+ return !pottery.getTagCompound().getBoolean(CHANGED_INDEXES+index);
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryFurnace.class b/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryFurnace.class Binary files differnew file mode 100644 index 0000000..7086075 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryFurnace.class diff --git a/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryFurnace.java b/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryFurnace.java new file mode 100644 index 0000000..8f979bf --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryFurnace.java @@ -0,0 +1,48 @@ +package jp.plusplus.fbs.pottery.usable;
+
+import com.google.common.collect.Maps;
+import cpw.mods.fml.common.registry.GameData;
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemBlock;
+import net.minecraft.item.ItemStack;
+import net.minecraft.item.crafting.FurnaceRecipes;
+
+import javax.annotation.Nullable;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.Random;
+
+/**
+ * Created by plusplus_F on 2016/04/02.
+ */
+public class PotteryFurnace extends PotteryKeep {
+ @Override
+ public String getUnlocalizedName() {
+ return "pottery.fbs.pot.furnace";
+ }
+
+ @Override
+ public float getPriceScale(ItemStack pottery){
+ return 1.5f;
+ }
+
+ @Override
+ public ItemStack onInventoryClosing(EntityPlayer player, ItemStack pottery, int index, @Nullable ItemStack itemStack){
+ if(itemStack!=null && !pottery.getTagCompound().getBoolean(CHANGED_INDEXES+index)){
+ ItemStack ret=FurnaceRecipes.smelting().getSmeltingResult(itemStack);
+ if(ret!=null){
+ ItemStack t=ret.copy();
+ t.stackSize=Math.min(itemStack.stackSize, t.getMaxStackSize());
+ return t;
+ }
+ }
+ return itemStack;
+ }
+
+ @Override
+ public boolean canTakeStack(EntityPlayer player, ItemStack pottery, int index, ItemStack itemStack){
+ return !pottery.getTagCompound().getBoolean(CHANGED_INDEXES+index);
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryKeep.class b/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryKeep.class Binary files differnew file mode 100644 index 0000000..9675d30 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryKeep.class diff --git a/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryKeep.java b/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryKeep.java new file mode 100644 index 0000000..fe318cf --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryKeep.java @@ -0,0 +1,39 @@ +package jp.plusplus.fbs.pottery.usable;
+
+import com.google.common.collect.Maps;
+import cpw.mods.fml.common.registry.GameData;
+import jp.plusplus.fbs.FBS;
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemBlock;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.MathHelper;
+
+import javax.annotation.Nullable;
+import java.util.ArrayList;
+import java.util.Map;
+
+/**
+ * Created by plusplus_F on 2016/03/30.
+ */
+public class PotteryKeep extends PotteryBase {
+ public static final String CHANGED_INDEXES="ChangedIndex";
+
+ @Override
+ public String getUnlocalizedName() {
+ return "pottery.fbs.pot.keep";
+ }
+
+ @Override
+ public ItemStack onInventoryOpening(EntityPlayer player, ItemStack pottery, int index, @Nullable ItemStack itemStack){
+ pottery.getTagCompound().setBoolean(CHANGED_INDEXES+index, itemStack!=null);
+ return itemStack;
+ }
+
+ @Override
+ public ItemStack onUse(EntityPlayer player, ItemStack pottery) {
+ player.openGui(FBS.instance, FBS.GUI_MAGIC_POT_ID, player.worldObj, MathHelper.floor_double(player.posX), MathHelper.floor_double(player.posY), MathHelper.floor_double(player.posZ));
+ return pottery;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryLottery.class b/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryLottery.class Binary files differnew file mode 100644 index 0000000..beb0309 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryLottery.class diff --git a/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryLottery.java b/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryLottery.java new file mode 100644 index 0000000..33b2fd1 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryLottery.java @@ -0,0 +1,44 @@ +package jp.plusplus.fbs.pottery.usable;
+
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.Registry;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.MathHelper;
+import net.minecraft.util.StatCollector;
+import net.minecraft.world.World;
+
+/**
+ * Created by plusplus_F on 2016/04/02.
+ */
+public class PotteryLottery extends PotteryUsableLimitted {
+ @Override
+ public String getUnlocalizedName() {
+ return "pottery.fbs.pot.lottery";
+ }
+
+ @Override
+ public float getPriceScale(ItemStack pottery){
+ return 0.8f*super.getPriceScale(pottery);
+ }
+
+ @Override
+ public void effect(EntityPlayer player, ItemStack pottery) {
+ World world=player.worldObj;
+
+ if(!world.isRemote){
+ if(world.rand.nextInt(256)==1){
+ //願い判定
+ player.openGui(FBS.instance, FBS.GUI_WISH_ID, world, MathHelper.floor_double(player.posX), MathHelper.floor_double(player.posY), MathHelper.floor_double(player.posZ));
+ }
+ else{
+ //ランダムにメッセージ
+ String m= Registry.GetRandomMessage();
+ int v=Registry.GetRandomMessageVariant(m);
+ player.addChatComponentMessage(new ChatComponentText("<"+ StatCollector.translateToLocal(getUnlocalizedName())+">"+Registry.GetLocalizedFortuneCookieMessage(m, v)));
+ }
+ }
+ }
+
+}
diff --git a/src/main/java/jp/plusplus/fbs/pottery/usable/PotterySenaka.class b/src/main/java/jp/plusplus/fbs/pottery/usable/PotterySenaka.class Binary files differnew file mode 100644 index 0000000..e75b8db --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/usable/PotterySenaka.class diff --git a/src/main/java/jp/plusplus/fbs/pottery/usable/PotterySenaka.java b/src/main/java/jp/plusplus/fbs/pottery/usable/PotterySenaka.java new file mode 100644 index 0000000..7839376 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/usable/PotterySenaka.java @@ -0,0 +1,41 @@ +package jp.plusplus.fbs.pottery.usable;
+
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.api.IPottery;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemBlock;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.MathHelper;
+import net.minecraft.world.World;
+import shift.sextiarysector.api.SextiarySectorAPI;
+
+import javax.annotation.Nullable;
+
+/**
+ * Created by plusplus_F on 2016/03/30.
+ */
+public class PotterySenaka extends PotteryUsableLimitted {
+ public static final String USE_COUNT="UseCount";
+
+ @Override
+ public String getUnlocalizedName() {
+ return "pottery.fbs.pot.senaka";
+ }
+
+ @Override
+ public float getPriceScale(ItemStack pottery){
+ return 2.f*super.getPriceScale(pottery);
+ }
+
+ @Override
+ public void effect(EntityPlayer player, ItemStack pottery) {
+ player.heal(player.getMaxHealth());
+ player.getFoodStats().addStats(20, 1);
+ if(FBS.cooperatesSS2) forSS2(player);
+ }
+
+ protected void forSS2(EntityPlayer player){
+ SextiarySectorAPI.addMoistureStats(player, 20, 1);
+ SextiarySectorAPI.addStaminaStats(player, 100, 1);
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryTaboo.class b/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryTaboo.class Binary files differnew file mode 100644 index 0000000..1b250ca --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryTaboo.class diff --git a/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryTaboo.java b/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryTaboo.java new file mode 100644 index 0000000..df1f298 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryTaboo.java @@ -0,0 +1,72 @@ +package jp.plusplus.fbs.pottery.usable;
+
+import jp.plusplus.fbs.AchievementRegistry;
+import jp.plusplus.fbs.api.FBSEntityPropertiesAPI;
+import jp.plusplus.fbs.api.IPottery;
+import jp.plusplus.fbs.exprop.FBSEntityProperties;
+import jp.plusplus.fbs.exprop.SanityManager;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemBlock;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.nbt.NBTTagList;
+import net.minecraft.potion.Potion;
+import net.minecraft.potion.PotionEffect;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.DamageSource;
+import net.minecraft.util.StatCollector;
+
+/**
+ * Created by plusplus_F on 2016/04/02.
+ */
+public class PotteryTaboo extends PotteryUsableLimitted {
+
+ @Override
+ public float getPriceScale(ItemStack pottery){
+ return 3.5f*super.getPriceScale(pottery);
+ }
+
+ @Override
+ public void effect(EntityPlayer player, ItemStack pottery) {
+ if(player.worldObj.isRemote) return;
+
+ FBSEntityProperties properties=FBSEntityProperties.get(player);
+
+ int now=properties.getSanity();
+ properties.setSanity(now/2+1);
+ int san=now-properties.getSanity();
+ if(san>0){
+ player.addChatComponentMessage(new ChatComponentText(String.format(StatCollector.translateToLocal("info.fbs.san.1"), san)));
+ player.triggerAchievement(AchievementRegistry.insanity);
+
+ if(san>=2 && 100*san/now>=20){
+ //発狂判定
+ player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("info.fbs.san.2")));
+ player.addPotionEffect(new PotionEffect(Potion.confusion.getId(), 20 * 15, 2));
+ player.addPotionEffect(new PotionEffect(Potion.hunger.getId(), 20*15, 1));
+ player.triggerAchievement(AchievementRegistry.madness);
+ }
+ }
+ SanityManager.sendPacket(player);
+
+ if(!player.isDead){
+ IPottery ip=(IPottery)((ItemBlock)pottery.getItem()).field_150939_a;
+
+ int dur=20*30*(ip.getGrade(pottery.getTagCompound()).getValue()+1);
+
+ player.addPotionEffect(new PotionEffect(Potion.damageBoost.getId(), dur, 2));
+ player.addPotionEffect(new PotionEffect(Potion.resistance.getId(), dur, 2));
+ player.addPotionEffect(new PotionEffect(Potion.moveSpeed.getId(), dur, 2));
+ }
+ }
+
+ @Override
+ public String getUnlocalizedName() {
+ return "pottery.fbs.pot.taboo";
+ }
+
+ public void onCrash(EntityPlayer player, ItemStack pottery){
+ if(player.worldObj.isRemote) return;
+ SanityManager.loseSanity(player, 10, 100, true);
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryUnbreakable.class b/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryUnbreakable.class Binary files differnew file mode 100644 index 0000000..3843db3 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryUnbreakable.class diff --git a/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryUnbreakable.java b/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryUnbreakable.java new file mode 100644 index 0000000..a4b2ddd --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryUnbreakable.java @@ -0,0 +1,39 @@ +package jp.plusplus.fbs.pottery.usable;
+
+import com.google.common.collect.Maps;
+import cpw.mods.fml.common.registry.GameData;
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemBlock;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.nbt.NBTTagList;
+
+import javax.annotation.Nullable;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.Random;
+
+/**
+ * Created by plusplus_F on 2016/03/30.
+ */
+public class PotteryUnbreakable extends PotteryKeep {
+ @Override
+ public String getUnlocalizedName() {
+ return "pottery.fbs.pot.unbreakable";
+ }
+
+ @Override
+ public float getPriceScale(ItemStack pottery){
+ return 5.0f;
+ }
+
+ @Override
+ public boolean canTakeStack(EntityPlayer player, ItemStack pottery, int index, ItemStack itemStack){
+ return !pottery.getTagCompound().getBoolean(CHANGED_INDEXES+index);
+ }
+
+ @Override
+ public void onCrash(EntityPlayer player, ItemStack pottery){}
+}
diff --git a/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryUsableLimitted$1.class b/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryUsableLimitted$1.class Binary files differnew file mode 100644 index 0000000..85bb083 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryUsableLimitted$1.class diff --git a/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryUsableLimitted.class b/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryUsableLimitted.class Binary files differnew file mode 100644 index 0000000..d63d7ce --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryUsableLimitted.class diff --git a/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryUsableLimitted.java b/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryUsableLimitted.java new file mode 100644 index 0000000..1dbcb69 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryUsableLimitted.java @@ -0,0 +1,71 @@ +package jp.plusplus.fbs.pottery.usable;
+
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.api.IPottery;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemBlock;
+import net.minecraft.item.ItemStack;
+import net.minecraft.world.World;
+import shift.sextiarysector.api.SextiarySectorAPI;
+
+import javax.annotation.Nullable;
+import java.util.Random;
+
+/**
+ * Created by plusplus_F on 2016/04/02.
+ */
+public abstract class PotteryUsableLimitted extends PotteryBase {
+ public static final String USE_COUNT="UseCount";
+ public Random rand=new Random();
+
+ /**
+ * 壺そのものの効果
+ * @param player 所有者
+ * @param pottery 壺のアイテムスタック
+ */
+ public abstract void effect(EntityPlayer player, ItemStack pottery);
+
+ @Override
+ public String getNameModifier(ItemStack pottery){
+ return "["+pottery.getTagCompound().getInteger(USE_COUNT)+"]";
+ }
+
+ @Override
+ public float getPriceScale(ItemStack pottery){
+ return 0.8f+0.1f*pottery.getTagCompound().getInteger(USE_COUNT);
+ }
+
+ @Override
+ public void onBaked(ItemStack pottery){
+ IPottery ip=(IPottery)((ItemBlock) pottery.getItem()).field_150939_a;
+
+ int c;
+ switch (ip.getSize(pottery.getTagCompound())){
+ case SMALL: c=2; break;
+ case LARGE: c=8; break;
+ default: c=5; break;
+ }
+ c+=rand.nextInt(c/2);
+
+ switch (ip.getGrade(pottery.getTagCompound())){
+ case BAD: c=(int)(c*0.8); break;
+ case GOOD: c=(int)(c*1.5); break;
+ case GREAT: c=(int)(c*2); break;
+ case SOULFUL: c=(int)(c*3); break;
+ default: break;
+ }
+
+ pottery.getTagCompound().setInteger(USE_COUNT, c);
+ }
+
+ @Override
+ public ItemStack onUse(EntityPlayer player, ItemStack pottery) {
+ int c=pottery.getTagCompound().getInteger(USE_COUNT);
+ if(c>0){
+ effect(player, pottery);
+ if(!player.capabilities.isCreativeMode) pottery.getTagCompound().setInteger(USE_COUNT, c-1);
+ player.swingItem();
+ }
+ return pottery;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryVoid.class b/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryVoid.class Binary files differnew file mode 100644 index 0000000..bc28a2a --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryVoid.class diff --git a/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryVoid.java b/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryVoid.java new file mode 100644 index 0000000..62fbf3d --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryVoid.java @@ -0,0 +1,26 @@ +package jp.plusplus.fbs.pottery.usable;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+
+import javax.annotation.Nullable;
+
+/**
+ * Created by plusplus_F on 2016/03/30.
+ */
+public class PotteryVoid extends PotteryKeep {
+ @Override
+ public String getUnlocalizedName() {
+ return "pottery.fbs.pot.void";
+ }
+
+ @Override
+ public float getPriceScale(ItemStack pottery){
+ return 0.5f;
+ }
+
+ public ItemStack onInventoryClosing(EntityPlayer player, ItemStack pottery, int index, @Nullable ItemStack itemStack){
+ return null;
+ }
+
+}
diff --git a/src/main/java/jp/plusplus/fbs/pottery/usable/container/ContainerPotteryUsableBase.class b/src/main/java/jp/plusplus/fbs/pottery/usable/container/ContainerPotteryUsableBase.class Binary files differnew file mode 100644 index 0000000..425e8ea --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/usable/container/ContainerPotteryUsableBase.class diff --git a/src/main/java/jp/plusplus/fbs/pottery/usable/container/ContainerPotteryUsableBase.java b/src/main/java/jp/plusplus/fbs/pottery/usable/container/ContainerPotteryUsableBase.java new file mode 100644 index 0000000..0c679c5 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/usable/container/ContainerPotteryUsableBase.java @@ -0,0 +1,95 @@ +package jp.plusplus.fbs.pottery.usable.container;
+
+import jp.plusplus.fbs.container.slot.SlotShowOnly;
+import jp.plusplus.fbs.item.ItemCore;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.inventory.Container;
+import net.minecraft.inventory.ContainerChest;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+
+/**
+ * Created by plusplus_F on 2016/03/30.
+ */
+public class ContainerPotteryUsableBase extends Container {
+ public ItemStack currentItem;
+ public EntityPlayer player;
+ public InventoryPotteryUsable inventory;
+ public int inventoryRows;
+
+ public ContainerPotteryUsableBase(EntityPlayer player) {
+ this.player = player;
+ currentItem = player.getCurrentEquippedItem();
+ inventory = new InventoryPotteryUsable(player);
+
+ //壺のスロット
+ inventoryRows = (inventory.getSizeInventory() + 8) / 9;
+ for (int i = 0; i < inventory.getSizeInventory(); i++) {
+ addSlotToContainer(new SlotPotteryUsable(inventory, i, 8 + (i % 9) * 18, 18 + (i / 9) * 18));
+ }
+
+ //player slots
+ int y = (inventoryRows - 4) * 18;
+ for (int j = 0; j < 3; ++j) {
+ for (int k = 0; k < 9; ++k) {
+ this.addSlotToContainer(new Slot(player.inventory, k + j * 9 + 9, 8 + k * 18, 103 + j * 18 + y));
+ }
+ }
+ for (int j = 0; j < 9; ++j) {
+ if (j == inventory.potteryStackIndex) this.addSlotToContainer(new SlotShowOnly(player.inventory, j, 8 + j * 18, 161 + y));
+ else this.addSlotToContainer(new Slot(player.inventory, j, 8 + j * 18, 161 + y));
+ }
+
+ inventory.openInventory();
+ }
+
+ public void onContainerClosed(EntityPlayer p_75134_1_) {
+ super.onContainerClosed(p_75134_1_);
+ inventory.closeInventory();
+ }
+
+ @Override
+ public boolean canInteractWith(EntityPlayer p_75145_1_) {
+ return true;
+ }
+
+ @Override
+ public ItemStack transferStackInSlot(EntityPlayer player1, int slotIndex) {
+ ItemStack itemstack = null;
+ Slot slot = (Slot) this.inventorySlots.get(slotIndex);
+
+ if (slot != null && slot.getHasStack()) {
+ ItemStack itemstack1 = slot.getStack();
+ itemstack = itemstack1.copy();
+
+ if(slot.getStack()==null || slotIndex==inventory.potteryStackIndex){
+ //スロットがNULLだったり開いてる壺なら何もしない
+ return null;
+ }
+ else if (slotIndex < this.inventory.getSizeInventory()) {
+ //壺のインベントリ内であれば他所に移す
+ if (!this.mergeItemStack(itemstack1, this.inventory.getSizeInventory(), this.inventorySlots.size(), true)) {
+ return null;
+ }
+ }
+ else if(!inventory.isItemValidForSlot(slotIndex, itemstack)){
+ //プレイヤーのインベントリにあり、それが壺のインベントリに適さない場合何もしない
+ return null;
+ }
+ else if (!this.mergeItemStack(itemstack1, 0, this.inventory.getSizeInventory(), false)) {
+ //壺のインベントリに移せるか試してる
+ return null;
+ }
+
+ //アイテムの消去と更新処理
+ if (itemstack1.stackSize == 0) {
+ slot.putStack((ItemStack) null);
+ } else {
+ slot.onSlotChanged();
+ }
+ }
+
+ return itemstack;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/pottery/usable/container/GuiPotteryUsableBase.class b/src/main/java/jp/plusplus/fbs/pottery/usable/container/GuiPotteryUsableBase.class Binary files differnew file mode 100644 index 0000000..23856fb --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/usable/container/GuiPotteryUsableBase.class diff --git a/src/main/java/jp/plusplus/fbs/pottery/usable/container/GuiPotteryUsableBase.java b/src/main/java/jp/plusplus/fbs/pottery/usable/container/GuiPotteryUsableBase.java new file mode 100644 index 0000000..b3c9967 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/usable/container/GuiPotteryUsableBase.java @@ -0,0 +1,40 @@ +package jp.plusplus.fbs.pottery.usable.container;
+
+import net.minecraft.client.gui.inventory.GuiChest;
+import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.client.resources.I18n;
+import net.minecraft.inventory.Container;
+import net.minecraft.util.ResourceLocation;
+import org.lwjgl.opengl.GL11;
+
+/**
+ * Created by plusplus_F on 2016/03/30.
+ */
+public class GuiPotteryUsableBase extends GuiContainer {
+ private static final ResourceLocation field_147017_u = new ResourceLocation("textures/gui/container/generic_54.png");
+ private ContainerPotteryUsableBase container;
+
+ public GuiPotteryUsableBase(ContainerPotteryUsableBase p_i1072_1_) {
+ super(p_i1072_1_);
+ this.container=p_i1072_1_;
+ this.allowUserInput = false;
+ short short1 = 222;
+ int i = short1 - 108;
+ this.ySize = i + container.inventoryRows * 18;
+ }
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
+ this.fontRendererObj.drawString(container.inventory.getInventoryName(), 8, 6, 4210752);
+ }
+
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ this.mc.getTextureManager().bindTexture(field_147017_u);
+ int k = (this.width - this.xSize) / 2;
+ int l = (this.height - this.ySize) / 2;
+ this.drawTexturedModalRect(k, l, 0, 0, this.xSize, container.inventoryRows * 18 + 17);
+ this.drawTexturedModalRect(k, l + container.inventoryRows * 18 + 17, 0, 126, this.xSize, 96);
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/pottery/usable/container/InventoryPotteryUsable$1.class b/src/main/java/jp/plusplus/fbs/pottery/usable/container/InventoryPotteryUsable$1.class Binary files differnew file mode 100644 index 0000000..18ad90d --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/usable/container/InventoryPotteryUsable$1.class diff --git a/src/main/java/jp/plusplus/fbs/pottery/usable/container/InventoryPotteryUsable.class b/src/main/java/jp/plusplus/fbs/pottery/usable/container/InventoryPotteryUsable.class Binary files differnew file mode 100644 index 0000000..7f289ed --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/usable/container/InventoryPotteryUsable.class diff --git a/src/main/java/jp/plusplus/fbs/pottery/usable/container/InventoryPotteryUsable.java b/src/main/java/jp/plusplus/fbs/pottery/usable/container/InventoryPotteryUsable.java new file mode 100644 index 0000000..ec5ef32 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/usable/container/InventoryPotteryUsable.java @@ -0,0 +1,175 @@ +package jp.plusplus.fbs.pottery.usable.container;
+
+import jp.plusplus.fbs.api.IPottery;
+import jp.plusplus.fbs.pottery.ItemBlockPottery;
+import jp.plusplus.fbs.pottery.PotteryRegistry;
+import jp.plusplus.fbs.pottery.usable.PotteryBase;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.item.ItemBlock;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.nbt.NBTTagList;
+
+/**
+ * Created by plusplus_F on 2016/03/30.
+ * インベントリ持ち魔法の壺のインベントリ
+ */
+public class InventoryPotteryUsable implements IInventory{
+ public EntityPlayer player;
+ public ItemStack potteryStack;
+ public int potteryStackIndex;
+ public PotteryBase potteryEffect;
+ public IPottery pottery;
+
+ protected ItemStack[] itemStacks;
+ protected int inventorySize;
+
+ public InventoryPotteryUsable(EntityPlayer player){
+ this.player=player;
+ this.potteryStack=player.getCurrentEquippedItem();
+ this.potteryStackIndex=player.inventory.currentItem;
+ this.potteryEffect= PotteryRegistry.getPotteryEffect(ItemBlockPottery.getId(potteryStack));
+ this.pottery=(IPottery)((ItemBlock)potteryStack.getItem()).field_150939_a;
+
+ switch (pottery.getSize(potteryStack.getTagCompound())){
+ case MEDIUM: inventorySize=9*2; break;
+ case LARGE: inventorySize=9*3; break;
+ default: inventorySize=9*1; break;
+ }
+ itemStacks=new ItemStack[inventorySize];
+ }
+
+ @Override
+ public int getSizeInventory() {
+ return inventorySize;
+ }
+
+ @Override
+ public ItemStack getStackInSlot(int p_70301_1_) {
+ return itemStacks[p_70301_1_];
+ }
+
+ @Override
+ public ItemStack decrStackSize(int i, int size) {
+ if (this.itemStacks[i] != null) {
+ ItemStack itemstack;
+
+ if (this.itemStacks[i].stackSize <= size) {
+ itemstack = this.itemStacks[i];
+ this.itemStacks[i] = null;
+ this.markDirty();
+ return itemstack;
+ } else {
+ itemstack = this.itemStacks[i].splitStack(size);
+
+ if (this.itemStacks[i].stackSize == 0) {
+ this.itemStacks[i] = null;
+ }
+
+ this.markDirty();
+ return itemstack;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public ItemStack getStackInSlotOnClosing(int i) {
+ if (this.itemStacks[i] != null) {
+ ItemStack itemstack = this.itemStacks[i];
+ this.itemStacks[i] = null;
+ return itemstack;
+ }
+ return null;
+ }
+
+ @Override
+ public void setInventorySlotContents(int i, ItemStack item) {
+ this.itemStacks[i] = item;
+
+ if (item != null && item.stackSize > this.getInventoryStackLimit()) {
+ item.stackSize = this.getInventoryStackLimit();
+ }
+
+ this.markDirty();
+ }
+
+ @Override
+ public String getInventoryName() {
+ return potteryStack.getDisplayName();
+ }
+
+ @Override
+ public boolean hasCustomInventoryName() {
+ return false;
+ }
+
+ @Override
+ public int getInventoryStackLimit() {
+ return 64;
+ }
+
+ @Override
+ public void markDirty() {
+
+ }
+
+ @Override
+ public boolean isUseableByPlayer(EntityPlayer p_70300_1_) {
+ return true;
+ }
+
+ @Override
+ public void openInventory() {
+ if (!potteryStack.hasTagCompound()) {
+ potteryStack.setTagCompound(new NBTTagCompound());
+ potteryStack.getTagCompound().setTag(PotteryBase.ITEM_STACKS, new NBTTagList());
+ }
+ else if(!potteryStack.getTagCompound().hasKey(PotteryBase.ITEM_STACKS)){
+ potteryStack.getTagCompound().setTag(PotteryBase.ITEM_STACKS, new NBTTagList());
+ }
+
+ NBTTagList tags = (NBTTagList) potteryStack.getTagCompound().getTag(PotteryBase.ITEM_STACKS);
+ for (int i = 0; i < tags.tagCount(); i++) {
+ NBTTagCompound tagCompound = tags.getCompoundTagAt(i);
+ int slot = tagCompound.getByte("Slot");
+ if (slot >= 0 && slot < itemStacks.length) {
+ itemStacks[slot] = ItemStack.loadItemStackFromNBT(tagCompound);
+ }
+ }
+
+ //インベントリが開くときの処理
+ for(int i=0;i<inventorySize;i++){
+ itemStacks[i]=potteryEffect.onInventoryOpening(player, potteryStack, i, itemStacks[i]);
+ }
+ }
+
+ @Override
+ public void closeInventory() {
+ //インベントリが閉じるときのの処理
+ for(int i=0;i<inventorySize;i++){
+ itemStacks[i]=potteryEffect.onInventoryClosing(player, potteryStack, i, itemStacks[i]);
+ }
+
+ NBTTagList tagList = new NBTTagList();
+ for (int i = 0; i < itemStacks.length; i++) {
+ if (itemStacks[i] != null) {
+ NBTTagCompound compound = new NBTTagCompound();
+ compound.setByte("Slot", (byte) i);
+ itemStacks[i].writeToNBT(compound);
+ tagList.appendTag(compound);
+ }
+ }
+ ItemStack result = new ItemStack(potteryStack.getItem(), 1, potteryStack.getItemDamage());
+ result.setTagCompound((NBTTagCompound)potteryStack.getTagCompound().copy());
+ result.getTagCompound().setTag(PotteryBase.ITEM_STACKS, tagList);
+
+ player.inventory.mainInventory[potteryStackIndex] = result;
+ }
+
+ @Override
+ public boolean isItemValidForSlot(int p_94041_1_, ItemStack p_94041_2_) {
+ return potteryEffect.isItemValid(player, potteryStack, p_94041_1_, p_94041_2_);
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/pottery/usable/container/SlotPotteryUsable.class b/src/main/java/jp/plusplus/fbs/pottery/usable/container/SlotPotteryUsable.class Binary files differnew file mode 100644 index 0000000..afebc3b --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/usable/container/SlotPotteryUsable.class diff --git a/src/main/java/jp/plusplus/fbs/pottery/usable/container/SlotPotteryUsable.java b/src/main/java/jp/plusplus/fbs/pottery/usable/container/SlotPotteryUsable.java new file mode 100644 index 0000000..099e65b --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/usable/container/SlotPotteryUsable.java @@ -0,0 +1,27 @@ +package jp.plusplus.fbs.pottery.usable.container;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+
+/**
+ * Created by plusplus_F on 2016/03/30.
+ */
+public class SlotPotteryUsable extends Slot {
+ protected InventoryPotteryUsable inventoryPottery;
+ public SlotPotteryUsable(InventoryPotteryUsable iInventory, int index, int x, int y) {
+ super(iInventory, index, x, y);
+ inventoryPottery=iInventory;
+ }
+
+ @Override
+ public boolean isItemValid(ItemStack itemStack) {
+ return inventoryPottery.potteryEffect.isItemValid(inventoryPottery.player, inventoryPottery.potteryStack, getSlotIndex(), itemStack);
+ }
+
+ @Override
+ public boolean canTakeStack(EntityPlayer player) {
+ return inventoryPottery.potteryEffect.canTakeStack(player, inventoryPottery.potteryStack, getSlotIndex(), getStack());
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/render/RendererBook.class b/src/main/java/jp/plusplus/fbs/render/RendererBook.class Binary files differnew file mode 100644 index 0000000..40256a1 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/render/RendererBook.class diff --git a/src/main/java/jp/plusplus/fbs/render/RendererBook.java b/src/main/java/jp/plusplus/fbs/render/RendererBook.java new file mode 100644 index 0000000..a0fea62 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/render/RendererBook.java @@ -0,0 +1,120 @@ +package jp.plusplus.fbs.render;
+
+import jp.plusplus.fbs.FBS;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.entity.EntityPlayerSP;
+import net.minecraft.client.renderer.ItemRenderer;
+import net.minecraft.client.renderer.OpenGlHelper;
+import net.minecraft.client.renderer.RenderHelper;
+import net.minecraft.client.renderer.Tessellator;
+import net.minecraft.client.renderer.texture.TextureManager;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.EnumAction;
+import net.minecraft.item.ItemCloth;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.IIcon;
+import net.minecraft.util.MathHelper;
+import net.minecraft.util.ResourceLocation;
+import net.minecraft.util.Timer;
+import net.minecraftforge.client.IItemRenderer;
+import org.lwjgl.opengl.GL11;
+import org.lwjgl.opengl.GL12;
+
+import static net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED_FIRST_PERSON;
+
+/**
+ * Createdby pluslus_Fon 2015/06/07.
+ */
+public class RendererBook implements IItemRenderer {
+ protected static final ResourceLocation RES_ITEM_GLINT = new ResourceLocation("textures/misc/enchanted_item_glint.png");
+
+ @Override
+ public boolean handleRenderType(ItemStack item, ItemRenderType type) {
+ EnumAction act=item.getItemUseAction();
+ if(act!= FBS.actionDecode && act!=FBS.actionSpell) return false;
+ return type==ItemRenderType.EQUIPPED_FIRST_PERSON;
+ }
+
+ @Override
+ public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
+ return false;
+ }
+
+ @Override
+ public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
+ if(type==ItemRenderType.EQUIPPED_FIRST_PERSON) {
+ EntityPlayer ep = FBS.proxy.getEntityPlayerInstance();
+
+ if (ep.isUsingItem()) {
+ float tick = FBS.proxy.getRenderPartialTicks();
+ float f1 = 1.0f;
+ float f2 = ep.prevRotationPitch + (ep.rotationPitch - ep.prevRotationPitch) * tick;
+ float f5;
+ float f6;
+ float f7;
+
+ //---------------------------------
+ float f13 = 0.8F;
+
+ f6 = (float) ep.getItemInUseCount() - tick + 1.0F;
+ f7 = 1.0F - f6 / (float) item.getMaxItemUseDuration();
+ float f8 = 1.0F - f7;
+ f8 = f8 * f8 * f8;
+ f8 = f8 * f8 * f8;
+ f8 = f8 * f8 * f8;
+ float f9 = 1.0F - f8;
+ GL11.glTranslatef(0.0F, MathHelper.abs(MathHelper.cos(f6 / 4.0F * (float) Math.PI) * 0.1F) * (float) ((double) f7 > 0.2D ? 1 : 0), 0.0F);
+ GL11.glTranslatef(f9 * 0.6F, -f9 * 0.4F, 0.0F);
+ GL11.glRotatef(f9 * 45.0f, -f9 * 45.0f, f9 * 45.0f, 0.0F);
+ GL11.glRotatef(f9 * 10.0F, 1.0F, 0.0F, 0.0F);
+ GL11.glRotatef(f9 * 30.0F, 0.0F, 0.0F, 1.0F);
+ }
+
+ IIcon icon = item.getIconIndex();
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ ItemRenderer.renderItemIn2D(Tessellator.instance, icon.getMaxU(), icon.getMinV(), icon.getMinU(), icon.getMaxV(), icon.getIconWidth(), icon.getIconHeight(), 0.0625f);
+ for (int x = 1; x < item.getItem().getRenderPasses(item.getItemDamage()); x++) {
+ int k1 = item.getItem().getColorFromItemStack(item, x);
+ float f10 = (float) (k1 >> 16 & 255) / 255.0F;
+ float f11 = (float) (k1 >> 8 & 255) / 255.0F;
+ float f12 = (float) (k1 & 255) / 255.0F;
+ GL11.glColor4f(1.0F * f10, 1.0F * f11, 1.0F * f12, 1.0F);
+ icon = item.getItem().getIcon(item, x);
+ ItemRenderer.renderItemIn2D(Tessellator.instance, icon.getMaxU(), icon.getMinV(), icon.getMinU(), icon.getMaxV(), icon.getIconWidth(), icon.getIconHeight(), 0.0625f);
+ }
+
+ if (item.hasEffect(0)) {
+ TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
+ Tessellator tessellator=Tessellator.instance;
+
+ GL11.glDepthFunc(GL11.GL_EQUAL);
+ GL11.glDisable(GL11.GL_LIGHTING);
+ texturemanager.bindTexture(RES_ITEM_GLINT);
+ GL11.glEnable(GL11.GL_BLEND);
+ OpenGlHelper.glBlendFunc(768, 1, 1, 0);
+ float f7 = 0.76F;
+ GL11.glColor4f(0.5F * f7, 0.25F * f7, 0.8F * f7, 1.0F);
+ GL11.glMatrixMode(GL11.GL_TEXTURE);
+ GL11.glPushMatrix();
+ float f8 = 0.125F;
+ GL11.glScalef(f8, f8, f8);
+ float f9 = (float) (Minecraft.getSystemTime() % 3000L) / 3000.0F * 8.0F;
+ GL11.glTranslatef(f9, 0.0F, 0.0F);
+ GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F);
+ ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F);
+ GL11.glPopMatrix();
+ GL11.glPushMatrix();
+ GL11.glScalef(f8, f8, f8);
+ f9 = (float) (Minecraft.getSystemTime() % 4873L) / 4873.0F * 8.0F;
+ GL11.glTranslatef(-f9, 0.0F, 0.0F);
+ GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F);
+ ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F);
+ GL11.glPopMatrix();
+ GL11.glMatrixMode(GL11.GL_MODELVIEW);
+ GL11.glDisable(GL11.GL_BLEND);
+ GL11.glEnable(GL11.GL_LIGHTING);
+ GL11.glDepthFunc(GL11.GL_LEQUAL);
+ }
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/render/RendererGameOverlay.class b/src/main/java/jp/plusplus/fbs/render/RendererGameOverlay.class Binary files differnew file mode 100644 index 0000000..611260d --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/render/RendererGameOverlay.class diff --git a/src/main/java/jp/plusplus/fbs/render/RendererGameOverlay.java b/src/main/java/jp/plusplus/fbs/render/RendererGameOverlay.java new file mode 100644 index 0000000..b5a731c --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/render/RendererGameOverlay.java @@ -0,0 +1,159 @@ +package jp.plusplus.fbs.render;
+
+import com.mojang.realmsclient.gui.ChatFormatting;
+import cpw.mods.fml.client.FMLClientHandler;
+import cpw.mods.fml.common.eventhandler.EventPriority;
+import cpw.mods.fml.common.eventhandler.SubscribeEvent;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.RecipeBladeSpice;
+import jp.plusplus.fbs.Registry;
+import jp.plusplus.fbs.alchemy.characteristic.CharacteristicBase;
+import jp.plusplus.fbs.exprop.FBSEntityProperties;
+import jp.plusplus.fbs.item.ItemBookSorcery;
+import jp.plusplus.fbs.spirit.ISpiritTool;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.Gui;
+import net.minecraft.client.renderer.Tessellator;
+import net.minecraft.item.ItemStack;
+import net.minecraft.item.ItemSword;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.ResourceLocation;
+import net.minecraft.util.StatCollector;
+import net.minecraftforge.client.GuiIngameForge;
+import net.minecraftforge.client.event.RenderGameOverlayEvent;
+import net.minecraftforge.event.entity.player.ItemTooltipEvent;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Createdby pluslus_Fon 2015/06/05.
+ */
+public class RendererGameOverlay {
+ public static final ResourceLocation icons = new ResourceLocation(FBS.MODID+":textures/gui/san.png");
+ public static Minecraft mc = FMLClientHandler.instance().getClient();
+
+ @SideOnly(Side.CLIENT)
+ private static int Count = 0;
+ @SideOnly(Side.CLIENT)
+ public static boolean renderHUD = false;
+ @SideOnly(Side.CLIENT)
+ public static boolean renderAria=false;
+
+ @SideOnly(Side.CLIENT)
+ @SubscribeEvent(priority = EventPriority.LOWEST)
+ public void onRenderGameOverlayEvent(RenderGameOverlayEvent.Pre event) {
+ if (event.type == RenderGameOverlayEvent.ElementType.FOOD && mc.playerController.shouldDrawHUD()) {
+ renderHUD = true;
+ }
+ if(event.type==RenderGameOverlayEvent.ElementType.HOTBAR) renderAria=true;
+ }
+
+ @SideOnly(Side.CLIENT)
+ @SubscribeEvent(priority = EventPriority.LOWEST)
+ public void onRenderGameOverlayEvent(RenderGameOverlayEvent.Post event) {
+ int width = event.resolution.getScaledWidth();
+ int height = event.resolution.getScaledHeight();
+
+ if (renderHUD) {
+ renderHUD = false;
+
+ mc.mcProfiler.startSection(FBS.MODID+"-san");
+ FMLClientHandler.instance().getClient().getTextureManager().bindTexture(icons);
+
+ int x=width/2-91;
+ int y=height - GuiIngameForge.left_height;
+ GuiIngameForge.left_height += 10;
+
+ //san
+ drawTexturedModalRect(x, y, 0, 0, 24, 8);
+ if(mc.thePlayer!=null){
+ FBSEntityProperties fbsep=FBSEntityProperties.get(mc.thePlayer);
+ int s=fbsep.getSanity();
+ int ms=fbsep.get(mc.thePlayer).getMaxSanity();
+
+ for(int i=0;i==0 || s>0;i++){
+ drawTexturedModalRect(x+24+8*(2-i), y, 8 * (s%10), 8, 8, 8);
+ s/=10;
+ }
+ drawTexturedModalRect(x+24+8*3, y, 24, 0, 8, 8);
+ for(int i=0;i==0 || ms>0;i++){
+ drawTexturedModalRect(x+24+8*(5-i), y, 8 * (ms%10), 8, 8, 8);
+ ms/=10;
+ }
+ }
+ mc.mcProfiler.endSection();
+ FMLClientHandler.instance().getClient().getTextureManager().bindTexture(Gui.icons);
+ }
+
+ if(renderAria){
+ renderAria = false;
+
+ mc.mcProfiler.startSection(FBS.MODID+"-aria");
+ FMLClientHandler.instance().getClient().getTextureManager().bindTexture(icons);
+
+ //詠唱時間の描画
+ if(mc.thePlayer.isUsingItem()){
+ ItemStack itemStack=mc.thePlayer.getCurrentEquippedItem();
+ if(itemStack!=null && itemStack.getItem() instanceof ItemBookSorcery){
+ int baseX=width/2-33;
+ int baseY=height/2+9;
+ int w=64-(int)(64.f*mc.thePlayer.getItemInUseCount()/itemStack.getMaxItemUseDuration());
+
+ drawTexturedModalRect(baseX, baseY, 88, 0, 66, 4);
+ if(w>0) drawTexturedModalRect(baseX+1, baseY+1, 89, 4, w, 2);
+ }
+ }
+ mc.mcProfiler.endSection();
+ FMLClientHandler.instance().getClient().getTextureManager().bindTexture(Gui.icons);
+ }
+ }
+
+
+ @SubscribeEvent
+ public void onItemTooltipEvent(ItemTooltipEvent event) {
+ ItemStack itemStack = event.itemStack;
+ List<String> toolTip = event.toolTip;
+
+ //使用することでSAN値が増減するアイテム
+ Registry.ItemSanity isan=Registry.GetItemSanity(event.itemStack);
+ if(isan!=null){
+ if(isan.max>0) toolTip.add(ChatFormatting.BLUE+StatCollector.translateToLocalFormatted("info.fbs.sanity.add", isan.trial, isan.max));
+ else if(isan.max<0) toolTip.add(ChatFormatting.RED+StatCollector.translateToLocalFormatted("info.fbs.sanity.lose", isan.trial, -isan.max));
+ }
+
+ //精霊武器
+ if(itemStack.getItem() instanceof ISpiritTool){
+
+ }
+
+ //剣と刃薬
+ if(itemStack.getItem() instanceof ItemSword){
+ NBTTagCompound nbt=itemStack.getTagCompound();
+ if(nbt!=null && nbt.hasKey(RecipeBladeSpice.AMOUNT)){
+ toolTip.add("[Blade Spice "+nbt.getInteger(RecipeBladeSpice.AMOUNT)+"]");
+
+ ArrayList<CharacteristicBase> cbs=RecipeBladeSpice.getCharacteristics(itemStack);
+ for(CharacteristicBase cb : cbs){
+ toolTip.add(cb.getNameColor()+"-"+cb.getLocalizedName()+":"+cb.getLocalizedEffectValue());
+ }
+ }
+ }
+ }
+
+ public static void drawTexturedModalRect(int par1, int par2, int par3, int par4, int par5, int par6){
+ float zLevel = -90.0F;
+
+ float f = 0.00390625F;
+ float f1 = 0.00390625F;
+ Tessellator tessellator = Tessellator.instance;
+ tessellator.startDrawingQuads();
+ tessellator.addVertexWithUV((par1 + 0), (par2 + par6), zLevel, ((par3 + 0) * f), ((par4 + par6) * f1));
+ tessellator.addVertexWithUV((par1 + par5), (par2 + par6), zLevel, ((par3 + par5) * f), ((par4 + par6) * f1));
+ tessellator.addVertexWithUV((par1 + par5), (par2 + 0), zLevel, ((par3 + par5) * f), ((par4 + 0) * f1));
+ tessellator.addVertexWithUV((par1 + 0), (par2 + 0), zLevel, ((par3 + 0) * f), ((par4 + 0) * f1));
+ tessellator.draw();
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/render/TessellatorWrapper.class b/src/main/java/jp/plusplus/fbs/render/TessellatorWrapper.class Binary files differnew file mode 100644 index 0000000..fb6a808 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/render/TessellatorWrapper.class diff --git a/src/main/java/jp/plusplus/fbs/render/TessellatorWrapper.java b/src/main/java/jp/plusplus/fbs/render/TessellatorWrapper.java new file mode 100644 index 0000000..c9937e4 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/render/TessellatorWrapper.java @@ -0,0 +1,168 @@ +package jp.plusplus.fbs.render;
+
+import net.minecraft.client.renderer.Tessellator;
+import net.minecraft.util.IIcon;
+
+/**
+ * Created by plusplus_F on 2015/06/28.
+ * なんで!!!てってれーたーには!!!!面描画メソッドが!!!!用意されてないんですか!!!!!1111
+ */
+public class TessellatorWrapper {
+ private static Tessellator tessellator=Tessellator.instance;
+ private static boolean isBlockRender;
+
+ public static void SetBlockRender(boolean flag){
+ isBlockRender=flag;
+ }
+
+ public static void DrawXPos(float bx, float by, float bz, float my, float mz, IIcon icon){
+ float minU=icon.getInterpolatedU(16*bz);
+ float maxU=icon.getInterpolatedU(16*mz);
+ float minV=icon.getInterpolatedV(16*my);
+ float maxV=icon.getInterpolatedV(16*by);
+
+ if(isBlockRender){
+ tessellator.setNormal(1.0f, 0.0f, 0.0f);
+ tessellator.addVertexWithUV(bx, my, bz, minU, minV);
+ tessellator.addVertexWithUV(bx, my, mz, maxU, minV);
+ tessellator.addVertexWithUV(bx, by, mz, maxU, maxV);
+ tessellator.addVertexWithUV(bx, by, bz, minU, maxV);
+ }
+ else{
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(1.0f, 0.0f, 0.0f);
+ tessellator.addVertexWithUV(bx, my, bz, minU, minV);
+ tessellator.addVertexWithUV(bx, my, mz, maxU, minV);
+ tessellator.addVertexWithUV(bx, by, mz, maxU, maxV);
+ tessellator.addVertexWithUV(bx, by, bz, minU, maxV);
+ tessellator.draw();
+ }
+ }
+ public static void DrawXNeg(float bx, float by, float bz, float my, float mz, IIcon icon){
+ float minU=icon.getInterpolatedU(16 * bz);
+ float maxU=icon.getInterpolatedU(16 * mz);
+ float minV=icon.getInterpolatedV(16 * my);
+ float maxV=icon.getInterpolatedV(16 * by);
+
+ if(isBlockRender){
+ tessellator.setNormal(-1.0f, 0.0f, 0.0f);
+ tessellator.addVertexWithUV(bx, my, bz, minU, minV);
+ tessellator.addVertexWithUV(bx, by, bz, minU, maxV);
+ tessellator.addVertexWithUV(bx, by, mz, maxU, maxV);
+ tessellator.addVertexWithUV(bx, my, mz, maxU, minV);
+ }
+ else{
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(-1.0f, 0.0f, 0.0f);
+ tessellator.addVertexWithUV(bx, my, bz, minU, minV);
+ tessellator.addVertexWithUV(bx, by, bz, minU, maxV);
+ tessellator.addVertexWithUV(bx, by, mz, maxU, maxV);
+ tessellator.addVertexWithUV(bx, my, mz, maxU, minV);
+ tessellator.draw();
+ }
+ }
+
+ public static void DrawYPos(float bx, float by, float bz, float mx, float mz, IIcon icon){
+ float minU=icon.getInterpolatedU(16 * bx);
+ float maxU=icon.getInterpolatedU(16 * mx);
+ float minV=icon.getInterpolatedV(16 * bz);
+ float maxV=icon.getInterpolatedV(16 * mz);
+
+ if(isBlockRender){
+ tessellator.setNormal(0.0f, 1.0f, 0.0f);
+ tessellator.addVertexWithUV(bx, by, bz, minU, minV);
+ tessellator.addVertexWithUV(bx, by, mz, minU, maxV);
+ tessellator.addVertexWithUV(mx, by, mz, maxU, maxV);
+ tessellator.addVertexWithUV(mx, by, bz, maxU, minV);
+ }
+ else{
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(0.0f, 1.0f, 0.0f);
+ tessellator.addVertexWithUV(bx, by, bz, minU, minV);
+ tessellator.addVertexWithUV(bx, by, mz, minU, maxV);
+ tessellator.addVertexWithUV(mx, by, mz, maxU, maxV);
+ tessellator.addVertexWithUV(mx, by, bz, maxU, minV);
+ tessellator.draw();
+ }
+ }
+ public static void DrawYNeg(float bx, float by, float bz, float mx, float mz, IIcon icon){
+ float minU=icon.getInterpolatedU(16 * bx);
+ float maxU=icon.getInterpolatedU(16 * mx);
+ float minV=icon.getInterpolatedV(16 * bz);
+ float maxV=icon.getInterpolatedV(16 * mz);
+
+ if(isBlockRender){
+ tessellator.setNormal(0.0f,-1.0f,0.0f);
+ tessellator.addVertexWithUV(bx, by, bz, minU, minV);
+ tessellator.addVertexWithUV(mx, by, bz, maxU, minV);
+ tessellator.addVertexWithUV(mx, by, mz, maxU, maxV);
+ tessellator.addVertexWithUV(bx, by, mz, minU, maxV);
+ }
+ else{
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(0.0f,-1.0f,0.0f);
+ tessellator.addVertexWithUV(bx, by, bz, minU, minV);
+ tessellator.addVertexWithUV(mx, by, bz, maxU, minV);
+ tessellator.addVertexWithUV(mx, by, mz, maxU, maxV);
+ tessellator.addVertexWithUV(bx, by, mz, minU, maxV);
+ tessellator.draw();
+ }
+ }
+
+ public static void DrawZPos(float bx, float by, float bz, float mx, float my, IIcon icon){
+ float minU=icon.getInterpolatedU(16 * bx);
+ float maxU=icon.getInterpolatedU(16 * mx);
+ float minV=icon.getInterpolatedV(16 * by);
+ float maxV=icon.getInterpolatedV(16 * my);
+
+ if(isBlockRender){
+ tessellator.setNormal(0.0f,0.0f,1.0f);
+ tessellator.addVertexWithUV(bx, by, bz, minU, minV);
+ tessellator.addVertexWithUV(mx, by, bz, maxU, minV);
+ tessellator.addVertexWithUV(mx, my, bz, maxU, maxV);
+ tessellator.addVertexWithUV(bx, my, bz, minU, maxV);
+ }
+ else{
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(0.0f,0.0f,1.0f);
+ tessellator.addVertexWithUV(bx, by, bz, minU, minV);
+ tessellator.addVertexWithUV(mx, by, bz, maxU, minV);
+ tessellator.addVertexWithUV(mx, my, bz, maxU, maxV);
+ tessellator.addVertexWithUV(bx, my, bz, minU, maxV);
+ tessellator.draw();
+ }
+ }
+ public static void DrawZNeg(float bx, float by, float bz, float mx, float my, IIcon icon){
+ float minU=icon.getInterpolatedU(16*bx);
+ float maxU=icon.getInterpolatedU(16*mx);
+ float minV=icon.getInterpolatedV(16 * by);
+ float maxV=icon.getInterpolatedV(16*my);
+
+ if(isBlockRender){
+ tessellator.setNormal(0.0f, 0.0f, -1.0f);
+ tessellator.addVertexWithUV(bx, by, bz, minU, minV);
+ tessellator.addVertexWithUV(bx, my, bz, minU, maxV);
+ tessellator.addVertexWithUV(mx, my, bz, maxU, maxV);
+ tessellator.addVertexWithUV(mx, by, bz, maxU, minV);
+ }
+ else{
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(0.0f, 0.0f, -1.0f);
+ tessellator.addVertexWithUV(bx, by, bz, minU, minV);
+ tessellator.addVertexWithUV(bx, my, bz, minU, maxV);
+ tessellator.addVertexWithUV(mx, my, bz, maxU, maxV);
+ tessellator.addVertexWithUV(mx, by, bz, maxU, minV);
+ tessellator.draw();
+ }
+ }
+
+ public static void DrawAllFaces(float bx, float by, float bz, float mx, float my, float mz, IIcon icon) {
+ DrawYNeg(bx, by, bz, mx, mz, icon);
+ DrawYPos(bx, my, bz, mx, mz, icon);
+ DrawZNeg(bx, by, bz, mx, my, icon);
+ DrawZPos(bx, by, mz, mx, my, icon);
+ DrawXNeg(bx, by, bz, my, mz, icon);
+ DrawXPos(mx, by, bz, my, mz, icon);
+ }
+
+}
diff --git a/src/main/java/jp/plusplus/fbs/spirit/ISpiritTool.class b/src/main/java/jp/plusplus/fbs/spirit/ISpiritTool.class Binary files differnew file mode 100644 index 0000000..e475ba9 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/spirit/ISpiritTool.class diff --git a/src/main/java/jp/plusplus/fbs/spirit/ISpiritTool.java b/src/main/java/jp/plusplus/fbs/spirit/ISpiritTool.java new file mode 100644 index 0000000..919283a --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/spirit/ISpiritTool.java @@ -0,0 +1,37 @@ +package jp.plusplus.fbs.spirit;
+
+import net.minecraft.item.ItemStack;
+
+/**
+ * Created by plusplus_F on 2015/11/02.
+ * 精霊武器であることを示すインターフェース
+ */
+public interface ISpiritTool {
+ /**
+ * 攻撃力を計算する
+ * @param ss
+ * @return
+ */
+ public float calcDamage(SpiritStatus ss);
+
+ /**
+ * 採掘レベルを計算する
+ * @param ss
+ * @return
+ */
+ public int calcDigLv(SpiritStatus ss);
+
+ /**
+ * 耐久度を計算する
+ * @param ss
+ * @return
+ */
+ public int calcDurable(SpiritStatus ss);
+
+ /**
+ * 使用した素材アイテムによって、初期値を決定する
+ * @param ss
+ * @param material
+ */
+ public void calcInitialValue(SpiritStatus ss, ItemStack material);
+}
diff --git a/src/main/java/jp/plusplus/fbs/spirit/ItemSwordSpirit.class b/src/main/java/jp/plusplus/fbs/spirit/ItemSwordSpirit.class Binary files differnew file mode 100644 index 0000000..dafddb2 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/spirit/ItemSwordSpirit.class diff --git a/src/main/java/jp/plusplus/fbs/spirit/ItemSwordSpirit.java b/src/main/java/jp/plusplus/fbs/spirit/ItemSwordSpirit.java new file mode 100644 index 0000000..80c79b7 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/spirit/ItemSwordSpirit.java @@ -0,0 +1,187 @@ +package jp.plusplus.fbs.spirit;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.AchievementRegistry;
+import jp.plusplus.fbs.exprop.SanityManager;
+import jp.plusplus.fbs.item.ItemBase;
+import net.minecraft.block.Block;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.EnumAction;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.item.ItemSword;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.MathHelper;
+import net.minecraft.util.StatCollector;
+import net.minecraft.world.World;
+
+import java.util.List;
+
+/**
+ * Created by plusplus_F on 2015/11/02.
+ */
+public class ItemSwordSpirit extends ItemBase implements ISpiritTool {
+ public ItemSwordSpirit() {
+ setCreativeTab(null);
+ setUnlocalizedName("spiritSword");
+ setTextureName("spiritSword");
+ setMaxStackSize(1);
+ setNoRepair();
+ }
+
+ @Override
+ public boolean hitEntity(ItemStack itemStack, EntityLivingBase target, EntityLivingBase player) {
+ if(player instanceof EntityPlayer){
+ SpiritStatus ss=SpiritStatus.readFromNBT(itemStack.getTagCompound());
+
+ int dur=calcDurable(ss);
+ ss.addItemDamage(1);
+ if(ss.getItemDamage()>dur){
+ ss.setItemDamage(dur);
+ }
+ if(ss.getItemDamage()==dur){
+ ((EntityPlayer) player).triggerAchievement(AchievementRegistry.evil);
+ }
+ if(ss.getItemDamage()<dur && ss.isOwner((EntityPlayer)player) && ss.addExp(1)){
+ SpiritManager.talk((EntityPlayer)player, ss.getCharacter(), "lvup", itemStack);
+ SanityManager.setSpiritLevel((EntityPlayer)player, ss.getLv());
+
+ if(!((EntityPlayer) player).worldObj.isRemote && ss.getLv()==50) ((EntityPlayer) player).triggerAchievement(AchievementRegistry.best);
+ }
+ SpiritManager.updateNBT(itemStack, ss);
+ }
+ return true;
+ }
+
+ @Override
+ public boolean onBlockDestroyed(ItemStack itemStack, World world, Block block, int x, int y, int z, EntityLivingBase p_150894_7_) {
+ if ((double) block.getBlockHardness(world, x, y, z) != 0.0D) {
+ SpiritStatus ss=SpiritStatus.readFromNBT(itemStack.getTagCompound());
+
+ ss.addItemDamage(2);
+ SpiritManager.updateNBT(itemStack, ss);
+ }
+
+ return true;
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public boolean isFull3D() {
+ return true;
+ }
+
+ @Override
+ public EnumAction getItemUseAction(ItemStack p_77661_1_) {
+ return EnumAction.block;
+ }
+
+ @Override
+ public int getMaxItemUseDuration(ItemStack p_77626_1_) {
+ return 72000;
+ }
+
+ @Override
+ public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) {
+ if(player.isSneaking()){
+ SpiritStatus status=SpiritStatus.readFromNBT(itemStack.getTagCompound());
+ if(status.getOwnerName().equals(player.getDisplayName())){
+ SpiritManager.openGui(player);
+ }
+ }
+ else{
+ player.setItemInUse(itemStack, this.getMaxItemUseDuration(itemStack));
+ }
+
+ return itemStack;
+ }
+
+ @Override
+ public boolean func_150897_b(Block p_150897_1_) {
+ return p_150897_1_ == Blocks.web;
+ }
+
+ @Override
+ public int getItemEnchantability() {
+ return 0;
+ }
+
+ @Override
+ public boolean getIsRepairable(ItemStack p_82789_1_, ItemStack p_82789_2_) {
+ return false;
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void addInformation(ItemStack itemStack, EntityPlayer player, List list, boolean flag) {
+ SpiritManager.addInformation(itemStack, player, list, flag);
+ }
+
+ @Override
+ public String getItemStackDisplayName(ItemStack p_77653_1_) {
+ return SpiritManager.getSpiritDisplayName(p_77653_1_);
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public boolean hasEffect(ItemStack p_77636_1_) {
+ return true;
+ }
+
+ @Override
+ public double getDurabilityForDisplay(ItemStack stack) {
+ SpiritStatus ss=SpiritStatus.readFromNBT(stack.getTagCompound());
+ return (double) ss.getItemDamage() / calcDurable(ss);
+ }
+
+ @Override
+ public boolean isDamaged(ItemStack stack) {
+ if(!stack.hasTagCompound()) return false;
+ return SpiritStatus.readFromNBT(stack.getTagCompound()).getItemDamage()>0;
+ //return true;
+ }
+ @Override
+ public boolean isItemTool(ItemStack p_77616_1_) {
+ return true;
+ }
+ @Override
+ public boolean showDurabilityBar(ItemStack stack) {
+ return isDamaged(stack);
+ }
+
+ //--------------------------------------------------------------------------------
+ @Override
+ public float calcDamage(SpiritStatus ss) {
+ if(ss.getItemDamage()>=calcDurable(ss)) return 0.5f;
+ return 3.5f+ss.getMaxDamage()*ss.calcRatio(ss.getStrength());
+ }
+
+ @Override
+ public int calcDigLv(SpiritStatus ss) {
+ return 0;
+ }
+
+ @Override
+ public int calcDurable(SpiritStatus ss) {
+ return 1000+(int)(ss.getMaxDurability()*ss.calcRatio(ss.getToughness()));
+ }
+
+ @Override
+ public void calcInitialValue(SpiritStatus ss, ItemStack material){
+ ItemSword sword=(ItemSword)material.getItem();
+ ToolMaterial tm=ToolMaterial.valueOf(sword.getToolMaterialName());
+
+ //最大攻撃力は武器の攻撃力の10倍
+ float maxDamage=(tm.getDamageVsEntity())*10;
+
+ //最大耐久力は武器の耐久*10+10000
+ float maxDurabity=tm.getMaxUses()*10+10000;
+
+ ss.setMaxStatus(maxDamage, 0, maxDurabity);
+ ss.addStrength(MathHelper.ceiling_float_int(tm.getDamageVsEntity() / (ss.getMaxDamage() / 255.f)));
+ ss.addToughness(MathHelper.ceiling_float_int(tm.getMaxUses()/(ss.getMaxDurability()/255.f)));
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/spirit/SkillManager$Skill.class b/src/main/java/jp/plusplus/fbs/spirit/SkillManager$Skill.class Binary files differnew file mode 100644 index 0000000..8f57aa3 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/spirit/SkillManager$Skill.class diff --git a/src/main/java/jp/plusplus/fbs/spirit/SkillManager$SkillData.class b/src/main/java/jp/plusplus/fbs/spirit/SkillManager$SkillData.class Binary files differnew file mode 100644 index 0000000..bee1c87 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/spirit/SkillManager$SkillData.class diff --git a/src/main/java/jp/plusplus/fbs/spirit/SkillManager$SkillEntry.class b/src/main/java/jp/plusplus/fbs/spirit/SkillManager$SkillEntry.class Binary files differnew file mode 100644 index 0000000..a4a1f21 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/spirit/SkillManager$SkillEntry.class diff --git a/src/main/java/jp/plusplus/fbs/spirit/SkillManager.class b/src/main/java/jp/plusplus/fbs/spirit/SkillManager.class Binary files differnew file mode 100644 index 0000000..dd12e75 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/spirit/SkillManager.class diff --git a/src/main/java/jp/plusplus/fbs/spirit/SkillManager.java b/src/main/java/jp/plusplus/fbs/spirit/SkillManager.java new file mode 100644 index 0000000..1f499d5 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/spirit/SkillManager.java @@ -0,0 +1,208 @@ +package jp.plusplus.fbs.spirit;
+
+import net.minecraft.util.StatCollector;
+
+import java.util.ArrayList;
+
+/**
+ * Created by plusplus_F on 2015/11/02.
+ * 精霊武器のスキルを管理するクラス
+ */
+public class SkillManager {
+ private static SkillManager instance=new SkillManager();
+
+ private int uId=0;
+ private ArrayList<Skill> skills=new ArrayList<Skill>();
+ private ArrayList<SkillEntry> skillEntries=new ArrayList<SkillEntry>();
+
+ private SkillManager(){}
+
+ public static void register(){
+ //congenital
+ registerSkill("fbs.precocious", 1);
+ registerSkill("fbs.lateBloomer", 1);
+
+ //demerit
+ registerSkill("fbs.blood", 1);
+ registerSkill("fbs.end", 1);
+ registerSkill("fbs.insanity", 1);
+
+ //passive
+ registerSkill("fbs.soulBind", 1);
+ registerSkill("fbs.contract", 1);
+ registerSkill("fbs.knowledge", 1);
+
+ //battle
+ registerSkill("fbs.fire", 5);
+ registerSkill("fbs.vampire", 5);
+ registerSkill("fbs.poison", 5);
+ registerSkill("fbs.sonic", 5);
+ registerSkill("fbs.knockback", 5);
+ registerSkill("fbs.infinity", 1);
+ registerSkill("fbs.critical", 5);
+ registerSkill("fbs.hero", 5);
+ registerSkill("fbs.lucky", 5);
+ registerSkill("fbs.headhunt", 5);
+ registerSkill("fbs.smite", 3);
+ registerSkill("fbs.arthropods", 3);
+
+ //harvest
+
+ //-------------------------------------------------------------------------------------------------
+
+ addSkillEntry(new SkillEntry(getSkill("fbs.soulBind"), new int[]{10}));
+ addSkillEntry(new SkillEntry(getSkill("fbs.contract"), new int[]{15}));
+ addSkillEntry(new SkillEntry(getSkill("fbs.knowledge"), new int[]{8}));
+
+ addSkillEntry(new SkillEntry(getSkill("fbs.fire"), new int[]{5,8,11,14,17}));
+ addSkillEntry(new SkillEntry(getSkill("fbs.blood"), new int[]{10,14,18,22,26}));
+ addSkillEntry(new SkillEntry(getSkill("fbs.poison"), new int[]{5,8,11,14,17}));
+ addSkillEntry(new SkillEntry(getSkill("fbs.sonic"), new int[]{10,14,18,22,26}));
+ addSkillEntry(new SkillEntry(getSkill("fbs.knockback"), new int[]{5,8,11,14,17}));
+ addSkillEntry(new SkillEntry(getSkill("fbs.infinity"), new int[]{35}));
+ addSkillEntry(new SkillEntry(getSkill("fbs.critical"), new int[]{5,8,11,14,17}));
+ addSkillEntry(new SkillEntry(getSkill("fbs.hero"), new int[]{10,14,18,22,26}));
+ addSkillEntry(new SkillEntry(getSkill("fbs.lucky"), new int[]{10,14,18,22,26}));
+ addSkillEntry(new SkillEntry(getSkill("fbs.headhunt"), new int[]{20,25,30,35,40}));
+ addSkillEntry(new SkillEntry(getSkill("fbs.smite"), new int[]{3,6,9,12,15}));
+ addSkillEntry(new SkillEntry(getSkill("fbs.arthropods"), new int[]{3,6,9,12,15}));
+ }
+
+ /**
+ * 精霊武器のスキルのデータを登録する。
+ * @param name スキル名
+ * @param max 最大レベル
+ * @return
+ */
+ public static int registerSkill(String name, int max){
+ instance.skills.add(new Skill(++instance.uId, name, max));
+ return instance.uId;
+ }
+
+ /**
+ * IDからスキルのデータを取得する
+ * @param id
+ * @return
+ */
+ public static Skill getSkill(int id){
+ if(id<=0 || id>instance.skills.size()) return null;
+ return instance.skills.get(id-1);
+ }
+ public static Skill getSkill(String name){
+ for(Skill s : instance.skills){
+ if(s.getName().equals(name)) return s;
+ }
+ return null;
+ }
+
+ public static void addSkillEntry(SkillEntry se){
+ instance.skillEntries.add(se);
+ }
+
+ public static ArrayList<SkillEntry> getSkillEntiries(){
+ return instance.skillEntries;
+ }
+
+ /**
+ * スキルのデータのクラス
+ */
+ public static class Skill{
+ private int id;
+ private String name;
+ private int lvMax;
+
+ public Skill(int id, String name, int max){
+ this.id=id;
+ this.name=name;
+ lvMax=max;
+ }
+
+
+
+ public String getLocalizedName(){
+ return StatCollector.translateToLocal("spirit.skill."+name);
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ public int getLvMax() {
+ return lvMax;
+ }
+
+ public String getName(){
+ return name;
+ }
+ }
+
+ public static class SkillEntry{
+ private Skill skill;
+ private int[] minLv;
+ private SkillData[] parents;
+
+ public SkillEntry(Skill skill, int[] minLv){
+ this(skill, minLv, new SkillData[0]);
+ }
+ public SkillEntry(Skill skill, int[] minLv, SkillData[] parents){
+ this.skill=skill;
+ this.minLv=minLv;
+ this.parents=parents;
+ }
+
+ public boolean canLearn(SpiritStatus status){
+ //精霊レベル
+ int nowLv=status.getSkillLevel(skill.getId())+1;
+ if(nowLv>=skill.getLvMax()) return false;
+ if(status.getLv()<minLv[nowLv]) return false;
+
+ //前提スキルの判定
+ for(SkillData sd : parents){
+ int now=status.getSkillLevel(sd.getSkill().getName());
+ if(sd.lv<now) return false;
+ }
+
+ return true;
+ }
+
+ public int getSkillId(){ return skill.getId(); }
+ public String getString(int lv){
+ String ret="Lv"+(lv+1)+" "+skill.getLocalizedName();
+ ret+="\n"+StatCollector.translateToLocal("spirit.gui.fbs.need")+":Lv"+minLv[lv];
+ if(parents.length>0){
+ for(int i=0;i<parents.length;i++){
+ ret+=","+parents[i].getString();
+ }
+ }
+ return ret;
+ }
+ }
+
+ /**
+ * 精霊武器が持つスキル情報
+ */
+ public static class SkillData{
+ public int id;
+ public int lv;
+
+ public SkillData(int id, int lv){
+ this.id=id;
+ this.lv=lv;
+ }
+
+ public Skill getSkill(){
+ return SkillManager.getSkill(id);
+ }
+
+ public boolean isSkillEqual(Skill skill){
+ return id==skill.getId();
+ }
+ public boolean isSkillEqual(int id){
+ return this.id==id;
+ }
+
+ public String getString() {
+ return "Lv"+(lv + 1) + " " + getSkill().getLocalizedName();
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/spirit/SpiritManager$ToolEntry.class b/src/main/java/jp/plusplus/fbs/spirit/SpiritManager$ToolEntry.class Binary files differnew file mode 100644 index 0000000..0247925 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/spirit/SpiritManager$ToolEntry.class diff --git a/src/main/java/jp/plusplus/fbs/spirit/SpiritManager.class b/src/main/java/jp/plusplus/fbs/spirit/SpiritManager.class Binary files differnew file mode 100644 index 0000000..568fea7 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/spirit/SpiritManager.class diff --git a/src/main/java/jp/plusplus/fbs/spirit/SpiritManager.java b/src/main/java/jp/plusplus/fbs/spirit/SpiritManager.java new file mode 100644 index 0000000..1eb7880 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/spirit/SpiritManager.java @@ -0,0 +1,385 @@ +package jp.plusplus.fbs.spirit;
+
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.Registry;
+import jp.plusplus.fbs.alchemy.AlchemyRegistry;
+import jp.plusplus.fbs.alchemy.characteristic.CharacteristicBase;
+import jp.plusplus.fbs.alchemy.characteristic.CharacteristicQuality;
+import jp.plusplus.fbs.api.event.SpiritTalkEvent;
+import jp.plusplus.fbs.exprop.SanityManager;
+import jp.plusplus.fbs.item.ItemCore;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.EntityPlayerMP;
+import net.minecraft.init.Items;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.item.ItemSword;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.potion.Potion;
+import net.minecraft.potion.PotionEffect;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.FoodStats;
+import net.minecraft.util.MathHelper;
+import net.minecraft.util.StatCollector;
+import net.minecraftforge.common.MinecraftForge;
+import shift.sextiarysector.SextiarySector;
+import shift.sextiarysector.api.SextiarySectorAPI;
+import shift.sextiarysector.packet.PacketPlayerData;
+import shift.sextiarysector.packet.SSPacketHandler;
+import shift.sextiarysector.player.CustomPlayerData;
+import shift.sextiarysector.player.EntityPlayerManager;
+import shift.sextiarysector.player.MoistureStats;
+import shift.sextiarysector.player.StaminaStats;
+
+import javax.annotation.Nullable;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.List;
+import java.util.Random;
+
+/**
+ * Created by plusplus_F on 2015/11/02.
+ * 精霊の人格の管理、メッセージの表示などを扱う
+ */
+public class SpiritManager {
+ private static SpiritManager instance=new SpiritManager();
+
+ private Random rand=new Random();
+ private ArrayList<String> characterMale=new ArrayList<String>();
+ private ArrayList<String> characterFemale=new ArrayList<String>();
+ private ArrayList<ToolEntry> tools=new ArrayList<ToolEntry>();
+
+ private SpiritManager(){}
+
+ public static void register(){
+ registerTool(ItemCore.spiritSword, ItemSword.class);
+
+ registerSpiritCharacter(false, "fbs.alice");
+ registerSpiritCharacter(false, "fbs.tama");
+ registerSpiritCharacter(false, "fbs.hiyo");
+ registerSpiritCharacter(false, "fbs.kako");
+ registerSpiritCharacter(true, "fbs.d");
+ registerSpiritCharacter(true, "fbs.kouta");
+
+ SkillManager.register();
+ }
+
+ public static void openGui(EntityPlayer player){
+ int x= MathHelper.floor_double(player.posX);
+ int y= MathHelper.floor_double(player.posY);
+ int z= MathHelper.floor_double(player.posZ);
+
+ player.openGui(FBS.instance, FBS.GUI_SPIRIT_MAIN_ID, player.worldObj, x,y,z);
+ }
+
+ public static int findSpiritToolIndex(EntityPlayer player){
+ int size=player.inventory.getSizeInventory();
+ for(int i=0;i<size;i++){
+ ItemStack is=player.inventory.getStackInSlot(i);
+ if(is!=null && is.getItem() instanceof ISpiritTool){
+ return i;
+ }
+ }
+ return -1;
+ }
+ public static ItemStack findSpiritTool(EntityPlayer player){
+ int i=findSpiritToolIndex(player);
+ return i==-1?null:player.inventory.getStackInSlot(i);
+ }
+
+ public static void registerTool(Item spiritTool, Class<? extends Item> tool){
+ instance.tools.add(new ToolEntry(spiritTool, tool));
+ }
+ public static ToolEntry getTool(Item item){
+ for(ToolEntry te : instance.tools){
+ if(te.matches(item)){
+ return te;
+ }
+ }
+ return null;
+ }
+ public static boolean isTool(Item item){
+ return getTool(item)!=null;
+ }
+
+ /**
+ * 契約可能な精霊の人格を登録する
+ * @param isMale trueの場合、それは男性であることを示す
+ * @param character 精霊の内部名
+ */
+ public static void registerSpiritCharacter(boolean isMale, String character){
+ if(isMale) instance.characterMale.add(character);
+ else instance.characterFemale.add(character);
+ }
+
+ /**
+ * 契約可能な精霊の名前をランダムで取得する
+ * @param isMale trueの場合、それは男性であることを示す
+ * @return 精霊の内部名
+ */
+ public static String getRandomCharacter(boolean isMale){
+ if(isMale){
+ return instance.characterMale.get(instance.rand.nextInt(instance.characterMale.size()));
+ }
+ else{
+ return instance.characterFemale.get(instance.rand.nextInt(instance.characterFemale.size()));
+ }
+ }
+
+ /**
+ * 精霊武器アイテムスタックのNBTを更新する
+ * @param itemStack
+ * @param status
+ */
+ public static void updateNBT(ItemStack itemStack, SpiritStatus status){
+ NBTTagCompound nbt=new NBTTagCompound();
+ SpiritStatus.writeToNBT(status, nbt);
+ itemStack.setTagCompound(nbt);
+ }
+
+ /**
+ * ゲーム中に表示される精霊武器の名前を取得する
+ * @param itemStack
+ * @return
+ */
+ public static String getSpiritDisplayName(ItemStack itemStack){
+ SpiritStatus ss=SpiritStatus.readFromNBT(itemStack.getTagCompound());
+ if(ss==null) return "Unnamed";
+ return StatCollector.translateToLocal("item.fbs.spirit.name").replaceAll("%owner%", ss.getOwnerName()).replaceAll("%spirit%", ss.getName());
+ }
+
+ /**
+ * プレイヤーに対し精霊が話しかける。
+ * メッセージは最大で10行(0-9)
+ * @param player 対象プレイヤー
+ * @param character 人格
+ * @param event イベント
+ * @param params その他引数
+ */
+ public static void talk(EntityPlayer player, String character, String event, @Nullable ItemStack spiritToolStack, Object ... params){
+ if(player.worldObj.isRemote) return;
+
+ ItemStack itemStack=null;
+ SpiritStatus status=null;
+
+ if(spiritToolStack!=null){
+ itemStack=spiritToolStack;
+ }
+ else{
+ itemStack=findSpiritTool(player);
+ }
+ if(itemStack==null) return;
+ status=SpiritStatus.readFromNBT(itemStack.getTagCompound());
+ if(status==null) return;
+
+ if(!status.isOwner(player)) return;
+
+ //設定を確認する
+ if(event.equals("morning") || event.equals("noon") || event.equals("night")){
+ if(!status.getConfiguration().get("enableTimeSignalMessage") && !status.getConfiguration().get("enableMessage")) return;
+ }
+ else if(!status.getConfiguration().get("enableMessage")){
+ return;
+ }
+
+ SpiritTalkEvent ste=new SpiritTalkEvent(player, character, event, params);
+ boolean isCanceled=MinecraftForge.EVENT_BUS.post(ste);
+ if(!isCanceled){
+
+ for(int i=0;i<10;i++){
+ String m="spirit.talk."+character+"."+event+"."+i;
+ if(!StatCollector.canTranslate(m)) break;
+
+ m=translateString(m, status);
+ player.addChatComponentMessage(new ChatComponentText("<"+spiritToolStack.getDisplayName()+">"+m));
+ }
+ }
+ }
+
+ /**
+ * いい感じにローカライズする
+ * @param key
+ * @param status
+ * @return
+ */
+ public static String translateString(String key, SpiritStatus status, Object ... params){
+ String m=StatCollector.translateToLocal(key);
+ m=m.replaceAll("%spirit%", status.getName());
+ m=m.replaceAll("%owner%", status.getOwnerName());
+ return m;
+ }
+
+ public static void addInformation(ItemStack itemStack, EntityPlayer player, List list, boolean flag){
+ ISpiritTool ist=(ISpiritTool)itemStack.getItem();
+ SpiritStatus ss=SpiritStatus.readFromNBT(itemStack.getTagCompound());
+
+ list.add("[Status]");
+ list.add("Level:"+ss.getLv());
+ list.add(String.format("Damage:%.1f", ist.calcDamage(ss)+0.5));
+ list.add("Harvest Level:"+ist.calcDigLv(ss));
+
+ int t=ist.calcDurable(ss);
+ list.add("Durability:"+(t-ss.getItemDamage())+"/"+t);
+ }
+
+ /**
+ * 精霊の祝福
+ * @param player
+ */
+ public static void bless(EntityPlayer player, ItemStack tool){
+ SpiritStatus status=SpiritStatus.readFromNBT(tool.getTagCompound());
+ //もうめんどくさいんでハードコード
+
+ //ライフ・満腹度・水分・スタミナのいずれか
+ int r=instance.rand.nextInt(FBS.cooperatesSS2?4:2);
+ switch (r){
+ case 0:
+ player.heal(player.getMaxHealth());
+ player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("spirit.bless.fbs.health")));
+ break;
+
+ case 1:
+ FoodStats fs=player.getFoodStats();
+ fs.addStats(20, 1.f);
+ player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("spirit.bless.fbs.food")));
+ break;
+
+ case 2:
+ instance.blessForSS2(player, 0);
+ player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("spirit.bless.fbs.moisture")));
+ break;
+
+ case 3:
+ instance.blessForSS2(player, 1);
+ player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("spirit.bless.fbs.stamina")));
+ break;
+ }
+
+
+ //さらに、マイナス効果を全て打ち消しランダムでエンチャント効果
+ ItemStack dummy=new ItemStack(Items.milk_bucket);
+ player.curePotionEffects(dummy);
+
+ Potion p;
+ switch (instance.rand.nextInt(13)){
+ case 0: p=Potion.damageBoost; break;
+ case 1: p=Potion.digSpeed; break;
+ case 2: p=Potion.fireResistance; break;
+ case 3: p=Potion.invisibility; break;
+ case 4: p=Potion.moveSpeed; break;
+ case 5: p=Potion.jump; break;
+ case 6: p=Potion.nightVision; break;
+ case 7: p=Potion.nightVision; break;
+ case 8: p=Potion.regeneration; break;
+ case 9: p=Potion.resistance; break;
+ case 10: p=Potion.waterBreathing; break;
+ case 11: p=Registry.potionCleverness; break;
+ case 12: p=Registry.potionContract; break;
+ default: p=Potion.heal; break;
+ }
+
+ player.addPotionEffect(new PotionEffect(p.getId(), 20*(60+3*status.getLv()), status.getLv()/15));
+ status.updateLastBlessDate(player.worldObj.getCurrentDate().get(Calendar.DATE));
+
+ NBTTagCompound nbt=new NBTTagCompound();
+ SpiritStatus.writeToNBT(status, nbt);
+ tool.setTagCompound(nbt);
+
+ //精霊の涙
+ ItemStack tear=AlchemyRegistry.getItemStack(ItemCore.alchemyMaterial, status.hasSkill("fbs.sentimental")?2:1, 40);
+ if(player.inventory.addItemStackToInventory(tear) && tear.stackSize>0){
+ player.entityDropItem(tear, 0);
+ }
+
+ talk(player, status.getCharacter(), "bless", tool);
+ }
+
+ /**
+ * 精霊の修理
+ * @param player
+ * @param tool
+ * @param potionIndex
+ */
+ public static void repair(EntityPlayer player, ItemStack tool, int potionIndex){
+ if(potionIndex==-1){
+ int s=player.inventory.getSizeInventory();
+ for(int i=0;i<s;i++){
+ ItemStack is=player.inventory.getStackInSlot(i);
+ if(is==null) continue;
+ if(is.getItem()==ItemCore.alchemyPotion && is.getItemDamage()==2){
+ potionIndex=i;
+ break;
+ }
+ }
+ }
+ if(potionIndex==-1) return;
+
+ //回復量を得る
+ float scale=1.f;
+ ItemStack potion=player.inventory.getStackInSlot(potionIndex);
+ ArrayList<CharacteristicBase> cbs=AlchemyRegistry.ReadCharacteristicFromNBT(potion.getTagCompound());
+ for(CharacteristicBase cb :cbs){
+ if(cb instanceof CharacteristicQuality){
+ scale=cb.getMPScale();
+ break;
+ }
+ }
+
+ //回復する
+ SpiritStatus status=SpiritStatus.readFromNBT(tool.getTagCompound());
+ status.repair((int)(500*scale));
+
+ //更新
+ NBTTagCompound nbt1=new NBTTagCompound();
+ SpiritStatus.writeToNBT(status, nbt1);
+ tool.setTagCompound(nbt1);
+ }
+
+ public void blessForSS2(EntityPlayer player, int type){
+ if(type==0){
+ SextiarySectorAPI.addMoistureStats(player, 20, 20);
+ }
+ else{
+ SextiarySectorAPI.addStaminaStats(player, 100, 50);
+ }
+
+ if(player instanceof EntityPlayerMP) SSPacketHandler.INSTANCE.sendTo(new PacketPlayerData(EntityPlayerManager.getCustomPlayerData(player)), (EntityPlayerMP)player);
+ }
+
+ /**
+ * 使用した武器と精霊武器のクラスを関連付ける。
+ */
+ public static class ToolEntry{
+ private Class<? extends Item> tool;
+ private Item spiritTool;
+
+ public ToolEntry(Item spiritTool, Class<? extends Item> tool){
+ this.spiritTool=spiritTool;
+ this.tool=tool;
+ }
+
+ public boolean matches(Item item){
+ return tool.isAssignableFrom(item.getClass());
+ }
+
+ public ItemStack getSpiritToolStack(boolean isMale, String character, String name, EntityPlayer owner, ItemStack material){
+ ItemStack ret=new ItemStack(spiritTool);
+ SpiritStatus ss=new SpiritStatus(isMale, character, name, owner);
+
+ //先天スキルの設定
+ float r=new Random().nextFloat();
+ if(r<0.05f) ss.setSkill("fbs.precocious", 0);
+ else if(r<0.10f) ss.setSkill("fbs.lateBloomer", 0);
+ else if(r<0.15f) ss.setSkill("fbs.hero", 0);
+ else if(r<0.20f) ss.setSkill("fbs.skillful", 0);
+ else if(r<0.25f) ss.setSkill("fbs.sentimental", 0);
+
+ ((ISpiritTool) spiritTool).calcInitialValue(ss, material);
+ updateNBT(ret, ss);
+
+ SanityManager.setSpirit(owner, ss.getName(), ss.getLv());
+
+ return ret;
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/spirit/SpiritStatus$Configuration$Pair.class b/src/main/java/jp/plusplus/fbs/spirit/SpiritStatus$Configuration$Pair.class Binary files differnew file mode 100644 index 0000000..381a538 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/spirit/SpiritStatus$Configuration$Pair.class diff --git a/src/main/java/jp/plusplus/fbs/spirit/SpiritStatus$Configuration.class b/src/main/java/jp/plusplus/fbs/spirit/SpiritStatus$Configuration.class Binary files differnew file mode 100644 index 0000000..da19ab1 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/spirit/SpiritStatus$Configuration.class diff --git a/src/main/java/jp/plusplus/fbs/spirit/SpiritStatus.class b/src/main/java/jp/plusplus/fbs/spirit/SpiritStatus.class Binary files differnew file mode 100644 index 0000000..3f37c00 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/spirit/SpiritStatus.class diff --git a/src/main/java/jp/plusplus/fbs/spirit/SpiritStatus.java b/src/main/java/jp/plusplus/fbs/spirit/SpiritStatus.java new file mode 100644 index 0000000..3517218 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/spirit/SpiritStatus.java @@ -0,0 +1,437 @@ +package jp.plusplus.fbs.spirit;
+
+import jp.plusplus.fbs.exprop.FBSEntityProperties;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.nbt.NBTTagList;
+import net.minecraft.util.MathHelper;
+
+import java.util.ArrayList;
+import java.util.Random;
+
+/**
+ * Created by plusplus_F on 2015/11/02.
+ * 精霊武器のステータスクラス
+ * NBTで読み書きする
+ */
+public class SpiritStatus {
+ private static Random random=new Random();
+ private static float log255=2.40654f;
+
+ public static final short LEVEL_MAX=50;
+ public static final short STATUS_MAX=255;
+ public static final short FOOD_LEVEL_MAX=128;
+
+ //基本
+ private boolean isMale;
+ private String character; //人格名
+ private String name; //プレイヤーのつけた名前
+ private String owner; //所有者の名前
+ private short level=1;
+ private double next;
+ private double exp;
+ private int itemDamage; //減ってる耐久値
+ private short skillPoint;
+ private int lastBlessDate=-1;
+ private short foodLevel=FOOD_LEVEL_MAX;
+
+ /**
+ * ダメージとか採掘レベルに関係する
+ */
+ private short strength;
+ private float maxDamage;
+ private float maxHarvestLevel;
+
+ /**
+ * 最大耐久に関係
+ */
+ private short toughness;
+ private float maxDurability;
+
+ /**
+ * 精霊の所持スキル
+ */
+ private ArrayList<SkillManager.SkillData> skills=new ArrayList<SkillManager.SkillData>();
+
+ /**
+ * 精霊の設定
+ */
+ private Configuration configuration=new Configuration();
+
+ public SpiritStatus(boolean isMale, String character, String name, EntityPlayer owner){
+ this();
+ this.isMale=isMale;
+ this.character=character;
+ this.name=name;
+ this.owner=owner.getDisplayName();
+ }
+ public SpiritStatus(){
+ level=0;
+ levelUp();
+ }
+
+ public static SpiritStatus readFromNBT(NBTTagCompound nbt){
+ if(nbt==null) return null;
+ SpiritStatus ss=new SpiritStatus();
+
+ ss.isMale=nbt.getBoolean("isMale");
+ ss.character=nbt.getString("character");
+ ss.name=nbt.getString("name");
+ ss.owner=nbt.getString("owner");
+ ss.level=nbt.getShort("level");
+ ss.next=nbt.getDouble("next");
+ ss.exp=nbt.getDouble("exp");
+ ss.itemDamage=nbt.getInteger("itemDamage");
+ ss.skillPoint=nbt.getShort("skillPt");
+ ss.lastBlessDate=nbt.getInteger("lastBlessDate");
+ ss.foodLevel=nbt.getShort("FoodLevel");
+
+ ss.strength=nbt.getShort("strength");
+ ss.toughness=nbt.getShort("toughness");
+ ss.maxDamage=nbt.getFloat("maxDamage");
+ ss.maxHarvestLevel=nbt.getFloat("maxHarvestLevel");
+ ss.maxDurability=nbt.getFloat("maxDurability");
+
+ NBTTagList list=(NBTTagList)nbt.getTag("skills");
+ for(int i=0;i<list.tagCount();i++){
+ NBTTagCompound n=list.getCompoundTagAt(i);
+ int id=n.getInteger("id");
+ if(SkillManager.getSkill(id)!=null){
+ ss.skills.add(new SkillManager.SkillData(id, n.getInteger("lv")));
+ }
+ }
+
+ ss.configuration.readFromNBT(nbt.getCompoundTag("config"));
+
+ return ss;
+ }
+ public static void writeToNBT(SpiritStatus ss, NBTTagCompound nbt){
+ nbt.setBoolean("isMale", ss.isMale);
+ nbt.setString("character", ss.character);
+ nbt.setString("name", ss.name);
+ nbt.setString("owner", ss.owner);
+ nbt.setShort("level", ss.level);
+ nbt.setDouble("next", ss.next);
+ nbt.setDouble("exp", ss.exp);
+ nbt.setInteger("itemDamage", ss.itemDamage);
+ nbt.setShort("skillPt", ss.skillPoint);
+ nbt.setInteger("lastBlessDate", ss.lastBlessDate);
+ nbt.setShort("FoodLevel", ss.foodLevel);
+
+ nbt.setShort("strength", ss.strength);
+ nbt.setShort("toughness", ss.toughness);
+ nbt.setFloat("maxDamage", ss.maxDamage);
+ nbt.setFloat("maxHarvestLevel", ss.maxHarvestLevel);
+ nbt.setFloat("maxDurability", ss.maxDurability);
+
+ NBTTagList list=new NBTTagList();
+ for(SkillManager.SkillData se : ss.skills){
+ NBTTagCompound n=new NBTTagCompound();
+ n.setInteger("id", se.id);
+ n.setInteger("lv", se.lv);
+ list.appendTag(n);
+ }
+ nbt.setTag("skills", list);
+
+ NBTTagCompound nbt1=new NBTTagCompound();
+ ss.configuration.writeToNBT(nbt1);
+ nbt.setTag("config", nbt1);
+ }
+
+ public boolean isOwner(EntityPlayer player){
+ if(!player.getDisplayName().equals(getOwnerName())) return false;
+ FBSEntityProperties prop=FBSEntityProperties.get(player);
+ String t=prop.getSpiritToolName();
+ if(t==null || !t.equals(getName())) return false;
+ return true;
+ }
+
+ public boolean addExp(double e){
+ if(e<=0) return false;
+
+ boolean flag=false;
+ exp+=e;
+ while(exp>=next && level<LEVEL_MAX){
+ exp-=next;
+ levelUp();
+ flag=true;
+ }
+ return flag;
+ }
+ public void levelUp(){
+ level++;
+ next+= MathHelper.ceiling_double_int(8 * level + 0.5f * next);
+ //next+=1;
+
+ //ここで器用の効果発動
+ if(level%(hasSkill("fbs.skillful")?2:3)==0){
+ skillPoint++;
+ }
+
+ addStrength(3+random.nextInt(3));
+ addToughness(3 + random.nextInt(3));
+
+ //ここでデメリット判定
+ if(level>0 && level%10==0 && random.nextFloat()<0.125f){
+ setSkill("fbs.blood", 0);
+ }
+ }
+
+ public void addStrength(int p){
+ if(p<0) return;
+ strength+=p;
+ if(strength>STATUS_MAX) strength=STATUS_MAX;
+ }
+ public void addToughness(int p){
+ if(p<0) return;
+ toughness+=p;
+ if(toughness>STATUS_MAX) toughness=STATUS_MAX;
+ }
+ public void addItemDamage(int p) {
+ if (p < 0) return;
+ itemDamage += p;
+ }
+ public void setItemDamage(int p){
+ if (p < 0) return;
+ itemDamage=p;
+ }
+
+ public void reduceSkillPoint(){
+ if(skillPoint>0) skillPoint--;
+ }
+
+ public void updateLastBlessDate(int d){ lastBlessDate=d; }
+ public void repair(int r){
+ if(r<0) return;
+ itemDamage-=r;
+ if(itemDamage<0) itemDamage=0;
+ }
+
+ /**
+ * 各種最大値を設定する。
+ * 先天スキルの影響を受ける
+ * @param maxDamage
+ * @param maxHarvestLevel
+ * @param maxDurability
+ */
+ public void setMaxStatus(float maxDamage, float maxHarvestLevel, float maxDurability){
+ float rate=1.f;
+ float rateDamage=1.f;
+ float rateHL=1.f;
+ float rateDurability=1.f;
+ for(SkillManager.SkillData se : getSkills()){
+ if(se.getSkill().getName().equals("fbs.precocious")){
+ rate=0.75f;
+ break;
+ }
+ else if(se.getSkill().getName().equals("fbs.lateBloomer")){
+ rate=1.25f;
+ break;
+ }
+ else if(se.getSkill().getName().equals("fbs.skillful")){
+ rate=0.80f;
+ break;
+ }
+ else if(se.getSkill().getName().equals("fbs.hero")){
+ rateDamage=1.5f;
+ rateHL=1.25f;
+ rateDurability=0.75f;
+ break;
+ }
+ else if(se.getSkill().getName().equals("fbs.patient")){
+ rateDamage=0.75f;
+ rateDurability=1.5f;
+ break;
+ }
+ else if(se.getSkill().getName().equals("fbs.sentimental")){
+ rate=0.8f;
+ break;
+ }
+ }
+
+ this.maxDamage=maxDamage*rate*rateDamage;
+ this.maxHarvestLevel=maxHarvestLevel*rate*rateHL;
+ this.maxDurability=maxDurability*rate*rateDurability;
+ }
+
+ /**
+ * ステータス最大値(255)との割合を計算する。
+ * このとき、各種先天スキルの影響を受ける。
+ * @param param
+ * @return
+ */
+ public float calcRatio(int param){
+ int type=0;
+ for(SkillManager.SkillData se : getSkills()){
+ if(se.getSkill().getName().equals("fbs.precocious")){
+ type=1;
+ break;
+ }
+ else if(se.getSkill().getName().equals("fbs.lateBloomer")){
+ type=2;
+ break;
+ }
+ }
+
+ float rate=0;
+ switch (type){
+ case 1:
+ rate=(param==0?0:(float)Math.log(param)/log255);
+ break;
+
+ case 2:
+ rate=(float)(param*param)/(float)(STATUS_MAX*STATUS_MAX);
+ break;
+
+ default:
+ rate=(float)param/STATUS_MAX;
+ }
+
+ return rate;
+ }
+
+ public short getLv(){ return level; }
+ public short getStrength(){ return strength; }
+ public float getMaxDamage(){ return maxDamage; }
+ public float getMaxHarvestLevel(){ return maxHarvestLevel; }
+ public short getToughness(){ return toughness; }
+ public float getMaxDurability(){ return maxDurability; }
+ public String getName(){ return name; }
+ public String getOwnerName(){ return owner; }
+ public String getCharacter(){ return character; }
+ public int getItemDamage(){ return itemDamage; }
+ public int getLastBlessDate(){ return lastBlessDate; }
+ public short getSkillPoint(){ return skillPoint; }
+ public short getFoodLevel(){ return foodLevel; }
+
+ public void setFoodLevel(int food){
+ this.foodLevel=(short)food;
+ }
+
+ /**
+ * スキルをセットする
+ * @param name
+ * @param lv
+ */
+ public void setSkill(String name, int lv){
+ SkillManager.Skill skill=SkillManager.getSkill(name);
+ if(skill==null) return;
+ if(lv>=skill.getLvMax()) lv=skill.getLvMax()-1;
+
+ //すでにそのスキルを所持している場合上書き
+ for(SkillManager.SkillData se : skills){
+ if(se.isSkillEqual(skill)){
+ se.lv=lv;
+ return;
+ }
+ }
+
+ //そうでないなら新しく
+ skills.add(new SkillManager.SkillData(skill.getId(), lv));
+ }
+
+ /**
+ * そのスキルを所持しているか判定する
+ * @param name
+ * @return
+ */
+ public boolean hasSkill(String name){
+ SkillManager.Skill skill=SkillManager.getSkill(name);
+ if(skill==null) return false;
+ for(SkillManager.SkillData se : skills){
+ if(se.isSkillEqual(skill)){
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * そのスキルのレベルを得る
+ * @param name
+ * @return スキルを所持していない場合-1
+ */
+ public int getSkillLevel(String name){
+ SkillManager.Skill skill=SkillManager.getSkill(name);
+ if(skill==null) return -1;
+ for(SkillManager.SkillData se : skills){
+ if(se.isSkillEqual(skill)){
+ return se.lv;
+ }
+ }
+ return -1;
+ }
+ public int getSkillLevel(int id){
+ for(SkillManager.SkillData se : skills){
+ if(se.isSkillEqual(id)){
+ return se.lv;
+ }
+ }
+ return -1;
+ }
+
+ public ArrayList<SkillManager.SkillData> getSkills(){ return skills; }
+ public Configuration getConfiguration(){ return configuration; }
+
+ /**
+ * 精霊武器の設定
+ */
+ public static class Configuration{
+ private ArrayList<Pair> configs=new ArrayList<Pair>();
+
+ public Configuration(){
+ add("enableMessage", true);
+ add("enableTimeSignalMessage", true);
+ }
+
+ public void add(String key){
+ add(key, false);
+ }
+ public void add(String key, boolean value){
+ configs.add(new Pair(key, value));
+ }
+ public void update(String key, boolean value){
+ for(Pair p : configs){
+ if(p.key.equals(key)){
+ p.value=value;
+ break;
+ }
+ }
+ }
+ public boolean get(String key){
+ for(Pair p : configs){
+ if(p.key.equals(key)){
+ return p.value;
+ }
+ }
+ return false;
+ }
+ public ArrayList<String> getKeys(){
+ ArrayList<String> ret=new ArrayList<String>();
+ for(Pair p : configs){
+ ret.add(p.key);
+ }
+ return ret;
+ }
+
+ public void writeToNBT(NBTTagCompound nbt){
+ for(Pair p : configs){
+ nbt.setBoolean(p.key, p.value);
+ }
+ }
+ public void readFromNBT(NBTTagCompound nbt){
+ for(Pair p :configs){
+ update(p.key, nbt.getBoolean(p.key));
+ }
+ }
+
+ private class Pair{
+ private String key;
+ private boolean value;
+ public Pair(String key, boolean value){
+ this.key=key;
+ this.value=value;
+ }
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/spirit/model/ModelAlice.class b/src/main/java/jp/plusplus/fbs/spirit/model/ModelAlice.class Binary files differnew file mode 100644 index 0000000..ce0de0b --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/spirit/model/ModelAlice.class diff --git a/src/main/java/jp/plusplus/fbs/spirit/model/ModelAlice.java b/src/main/java/jp/plusplus/fbs/spirit/model/ModelAlice.java new file mode 100644 index 0000000..46bd2f5 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/spirit/model/ModelAlice.java @@ -0,0 +1,175 @@ +// Date: 2016/03/03 11:24:46 +// Template version 1.1 +// Java generated by Techne +// Keep in mind that you still need to fill in some blanks +// - ZeuX + +package jp.plusplus.fbs.spirit.model; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; +import net.minecraft.util.MathHelper; + +public class ModelAlice extends ModelBase { + //fields + ModelRenderer body1; + ModelRenderer ornaments; + ModelRenderer hair; + ModelRenderer head; + ModelRenderer body; + ModelRenderer rightarm; + ModelRenderer leftarm; + ModelRenderer rightleg; + ModelRenderer leftleg; + ModelRenderer body2; + ModelRenderer ornaments1; + + public ModelAlice() { + textureWidth = 128; + textureHeight = 64; + + body1 = new ModelRenderer(this, 32, 0); + body1.addBox(-5F, 7F, -3F, 10, 6, 6); + body1.setRotationPoint(0F, 0F, 0F); + body1.setTextureSize(128, 64); + body1.mirror = true; + setRotation(body1, 0F, 0F, 0F); + ornaments = new ModelRenderer(this, 0, 47); + ornaments.addBox(-6F, -9F, -2F, 3, 2, 1); + ornaments.setRotationPoint(0F, 0F, 0F); + ornaments.setTextureSize(128, 64); + ornaments.mirror = true; + setRotation(ornaments, 0F, 0F, 0F); + hair = new ModelRenderer(this, 64, 0); + hair.addBox(-4F, 0F, 3F, 8, 10, 1); + hair.setRotationPoint(0F, 0F, 0F); + hair.setTextureSize(128, 64); + hair.mirror = true; + setRotation(hair, 0F, 0F, 0F); + head = new ModelRenderer(this, 0, 0); + head.addBox(-4F, -8F, -4F, 8, 8, 8); + head.setRotationPoint(0F, 0F, 0F); + head.setTextureSize(128, 64); + head.mirror = true; + setRotation(head, 0F, 0F, 0F); + body = new ModelRenderer(this, 16, 16); + body.addBox(-4F, 0F, -2F, 8, 7, 4); + body.setRotationPoint(0F, 0F, 0F); + body.setTextureSize(128, 64); + body.mirror = true; + setRotation(body, 0F, 0F, 0F); + rightarm = new ModelRenderer(this, 56, 16); + rightarm.addBox(-3F, -2F, -2F, 4, 12, 4); + rightarm.setRotationPoint(-5F, 2F, 0F); + rightarm.setTextureSize(128, 64); + rightarm.mirror = true; + setRotation(rightarm, 0F, 0F, 0F); + leftarm = new ModelRenderer(this, 40, 16); + leftarm.addBox(-1F, -2F, -2F, 4, 12, 4); + leftarm.setRotationPoint(5F, 2F, 0F); + leftarm.setTextureSize(128, 64); + leftarm.mirror = true; + setRotation(leftarm, 0F, 0F, 0F); + rightleg = new ModelRenderer(this, 0, 16); + rightleg.addBox(-2F, 0F, -2F, 4, 12, 4); + rightleg.setRotationPoint(-2F, 12F, 0F); + rightleg.setTextureSize(128, 64); + rightleg.mirror = true; + setRotation(rightleg, 0F, 0F, 0F); + leftleg = new ModelRenderer(this, 0, 16); + leftleg.addBox(-2F, 0F, -2F, 4, 12, 4); + leftleg.setRotationPoint(2F, 12F, 0F); + leftleg.setTextureSize(128, 64); + leftleg.mirror = true; + setRotation(leftleg, 0F, 0F, 0F); + body2 = new ModelRenderer(this, 0, 32); + body2.addBox(-6F, 10F, -4F, 12, 7, 8); + body2.setRotationPoint(0F, 3F, 0F); + body2.setTextureSize(128, 64); + body2.mirror = true; + setRotation(body2, 0F, 0F, 0F); + ornaments1 = new ModelRenderer(this, 0, 50); + ornaments1.addBox(3F, -9F, -2F, 3, 2, 1); + ornaments1.setRotationPoint(0F, 0F, 0F); + ornaments1.setTextureSize(128, 64); + ornaments1.mirror = true; + setRotation(ornaments1, 0F, 0F, 0F); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + setRotationAngles(f, f1, f2, f3, f4, f5, null); + body1.render(f5); + ornaments.render(f5); + hair.render(f5); + head.render(f5); + body.render(f5); + rightarm.render(f5); + leftarm.render(f5); + rightleg.render(f5); + leftleg.render(f5); + body2.render(f5); + ornaments1.render(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + + public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float angleY, float angleX, float p_78087_6_, Entity entity) { + this.head.rotateAngleY = angleY / (180F / (float) Math.PI); + this.head.rotateAngleX = angleX / (180F / (float) Math.PI); + this.ornaments1.rotateAngleY = this.ornaments.rotateAngleY = this.head.rotateAngleY; + this.ornaments1.rotateAngleX = this.ornaments.rotateAngleX = this.head.rotateAngleX; + this.rightarm.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F + (float) Math.PI) * 2.0F * p_78087_2_ * 0.5F; + this.leftarm.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F) * 2.0F * p_78087_2_ * 0.5F; + this.rightarm.rotateAngleZ = 0.0F; + this.leftarm.rotateAngleZ = 0.0F; + this.rightleg.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F) * 1.4F * p_78087_2_; + this.leftleg.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F + (float) Math.PI) * 1.4F * p_78087_2_; + this.rightleg.rotateAngleY = 0.0F; + this.leftleg.rotateAngleY = 0.0F; + + this.rightarm.rotateAngleY = 0.0F; + this.leftarm.rotateAngleY = 0.0F; + float f6; + float f7; + + if (this.onGround > -9990.0F) { + f6 = this.onGround; + this.body2.rotateAngleY = this.body1.rotateAngleY = this.body.rotateAngleY = MathHelper.sin(MathHelper.sqrt_float(f6) * (float) Math.PI * 2.0F) * 0.2F; + this.rightarm.rotationPointZ = MathHelper.sin(this.body.rotateAngleY) * 5.0F; + this.rightarm.rotationPointX = -MathHelper.cos(this.body.rotateAngleY) * 5.0F; + this.leftarm.rotationPointZ = -MathHelper.sin(this.body.rotateAngleY) * 5.0F; + this.leftarm.rotationPointX = MathHelper.cos(this.body.rotateAngleY) * 5.0F; + this.rightarm.rotateAngleY += this.body.rotateAngleY; + this.leftarm.rotateAngleY += this.body.rotateAngleY; + this.leftarm.rotateAngleX += this.body.rotateAngleY; + f6 = 1.0F - this.onGround; + f6 *= f6; + f6 *= f6; + f6 = 1.0F - f6; + f7 = MathHelper.sin(f6 * (float) Math.PI); + float f8 = MathHelper.sin(this.onGround * (float) Math.PI) * -(this.head.rotateAngleX - 0.7F) * 0.75F; + this.rightarm.rotateAngleX = (float) ((double) this.rightarm.rotateAngleX - ((double) f7 * 1.2D + (double) f8)); + this.rightarm.rotateAngleY += this.body.rotateAngleY * 2.0F; + this.rightarm.rotateAngleZ = MathHelper.sin(this.onGround * (float) Math.PI) * -0.4F; + } + + this.body2.rotateAngleX = this.body1.rotateAngleX = this.body.rotateAngleX = 0.0F; + this.rightleg.rotationPointZ = 0.1F; + this.leftleg.rotationPointZ = 0.1F; + this.rightleg.rotationPointY = 12.0F; + this.leftleg.rotationPointY = 12.0F; + this.head.rotationPointY = 0.0F; + this.ornaments.rotationPointY = 0.0F; + + this.rightarm.rotateAngleZ += MathHelper.cos(p_78087_3_ * 0.09F) * 0.05F + 0.05F; + this.leftarm.rotateAngleZ -= MathHelper.cos(p_78087_3_ * 0.09F) * 0.05F + 0.05F; + this.rightarm.rotateAngleX += MathHelper.sin(p_78087_3_ * 0.067F) * 0.05F; + this.leftarm.rotateAngleX -= MathHelper.sin(p_78087_3_ * 0.067F) * 0.05F; + } +} diff --git a/src/main/java/jp/plusplus/fbs/spirit/render/RenderAlice.class b/src/main/java/jp/plusplus/fbs/spirit/render/RenderAlice.class Binary files differnew file mode 100644 index 0000000..2e97fc1 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/spirit/render/RenderAlice.class diff --git a/src/main/java/jp/plusplus/fbs/spirit/render/RenderAlice.java b/src/main/java/jp/plusplus/fbs/spirit/render/RenderAlice.java new file mode 100644 index 0000000..aadcbca --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/spirit/render/RenderAlice.java @@ -0,0 +1,179 @@ +package jp.plusplus.fbs.spirit.render;
+
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.spirit.model.ModelAlice;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.model.ModelBiped;
+import net.minecraft.client.renderer.OpenGlHelper;
+import net.minecraft.client.renderer.entity.RenderManager;
+import net.minecraft.client.renderer.entity.RenderPlayer;
+import net.minecraft.client.renderer.entity.RendererLivingEntity;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.util.MathHelper;
+import net.minecraft.util.ResourceLocation;
+import net.minecraftforge.client.event.RenderLivingEvent;
+import net.minecraftforge.common.MinecraftForge;
+import org.lwjgl.opengl.GL11;
+import org.lwjgl.opengl.GL12;
+
+/**
+ * Created by plusplus_F on 2016/03/03.
+ */
+public class RenderAlice extends RendererLivingEntity {
+ private static final ResourceLocation rl = new ResourceLocation(FBS.MODID, "textures/entity/Alice.png");
+
+ public RenderAlice() {
+ super(new ModelAlice(), 0.5f);
+ renderManager= RenderManager.instance;
+ }
+
+ @Override
+ protected ResourceLocation getEntityTexture(Entity p_110775_1_) {
+ return rl;
+ }
+
+ public float interpolateRotation(float p_77034_1_, float p_77034_2_, float p_77034_3_) {
+ float f3;
+
+ for (f3 = p_77034_2_ - p_77034_1_; f3 < -180.0F; f3 += 360.0F) {
+ ;
+ }
+
+ while (f3 >= 180.0F) {
+ f3 -= 360.0F;
+ }
+
+ return p_77034_1_ + p_77034_3_ * f3;
+ }
+
+ @Override
+ public void doRender(EntityLivingBase p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) {
+ GL11.glPushMatrix();
+ GL11.glDisable(GL11.GL_CULL_FACE);
+ this.mainModel.onGround = this.renderSwingProgress(p_76986_1_, p_76986_9_);
+
+ if (this.renderPassModel != null) {
+ this.renderPassModel.onGround = this.mainModel.onGround;
+ }
+
+ this.mainModel.isRiding = false;
+
+ if (this.renderPassModel != null) {
+ this.renderPassModel.isRiding = this.mainModel.isRiding;
+ }
+
+ this.mainModel.isChild = false;
+
+ if (this.renderPassModel != null) {
+ this.renderPassModel.isChild = this.mainModel.isChild;
+ }
+
+ try {
+ float f2 = this.interpolateRotation(p_76986_1_.prevRenderYawOffset, p_76986_1_.renderYawOffset, p_76986_9_);
+ float f3 = this.interpolateRotation(p_76986_1_.prevRotationYawHead, p_76986_1_.rotationYawHead, p_76986_9_);
+ float f4;
+
+ float f13 = p_76986_1_.prevRotationPitch + (p_76986_1_.rotationPitch - p_76986_1_.prevRotationPitch) * p_76986_9_;
+ this.renderLivingAt(p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_);
+ f4 = this.handleRotationFloat(p_76986_1_, p_76986_9_);
+ this.rotateCorpse(p_76986_1_, f4, f2, p_76986_9_);
+ float f5 = 0.0625F;
+ GL11.glEnable(GL12.GL_RESCALE_NORMAL);
+ GL11.glScalef(-1.0F, -1.0F, 1.0F);
+ this.preRenderCallback(p_76986_1_, p_76986_9_);
+ GL11.glTranslatef(0.0F, -24.0F * f5 - 0.0078125F, 0.0F);
+ float f6 = p_76986_1_.prevLimbSwingAmount + (p_76986_1_.limbSwingAmount - p_76986_1_.prevLimbSwingAmount) * p_76986_9_;
+ float f7 = p_76986_1_.limbSwing - p_76986_1_.limbSwingAmount * (1.0F - p_76986_9_);
+
+ if (f6 > 1.0F) {
+ f6 = 1.0F;
+ }
+
+ GL11.glEnable(GL11.GL_ALPHA_TEST);
+ this.mainModel.setLivingAnimations(p_76986_1_, f7, f6, p_76986_9_);
+ this.renderModel(p_76986_1_, f7, f6, f4, f3 - f2, f13, f5);
+ int j;
+ float f8;
+ float f9;
+ float f10;
+
+ for (int i = 0; i < 4; ++i) {
+ j = this.shouldRenderPass(p_76986_1_, i, p_76986_9_);
+
+ if (j > 0) {
+ this.renderPassModel.setLivingAnimations(p_76986_1_, f7, f6, p_76986_9_);
+ this.renderPassModel.render(p_76986_1_, f7, f6, f4, f3 - f2, f13, f5);
+
+ if ((j & 240) == 16) {
+ this.func_82408_c(p_76986_1_, i, p_76986_9_);
+ this.renderPassModel.render(p_76986_1_, f7, f6, f4, f3 - f2, f13, f5);
+ }
+
+ GL11.glDisable(GL11.GL_BLEND);
+ GL11.glEnable(GL11.GL_ALPHA_TEST);
+ }
+ }
+
+ GL11.glDepthMask(true);
+ this.renderEquippedItems(p_76986_1_, p_76986_9_);
+ float f14 = p_76986_1_.getBrightness(p_76986_9_);
+ j = this.getColorMultiplier(p_76986_1_, f14, p_76986_9_);
+ OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit);
+ GL11.glDisable(GL11.GL_TEXTURE_2D);
+ OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit);
+
+ if ((j >> 24 & 255) > 0) {
+ GL11.glDisable(GL11.GL_TEXTURE_2D);
+ GL11.glDisable(GL11.GL_ALPHA_TEST);
+ GL11.glEnable(GL11.GL_BLEND);
+ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
+ GL11.glDepthFunc(GL11.GL_EQUAL);
+
+ if (p_76986_1_.hurtTime > 0 || p_76986_1_.deathTime > 0) {
+ GL11.glColor4f(f14, 0.0F, 0.0F, 0.4F);
+ this.mainModel.render(p_76986_1_, f7, f6, f4, f3 - f2, f13, f5);
+
+ for (int l = 0; l < 4; ++l) {
+ if (this.inheritRenderPass(p_76986_1_, l, p_76986_9_) >= 0) {
+ GL11.glColor4f(f14, 0.0F, 0.0F, 0.4F);
+ this.renderPassModel.render(p_76986_1_, f7, f6, f4, f3 - f2, f13, f5);
+ }
+ }
+ }
+
+ if ((j >> 24 & 255) > 0) {
+ f8 = (float) (j >> 16 & 255) / 255.0F;
+ f9 = (float) (j >> 8 & 255) / 255.0F;
+ float f15 = (float) (j & 255) / 255.0F;
+ f10 = (float) (j >> 24 & 255) / 255.0F;
+ GL11.glColor4f(f8, f9, f15, f10);
+ this.mainModel.render(p_76986_1_, f7, f6, f4, f3 - f2, f13, f5);
+
+ for (int i1 = 0; i1 < 4; ++i1) {
+ if (this.inheritRenderPass(p_76986_1_, i1, p_76986_9_) >= 0) {
+ GL11.glColor4f(f8, f9, f15, f10);
+ this.renderPassModel.render(p_76986_1_, f7, f6, f4, f3 - f2, f13, f5);
+ }
+ }
+ }
+
+ GL11.glDepthFunc(GL11.GL_LEQUAL);
+ GL11.glDisable(GL11.GL_BLEND);
+ GL11.glEnable(GL11.GL_ALPHA_TEST);
+ GL11.glEnable(GL11.GL_TEXTURE_2D);
+ }
+
+ GL11.glDisable(GL12.GL_RESCALE_NORMAL);
+ } catch (Exception exception) {
+ FBS.logger.error("Couldn\'t render entity", exception);
+ }
+
+ OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit);
+ GL11.glEnable(GL11.GL_TEXTURE_2D);
+ OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit);
+ GL11.glEnable(GL11.GL_CULL_FACE);
+ GL11.glPopMatrix();
+ //this.passSpecialRender(p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_);
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/storage/BlockMealCrystal.class b/src/main/java/jp/plusplus/fbs/storage/BlockMealCrystal.class Binary files differnew file mode 100644 index 0000000..4386ff3 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/storage/BlockMealCrystal.class diff --git a/src/main/java/jp/plusplus/fbs/storage/BlockMealCrystal.java b/src/main/java/jp/plusplus/fbs/storage/BlockMealCrystal.java new file mode 100644 index 0000000..127ed2f --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/storage/BlockMealCrystal.java @@ -0,0 +1,206 @@ +package jp.plusplus.fbs.storage;
+
+import cpw.mods.fml.client.FMLClientHandler;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.api.FBSEntityPropertiesAPI;
+import jp.plusplus.fbs.block.BlockBase;
+import jp.plusplus.fbs.item.ItemMonocle;
+import jp.plusplus.fbs.particle.EntityGlowFX;
+import net.minecraft.block.Block;
+import net.minecraft.block.ITileEntityProvider;
+import net.minecraft.block.material.Material;
+import net.minecraft.entity.item.EntityItem;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.world.IBlockAccess;
+import net.minecraft.world.World;
+
+import java.util.Random;
+
+/**
+ * Created by plusplus_F on 2016/03/07.
+ */
+public class BlockMealCrystal extends BlockBase implements ITileEntityProvider,ChunkLoadManager.IChunkLoader {
+ private static boolean breaking=false;
+
+ public BlockMealCrystal() {
+ super(Material.rock);
+ setStepSound(soundTypeGlass);
+ setBlockName("mealCrystal");
+ setBlockTextureName("mealCrystal");
+ setResistance(10000);
+ setHardness(0.5f);
+ setHarvestLevel("pickaxe", Item.ToolMaterial.EMERALD.getHarvestLevel());
+
+ infoName="mealCrystal";
+ infoRow=1;
+ }
+
+ @Override
+ public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
+ return p_149915_2_==0?new TileEntityMeal():null;
+ }
+
+ @Override
+ protected boolean canSilkHarvest() {
+ return false;
+ }
+ @Override
+ public int quantityDropped(Random p_149745_1_) {
+ return 0;
+ }
+
+ public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_) {
+ int m=world.getBlockMetadata(x,y,z);
+ TileEntityMeal te=null;
+ if(m==0) te=(TileEntityMeal)world.getTileEntity(x,y,z);
+ else te=(TileEntityMeal)world.getTileEntity(x,y-1,z);
+ if(te==null || !te.hasFragment()) return false;
+
+ ItemStack ret=te.getFragment(true);
+ if(!world.isRemote){
+ if(ret!=null){
+ player.entityDropItem(ret, player.getEyeHeight());
+ if(!player.capabilities.isCreativeMode) FBSEntityPropertiesAPI.LoseSanity(player, 1, 6, true);
+ }
+ }
+ te.markDirty();
+ world.markBlockForUpdate(x,y,z);
+
+ return true;
+ }
+
+ @Override
+ public boolean canLoad(World w, int x, int y, int z) {
+ return true;
+ }
+
+ @Override
+ public void breakBlock(World par1World, int x, int y, int z, Block block, int par6){
+ TileEntityMeal te = (TileEntityMeal)par1World.getTileEntity(x, y, z);
+ if(te!=null){
+ ItemStack[] list=te.getAllItemStacks();
+ for(ItemStack itemstack : list){
+ if (itemstack != null){
+ float f = this.rand.nextFloat() * 0.8F + 0.1F;
+ float f1 = this.rand.nextFloat() * 0.8F + 0.1F;
+ float f2 = this.rand.nextFloat() * 0.8F + 0.1F;
+
+ while (itemstack.stackSize > 0){
+ int k1 = itemstack.getMaxStackSize();
+ if (k1 > itemstack.stackSize){
+ k1 = itemstack.stackSize;
+ }
+ itemstack.stackSize -= k1;
+
+ EntityItem entityitem = new EntityItem(par1World, (double)((float)x + f), (double)((float)y + f1), (double)((float)z + f2), new ItemStack(itemstack.getItem(), k1, itemstack.getItemDamage()));
+ if (itemstack.hasTagCompound()){
+ entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy());
+ }
+
+ float f3 = 0.05F;
+ entityitem.motionX = (double)((float)this.rand.nextGaussian() * f3);
+ entityitem.motionY = (double)((float)this.rand.nextGaussian() * f3 + 0.2F);
+ entityitem.motionZ = (double)((float)this.rand.nextGaussian() * f3);
+ par1World.spawnEntityInWorld(entityitem);
+ }
+ }
+ }
+ if(par6==0) ChunkLoadManager.removeChunkLoader(par1World, x,y,z);
+ }
+
+ if(!breaking){
+ breaking=true;
+ switch (par6){
+ case 0:
+ if(par1World.getBlock(x,y+1,z)==this) par1World.func_147480_a(x,y+1,z, false);
+ break;
+ case 1:
+ if(par1World.getBlock(x,y-1,z)==this) par1World.func_147480_a(x,y-1,z, false);
+ break;
+ }
+ breaking=false;
+ }
+
+ super.breakBlock(par1World, x, y, z, block, par6);
+ }
+
+ @Override
+ public boolean canPlaceBlockAt(World w, int x, int y, int z) {
+ for(int i=0;i<2;i++){
+ if(!w.getBlock(x,y+i,z).isReplaceable(w,x,y+i,z)) return false;
+ }
+ return true;
+ }
+
+ @Override
+ public void onPostBlockPlaced(World w, int x, int y, int z, int meta) {
+ }
+
+ @Override
+ public int onBlockPlaced(World w, int x, int y, int z, int side, float p_149660_6_, float p_149660_7_, float p_149660_8_, int meta) {
+ w.setBlock(x,y+1,z,this,1,2);
+ return meta;
+ }
+
+ @Override
+ public boolean isOpaqueCube() {
+ return false;
+ }
+
+ @Override
+ public boolean renderAsNormalBlock() {
+ return false;
+ }
+
+ @Override
+ public int getRenderType() {
+ return FBS.renderMealId;
+ }
+
+ public int getLightValue(IBlockAccess world, int x, int y, int z) {
+ return 15;
+ }
+
+
+ @SideOnly(Side.CLIENT)
+ public void randomDisplayTick(World world, int x, int y, int z, Random rand) {
+ EntityPlayer ep = FBS.proxy.getEntityPlayerInstance();
+ if (ep == null) return;
+
+ TileEntityMeal tem=null;
+ if (world.getBlockMetadata(x, y, z) == 0) tem=(TileEntityMeal)world.getTileEntity(x,y,z);
+ else if(world.getBlock(x,y-1,z)==this) tem=(TileEntityMeal)world.getTileEntity(x,y-1,z);
+ if(tem==null || !tem.hasFragment()) return;
+
+ float f = (float) x + 0.5F;
+ float f1 = (float) y + 0.5f;
+ float f2 = (float) z + 0.5F;
+ for(int i=0;i<2;i++){
+ float f3 = (0.2f+0.3f*rand.nextFloat())*(rand.nextBoolean()?-1:1);
+ float f4 = rand.nextFloat() * 0.8F - 0.4F;
+ float f5 = (0.2f+0.3f*rand.nextFloat())*(rand.nextBoolean()?-1:1);
+ spawnParticle(world, (double) (f+f3), (double) (f1+f4), (double) (f2 + f5));
+ }
+ /*
+ f4 = rand.nextFloat() * 0.6F - 0.3F;
+ f5 =rand.nextFloat()*0.75f;
+ spawnParticle(world, (double) (f + f4), (double) (f1+f5), (double) (f2 - f3));
+ f4 = rand.nextFloat() * 0.6F - 0.3F;
+ f5 =rand.nextFloat()*0.75f;
+ spawnParticle(world, (double) (f + f4), (double) (f1+f5), (double) (f2 + f3));
+ */
+ }
+
+ @SideOnly(Side.CLIENT)
+ protected void spawnParticle(World world, double x, double y, double z){
+ EntityGlowFX e=new EntityGlowFX(world, x,y,z);
+ e.setRBGColorF(0.8f+0.2f*rand.nextFloat(), 0.8f+0.2f*rand.nextFloat(), 0);
+ FMLClientHandler.instance().getClient().effectRenderer.addEffect(e);
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/storage/BlockMealInlet.class b/src/main/java/jp/plusplus/fbs/storage/BlockMealInlet.class Binary files differnew file mode 100644 index 0000000..aff9ebf --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/storage/BlockMealInlet.class diff --git a/src/main/java/jp/plusplus/fbs/storage/BlockMealInlet.java b/src/main/java/jp/plusplus/fbs/storage/BlockMealInlet.java new file mode 100644 index 0000000..80458a5 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/storage/BlockMealInlet.java @@ -0,0 +1,190 @@ +package jp.plusplus.fbs.storage;
+
+import cpw.mods.fml.client.FMLClientHandler;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.block.BlockBase;
+import jp.plusplus.fbs.item.ItemCore;
+import jp.plusplus.fbs.particle.EntityGlowFX;
+import net.minecraft.block.Block;
+import net.minecraft.block.BlockTorch;
+import net.minecraft.block.ITileEntityProvider;
+import net.minecraft.block.material.Material;
+import net.minecraft.entity.item.EntityItem;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.AxisAlignedBB;
+import net.minecraft.world.IBlockAccess;
+import net.minecraft.world.World;
+
+import java.util.Random;
+
+/**
+ * Created by plusplus_F on 2016/03/07.
+ */
+public class BlockMealInlet extends BlockBase implements ITileEntityProvider {
+ public BlockMealInlet() {
+ super(Material.rock);
+ setBlockName("mealInlet");
+ setBlockTextureName("mealCrystal");
+ setStepSound(soundTypeGlass);
+
+ infoName="mealInlet";
+ infoRow=1;
+ }
+
+ @Override
+ public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
+ return new TileEntityMealInlet();
+ }
+
+ @Override
+ public int onBlockPlaced(World world, int x, int y, int z, int side, float p_149660_6_, float p_149660_7_, float p_149660_8_, int p_149660_9_) {
+ //world.setBlockMetadataWithNotify(x,y,z,side,2);
+ return side^1;
+ }
+
+ @Override
+ public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_) {
+ IMealDevice te=(IMealDevice)world.getTileEntity(x,y,z);
+ if(te==null) return false;
+
+ ItemStack hav=player.getCurrentEquippedItem();
+ if(te.hasFragment()){
+ //ミールを取り出す
+ if(!world.isRemote){
+ player.entityDropItem(te.getFragment().copy(), 0);
+ }
+ te.setFragment(null);
+
+ ((TileEntity)te).markDirty();
+ player.inventory.markDirty();
+ world.markBlockForUpdate(x, y, z);
+ return true;
+ }
+ else if(hav!=null && hav.getItem()==ItemCore.mealFragment){
+ //ミールを設定する
+ ItemStack f=hav.copy();
+ f.stackSize=1;
+ te.setFragment(f);
+
+ if(!world.isRemote){
+ hav.stackSize--;
+ if(hav.stackSize<=0){
+ player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
+ }
+ }
+ ((TileEntity)te).markDirty();
+ player.inventory.markDirty();
+ world.markBlockForUpdate(x, y, z);
+ return true;
+ }
+
+ return false;
+ }
+
+ @Override
+ public void breakBlock(World par1World, int x, int y, int z, Block block, int par6){
+ //ミールの欠片をドロップさせる
+ IMealDevice te = (IMealDevice)par1World.getTileEntity(x, y, z);
+ if(te!=null && te.hasFragment()){
+ float f = this.rand.nextFloat() * 0.8F + 0.1F;
+ float f1 = this.rand.nextFloat() * 0.8F + 0.1F;
+ float f2 = this.rand.nextFloat() * 0.8F + 0.1F;
+ ItemStack fragment=te.getFragment();
+ EntityItem entityitem = new EntityItem(par1World, (double)((float)x + f), (double)((float)y + f1), (double)((float)z + f2), new ItemStack(fragment.getItem(), fragment.stackSize, fragment.getItemDamage()));
+ if (fragment.hasTagCompound()){
+ entityitem.getEntityItem().setTagCompound((NBTTagCompound)fragment.getTagCompound().copy());
+ }
+
+ float f3 = 0.05F;
+ entityitem.motionX = (double)((float)this.rand.nextGaussian() * f3);
+ entityitem.motionY = (double)((float)this.rand.nextGaussian() * f3 + 0.2F);
+ entityitem.motionZ = (double)((float)this.rand.nextGaussian() * f3);
+ par1World.spawnEntityInWorld(entityitem);
+ }
+ super.breakBlock(par1World, x, y, z, block, par6);
+ }
+
+ @Override
+ public boolean isOpaqueCube() {
+ return false;
+ }
+
+ @Override
+ public boolean renderAsNormalBlock() {
+ return false;
+ }
+
+ @Override
+ public int getRenderType() {
+ return FBS.renderMealInletId;
+ }
+
+ @Override
+ public void setBlockBoundsBasedOnState(IBlockAccess w, int x, int y, int z) {
+ int meta=w.getBlockMetadata(x,y,z);
+ switch (meta){
+ case 0: setBlockBounds(0,0,0,1,0.5f,1); break;
+ case 1: setBlockBounds(0,0.5f,0,1,1,1); break;
+ case 2: setBlockBounds(0,0,0,1,1,0.5f); break;
+ case 3: setBlockBounds(0,0,0.5f,1,1,1); break;
+ case 4: setBlockBounds(0,0,0,0.5f,1,1); break;
+ case 5: setBlockBounds(0.5f,0,0,1,1,1); break;
+ }
+ }
+
+ @Override
+ public AxisAlignedBB getCollisionBoundingBoxFromPool(World w, int x, int y, int z) {
+ setBlockBoundsBasedOnState(w,x,y,z);
+ return super.getCollisionBoundingBoxFromPool(w,x,y,z);
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public AxisAlignedBB getSelectedBoundingBoxFromPool(World w, int x, int y, int z) {
+ setBlockBoundsBasedOnState(w,x,y,z);
+ return super.getSelectedBoundingBoxFromPool(w, x, y, z);
+ }
+
+ @Override
+ public int getLightValue(IBlockAccess world, int x, int y, int z) {
+ TileEntity te=world.getTileEntity(x,y,z);
+ if(te instanceof IMealDevice){
+ return ((IMealDevice) te).hasFragment()?15:0;
+ }
+ return 15;
+ }
+
+
+
+ @SideOnly(Side.CLIENT)
+ public void randomDisplayTick(World world, int x, int y, int z, Random rand) {
+ EntityPlayer ep = FBS.proxy.getEntityPlayerInstance();
+ if (ep == null) return;
+
+ IMealDevice tem=(IMealDevice)world.getTileEntity(x,y,z);
+ if(tem==null || !tem.hasFragment()) return;
+
+ float f = (float) x + 0.5F;
+ float f1 = (float) y + 0.5f;
+ float f2 = (float) z + 0.5F;
+ for(int i=0;i<2;i++){
+ float f3 = 0.3f*rand.nextFloat()-0.15f;
+ float f4 = rand.nextFloat() * 0.4F - 0.2F;
+ float f5 = 0.3f*rand.nextFloat()-0.15f;
+ spawnParticle(world, (double) (f+f3), (double) (f1+f4), (double) (f2 + f5));
+ }
+ }
+
+ @SideOnly(Side.CLIENT)
+ protected void spawnParticle(World world, double x, double y, double z){
+ EntityGlowFX e=new EntityGlowFX(world, x,y,z);
+ e.setRBGColorF(0.8f+0.2f*rand.nextFloat(), 0.8f+0.2f*rand.nextFloat(), 0);
+ FMLClientHandler.instance().getClient().effectRenderer.addEffect(e);
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/storage/BlockMealOutletSingle.class b/src/main/java/jp/plusplus/fbs/storage/BlockMealOutletSingle.class Binary files differnew file mode 100644 index 0000000..cfbfcb9 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/storage/BlockMealOutletSingle.class diff --git a/src/main/java/jp/plusplus/fbs/storage/BlockMealOutletSingle.java b/src/main/java/jp/plusplus/fbs/storage/BlockMealOutletSingle.java new file mode 100644 index 0000000..80f39d4 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/storage/BlockMealOutletSingle.java @@ -0,0 +1,92 @@ +package jp.plusplus.fbs.storage;
+
+import jp.plusplus.fbs.block.BlockCore;
+import jp.plusplus.fbs.item.ItemCore;
+import net.minecraft.block.Block;
+import net.minecraft.block.material.Material;
+import net.minecraft.entity.item.EntityItem;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.StatCollector;
+import net.minecraft.world.World;
+
+/**
+ * Created by plusplus_F on 2016/03/08.
+ */
+public class BlockMealOutletSingle extends BlockMealInlet {
+ public BlockMealOutletSingle() {
+ super();
+ setBlockName("mealOutletSingle");
+ infoName="mealOutlet";
+ }
+
+ @Override
+ public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
+ return new TileEntityMealOutletSingle();
+ }
+
+ @Override
+ public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_) {
+ TileEntityMealOutletSingle temos=(TileEntityMealOutletSingle)world.getTileEntity(x,y,z);
+ if(temos==null) return false;
+
+ //リクエストを取り出す
+ if(temos.hasRequirement()){
+ if(!world.isRemote){
+ player.entityDropItem(temos.getRequirement().copy(), player.getEyeHeight());
+ temos.setRequirement(null);
+ }
+ temos.markDirty();
+ world.markBlockForUpdate(x,y,z);
+ return true;
+ }
+
+ //リクエストを設定する
+ ItemStack hav=player.getCurrentEquippedItem();
+ if(hav!=null && temos.hasFragment()){
+ if(!world.isRemote){
+ ItemStack f=hav.copy();
+ f.stackSize=1;
+ temos.setRequirement(f);
+
+ hav.stackSize--;
+ if(hav.stackSize<=0){
+ player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
+ }
+
+ player.addChatComponentMessage(new ChatComponentText("Set requirement : "+f.getDisplayName()));
+ }
+ player.inventory.markDirty();
+ world.markBlockForUpdate(x, y, z);
+ return true;
+ }
+
+ return super.onBlockActivated(world, x, y, z, player, p_149727_6_, p_149727_7_, p_149727_8_, p_149727_9_);
+ }
+
+ @Override
+ public void breakBlock(World par1World, int x, int y, int z, Block block, int par6){
+ TileEntityMealOutletSingle te = (TileEntityMealOutletSingle)par1World.getTileEntity(x, y, z);
+ if(te!=null && te.hasRequirement()){
+ float f = this.rand.nextFloat() * 0.8F + 0.1F;
+ float f1 = this.rand.nextFloat() * 0.8F + 0.1F;
+ float f2 = this.rand.nextFloat() * 0.8F + 0.1F;
+ ItemStack fragment=te.getRequirement();
+ EntityItem entityitem = new EntityItem(par1World, (double)((float)x + f), (double)((float)y + f1), (double)((float)z + f2), new ItemStack(fragment.getItem(), fragment.stackSize, fragment.getItemDamage()));
+ if (fragment.hasTagCompound()){
+ entityitem.getEntityItem().setTagCompound((NBTTagCompound)fragment.getTagCompound().copy());
+ }
+
+ float f3 = 0.05F;
+ entityitem.motionX = (double)((float)this.rand.nextGaussian() * f3);
+ entityitem.motionY = (double)((float)this.rand.nextGaussian() * f3 + 0.2F);
+ entityitem.motionZ = (double)((float)this.rand.nextGaussian() * f3);
+ par1World.spawnEntityInWorld(entityitem);
+ }
+ super.breakBlock(par1World, x, y, z, block, par6);
+ }
+
+}
diff --git a/src/main/java/jp/plusplus/fbs/storage/BlockMealTerminal.class b/src/main/java/jp/plusplus/fbs/storage/BlockMealTerminal.class Binary files differnew file mode 100644 index 0000000..daf1082 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/storage/BlockMealTerminal.class diff --git a/src/main/java/jp/plusplus/fbs/storage/BlockMealTerminal.java b/src/main/java/jp/plusplus/fbs/storage/BlockMealTerminal.java new file mode 100644 index 0000000..7d881b1 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/storage/BlockMealTerminal.java @@ -0,0 +1,159 @@ +package jp.plusplus.fbs.storage;
+
+import cpw.mods.fml.client.FMLClientHandler;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.block.BlockBase;
+import jp.plusplus.fbs.item.ItemCore;
+import jp.plusplus.fbs.particle.EntityGlowFX;
+import net.minecraft.block.Block;
+import net.minecraft.block.ITileEntityProvider;
+import net.minecraft.block.material.Material;
+import net.minecraft.entity.item.EntityItem;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.world.IBlockAccess;
+import net.minecraft.world.World;
+
+import java.util.Random;
+
+/**
+ * Created by plusplus_F on 2016/03/08.
+ */
+public class BlockMealTerminal extends BlockBase implements ITileEntityProvider {
+ public BlockMealTerminal() {
+ super(Material.rock);
+ setBlockName("mealTerminal");
+ setBlockTextureName("mealCrystal");
+ stepSound=soundTypeGlass;
+ infoName="mealTerminal";
+ infoRow=1;
+ }
+
+ @Override
+ public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
+ return new TileEntityMealTerminal();
+ }
+
+ @Override
+ public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_) {
+ IMealDevice te=(IMealDevice)world.getTileEntity(x,y,z);
+ if(te==null) return false;
+
+ ItemStack hav=player.getCurrentEquippedItem();
+ if(te.hasFragment()){
+ if(hav==null && !player.isSneaking()){
+ //ミールを取り出す
+ if(!world.isRemote){
+ player.entityDropItem(te.getFragment().copy(), 0);
+ }
+ te.setFragment(null);
+
+ ((TileEntity)te).markDirty();
+ player.inventory.markDirty();
+ world.markBlockForUpdate(x, y, z);
+ return true;
+ }
+ else{
+ if(!world.isRemote && ItemMealFragment.getTileEntity(te.getFragment())!=null) player.openGui(FBS.instance, -1, world, x,y,z);
+ return true;
+ }
+ }
+ else if(hav!=null && hav.getItem()==ItemCore.mealFragment){
+ //ミールを設定する
+ ItemStack f=hav.copy();
+ f.stackSize=1;
+ te.setFragment(f);
+
+ if(!world.isRemote){
+ hav.stackSize--;
+ if(hav.stackSize<=0){
+ player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
+ }
+ }
+ ((TileEntity)te).markDirty();
+ player.inventory.markDirty();
+ world.markBlockForUpdate(x, y, z);
+ return true;
+ }
+
+ return false;
+ }
+
+ @Override
+ public void breakBlock(World par1World, int x, int y, int z, Block block, int par6){
+ //ミールの欠片をドロップさせる
+ IMealDevice te = (IMealDevice)par1World.getTileEntity(x, y, z);
+ if(te!=null && te.hasFragment()){
+ float f = this.rand.nextFloat() * 0.8F + 0.1F;
+ float f1 = this.rand.nextFloat() * 0.8F + 0.1F;
+ float f2 = this.rand.nextFloat() * 0.8F + 0.1F;
+ ItemStack fragment=te.getFragment();
+ EntityItem entityitem = new EntityItem(par1World, (double)((float)x + f), (double)((float)y + f1), (double)((float)z + f2), new ItemStack(fragment.getItem(), fragment.stackSize, fragment.getItemDamage()));
+ if (fragment.hasTagCompound()){
+ entityitem.getEntityItem().setTagCompound((NBTTagCompound)fragment.getTagCompound().copy());
+ }
+
+ float f3 = 0.05F;
+ entityitem.motionX = (double)((float)this.rand.nextGaussian() * f3);
+ entityitem.motionY = (double)((float)this.rand.nextGaussian() * f3 + 0.2F);
+ entityitem.motionZ = (double)((float)this.rand.nextGaussian() * f3);
+ par1World.spawnEntityInWorld(entityitem);
+ }
+ super.breakBlock(par1World, x, y, z, block, par6);
+ }
+
+ @Override
+ public boolean isOpaqueCube() {
+ return false;
+ }
+
+ @Override
+ public boolean renderAsNormalBlock() {
+ return false;
+ }
+
+ @Override
+ public int getRenderType() {
+ return FBS.renderMealTerminalId;
+ }
+
+ @Override
+ public int getLightValue(IBlockAccess world, int x, int y, int z) {
+ TileEntity te=world.getTileEntity(x,y,z);
+ if(te instanceof IMealDevice){
+ return ((IMealDevice) te).hasFragment()?15:0;
+ }
+ return 0;
+ }
+
+
+ @SideOnly(Side.CLIENT)
+ public void randomDisplayTick(World world, int x, int y, int z, Random rand) {
+ EntityPlayer ep = FBS.proxy.getEntityPlayerInstance();
+ if (ep == null) return;
+
+ IMealDevice tem=(IMealDevice)world.getTileEntity(x,y,z);
+ if(tem==null || !tem.hasFragment()) return;
+
+ float f = (float) x + 0.5F;
+ float f1 = (float) y + 0.6f;
+ float f2 = (float) z + 0.5F;
+ for(int i=0;i<2;i++){
+ float f3 = 0.3f*rand.nextFloat()-0.15f;
+ float f4 = rand.nextFloat() * 0.4F - 0.2F;
+ float f5 = 0.3f*rand.nextFloat()-0.15f;
+ spawnParticle(world, (double) (f+f3), (double) (f1+f4), (double) (f2 + f5));
+ }
+ }
+
+ @SideOnly(Side.CLIENT)
+ protected void spawnParticle(World world, double x, double y, double z){
+ EntityGlowFX e=new EntityGlowFX(world, x,y,z);
+ e.setRBGColorF(0.8f+0.2f*rand.nextFloat(), 0.8f+0.2f*rand.nextFloat(), 0);
+ FMLClientHandler.instance().getClient().effectRenderer.addEffect(e);
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/storage/ChunkLoadManager$IChunkLoader.class b/src/main/java/jp/plusplus/fbs/storage/ChunkLoadManager$IChunkLoader.class Binary files differnew file mode 100644 index 0000000..42a7fbb --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/storage/ChunkLoadManager$IChunkLoader.class diff --git a/src/main/java/jp/plusplus/fbs/storage/ChunkLoadManager$Pos.class b/src/main/java/jp/plusplus/fbs/storage/ChunkLoadManager$Pos.class Binary files differnew file mode 100644 index 0000000..97068ac --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/storage/ChunkLoadManager$Pos.class diff --git a/src/main/java/jp/plusplus/fbs/storage/ChunkLoadManager.class b/src/main/java/jp/plusplus/fbs/storage/ChunkLoadManager.class Binary files differnew file mode 100644 index 0000000..d6545a7 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/storage/ChunkLoadManager.class diff --git a/src/main/java/jp/plusplus/fbs/storage/ChunkLoadManager.java b/src/main/java/jp/plusplus/fbs/storage/ChunkLoadManager.java new file mode 100644 index 0000000..bb9a1f5 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/storage/ChunkLoadManager.java @@ -0,0 +1,144 @@ +package jp.plusplus.fbs.storage;
+
+import com.google.common.collect.ImmutableSetMultimap;
+import jp.plusplus.fbs.FBS;
+import net.minecraft.block.Block;
+import net.minecraft.world.ChunkCoordIntPair;
+import net.minecraft.world.World;
+import net.minecraftforge.common.ForgeChunkManager;
+
+import java.util.Dictionary;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Created by plusplus_F on 2016/03/07.
+ */
+public class ChunkLoadManager implements ForgeChunkManager.LoadingCallback{
+ private static ChunkLoadManager obj=new ChunkLoadManager();
+ private static HashMap<Pos, ForgeChunkManager.Ticket> tickets=new HashMap<Pos, ForgeChunkManager.Ticket>();
+
+ //インスタンスの取得
+ public static ChunkLoadManager instance(){
+ return obj;
+ }
+
+ //チャンクローダの登録
+ public static void setChunkLoader(World w, int x, int y, int z){
+ if(w==null){
+ FBS.logger.error("Error! World is null.");
+ return;
+ }
+
+ Pos p=new Pos(x,y,z);
+ for(Pos pos : tickets.keySet()){
+ if(pos.equals(p)){
+ FBS.logger.error("Error! Already registered.");
+ return;
+ }
+ }
+
+ //チケットの要求
+ ForgeChunkManager.Ticket t=ForgeChunkManager.requestTicket(FBS.instance, w, ForgeChunkManager.Type.NORMAL);
+ if(t==null){
+ FBS.logger.error("Error! Couldn't get ticket.");
+ return;
+ }
+
+ //チケットに情報書き込み
+ t.getModData().setString("type", "block");
+ t.getModData().setInteger("x", x);
+ t.getModData().setInteger("y", y);
+ t.getModData().setInteger("z", z);
+
+ //チケットをどうたら
+ tickets.put(p, t);
+ ForgeChunkManager.forceChunk(t, w.getChunkFromBlockCoords(x, z).getChunkCoordIntPair());
+ FBS.logger.info("Added ChunkLoader at "+w.provider.getDimensionName()+"("+x+","+y+","+z+")");
+ }
+
+ //チャンクローダの削除
+ public static void removeChunkLoader(World world, int x, int y, int z){
+ Pos p=new Pos(x,y,z);
+
+ //チケットが存在するか確認
+ for(Pos pos : tickets.keySet()){
+ if(pos.equals(p)){
+ //チャンクロードの停止
+ ForgeChunkManager.Ticket t=tickets.get(pos);
+
+ World w=t.world;
+ if(w!=null){
+ ImmutableSetMultimap<ChunkCoordIntPair, ForgeChunkManager.Ticket> map=ForgeChunkManager.getPersistentChunksFor(t.world);
+ if(map!=null && !map.isEmpty()){
+ ForgeChunkManager.unforceChunk(t, world.getChunkFromBlockCoords(x, z).getChunkCoordIntPair());
+ FBS.logger.info("Removed chunk loader at "+world.provider.getDimensionName()+"("+x+","+y+","+z+")");
+ }
+ }
+
+ //削除
+ tickets.remove(p);
+ return;
+ }
+ }
+
+ FBS.logger.error("Error! Couldn't found chunk loader at "+world.provider.getDimensionName()+"("+x+","+y+","+z+")");
+ }
+
+ @Override
+ public void ticketsLoaded(List<ForgeChunkManager.Ticket> tickets, World world) {
+ ChunkLoadManager.tickets.clear();
+
+ //チケット全部見てなんか処理してる
+ for(ForgeChunkManager.Ticket t : tickets){
+ if(t.getModData().getString("type").equals("block")){
+ int x = t.getModData().getInteger("x");
+ int y = t.getModData().getInteger("y");
+ int z = t.getModData().getInteger("z");
+ Block b=world.getBlock(x,y,z);
+
+ //チャンクローダか判定してそれぞれ処理
+ if(b instanceof IChunkLoader){
+ if(((IChunkLoader)b).canLoad(world, x, y, z)){
+ setChunkLoader(world, x, y, z);
+ }
+ }
+ }
+ }
+ }
+
+ public static HashMap<Pos, ForgeChunkManager.Ticket> getTickets(){
+ return tickets;
+ }
+
+ public static World getWorld(int dId){
+ for(ForgeChunkManager.Ticket t : tickets.values()){
+ if(t.world.provider.dimensionId==dId){
+ return t.world;
+ }
+ }
+ return null;
+ }
+
+ public interface IChunkLoader{
+ public boolean canLoad(World w, int x, int y, int z);
+ }
+
+ private static class Pos{
+ int x,y,z;
+
+ public Pos(int x, int y, int z){
+ this.x=x;
+ this.y=y;
+ this.z=z;
+ }
+
+ @Override
+ public boolean equals(Object obj){
+ if(!(obj instanceof Pos)) return false;
+ Pos p=(Pos)obj;
+ return x==p.x && y==p.y && z==p.z;
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/storage/ContainerMealTerminal$SlotTerminal.class b/src/main/java/jp/plusplus/fbs/storage/ContainerMealTerminal$SlotTerminal.class Binary files differnew file mode 100644 index 0000000..cec3592 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/storage/ContainerMealTerminal$SlotTerminal.class diff --git a/src/main/java/jp/plusplus/fbs/storage/ContainerMealTerminal.class b/src/main/java/jp/plusplus/fbs/storage/ContainerMealTerminal.class Binary files differnew file mode 100644 index 0000000..0f778c5 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/storage/ContainerMealTerminal.class diff --git a/src/main/java/jp/plusplus/fbs/storage/ContainerMealTerminal.java b/src/main/java/jp/plusplus/fbs/storage/ContainerMealTerminal.java new file mode 100644 index 0000000..7e6e3d8 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/storage/ContainerMealTerminal.java @@ -0,0 +1,301 @@ +package jp.plusplus.fbs.storage;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.ProxyClient;
+import jp.plusplus.fbs.block.BlockCore;
+import jp.plusplus.fbs.packet.PacketHandler;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.EntityPlayerMP;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.inventory.*;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+
+import java.lang.reflect.Field;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+/**
+ * Created by plusplus_F on 2016/03/08.
+ */
+public class ContainerMealTerminal extends Container {
+ public InventoryTerminal inv;
+ public TileEntityMeal meal;
+ private int state;
+ private int fuck1=-1;
+ private Set fuckSet1=new HashSet();
+ public EntityPlayer player;
+
+ public ContainerMealTerminal(EntityPlayer player, TileEntityMealTerminal meal){
+ this.player=player;
+ this.meal=ItemMealFragment.getTileEntity(meal.getFragment());
+ inv=new InventoryTerminal(this.meal);
+ inv.openInventory();
+
+ SlotTerminal.dontUpdate=inv.dontUpdate=true;
+ for(int i=0;i<54;i++) addSlotToContainer(new SlotTerminal(inv, i, 8+18*(i%9), 18+18*(i/9)));
+
+ for(int i=0;i<27;i++) addSlotToContainer(new Slot(player.inventory, 9+i, 8+18*(i%9), 140+18*(i/9)));
+ for(int i=0;i<9;i++) addSlotToContainer(new Slot(player.inventory, i, 8+18*(i%9), 198+18*(i/9)));
+ SlotTerminal.dontUpdate=inv.dontUpdate=false;
+ }
+
+ public void scrollTo(float f){
+ int preShift=(int)(((inv.allItem.length-54)/9+1)*inv.scroll);
+
+ inv.scroll=f;
+ inv.markDirty();
+
+ if(player.worldObj.isRemote && preShift!=(int)(((inv.allItem.length-54)/9+1)*inv.scroll)){
+ PacketHandler.INSTANCE.sendToServer(new MessageMealTerminalScroll(player.worldObj.provider.dimensionId, player, inv.scroll));
+ }
+ }
+
+ @Override
+ public boolean canInteractWith(EntityPlayer p_75145_1_) {
+ return meal.getWorldObj().getBlock(meal.xCoord, meal.yCoord, meal.zCoord)==BlockCore.mealCrystal;
+ }
+
+ @Override
+ public void onContainerClosed(EntityPlayer p_75134_1_) {
+ super.onContainerClosed(p_75134_1_);
+ inv.closeInventory();
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void putStacksInSlots(ItemStack[] p_75131_1_) {
+ SlotTerminal.dontUpdate=true;
+ super.putStacksInSlots(p_75131_1_);
+ SlotTerminal.dontUpdate=false;
+ }
+
+ @Override
+ public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int p_82846_2_) {
+ Slot slot=(Slot)inventorySlots.get(p_82846_2_);
+ if(slot instanceof SlotTerminal || slot.getStack()==null) return null;
+
+ ItemStack itemStack=slot.getStack();
+ slot.putStack(null);
+
+ if(!p_82846_1_.worldObj.isRemote){
+ ItemStack tmp = itemStack.copy();
+ meal.insertItemStack(tmp);
+ inv.markDirty();
+ }
+
+
+ return null;
+ }
+
+ /*
+ @Mojang
+ fニヽ
+ |_||
+ |= |
+ | |
+ |= |
+ i⌒| |⌒i_
+ /| | | | ヽ
+ | ( ( ( ( |
+ |/ |
+ | |
+ \ ノ
+ \ /
+ | |
+ */
+ @Override
+ public ItemStack slotClick(int slotIndex, int button, int type, EntityPlayer player) {
+ boolean isClient=(player.worldObj.isRemote);
+
+ //FBS.logger.info("slot:"+slotIndex+","+button+","+type+","+player.toString());
+
+ ItemStack itemstack = null;
+ InventoryPlayer inventoryplayer = player.inventory;
+ int i1;
+ //ItemStack itemstack3;
+ //FBS.logger.info("item:"+inventoryplayer.getItemStack());
+
+ //通常のスロットであれば普通に処理する
+ if (slotIndex!=-999 && (slotIndex<0 || !(inventorySlots.get(slotIndex) instanceof SlotTerminal))){
+ return super.slotClick(slotIndex, button, type, player);
+ }
+
+ try{
+ Class c=Container.class;
+ Field field=c.getDeclaredField("field_94536_g");
+ field.setAccessible(true);
+ if(field.getInt(this)!=0){
+ func_94533_d();
+ return null;
+ }
+ }catch (Exception e){
+ FBS.logger.error(e);
+ }
+
+ if(state!=0){
+ this.func_94533_d();
+ return null;
+ }
+
+ Slot slot2;
+ int size;
+ ItemStack itemstack5;
+
+ if(slotIndex==-999 && button==0 && type==0){
+ return inventoryplayer.getItemStack();
+ }
+ if(type==1){
+ return inventoryplayer.getItemStack();
+ }
+
+ if(!isClient) return inventoryplayer.getItemStack();
+
+ ///////////////////////////////////////////////////////////////////////////////////////
+ //
+ // シフトを押さない左または右クリック
+ //
+ ///////////////////////////////////////////////////////////////////////////////////////
+ if (type==0 && (button == 0 || button == 1)) {
+ if (slotIndex == -999) {
+ ///////////////////////////////////////////////////////////////////////////////////////
+ //
+ // 持っているアイテムを捨てる処理
+ //
+ ///////////////////////////////////////////////////////////////////////////////////////
+
+ if (inventoryplayer.getItemStack() != null && slotIndex == -999) {
+ if (button == 0) {
+ player.dropPlayerItemWithRandomChoice(inventoryplayer.getItemStack(), true);
+ inventoryplayer.setItemStack((ItemStack) null);
+ }
+
+ if (button == 1) {
+ player.dropPlayerItemWithRandomChoice(inventoryplayer.getItemStack().splitStack(1), true);
+
+ if (inventoryplayer.getItemStack().stackSize == 0) {
+ inventoryplayer.setItemStack((ItemStack) null);
+ }
+ }
+ }
+ } else {
+ if (slotIndex < 0) {
+ return null;
+ }
+
+ slot2 = (Slot) this.inventorySlots.get(slotIndex);
+ if (slot2 == null) return null;
+
+ ItemStack slotItem = slot2.getStack();
+ ItemStack playerCurrentItem = inventoryplayer.getItemStack();
+ if (slotItem != null) itemstack = slotItem.copy();
+
+ if (slotItem == null) {
+ ////////////////////////////////////////////////////////////////////////////////////////
+ //
+ // スロットが空の場合
+ //
+ ////////////////////////////////////////////////////////////////////////////////////////
+ if (playerCurrentItem != null && slot2.isItemValid(playerCurrentItem)) {
+ ////////////////////////////////////////////////////////////////////////////////////////
+ //
+ // 空のスロットに持っているアイテムを置く処理
+ //
+ ////////////////////////////////////////////////////////////////////////////////////////
+ size = button == 0 ? playerCurrentItem.stackSize : 1;
+ playerCurrentItem.splitStack(size);
+
+ ItemStack tmp = playerCurrentItem.copy();
+ tmp.stackSize = size;
+ //meal.insertItemStack(tmp);
+ //inv.markDirty();
+
+ if (isClient) {
+ PacketHandler.INSTANCE.sendToServer(new MessageMealTerminal(player, meal, 0, tmp));
+ }
+
+ if (playerCurrentItem.stackSize == 0) {
+ inventoryplayer.setItemStack((ItemStack) null);
+ }
+
+ }
+ } else if (slot2.canTakeStack(player)) {
+ if (playerCurrentItem == null) {
+ ////////////////////////////////////////////////////////////////////////////////////////
+ //
+ // 何も持っていないときにスロットからアイテムを取り出す処理
+ //
+ ////////////////////////////////////////////////////////////////////////////////////////
+ size = (button == 0 ? slotItem.stackSize : (slotItem.stackSize + 1) / 2);
+ if (size > slotItem.getMaxStackSize()) size = slotItem.getMaxStackSize();
+
+ //itemstack5 = slot2.decrStackSize(size);
+ itemstack5=slotItem.copy();
+ itemstack5.stackSize=size;
+ inventoryplayer.setItemStack(itemstack5);
+
+ FBS.logger.info("picked up:"+itemstack5);
+
+ ItemStack tmp = itemstack5.copy();
+ //meal.exportItemStack(tmp, tmp.stackSize);
+ //inv.markDirty();
+
+ if(isClient){
+ //PacketHandler.INSTANCE.sendTo(new MessageMealTerminal(player, meal, 1, tmp), (EntityPlayerMP) player);
+ PacketHandler.INSTANCE.sendToServer(new MessageMealTerminal(player, meal, 1, tmp));
+ }
+
+ //slot2.onPickupFromSlot(player, inventoryplayer.getItemStack());
+ } else if (slot2.isItemValid(playerCurrentItem)) {
+ ////////////////////////////////////////////////////////////////////////////////////////
+ //
+ // アイテムをミールへ送る処理
+ //
+ ////////////////////////////////////////////////////////////////////////////////////////
+ size = button == 0 ? playerCurrentItem.stackSize : 1;
+
+ playerCurrentItem.splitStack(size);
+ if (playerCurrentItem.stackSize == 0) {
+ inventoryplayer.setItemStack((ItemStack) null);
+ }
+
+ ItemStack tmp = playerCurrentItem.copy();
+ tmp.stackSize = size;
+ //meal.insertItemStack(tmp);
+ //inv.markDirty();
+
+ if(isClient){
+ PacketHandler.INSTANCE.sendToServer(new MessageMealTerminal(player, meal, 0, tmp));
+ }
+ }
+ }
+ }
+ }
+ return itemstack;
+ }
+
+
+ @Override
+ protected void func_94533_d() {
+ super.func_94533_d();
+ state = 0;
+ fuckSet1.clear();
+ }
+
+ public static class SlotTerminal extends Slot{
+ public static boolean dontUpdate;
+
+ public SlotTerminal(InventoryTerminal inv, int index, int x, int y) {
+ super(inv, index, x, y);
+ }
+
+ @Override
+ public int getSlotStackLimit() {
+ return Integer.MAX_VALUE;
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/storage/GuiMealTerminal.class b/src/main/java/jp/plusplus/fbs/storage/GuiMealTerminal.class Binary files differnew file mode 100644 index 0000000..ec87d82 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/storage/GuiMealTerminal.class diff --git a/src/main/java/jp/plusplus/fbs/storage/GuiMealTerminal.java b/src/main/java/jp/plusplus/fbs/storage/GuiMealTerminal.java new file mode 100644 index 0000000..9af4f73 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/storage/GuiMealTerminal.java @@ -0,0 +1,150 @@ +package jp.plusplus.fbs.storage;
+
+import jp.plusplus.fbs.FBS;
+import net.minecraft.client.gui.GuiTextField;
+import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.client.gui.inventory.GuiContainerCreative;
+import net.minecraft.client.gui.inventory.GuiInventory;
+import net.minecraft.client.renderer.RenderHelper;
+import net.minecraft.client.resources.I18n;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.inventory.Container;
+import net.minecraft.util.ResourceLocation;
+import org.lwjgl.input.Keyboard;
+import org.lwjgl.input.Mouse;
+import org.lwjgl.opengl.GL11;
+
+/**
+ * Created by plusplus_F on 2016/03/08.
+ */
+public class GuiMealTerminal extends GuiContainer {
+ private static final ResourceLocation rl = new ResourceLocation(FBS.MODID+":textures/gui/terminal.png");
+
+ private float currentScroll;
+ private boolean isScrolling;
+ private boolean wasClicking;
+ private GuiTextField searchField;
+ private boolean field_147057_D;
+
+ public GuiMealTerminal(Container p_i1072_1_) {
+ super(p_i1072_1_);
+ this.allowUserInput = true;
+ this.xSize = 195;
+ this.ySize = 222;
+ }
+
+ @Override
+ public void initGui() {
+ super.initGui();
+ this.buttonList.clear();
+ Keyboard.enableRepeatEvents(true);
+ this.searchField = new GuiTextField(this.fontRendererObj, this.guiLeft + 80, this.guiTop + 5, 89, this.fontRendererObj.FONT_HEIGHT);
+ this.searchField.setMaxStringLength(15);
+ this.searchField.setEnableBackgroundDrawing(false);
+ this.searchField.setVisible(false);
+ this.searchField.setTextColor(16777215);
+ }
+
+ @Override
+ public void onGuiClosed() {
+ super.onGuiClosed();
+ Keyboard.enableRepeatEvents(false);
+ }
+
+ @Override
+ protected void keyTyped(char p_73869_1_, int p_73869_2_) {
+ if (this.field_147057_D) {
+ this.field_147057_D = false;
+ this.searchField.setText("");
+ }
+
+ if (!this.checkHotbarKeys(p_73869_2_)) {
+ if (this.searchField.textboxKeyTyped(p_73869_1_, p_73869_2_)) {
+ this.updateSearch();
+ } else {
+ super.keyTyped(p_73869_1_, p_73869_2_);
+ }
+ }
+ }
+
+ protected void updateSearch(){
+
+ }
+
+ @Override
+ public void handleMouseInput() {
+ super.handleMouseInput();
+
+ int i = Mouse.getEventDWheel();
+ if (i != 0) {
+ ContainerMealTerminal cmt=(ContainerMealTerminal)inventorySlots;
+ int j = cmt.inv.allItem.length / 9 - 5 + 1;
+
+ if (i > 0) i = 1;
+ if (i < 0) i = -1;
+
+ this.currentScroll = (float) ((double) this.currentScroll - (double) i / (double) j);
+ if (this.currentScroll < 0.0F) this.currentScroll = 0.0F;
+ if (this.currentScroll > 1.0F) this.currentScroll = 1.0F;
+
+ cmt.scrollTo(currentScroll);
+ }
+ }
+
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+
+ this.mc.getTextureManager().bindTexture(rl);
+
+ int k = (this.width - this.xSize) / 2;
+ int l = (this.height - this.ySize) / 2;
+ this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
+
+ //GuiContainerCreative
+ this.drawTexturedModalRect(k+175, l+18+ (int)((196.f-15.f) * this.currentScroll), 232, 0, 12, 15);
+ }
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
+ GL11.glDisable(GL11.GL_BLEND);
+ this.fontRendererObj.drawString(I18n.format("tile.fbs.mealCrystal.name"), 8, 6, 4210752);
+ }
+
+
+ public void drawScreen(int p_73863_1_, int p_73863_2_, float p_73863_3_) {
+ boolean flag = Mouse.isButtonDown(0);
+ int k = this.guiLeft;
+ int l = this.guiTop;
+ int i1 = k + 175;
+ int j1 = l + 18;
+ int k1 = i1 + 14;
+ int l1 = j1 + 196;
+
+ ContainerMealTerminal cmt=(ContainerMealTerminal)inventorySlots;
+
+ if (!this.wasClicking && flag && p_73863_1_ >= i1 && p_73863_2_ >= j1 && p_73863_1_ < k1 && p_73863_2_ < l1) {
+ this.isScrolling = true;
+ }
+
+ if (!flag) {
+ this.isScrolling = false;
+ }
+
+ this.wasClicking = flag;
+
+ if (this.isScrolling) {
+ this.currentScroll = ((float) (p_73863_2_ - j1) - 7.5F) / ((float) (l1 - j1) - 15.0F);
+
+ if (this.currentScroll < 0.0F) this.currentScroll = 0.0F;
+ if (this.currentScroll > 1.0F) this.currentScroll = 1.0F;
+
+ cmt.scrollTo(this.currentScroll);
+ }
+
+ super.drawScreen(p_73863_1_, p_73863_2_, p_73863_3_);
+
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ GL11.glDisable(GL11.GL_LIGHTING);
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/storage/IMealDevice.class b/src/main/java/jp/plusplus/fbs/storage/IMealDevice.class Binary files differnew file mode 100644 index 0000000..69478b8 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/storage/IMealDevice.class diff --git a/src/main/java/jp/plusplus/fbs/storage/IMealDevice.java b/src/main/java/jp/plusplus/fbs/storage/IMealDevice.java new file mode 100644 index 0000000..6d4a9f5 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/storage/IMealDevice.java @@ -0,0 +1,12 @@ +package jp.plusplus.fbs.storage;
+
+import net.minecraft.item.ItemStack;
+
+/**
+ * Created by plusplus_F on 2016/03/07.
+ */
+public interface IMealDevice {
+ public ItemStack getFragment();
+ public void setFragment(ItemStack f);
+ public boolean hasFragment();
+}
diff --git a/src/main/java/jp/plusplus/fbs/storage/InventoryTerminal.class b/src/main/java/jp/plusplus/fbs/storage/InventoryTerminal.class Binary files differnew file mode 100644 index 0000000..6585c62 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/storage/InventoryTerminal.class diff --git a/src/main/java/jp/plusplus/fbs/storage/InventoryTerminal.java b/src/main/java/jp/plusplus/fbs/storage/InventoryTerminal.java new file mode 100644 index 0000000..e806ea5 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/storage/InventoryTerminal.java @@ -0,0 +1,126 @@ +package jp.plusplus.fbs.storage;
+
+import jp.plusplus.fbs.FBS;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.item.ItemStack;
+
+/**
+ * Created by plusplus_F on 2016/03/08.
+ */
+public class InventoryTerminal implements IInventory {
+ public ItemStack[] allItem;
+ public ItemStack[] itemStacks=new ItemStack[54];
+ public TileEntityMeal meal;
+ public float scroll;
+
+ public boolean dontUpdate;
+
+ public InventoryTerminal(TileEntityMeal meal){
+ this.meal=meal;
+ }
+
+ public void updateItemList(){
+ if(!dontUpdate){
+ allItem=meal.getAllItemStacks();
+ if(allItem.length<=54){
+ for(int i=0;i<itemStacks.length;i++) itemStacks[i]=null;
+ for(int i=0;i<allItem.length;i++) itemStacks[i]=allItem[i];
+ }
+ else{
+ //スクロールに合わせて変更
+ int shift=(int)(((allItem.length-54)/9+1)*scroll);
+ for(int i=0;i<54;i++){
+ int index=i+shift*9;
+ if(index<allItem.length) itemStacks[i]=allItem[index];
+ else itemStacks[i]=null;
+ }
+ }
+ }
+ }
+
+ @Override
+ public int getSizeInventory() {
+ return 54;
+ }
+
+ @Override
+ public ItemStack getStackInSlot(int p_70301_1_) {
+ return itemStacks[p_70301_1_];
+ }
+
+ @Override
+ public ItemStack decrStackSize(int index, int stackSize) {
+ if (this.itemStacks[index] != null) {
+ ItemStack itemstack;
+
+ if (this.itemStacks[index].stackSize <= stackSize) {
+ itemstack = this.itemStacks[index].copy();
+ this.itemStacks[index] = null;
+ this.markDirty();
+ return itemstack;
+ } else {
+ itemstack = this.itemStacks[index].splitStack(stackSize);
+
+ if (this.itemStacks[index].stackSize == 0) {
+ this.itemStacks[index] = null;
+ }
+
+ this.markDirty();
+ return itemstack;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public ItemStack getStackInSlotOnClosing(int p_70304_1_) {
+ return null;
+ }
+
+ @Override
+ public void setInventorySlotContents(int p_70299_1_, ItemStack p_70299_2_) {
+ //meal.insertItemStack(p_70299_2_);
+ itemStacks[p_70299_1_]=p_70299_2_;
+ markDirty();
+ }
+
+ @Override
+ public String getInventoryName() {
+ return "fbs.terminal";
+ }
+
+ @Override
+ public boolean hasCustomInventoryName() {
+ return false;
+ }
+
+ @Override
+ public int getInventoryStackLimit() {
+ return Integer.MAX_VALUE;
+ }
+
+ @Override
+ public void markDirty() {
+ updateItemList();
+ }
+
+ @Override
+ public boolean isUseableByPlayer(EntityPlayer p_70300_1_) {
+ return true;
+ }
+
+ @Override
+ public void openInventory() {
+ updateItemList();
+ }
+
+ @Override
+ public void closeInventory() {
+ }
+
+ @Override
+ public boolean isItemValidForSlot(int p_94041_1_, ItemStack p_94041_2_) {
+ return true;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/storage/ItemMealFragment.class b/src/main/java/jp/plusplus/fbs/storage/ItemMealFragment.class Binary files differnew file mode 100644 index 0000000..283d62f --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/storage/ItemMealFragment.class diff --git a/src/main/java/jp/plusplus/fbs/storage/ItemMealFragment.java b/src/main/java/jp/plusplus/fbs/storage/ItemMealFragment.java new file mode 100644 index 0000000..ec8649f --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/storage/ItemMealFragment.java @@ -0,0 +1,95 @@ +package jp.plusplus.fbs.storage;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import cpw.mods.fml.server.FMLServerHandler;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.item.ItemBase;
+import jp.plusplus.fbs.item.ItemCore;
+import net.minecraft.client.multiplayer.WorldClient;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.StatCollector;
+import net.minecraft.world.World;
+import net.minecraft.world.WorldProvider;
+import net.minecraftforge.common.DimensionManager;
+import net.minecraftforge.common.ForgeChunkManager;
+import net.minecraftforge.common.MinecraftForge;
+
+import java.awt.*;
+import java.util.List;
+
+/**
+ * Created by plusplus_F on 2016/03/07.
+ */
+public class ItemMealFragment extends ItemBase{
+ public static final String DIM="MEAL_DIM";
+ public static final String X="MEAL_X";
+ public static final String Y="MEAL_Y";
+ public static final String Z="MEAL_Z";
+
+ public ItemMealFragment(){
+ setUnlocalizedName("mealFragment");
+ setTextureName("mealFragment");
+ setCreativeTab(null);
+ }
+
+ public static ItemStack getItemStack(World w, int x, int y, int z){
+ NBTTagCompound nbt=new NBTTagCompound();
+ nbt.setInteger(DIM, w.provider.dimensionId);
+ nbt.setInteger(X, x);
+ nbt.setInteger(Y, y);
+ nbt.setInteger(Z, z);
+
+ ItemStack ret=new ItemStack(ItemCore.mealFragment);
+ ret.setTagCompound(nbt);
+ return ret;
+ }
+
+ public static TileEntityMeal getTileEntity(ItemStack fragment){
+ if(fragment==null) {
+ FBS.logger.info("fragment is null");
+ return null;
+ }
+ NBTTagCompound nbt=fragment.getTagCompound();
+ if(nbt==null){
+ FBS.logger.info("nbt is null");
+ return null;
+ }
+
+ int id=nbt.getInteger(DIM);
+ int x=nbt.getInteger(X);
+ int y=nbt.getInteger(Y);
+ int z=nbt.getInteger(Z);
+
+ World world=ChunkLoadManager.getWorld(id);
+ if(world==null){
+ FBS.logger.info("world is null");
+ return null;
+ }
+ if(!world.getChunkFromBlockCoords(x,z).isChunkLoaded){
+ FBS.logger.info("chunk is not loaded");
+ return null;
+ }
+
+ TileEntity te=world.getTileEntity(x,y,z);
+ return (te instanceof TileEntityMeal)?(TileEntityMeal)te:null;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void addInformation(ItemStack p_77624_1_, EntityPlayer p_77624_2_, List p_77624_3_, boolean p_77624_4_) {
+ String name = "???";
+
+ NBTTagCompound nbt = p_77624_1_.getTagCompound();
+ if(nbt==null) return;
+
+ World w=DimensionManager.getWorld(nbt.getInteger(DIM));
+ if(w!=null && w.provider!=null) {
+ name = w.provider.getDimensionName();
+ }
+ p_77624_3_.add(name + "(" + nbt.getInteger(X) + "," + nbt.getInteger(Y) + "," + nbt.getInteger(Z) + ")");
+
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/storage/MessageMealTerminal$Handler.class b/src/main/java/jp/plusplus/fbs/storage/MessageMealTerminal$Handler.class Binary files differnew file mode 100644 index 0000000..028cc61 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/storage/MessageMealTerminal$Handler.class diff --git a/src/main/java/jp/plusplus/fbs/storage/MessageMealTerminal$HandlerClient.class b/src/main/java/jp/plusplus/fbs/storage/MessageMealTerminal$HandlerClient.class Binary files differnew file mode 100644 index 0000000..7030fdd --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/storage/MessageMealTerminal$HandlerClient.class diff --git a/src/main/java/jp/plusplus/fbs/storage/MessageMealTerminal.class b/src/main/java/jp/plusplus/fbs/storage/MessageMealTerminal.class Binary files differnew file mode 100644 index 0000000..37ebf1a --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/storage/MessageMealTerminal.class diff --git a/src/main/java/jp/plusplus/fbs/storage/MessageMealTerminal.java b/src/main/java/jp/plusplus/fbs/storage/MessageMealTerminal.java new file mode 100644 index 0000000..bcafdd8 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/storage/MessageMealTerminal.java @@ -0,0 +1,109 @@ +package jp.plusplus.fbs.storage;
+
+import cpw.mods.fml.common.network.ByteBufUtils;
+import cpw.mods.fml.common.network.simpleimpl.IMessage;
+import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
+import cpw.mods.fml.common.network.simpleimpl.MessageContext;
+import io.netty.buffer.ByteBuf;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.packet.PacketHandler;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.common.DimensionManager;
+
+import java.util.Iterator;
+
+/**
+ * Created by plusplus_F on 2016/03/08.
+ */
+public class MessageMealTerminal implements IMessage {
+ public int type;
+ public TileEntityMeal tem;
+ public ItemStack itemStack;
+ public EntityPlayer player;
+
+ public MessageMealTerminal(){}
+
+ public MessageMealTerminal(EntityPlayer player, TileEntityMeal te, int type, ItemStack itemStack){
+ tem=te;
+ this.type=type;
+ this.itemStack=itemStack;
+ this.player=player;
+ }
+
+
+ @Override
+ public void fromBytes(ByteBuf buf) {
+
+ type=ByteBufUtils.readVarInt(buf, 4);
+ int id=Integer.parseInt(ByteBufUtils.readUTF8String(buf));
+ int x=Integer.parseInt(ByteBufUtils.readUTF8String(buf));
+ int y=Integer.parseInt(ByteBufUtils.readUTF8String(buf));
+ int z=Integer.parseInt(ByteBufUtils.readUTF8String(buf));
+ itemStack=ByteBufUtils.readItemStack(buf);
+ String name=ByteBufUtils.readUTF8String(buf);
+
+ tem=(TileEntityMeal)ChunkLoadManager.getWorld(id).getTileEntity(x, y, z);
+ player=tem.getWorldObj().getPlayerEntityByName(name);
+ }
+
+ @Override
+ public void toBytes(ByteBuf buf) {
+ ByteBufUtils.writeVarInt(buf, type, 4);
+ ByteBufUtils.writeUTF8String(buf, "" + tem.getWorldObj().provider.dimensionId);
+ ByteBufUtils.writeUTF8String(buf, "" + tem.xCoord);
+ ByteBufUtils.writeUTF8String(buf, "" + tem.yCoord);
+ ByteBufUtils.writeUTF8String(buf, "" + tem.zCoord);
+ ByteBufUtils.writeItemStack(buf, itemStack);
+ ByteBufUtils.writeUTF8String(buf, player.getCommandSenderName());
+ }
+
+ public static class Handler implements IMessageHandler<MessageMealTerminal, IMessage>{
+
+ @Override
+ public IMessage onMessage(MessageMealTerminal message, MessageContext ctx) {
+ if (message.itemStack == null) return null;
+
+ if (message.type == 0) {
+ message.tem.insertItemStack(message.itemStack);
+ if(message.player.openContainer instanceof ContainerMealTerminal){
+ message.player.inventory.setItemStack(null);
+ }
+ } else if (message.type == 1) {
+ message.tem.exportItemStack(message.itemStack, message.itemStack.stackSize);
+ if(message.player.openContainer instanceof ContainerMealTerminal){
+ message.player.inventory.setItemStack(message.itemStack.copy());
+ }
+ }
+
+ Iterator it=message.tem.getWorldObj().playerEntities.iterator();
+ while(it.hasNext()){
+ EntityPlayer ep=(EntityPlayer)it.next();
+
+ if(ep.openContainer instanceof ContainerMealTerminal){
+ ((ContainerMealTerminal)ep.openContainer).inv.markDirty();
+ }
+ }
+
+ //return new MessageMealTerminal(message.player, message.tem, message.type, message.itemStack);
+ //return new MessageMealTerminal();
+
+ PacketHandler.INSTANCE.sendToAll(new MessageMealTerminal(message.player, message.tem, message.type, message.itemStack));
+
+ return null;
+ }
+ }
+
+ public static class HandlerClient implements IMessageHandler<MessageMealTerminal, IMessage>{
+
+ @Override
+ public IMessage onMessage(MessageMealTerminal message, MessageContext ctx) {
+ EntityPlayer player=FBS.proxy.getEntityPlayerInstance();
+ if(player!=null && player.openContainer instanceof ContainerMealTerminal){
+ ((ContainerMealTerminal) player.openContainer).inv.markDirty();
+ //FBS.logger.info("list updated");
+ }
+ return null;
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/storage/MessageMealTerminalScroll$Handler.class b/src/main/java/jp/plusplus/fbs/storage/MessageMealTerminalScroll$Handler.class Binary files differnew file mode 100644 index 0000000..40888ab --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/storage/MessageMealTerminalScroll$Handler.class diff --git a/src/main/java/jp/plusplus/fbs/storage/MessageMealTerminalScroll.class b/src/main/java/jp/plusplus/fbs/storage/MessageMealTerminalScroll.class Binary files differnew file mode 100644 index 0000000..770f0c8 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/storage/MessageMealTerminalScroll.class diff --git a/src/main/java/jp/plusplus/fbs/storage/MessageMealTerminalScroll.java b/src/main/java/jp/plusplus/fbs/storage/MessageMealTerminalScroll.java new file mode 100644 index 0000000..3682a8e --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/storage/MessageMealTerminalScroll.java @@ -0,0 +1,53 @@ +package jp.plusplus.fbs.storage;
+
+import cpw.mods.fml.common.network.ByteBufUtils;
+import cpw.mods.fml.common.network.simpleimpl.IMessage;
+import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
+import cpw.mods.fml.common.network.simpleimpl.MessageContext;
+import io.netty.buffer.ByteBuf;
+import jp.plusplus.fbs.FBS;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.Container;
+import net.minecraftforge.common.DimensionManager;
+
+/**
+ * Created by plusplus_F on 2016/03/09.
+ */
+public class MessageMealTerminalScroll implements IMessage {
+ public int dId;
+ public EntityPlayer player;
+ public float scroll;
+
+ public MessageMealTerminalScroll(){}
+ public MessageMealTerminalScroll(int id, EntityPlayer ep, float f){
+ dId=id;
+ player=ep;
+ scroll=f;
+ }
+
+ @Override
+ public void fromBytes(ByteBuf buf) {
+ dId=buf.readInt();
+ player= DimensionManager.getWorld(dId).getPlayerEntityByName(ByteBufUtils.readUTF8String(buf));
+ scroll=buf.readFloat();
+ }
+
+ @Override
+ public void toBytes(ByteBuf buf) {
+ buf.writeInt(dId);
+ ByteBufUtils.writeUTF8String(buf, player.getCommandSenderName());
+ buf.writeFloat(scroll);
+ }
+
+ public static class Handler implements IMessageHandler<MessageMealTerminalScroll, IMessage>{
+ @Override
+ public IMessage onMessage(MessageMealTerminalScroll message, MessageContext ctx) {
+ Container container=message.player.openContainer;
+ if(container instanceof ContainerMealTerminal){
+ ((ContainerMealTerminal) container).scrollTo(message.scroll);
+ //FBS.logger.info("scroll to " + message.scroll);
+ }
+ return null;
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/storage/ModelMealCrystal.class b/src/main/java/jp/plusplus/fbs/storage/ModelMealCrystal.class Binary files differnew file mode 100644 index 0000000..f68029e --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/storage/ModelMealCrystal.class diff --git a/src/main/java/jp/plusplus/fbs/storage/ModelMealCrystal.java b/src/main/java/jp/plusplus/fbs/storage/ModelMealCrystal.java new file mode 100644 index 0000000..0118878 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/storage/ModelMealCrystal.java @@ -0,0 +1,158 @@ +// Date: 2016/03/07 13:58:43 +// Template version 1.1 +// Java generated by Techne +// Keep in mind that you still need to fill in some blanks +// - ZeuX + + + + + + +package jp.plusplus.fbs.storage; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; +import org.lwjgl.opengl.GL11; + +public class ModelMealCrystal extends ModelBase { + //fields + ModelRenderer Shape1; + ModelRenderer Shape2; + ModelRenderer Shape3; + ModelRenderer Shape4; + ModelRenderer Shape5; + ModelRenderer Shape6; + ModelRenderer Shape7; + ModelRenderer Shape8; + ModelRenderer Shape9; + ModelRenderer Shape10; + ModelRenderer Shape11; + ModelRenderer Shape12; + ModelRenderer Shape13; + ModelRenderer Shape14; + + public ModelMealCrystal() { + textureWidth = 64; + textureHeight = 32; + + Shape1 = new ModelRenderer(this, 0, 0); + Shape1.addBox(-4F, 0F, -4F, 8, 18, 8); + Shape1.setRotationPoint(0F, 0F, 0F); + Shape1.setTextureSize(64, 32); + Shape1.mirror = true; + setRotation(Shape1, 0F, 0F, 0F); + Shape2 = new ModelRenderer(this, 32, 24); + Shape2.addBox(-3.5F, -1F, -3.5F, 7, 1, 7); + Shape2.setRotationPoint(0F, 0F, 0F); + Shape2.setTextureSize(64, 32); + Shape2.mirror = true; + setRotation(Shape2, 0F, 0F, 0F); + Shape3 = new ModelRenderer(this, 32, 17); + Shape3.addBox(-3F, -2F, -3F, 6, 1, 6); + Shape3.setRotationPoint(0F, 0F, 0F); + Shape3.setTextureSize(64, 32); + Shape3.mirror = true; + setRotation(Shape3, 0F, 0F, 0F); + Shape4 = new ModelRenderer(this, 32, 11); + Shape4.addBox(-2.5F, -3F, -2.5F, 5, 1, 5); + Shape4.setRotationPoint(0F, 0F, 0F); + Shape4.setTextureSize(64, 32); + Shape4.mirror = true; + setRotation(Shape4, 0F, 0F, 0F); + Shape5 = new ModelRenderer(this, 32, 6); + Shape5.addBox(-2F, -4F, -2F, 4, 1, 4); + Shape5.setRotationPoint(0F, 0F, 0F); + Shape5.setTextureSize(64, 32); + Shape5.mirror = true; + setRotation(Shape5, 0F, 0F, 0F); + Shape6 = new ModelRenderer(this, 53, 28); + Shape6.addBox(-1F, -6F, -1F, 2, 1, 2); + Shape6.setRotationPoint(0F, 0F, 0F); + Shape6.setTextureSize(64, 32); + Shape6.mirror = true; + setRotation(Shape6, 0F, 0F, 0F); + Shape7 = new ModelRenderer(this, 32, 2); + Shape7.addBox(-1.5F, -5F, -1.5F, 3, 1, 3); + Shape7.setRotationPoint(0F, 0F, 0F); + Shape7.setTextureSize(64, 32); + Shape7.mirror = true; + setRotation(Shape7, 0F, 0F, 0F); + Shape8 = new ModelRenderer(this, 53, 26); + Shape8.addBox(-0.5F, -7F, -0.5F, 1, 1, 1); + Shape8.setRotationPoint(0F, 0F, 0F); + Shape8.setTextureSize(64, 32); + Shape8.mirror = true; + setRotation(Shape8, 0F, 0F, 0F); + Shape9 = new ModelRenderer(this, 32, 24); + Shape9.addBox(-3.5F, 18F, -3.5F, 7, 1, 7); + Shape9.setRotationPoint(0F, 0F, 0F); + Shape9.setTextureSize(64, 32); + Shape9.mirror = true; + setRotation(Shape9, 0F, 0F, 0F); + Shape10 = new ModelRenderer(this, 32, 17); + Shape10.addBox(-3F, 19F, -3F, 6, 1, 6); + Shape10.setRotationPoint(0F, 0F, 0F); + Shape10.setTextureSize(64, 32); + Shape10.mirror = true; + setRotation(Shape10, 0F, 0F, 0F); + Shape11 = new ModelRenderer(this, 32, 11); + Shape11.addBox(-2.5F, 20F, -2.5F, 5, 1, 5); + Shape11.setRotationPoint(0F, 0F, 0F); + Shape11.setTextureSize(64, 32); + Shape11.mirror = true; + setRotation(Shape11, 0F, 0F, 0F); + Shape12 = new ModelRenderer(this, 32, 6); + Shape12.addBox(-2F, 21F, -2F, 4, 1, 4); + Shape12.setRotationPoint(0F, 0F, 0F); + Shape12.setTextureSize(64, 32); + Shape12.mirror = true; + setRotation(Shape12, 0F, 0F, 0F); + Shape13 = new ModelRenderer(this, 32, 2); + Shape13.addBox(-1.5F, 22F, -1.5F, 3, 1, 3); + Shape13.setRotationPoint(0F, 0F, 0F); + Shape13.setTextureSize(64, 32); + Shape13.mirror = true; + setRotation(Shape13, 0F, 0F, 0F); + Shape14 = new ModelRenderer(this, 53, 26); + Shape14.addBox(-0.5F, 23F, -0.5F, 1, 1, 1); + Shape14.setRotationPoint(0F, 0F, 0F); + Shape14.setTextureSize(64, 32); + Shape14.mirror = true; + setRotation(Shape14, 0F, 0F, 0F); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + setRotationAngles(f, f1, f2, f3, f4, f5); + } + + public void renderCrystal(float f5, float tick){ + GL11.glRotatef(16*tick/20*(float)(2*Math.PI/(5)), 0, 1, 0); + Shape1.render(f5); + Shape2.render(f5); + Shape3.render(f5); + Shape4.render(f5); + Shape5.render(f5); + Shape6.render(f5); + Shape7.render(f5); + Shape8.render(f5); + Shape9.render(f5); + Shape10.render(f5); + Shape11.render(f5); + Shape12.render(f5); + Shape13.render(f5); + Shape14.render(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + + public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5) { + super.setRotationAngles(f, f1, f2, f3, f4, f5, null); + } +} diff --git a/src/main/java/jp/plusplus/fbs/storage/ModelMealInlet.class b/src/main/java/jp/plusplus/fbs/storage/ModelMealInlet.class Binary files differnew file mode 100644 index 0000000..ccc5c10 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/storage/ModelMealInlet.class diff --git a/src/main/java/jp/plusplus/fbs/storage/ModelMealInlet.java b/src/main/java/jp/plusplus/fbs/storage/ModelMealInlet.java new file mode 100644 index 0000000..d625e08 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/storage/ModelMealInlet.java @@ -0,0 +1,75 @@ +// Date: 2016/03/07 16:29:33 +// Template version 1.1 +// Java generated by Techne +// Keep in mind that you still need to fill in some blanks +// - ZeuX + + + + + + +package jp.plusplus.fbs.storage; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +public class ModelMealInlet extends ModelBase { + //fields + ModelRenderer Shape1; + ModelRenderer Shape2; + ModelRenderer Shape3; + ModelRenderer Shape4; + + public ModelMealInlet(boolean io) { + textureWidth = 64; + textureHeight = 32; + + Shape1 = new ModelRenderer(this, 0, io?19:6); + Shape1.addBox(-5F, 5F, -5F, 10, 3, 10); + Shape1.setRotationPoint(0F, 0F, 0F); + Shape1.setTextureSize(64, 32); + Shape1.mirror = true; + setRotation(Shape1, 0F, 0F, 0F); + Shape2 = new ModelRenderer(this, 0, 23); + Shape2.addBox(-0.3333333F, 0.06666667F, -6F, 2, 4, 2); + Shape2.setRotationPoint(0F, 0F, 0F); + Shape2.setTextureSize(64, 32); + Shape2.mirror = true; + setRotation(Shape2, 0.7716627F, -1.07818F, 0F); + Shape3 = new ModelRenderer(this, 40, 25); + Shape3.addBox(-1F, 1F, 1F, 3, 4, 3); + Shape3.setRotationPoint(0F, 0F, 0F); + Shape3.setTextureSize(64, 32); + Shape3.mirror = true; + setRotation(Shape3, 0F, -0.3717861F, 0F); + Shape4 = new ModelRenderer(this, 30, 23); + Shape4.addBox(-0.6F, 1F, 2.733333F, 2, 4, 2); + Shape4.setRotationPoint(0F, 0F, 0F); + Shape4.setTextureSize(64, 32); + Shape4.mirror = true; + setRotation(Shape4, -0.3717861F, -2.41661F, 0F); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + setRotationAngles(f, f1, f2, f3, f4, f5); + Shape1.render(f5); + } + public void renderCrystal(float f5){ + Shape2.render(f5); + Shape3.render(f5); + Shape4.render(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + + public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5) { + super.setRotationAngles(f, f1, f2, f3, f4, f5, null); + } +} diff --git a/src/main/java/jp/plusplus/fbs/storage/RenderMealCrystal.class b/src/main/java/jp/plusplus/fbs/storage/RenderMealCrystal.class Binary files differnew file mode 100644 index 0000000..557f2ce --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/storage/RenderMealCrystal.class diff --git a/src/main/java/jp/plusplus/fbs/storage/RenderMealCrystal.java b/src/main/java/jp/plusplus/fbs/storage/RenderMealCrystal.java new file mode 100644 index 0000000..b6bed91 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/storage/RenderMealCrystal.java @@ -0,0 +1,61 @@ +package jp.plusplus.fbs.storage;
+
+import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.block.model.ModelAlchemyCauldron;
+import net.minecraft.block.Block;
+import net.minecraft.client.renderer.RenderBlocks;
+import net.minecraft.client.renderer.tileentity.TileEntityBeaconRenderer;
+import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.ResourceLocation;
+import net.minecraft.world.IBlockAccess;
+import org.lwjgl.opengl.GL11;
+import org.lwjgl.opengl.GL12;
+
+/**
+ * Created by plusplus_F on 2016/03/07.
+ */
+public class RenderMealCrystal extends TileEntitySpecialRenderer implements ISimpleBlockRenderingHandler {
+ public static ResourceLocation rl = new ResourceLocation(FBS.MODID, "textures/models/MealCrystal.png");
+ protected ModelMealCrystal model = new ModelMealCrystal();
+
+ @Override
+ public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
+
+ }
+
+ @Override
+ public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
+ return getRenderId()==modelId;
+ }
+
+ @Override
+ public boolean shouldRender3DInInventory(int modelId) {
+ return false;
+ }
+
+ @Override
+ public int getRenderId() {
+ return FBS.renderMealId;
+ }
+
+ @Override
+ public void renderTileEntityAt(TileEntity te, double x, double y, double z, float p_147500_8_) {
+ int meta = te.getWorldObj().getBlockMetadata(te.xCoord, te.yCoord, te.zCoord);
+ if (meta!=0) return;
+
+ GL11.glPushMatrix();
+ GL11.glTranslatef((float) x + 0.5f, (float) y + 1.5f+1.0f/16.0f, (float) z + 0.5f);
+ GL11.glRotatef(180.0f, 0, 0, 1);
+ float scale = 0.0625f;
+ GL11.glScalef(scale, scale, scale);
+ GL11.glEnable(GL12.GL_RESCALE_NORMAL);
+
+ this.bindTexture(rl);
+ model.render(null, 0, 0, 0, 0, 0, 1.0f);
+ model.renderCrystal(1.f, (float)te.getWorldObj().getTotalWorldTime()+p_147500_8_);
+ GL11.glDisable(GL12.GL_RESCALE_NORMAL);
+ GL11.glPopMatrix();
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/storage/RenderMealInlet$1.class b/src/main/java/jp/plusplus/fbs/storage/RenderMealInlet$1.class Binary files differnew file mode 100644 index 0000000..6bc22b9 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/storage/RenderMealInlet$1.class diff --git a/src/main/java/jp/plusplus/fbs/storage/RenderMealInlet.class b/src/main/java/jp/plusplus/fbs/storage/RenderMealInlet.class Binary files differnew file mode 100644 index 0000000..4fbdd1c --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/storage/RenderMealInlet.class diff --git a/src/main/java/jp/plusplus/fbs/storage/RenderMealInlet.java b/src/main/java/jp/plusplus/fbs/storage/RenderMealInlet.java new file mode 100644 index 0000000..943bce9 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/storage/RenderMealInlet.java @@ -0,0 +1,102 @@ +package jp.plusplus.fbs.storage;
+
+import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.block.BlockCore;
+import jp.plusplus.fbs.block.model.ModelHerb;
+import net.minecraft.block.Block;
+import net.minecraft.client.renderer.RenderBlocks;
+import net.minecraft.client.renderer.Tessellator;
+import net.minecraft.client.renderer.texture.TextureMap;
+import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.IIcon;
+import net.minecraft.util.ResourceLocation;
+import net.minecraft.world.IBlockAccess;
+import net.minecraftforge.common.util.ForgeDirection;
+import org.lwjgl.opengl.GL11;
+import org.lwjgl.opengl.GL12;
+
+/**
+ * Created by plusplus_F on 2016/03/07.
+ */
+public class RenderMealInlet extends TileEntitySpecialRenderer implements ISimpleBlockRenderingHandler {
+ public static ResourceLocation rl = new ResourceLocation(FBS.MODID + ":textures/models/MealInlet.png");
+ protected ModelMealInlet inlet=new ModelMealInlet(false);
+ protected ModelMealInlet outlet=new ModelMealInlet(true);
+
+ @Override
+ public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
+ if (modelId != getRenderId()) return;
+
+ GL11.glPushMatrix();
+ GL11.glTranslatef(0.5f, 0.5f, 0.5f);
+ GL11.glRotatef(180, 0, 0, 1);
+
+ float scale = 0.0625f;
+ scale *= 1.25f;
+ GL11.glScalef(scale, scale, scale);
+
+ bindTexture(rl);
+ if (block == BlockCore.mealInlet) {
+ inlet.render(null, 0, 0, 0, 0, 0, 1.0f);
+ inlet.renderCrystal(1.0f);
+ } else {
+ outlet.render(null, 0, 0, 0, 0, 0, 1.0f);
+ outlet.renderCrystal(1.0f);
+ }
+
+ bindTexture(TextureMap.locationBlocksTexture);
+
+ GL11.glScalef(1f, 1f, 1f);
+ GL11.glPopMatrix();
+ }
+
+ @Override
+ public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
+ return modelId==getRenderId();
+ }
+
+ @Override
+ public boolean shouldRender3DInInventory(int modelId) {
+ return true;
+ }
+
+ @Override
+ public int getRenderId() {
+ return FBS.renderMealInletId;
+ }
+
+ @Override
+ public void renderTileEntityAt(TileEntity te, double x, double y, double z, float p_147500_8_) {
+ ForgeDirection dir=ForgeDirection.getOrientation(te.getBlockMetadata()&7);
+
+ bindTexture(rl);
+
+ GL11.glPushMatrix();
+ GL11.glTranslatef((float) x + 0.5f, (float) y + 0.5f, (float) z + 0.5f);
+ switch (dir){
+ case DOWN: GL11.glRotatef(180, 0, 0, 1); break;
+ case UP: GL11.glRotatef(0, 0, 0, 1); break;
+ case NORTH: GL11.glRotatef(90, -1, 0, 0); break;
+ case SOUTH: GL11.glRotatef(90, 1, 0, 0); break;
+ case WEST: GL11.glRotatef(90, 0, 0, 1); break;
+ case EAST: GL11.glRotatef(90, 0, 0, -1); break;
+ }
+ float scale = 0.0625f;
+ GL11.glScalef(scale, scale, scale);
+ GL11.glEnable(GL12.GL_RESCALE_NORMAL);
+
+ ModelMealInlet model;
+ if(te.getBlockType()==BlockCore.mealInlet) model=inlet;
+ else model=outlet;
+
+ model.render(null, 0,0,0,0,0,1.f);
+ if(((IMealDevice)te).hasFragment()) model.renderCrystal(1.f);
+
+ GL11.glDisable(GL12.GL_RESCALE_NORMAL);
+ GL11.glPopMatrix();
+
+ bindTexture(TextureMap.locationBlocksTexture);
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/storage/RenderMealTerminal.class b/src/main/java/jp/plusplus/fbs/storage/RenderMealTerminal.class Binary files differnew file mode 100644 index 0000000..db2ce4d --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/storage/RenderMealTerminal.class diff --git a/src/main/java/jp/plusplus/fbs/storage/RenderMealTerminal.java b/src/main/java/jp/plusplus/fbs/storage/RenderMealTerminal.java new file mode 100644 index 0000000..3390b27 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/storage/RenderMealTerminal.java @@ -0,0 +1,84 @@ +package jp.plusplus.fbs.storage;
+
+import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.block.BlockCore;
+import net.minecraft.block.Block;
+import net.minecraft.client.renderer.RenderBlocks;
+import net.minecraft.client.renderer.texture.TextureMap;
+import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.ResourceLocation;
+import net.minecraft.world.IBlockAccess;
+import net.minecraftforge.common.util.ForgeDirection;
+import org.lwjgl.opengl.GL11;
+import org.lwjgl.opengl.GL12;
+
+/**
+ * Created by plusplus_F on 2016/03/08.
+ */
+public class RenderMealTerminal extends TileEntitySpecialRenderer implements ISimpleBlockRenderingHandler {
+ public static ResourceLocation rl = new ResourceLocation(FBS.MODID + ":textures/models/MealInlet.png");
+ protected ModelMealInlet inlet=new ModelMealInlet(false);
+ protected ModelMealInlet outlet=new ModelMealInlet(true);
+
+ @Override
+ public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
+ if (modelId != getRenderId()) return;
+
+ GL11.glPushMatrix();
+ GL11.glTranslatef(0.5f, 0.5f, 0.5f);
+ GL11.glRotatef(180, 0, 0, 1);
+
+ float scale = 0.0625f;
+ scale *= 1.25f;
+ GL11.glScalef(scale, scale, scale);
+
+ bindTexture(rl);
+ outlet.render(null, 0, 0, 0, 0, 0, 1.0f);
+ GL11.glTranslatef(0,-3/1.25f, 0);
+ inlet.render(null, 0, 0, 0, 0, 0, 1.0f);
+ inlet.renderCrystal(1.0f);
+ bindTexture(TextureMap.locationBlocksTexture);
+
+ GL11.glScalef(1f, 1f, 1f);
+ GL11.glPopMatrix();
+ }
+
+ @Override
+ public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
+ return modelId==getRenderId();
+ }
+
+ @Override
+ public boolean shouldRender3DInInventory(int modelId) {
+ return true;
+ }
+
+ @Override
+ public int getRenderId() {
+ return FBS.renderMealTerminalId;
+ }
+
+ @Override
+ public void renderTileEntityAt(TileEntity te, double x, double y, double z, float p_147500_8_) {
+ bindTexture(rl);
+
+ GL11.glPushMatrix();
+ GL11.glTranslatef((float) x + 0.5f, (float) y + 0.5f, (float) z + 0.5f);
+ GL11.glRotatef(180, 0, 0, 1);
+ float scale = 0.0625f;
+ GL11.glScalef(scale, scale, scale);
+ GL11.glEnable(GL12.GL_RESCALE_NORMAL);
+
+ outlet.render(null, 0, 0, 0, 0, 0, 1.f);
+ GL11.glTranslatef(0, -3, 0);
+ inlet.render(null, 0,0,0,0,0,1.f);
+ if(((IMealDevice)te).hasFragment()) inlet.renderCrystal(1.f);
+
+ GL11.glDisable(GL12.GL_RESCALE_NORMAL);
+ GL11.glPopMatrix();
+
+ bindTexture(TextureMap.locationBlocksTexture);
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/storage/TileEntityMeal$1.class b/src/main/java/jp/plusplus/fbs/storage/TileEntityMeal$1.class Binary files differnew file mode 100644 index 0000000..6c25b58 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/storage/TileEntityMeal$1.class diff --git a/src/main/java/jp/plusplus/fbs/storage/TileEntityMeal.class b/src/main/java/jp/plusplus/fbs/storage/TileEntityMeal.class Binary files differnew file mode 100644 index 0000000..d4ccfe6 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/storage/TileEntityMeal.class diff --git a/src/main/java/jp/plusplus/fbs/storage/TileEntityMeal.java b/src/main/java/jp/plusplus/fbs/storage/TileEntityMeal.java new file mode 100644 index 0000000..65999b6 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/storage/TileEntityMeal.java @@ -0,0 +1,328 @@ +package jp.plusplus.fbs.storage;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.api.FBSEntityPropertiesAPI;
+import jp.plusplus.fbs.packet.PacketHandler;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.EntityPlayerMP;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemBlock;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.nbt.NBTTagList;
+import net.minecraft.network.NetworkManager;
+import net.minecraft.network.Packet;
+import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.AxisAlignedBB;
+
+import java.util.*;
+
+/**
+ * Created by plusplus_F on 2016/03/07.
+ */
+public class TileEntityMeal extends TileEntity {
+ protected ArrayList<ItemStack> listBlocks=new ArrayList<ItemStack>();
+ protected ArrayList<ItemStack> listItems=new ArrayList<ItemStack>();
+
+ private LinkedList<ItemStack> cache=new LinkedList<ItemStack>();
+
+ public static final int FRAGEMNT_INTERVAL=20*60*5;
+ protected int fragmentTicks=FRAGEMNT_INTERVAL;
+
+ private boolean loaded;
+
+ @Override
+ public Packet getDescriptionPacket() {
+ NBTTagCompound nbtTagCompound = new NBTTagCompound();
+ this.writeToNBT(nbtTagCompound);
+ return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 1, nbtTagCompound);
+ }
+ @Override
+ public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
+ this.readFromNBT(pkt.func_148857_g());
+ }
+
+ @Override
+ public void readFromNBT(NBTTagCompound par1NBTTagCompound){
+ super.readFromNBT(par1NBTTagCompound);
+
+ cache.clear();
+
+ fragmentTicks=par1NBTTagCompound.getInteger("FragmentTicks");
+
+ NBTTagList nbttaglist = (NBTTagList)par1NBTTagCompound.getTag("Items");
+ listItems.clear();
+ for (int i=0;i<nbttaglist.tagCount();i++){
+ NBTTagCompound nbt = nbttaglist.getCompoundTagAt(i);
+ ItemStack it=ItemStack.loadItemStackFromNBT(nbt);
+ it.stackSize=nbt.getInteger("StackSize");
+ listItems.add(it);
+ }
+
+ nbttaglist = (NBTTagList)par1NBTTagCompound.getTag("Blocks");
+ listBlocks.clear();
+ for (int i=0;i<nbttaglist.tagCount();i++){
+ NBTTagCompound nbt = nbttaglist.getCompoundTagAt(i);
+ ItemStack it=ItemStack.loadItemStackFromNBT(nbt);
+ it.stackSize=nbt.getInteger("StackSize");
+ listBlocks.add(it);
+ }
+ }
+ @Override
+ public void writeToNBT(NBTTagCompound par1NBTTagCompound){
+ super.writeToNBT(par1NBTTagCompound);
+
+ par1NBTTagCompound.setInteger("FragmentTicks", fragmentTicks);
+
+ NBTTagList nbttaglist = new NBTTagList();
+ for(ItemStack it : listItems){
+ NBTTagCompound nbt = new NBTTagCompound();
+ it.writeToNBT(nbt);
+ nbt.setInteger("StackSize", it.stackSize);
+ nbttaglist.appendTag(nbt);
+ }
+ par1NBTTagCompound.setTag("Items", nbttaglist);
+
+ nbttaglist = new NBTTagList();
+ for(ItemStack it : listBlocks){
+ NBTTagCompound nbt = new NBTTagCompound();
+ it.writeToNBT(nbt);
+ nbt.setInteger("StackSize", it.stackSize);
+ nbttaglist.appendTag(nbt);
+ }
+ par1NBTTagCompound.setTag("Blocks", nbttaglist);
+ }
+
+ private boolean isItemEquals(ItemStack i1, ItemStack i2){
+ if(i1==null && i2==null) return true;
+ if(i1==null && i2!=null) return false;
+ if(i1!=null && i2==null) return false;
+
+ return i1.isItemEqual(i2) && ItemStack.areItemStackTagsEqual(i1, i2);
+ }
+
+ public void sendUpdate(){
+ //if(worldObj.isRemote) return;
+
+ /*
+ for(int i=0;i<worldObj.playerEntities.size();i++){
+ EntityPlayer ep=(EntityPlayer)worldObj.playerEntities.get(i);
+ if(ep.openContainer instanceof ContainerMealTerminal){
+ PacketHandler.INSTANCE.sendTo(new MessageMealTerminal(), (EntityPlayerMP)ep);
+ }
+ }
+ */
+
+ //PacketHandler.INSTANCE.sendToAll(new MessageMealTerminal());
+ }
+
+ /**
+ * 指定したアイテムをリストに格納する
+ * @param itemStack
+ */
+ public void insertItemStack(ItemStack itemStack){
+ if(worldObj.isRemote) return;
+ if(itemStack==null) return;
+
+ FBS.logger.info("inserted:"+itemStack.toString());
+
+ //キャッシュを見る
+ int size=cache.size();
+ for(int i=0;i<size;i++){
+ ItemStack t=cache.get(i);
+ if(isItemEquals(itemStack, t)){
+ //キャッシュにあれば
+ t.stackSize+=itemStack.stackSize;
+
+ //キャッシュ更新
+ cache.remove(i);
+ updateCache(t);
+
+ sendUpdate();
+ return;
+ }
+ }
+
+ //突っ込むリストの決定
+ ArrayList<ItemStack> list=null;
+ if(itemStack.getItem() instanceof ItemBlock) list=listBlocks;
+ else list=listItems;
+
+ //どこに突っ込むか探す
+ boolean found=false;
+ for(ItemStack it : list){
+ if(isItemEquals(it, itemStack)){
+ it.stackSize+=itemStack.stackSize;
+ found=true;
+
+ //キャッシュの更新
+ updateCache(it);
+ break;
+ }
+ }
+ if(!found){
+ ItemStack a=itemStack.copy();
+ list.add(a);
+
+ //キャッシュの更新
+ updateCache(a);
+ }
+
+ //更新
+ markDirty();
+ sendUpdate();
+ }
+
+ /**
+ * 全てのアイテムを得る<br>
+ * ただし、ここではItemStackはコピーされないので注意
+ * @return
+ */
+ public ItemStack[] getAllItemStacks(){
+ int sizeBlock=listBlocks.size(), sizeItem=listItems.size();
+ ItemStack[] ret=new ItemStack[sizeBlock+sizeItem];
+
+ if(ret.length>0){
+ int i=0;
+ for(;i<sizeBlock;i++) ret[i]=listBlocks.get(i);
+ for(int k=0;k<sizeItem;k++) ret[i+k]=listItems.get(k);
+
+ Arrays.sort(ret, new Comparator<ItemStack>() {
+ @Override
+ public int compare(ItemStack o1, ItemStack o2) {
+ int t=Item.getIdFromItem(o1.getItem())-Item.getIdFromItem(o2.getItem());
+ return t!=0?t:o1.getItemDamage()-o2.getItemDamage();
+ }
+ });
+ }
+
+ return ret;
+ }
+
+ /**
+ * キャッシュを更新する
+ * @param itemStack
+ */
+ private void updateCache(ItemStack itemStack){
+ cache.addFirst(itemStack);
+ if(cache.size()>10) cache.removeLast();
+ }
+
+ /**
+ * リストを走査して、存在しないItemStackが含まれていた場合、それを削除する
+ */
+ private void refreshList(){
+ ArrayList<ItemStack>[] lists=new ArrayList[]{listBlocks, listItems};
+ for(ArrayList<ItemStack> list : lists){
+ int size=list.size();
+ for(int i=0;i<size;){
+ ItemStack itemStack=list.get(i);
+ if(itemStack==null || itemStack.stackSize<=0){
+ list.remove(i);
+ size--;
+ }
+ else i++;
+ }
+ }
+ }
+
+ /**
+ * 指定したItemStackを取り出す
+ * @param req 指定アイテムスタック
+ * @param stackSize 取り出すスタックサイズ
+ * @return
+ */
+ public ItemStack exportItemStack(ItemStack req, int stackSize){
+ if(worldObj.isRemote) return null;
+ if(req==null || req.getItem()==null || stackSize<=0) return null;
+ if(req.getMaxStackSize()<stackSize) stackSize=req.getMaxStackSize();
+
+ req.stackSize=stackSize;
+ FBS.logger.info("exported:" + req.toString());
+
+ //キャッシュを見る
+ int size=cache.size();
+ for(int i=0;i<size;i++){
+ ItemStack itemStack=cache.get(i);
+ if(isItemEquals(itemStack, req)){
+ //キャッシュにあれば
+ stackSize=Math.min(stackSize, itemStack.stackSize);
+ stackSize=Math.min(stackSize, itemStack.getMaxStackSize());
+ ItemStack ret=itemStack.copy();
+ itemStack.stackSize-=stackSize;
+ ret.stackSize=stackSize;
+
+ //キャッシュ更新
+ cache.remove(i);
+
+ if(itemStack.stackSize>0) updateCache(itemStack);
+ else refreshList();
+
+ sendUpdate();
+ return ret;
+ }
+ }
+
+ //リストを見る
+ ArrayList<ItemStack> list=(req.getItem() instanceof ItemBlock)?listBlocks:listItems;
+ for(ItemStack itemStack : list){
+ if(isItemEquals(itemStack, req)){
+ stackSize=Math.min(stackSize, itemStack.stackSize);
+ stackSize=Math.min(stackSize, itemStack.getMaxStackSize());
+ ItemStack ret=itemStack.copy();
+ itemStack.stackSize-=stackSize;
+ ret.stackSize=stackSize;
+
+ if(itemStack.stackSize>0) updateCache(itemStack);
+ else refreshList();
+
+ sendUpdate();
+ return ret;
+ }
+ }
+
+ return null;
+ }
+
+ public boolean hasFragment(){
+ return fragmentTicks>=FRAGEMNT_INTERVAL;
+ }
+ public ItemStack getFragment(boolean reset){
+ if(reset) fragmentTicks=0;
+ return ItemMealFragment.getItemStack(worldObj, xCoord, yCoord, zCoord);
+ }
+
+ @Override
+ public void updateEntity(){
+ if(!worldObj.isRemote){
+ if (fragmentTicks < FRAGEMNT_INTERVAL) fragmentTicks++;
+ else if (fragmentTicks == FRAGEMNT_INTERVAL) {
+ fragmentTicks++;
+ markDirty();
+ worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
+ }
+
+ if(worldObj.getWorldTime()%20==0){
+ AxisAlignedBB aabb=AxisAlignedBB.getBoundingBox(xCoord-2, yCoord-1, zCoord-2, xCoord+3, yCoord+3, yCoord+3);
+ List list=worldObj.getEntitiesWithinAABB(EntityPlayer.class, aabb);
+ for(int i=0;i<list.size();i++){
+ EntityPlayer ep=(EntityPlayer)list.get(i);
+ if(!ep.capabilities.isCreativeMode && worldObj.rand.nextInt(16)==0) FBSEntityPropertiesAPI.LoseSanity(ep, 1, 6, true);
+ }
+ }
+ }
+
+ if(!loaded && getBlockMetadata()==0){
+ ChunkLoadManager.setChunkLoader(worldObj, xCoord, yCoord, zCoord);
+ loaded=true;
+ }
+ }
+
+ @SideOnly(Side.CLIENT)
+ public AxisAlignedBB getRenderBoundingBox() {
+ return AxisAlignedBB.getBoundingBox(xCoord,yCoord,zCoord,xCoord+1,yCoord+2,zCoord+1);
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/storage/TileEntityMealInlet.class b/src/main/java/jp/plusplus/fbs/storage/TileEntityMealInlet.class Binary files differnew file mode 100644 index 0000000..cbbf483 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/storage/TileEntityMealInlet.class diff --git a/src/main/java/jp/plusplus/fbs/storage/TileEntityMealInlet.java b/src/main/java/jp/plusplus/fbs/storage/TileEntityMealInlet.java new file mode 100644 index 0000000..d10af3d --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/storage/TileEntityMealInlet.java @@ -0,0 +1,138 @@ +package jp.plusplus.fbs.storage;
+
+import net.minecraft.inventory.IInventory;
+import net.minecraft.inventory.ISidedInventory;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.nbt.NBTTagList;
+import net.minecraft.network.NetworkManager;
+import net.minecraft.network.Packet;
+import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.tileentity.TileEntityChest;
+import net.minecraftforge.common.util.ForgeDirection;
+
+/**
+ * Created by plusplus_F on 2016/03/07.
+ */
+public class TileEntityMealInlet extends TileEntity implements IMealDevice {
+ public ItemStack fragment;
+
+ @Override
+ public Packet getDescriptionPacket() {
+ NBTTagCompound nbtTagCompound = new NBTTagCompound();
+ this.writeToNBT(nbtTagCompound);
+ return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 1, nbtTagCompound);
+ }
+ @Override
+ public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
+ this.readFromNBT(pkt.func_148857_g());
+ }
+
+ @Override
+ public void readFromNBT(NBTTagCompound par1NBTTagCompound){
+ super.readFromNBT(par1NBTTagCompound);
+ if(par1NBTTagCompound.hasKey("Fragment")) fragment=ItemStack.loadItemStackFromNBT(par1NBTTagCompound.getCompoundTag("Fragment"));
+ else fragment=null;
+ }
+ @Override
+ public void writeToNBT(NBTTagCompound par1NBTTagCompound){
+ super.writeToNBT(par1NBTTagCompound);
+ if(fragment!=null) par1NBTTagCompound.setTag("Fragment", fragment.writeToNBT(new NBTTagCompound()));
+ }
+
+ @Override
+ public ItemStack getFragment() {
+ return fragment;
+ }
+
+ @Override
+ public void setFragment(ItemStack f){
+ fragment=f;
+ }
+
+ @Override
+ public boolean hasFragment() {
+ return fragment!=null;
+ }
+
+ @Override
+ public void updateEntity(){
+ if(!worldObj.isRemote && worldObj.getWorldTime()%10==0){
+ ItemStack packet=null;
+ TileEntityMeal tem=ItemMealFragment.getTileEntity(fragment);
+ if(tem==null) return;
+
+ //パケットを得る
+ ForgeDirection dir=ForgeDirection.getOrientation(worldObj.getBlockMetadata(xCoord, yCoord, zCoord)&7);
+ TileEntity te=worldObj.getTileEntity(xCoord+dir.offsetX, yCoord+dir.offsetY, zCoord+dir.offsetZ);
+ if(te instanceof ISidedInventory){
+ ISidedInventory inv=(ISidedInventory)te;
+ int side=dir.ordinal()^1;
+ int[] index=inv.getAccessibleSlotsFromSide(side);
+
+ for(int i=0;i<index.length;i++){
+ ItemStack itemStack=inv.getStackInSlot(index[i]);
+ if(itemStack!=null && inv.canExtractItem(index[i], itemStack, side)){
+ packet=itemStack.copy();
+ packet.stackSize=1;
+ itemStack.stackSize--;
+ if(itemStack.stackSize<=0) inv.setInventorySlotContents(index[i], null);
+ te.markDirty();
+ break;
+ }
+ }
+ }
+ else if(te instanceof TileEntityChest){
+ TileEntityChest[] c=new TileEntityChest[2];
+ c[0]=(TileEntityChest)te;
+
+ if(c[0].adjacentChestXPos!=null) c[1]=c[0].adjacentChestXPos;
+ if(c[0].adjacentChestXNeg!=null) c[1]=c[0].adjacentChestXNeg;
+ if(c[0].adjacentChestZPos!=null) c[1]=c[0].adjacentChestZPos;
+ if(c[0].adjacentChestZNeg!=null) c[1]=c[0].adjacentChestZNeg;
+
+ for(TileEntityChest inv : c){
+ if(inv==null) break;
+
+ boolean f=false;
+ int size=inv.getSizeInventory();
+ for(int i=0;i<size;i++){
+ ItemStack itemStack=inv.getStackInSlot(i);
+ if(itemStack!=null){
+ packet=itemStack.copy();
+ packet.stackSize=1;
+ itemStack.stackSize--;
+ if(itemStack.stackSize<=0) inv.setInventorySlotContents(i, null);
+ te.markDirty();
+ f=true;
+ break;
+ }
+ }
+
+ if(f) break;
+ }
+ }
+ else if(te instanceof IInventory){
+ IInventory inv=(IInventory)te;
+ int size=inv.getSizeInventory();
+ for(int i=0;i<size;i++){
+ ItemStack itemStack=inv.getStackInSlot(i);
+ if(itemStack!=null){
+ packet=itemStack.copy();
+ packet.stackSize=1;
+ itemStack.stackSize--;
+ if(itemStack.stackSize<=0) inv.setInventorySlotContents(i, null);
+ te.markDirty();
+ break;
+ }
+ }
+ }
+
+ //パケットがあったら転送
+ if(packet!=null){
+ tem.insertItemStack(packet);
+ }
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/storage/TileEntityMealOutletSingle.class b/src/main/java/jp/plusplus/fbs/storage/TileEntityMealOutletSingle.class Binary files differnew file mode 100644 index 0000000..4afbb9f --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/storage/TileEntityMealOutletSingle.class diff --git a/src/main/java/jp/plusplus/fbs/storage/TileEntityMealOutletSingle.java b/src/main/java/jp/plusplus/fbs/storage/TileEntityMealOutletSingle.java new file mode 100644 index 0000000..e79ca17 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/storage/TileEntityMealOutletSingle.java @@ -0,0 +1,124 @@ +package jp.plusplus.fbs.storage;
+
+import net.minecraft.inventory.IInventory;
+import net.minecraft.inventory.ISidedInventory;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.tileentity.TileEntityChest;
+import net.minecraft.tileentity.TileEntityFurnace;
+import net.minecraftforge.common.util.ForgeDirection;
+
+/**
+ * Created by plusplus_F on 2016/03/07.
+ */
+public class TileEntityMealOutletSingle extends TileEntityMealInlet {
+ public ItemStack requirement;
+
+ @Override
+ public void readFromNBT(NBTTagCompound par1NBTTagCompound){
+ super.readFromNBT(par1NBTTagCompound);
+ if(par1NBTTagCompound.hasKey("Requirement")) requirement=ItemStack.loadItemStackFromNBT(par1NBTTagCompound.getCompoundTag("Requirement"));
+ else requirement=null;
+ }
+ @Override
+ public void writeToNBT(NBTTagCompound par1NBTTagCompound){
+ super.writeToNBT(par1NBTTagCompound);
+ if(requirement!=null) par1NBTTagCompound.setTag("Requirement", requirement.writeToNBT(new NBTTagCompound()));
+ }
+
+ public boolean hasRequirement(){
+ return requirement!=null;
+ }
+ public ItemStack getRequirement(){
+ return requirement;
+ }
+ public void setRequirement(ItemStack req){
+ requirement=req;
+ }
+
+ protected ItemStack getItemStack(){
+ if(!hasRequirement() && !hasFragment()) return null;
+
+ TileEntityMeal tem=ItemMealFragment.getTileEntity(getFragment());
+ return tem.exportItemStack(requirement, requirement.stackSize);
+ }
+
+ @Override
+ public void updateEntity(){
+ if(!worldObj.isRemote && requirement!=null && worldObj.getWorldTime()%10==0){
+ TileEntityMeal tem=ItemMealFragment.getTileEntity(fragment);
+ if(tem==null) return;
+
+ ForgeDirection dir=ForgeDirection.getOrientation(worldObj.getBlockMetadata(xCoord, yCoord, zCoord)&7);
+ TileEntity te=worldObj.getTileEntity(xCoord+dir.offsetX, yCoord+dir.offsetY, zCoord+dir.offsetZ);
+
+ if(te instanceof ISidedInventory){
+ ISidedInventory inv=(ISidedInventory)te;
+ int side=dir.ordinal()^1;
+ int[] index=inv.getAccessibleSlotsFromSide(side);
+
+ for(int i=0;i<index.length;i++){
+ if(((ISidedInventory) te).canInsertItem(index[i], requirement, side)){
+ ItemStack itemStack=inv.getStackInSlot(index[i]);
+ if((itemStack==null || (itemStack.isItemEqual(requirement) && ItemStack.areItemStackTagsEqual(itemStack, requirement) && itemStack.stackSize+1<=itemStack.getMaxStackSize()))){
+ ItemStack p=tem.exportItemStack(requirement, 1);
+ if(p==null) return;
+
+ if(itemStack==null) inv.setInventorySlotContents(i, p.copy());
+ else itemStack.stackSize++;
+
+ te.markDirty();
+ return;
+ }
+ }
+ }
+ }
+ else if(te instanceof TileEntityChest){
+ TileEntityChest[] c=new TileEntityChest[2];
+ c[0]=(TileEntityChest)te;
+
+ if(c[0].adjacentChestXPos!=null) c[1]=c[0].adjacentChestXPos;
+ if(c[0].adjacentChestXNeg!=null) c[1]=c[0].adjacentChestXNeg;
+ if(c[0].adjacentChestZPos!=null) c[1]=c[0].adjacentChestZPos;
+ if(c[0].adjacentChestZNeg!=null) c[1]=c[0].adjacentChestZNeg;
+
+ for(TileEntityChest inv : c){
+ if(inv==null) break;
+
+ int size=inv.getSizeInventory();
+ for(int i=0;i<size;i++){
+ ItemStack itemStack=inv.getStackInSlot(i);
+ if((itemStack==null || (itemStack.isItemEqual(requirement) && ItemStack.areItemStackTagsEqual(itemStack, requirement) && itemStack.stackSize+1<=itemStack.getMaxStackSize()))){
+ ItemStack p=tem.exportItemStack(requirement, 1);
+ if(p==null) return;
+
+ if(itemStack==null) inv.setInventorySlotContents(i, p.copy());
+ else itemStack.stackSize++;
+
+ te.markDirty();
+ return;
+ }
+ }
+ }
+ }
+ else if(te instanceof IInventory){
+ IInventory inv=(IInventory)te;
+ int size=inv.getSizeInventory();
+ for(int i=0;i<size;i++){
+ ItemStack itemStack=inv.getStackInSlot(i);
+ if((itemStack==null || (itemStack.isItemEqual(requirement) && ItemStack.areItemStackTagsEqual(itemStack, requirement) && itemStack.stackSize+1<=itemStack.getMaxStackSize()))){
+ ItemStack p=tem.exportItemStack(requirement, 1);
+ if(p==null) return;
+
+ if(itemStack==null) inv.setInventorySlotContents(i, p.copy());
+ else itemStack.stackSize++;
+
+ te.markDirty();
+ return;
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/storage/TileEntityMealTerminal.class b/src/main/java/jp/plusplus/fbs/storage/TileEntityMealTerminal.class Binary files differnew file mode 100644 index 0000000..21160d8 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/storage/TileEntityMealTerminal.class diff --git a/src/main/java/jp/plusplus/fbs/storage/TileEntityMealTerminal.java b/src/main/java/jp/plusplus/fbs/storage/TileEntityMealTerminal.java new file mode 100644 index 0000000..4414d6e --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/storage/TileEntityMealTerminal.java @@ -0,0 +1,55 @@ +package jp.plusplus.fbs.storage;
+
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.network.NetworkManager;
+import net.minecraft.network.Packet;
+import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
+import net.minecraft.tileentity.TileEntity;
+
+/**
+ * Created by plusplus_F on 2016/03/08.
+ */
+public class TileEntityMealTerminal extends TileEntity implements IMealDevice {
+ public ItemStack fragment;
+
+ @Override
+ public Packet getDescriptionPacket() {
+ NBTTagCompound nbtTagCompound = new NBTTagCompound();
+ this.writeToNBT(nbtTagCompound);
+ return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 1, nbtTagCompound);
+ }
+ @Override
+ public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
+ this.readFromNBT(pkt.func_148857_g());
+ }
+
+ @Override
+ public void readFromNBT(NBTTagCompound par1NBTTagCompound){
+ super.readFromNBT(par1NBTTagCompound);
+ if(par1NBTTagCompound.hasKey("Fragment")) fragment=ItemStack.loadItemStackFromNBT(par1NBTTagCompound.getCompoundTag("Fragment"));
+ else fragment=null;
+ }
+ @Override
+ public void writeToNBT(NBTTagCompound par1NBTTagCompound){
+ super.writeToNBT(par1NBTTagCompound);
+ if(fragment!=null) par1NBTTagCompound.setTag("Fragment", fragment.writeToNBT(new NBTTagCompound()));
+ }
+
+ @Override
+ public ItemStack getFragment() {
+ return fragment;
+ }
+
+ @Override
+ public void setFragment(ItemStack f){
+ fragment=f;
+ markDirty();
+ worldObj.markBlockForUpdate(xCoord,yCoord,zCoord);
+ }
+
+ @Override
+ public boolean hasFragment() {
+ return fragment!=null;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/tab/Tab.class b/src/main/java/jp/plusplus/fbs/tab/Tab.class Binary files differnew file mode 100644 index 0000000..d3bbdfe --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/tab/Tab.class diff --git a/src/main/java/jp/plusplus/fbs/tab/Tab.java b/src/main/java/jp/plusplus/fbs/tab/Tab.java new file mode 100644 index 0000000..12293bd --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/tab/Tab.java @@ -0,0 +1,31 @@ +package jp.plusplus.fbs.tab;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.item.ItemCore;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.init.Items;
+import net.minecraft.item.Item;
+
+/**
+ * Created by plusplus_F on 2015/01/31.
+ */
+public class Tab extends CreativeTabs{
+ public Tab(String label) {
+ super(label);
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public Item getTabIconItem() {
+ return ItemCore.butterfly;
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public String getTranslatedTabLabel() {
+ //return FBS.NAME+":Crucible of Sorcery";
+ return FBS.NAME+":Assorted Magics";
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/tab/TabAlchemy.class b/src/main/java/jp/plusplus/fbs/tab/TabAlchemy.class Binary files differnew file mode 100644 index 0000000..3487b4e --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/tab/TabAlchemy.class diff --git a/src/main/java/jp/plusplus/fbs/tab/TabAlchemy.java b/src/main/java/jp/plusplus/fbs/tab/TabAlchemy.java new file mode 100644 index 0000000..e6c583d --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/tab/TabAlchemy.java @@ -0,0 +1,30 @@ +package jp.plusplus.fbs.tab;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.item.ItemCore;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.item.Item;
+import net.minecraft.util.StatCollector;
+
+/**
+ * Created by plusplus_F on 2015/08/26.
+ */
+public class TabAlchemy extends CreativeTabs{
+ public TabAlchemy(String label) {
+ super(label);
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public Item getTabIconItem() {
+ return ItemCore.lavender;
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public String getTranslatedTabLabel() {
+ return FBS.NAME+":Secret Art of Alchemy";
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/tab/TabBooks.class b/src/main/java/jp/plusplus/fbs/tab/TabBooks.class Binary files differnew file mode 100644 index 0000000..bd5a92a --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/tab/TabBooks.class diff --git a/src/main/java/jp/plusplus/fbs/tab/TabBooks.java b/src/main/java/jp/plusplus/fbs/tab/TabBooks.java new file mode 100644 index 0000000..eec3a99 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/tab/TabBooks.java @@ -0,0 +1,31 @@ +package jp.plusplus.fbs.tab;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.item.ItemCore;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.init.Items;
+import net.minecraft.item.Item;
+import net.minecraft.util.StatCollector;
+
+/**
+ * Created by plusplus_F on 2015/08/26.
+ */
+public class TabBooks extends CreativeTabs{
+ public TabBooks(String label) {
+ super(label);
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public Item getTabIconItem() {
+ return ItemCore.bookWhite;
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public String getTranslatedTabLabel() {
+ return FBS.NAME+":Forbidden Books of Sorcery";
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/tab/TabPottery.class b/src/main/java/jp/plusplus/fbs/tab/TabPottery.class Binary files differnew file mode 100644 index 0000000..a84cceb --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/tab/TabPottery.class diff --git a/src/main/java/jp/plusplus/fbs/tab/TabPottery.java b/src/main/java/jp/plusplus/fbs/tab/TabPottery.java new file mode 100644 index 0000000..e3cdf5b --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/tab/TabPottery.java @@ -0,0 +1,31 @@ +package jp.plusplus.fbs.tab;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.item.ItemCore;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.init.Items;
+import net.minecraft.item.Item;
+import net.minecraft.util.StatCollector;
+
+/**
+ * Created by plusplus_F on 2015/08/26.
+ */
+public class TabPottery extends CreativeTabs{
+ public TabPottery(String label) {
+ super(label);
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public Item getTabIconItem() {
+ return Items.flower_pot;
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public String getTranslatedTabLabel() {
+ return FBS.NAME+":Ceramics Time";
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/tab/TabSpirit.class b/src/main/java/jp/plusplus/fbs/tab/TabSpirit.class Binary files differnew file mode 100644 index 0000000..fb5a181 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/tab/TabSpirit.class diff --git a/src/main/java/jp/plusplus/fbs/tab/TabSpirit.java b/src/main/java/jp/plusplus/fbs/tab/TabSpirit.java new file mode 100644 index 0000000..25b3aa2 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/tab/TabSpirit.java @@ -0,0 +1,29 @@ +package jp.plusplus.fbs.tab;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.item.ItemCore;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.item.Item;
+
+/**
+ * Created by plusplus_F on 2015/11/08.
+ */
+public class TabSpirit extends CreativeTabs{
+ public TabSpirit(String label) {
+ super(label);
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public Item getTabIconItem() {
+ return ItemCore.stoneActiveMale;
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public String getTranslatedTabLabel() {
+ return FBS.NAME+":Contract with Spirit";
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/tileentity/TankFBS.class b/src/main/java/jp/plusplus/fbs/tileentity/TankFBS.class Binary files differnew file mode 100644 index 0000000..b50d4ab --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/tileentity/TankFBS.class diff --git a/src/main/java/jp/plusplus/fbs/tileentity/TankFBS.java b/src/main/java/jp/plusplus/fbs/tileentity/TankFBS.java new file mode 100644 index 0000000..f997693 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/tileentity/TankFBS.java @@ -0,0 +1,50 @@ +package jp.plusplus.fbs.tileentity;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidStack;
+import net.minecraftforge.fluids.FluidTank;
+
+/**
+ * Createdby pluslus_Fon 2015/05/16.
+ */
+public class TankFBS extends FluidTank {
+ public TankFBS(int capacity) {
+ super(capacity);
+ }
+
+ public TankFBS(FluidStack stack, int capacity) {
+ super(stack, capacity);
+ }
+
+ public TankFBS(Fluid fluid, int amount, int capacity) {
+ super(fluid, amount, capacity);
+ }
+
+ public boolean isEmpty() {
+ return (getFluid() == null) || getFluid().getFluid() == null || (getFluid().amount <= 0);
+ }
+
+ public boolean isFull() {
+ return (getFluid() != null) && (getFluid().amount == getCapacity());
+ }
+
+ public Fluid getFluidType() {
+ return getFluid() != null ? getFluid().getFluid() : null;
+ }
+
+ public String getFluidName(){
+ return (this.fluid != null) && (this.fluid.getFluid() != null) ? this.fluid.getFluid().getLocalizedName(this.fluid): "Empty";
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void setAmount(int par1){
+ if (this.fluid != null && this.fluid.getFluid() != null){
+ this.fluid.amount = par1;
+ if(fluid.amount>capacity){
+ fluid.amount=capacity;
+ }
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/tileentity/TileEntityAlchemyCauldron$MaterialPair.class b/src/main/java/jp/plusplus/fbs/tileentity/TileEntityAlchemyCauldron$MaterialPair.class Binary files differnew file mode 100644 index 0000000..308d607 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/tileentity/TileEntityAlchemyCauldron$MaterialPair.class diff --git a/src/main/java/jp/plusplus/fbs/tileentity/TileEntityAlchemyCauldron.class b/src/main/java/jp/plusplus/fbs/tileentity/TileEntityAlchemyCauldron.class Binary files differnew file mode 100644 index 0000000..02fd483 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/tileentity/TileEntityAlchemyCauldron.class diff --git a/src/main/java/jp/plusplus/fbs/tileentity/TileEntityAlchemyCauldron.java b/src/main/java/jp/plusplus/fbs/tileentity/TileEntityAlchemyCauldron.java new file mode 100644 index 0000000..fdac55c --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/tileentity/TileEntityAlchemyCauldron.java @@ -0,0 +1,478 @@ +package jp.plusplus.fbs.tileentity;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.alchemy.AlchemyRegistry;
+import jp.plusplus.fbs.alchemy.characteristic.CharacteristicBase;
+import jp.plusplus.fbs.alchemy.characteristic.CharacteristicQuality;
+import jp.plusplus.fbs.api.FBSEntityPropertiesAPI;
+import jp.plusplus.fbs.exprop.FBSEntityProperties;
+import net.minecraft.block.material.Material;
+import net.minecraft.entity.item.EntityItem;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.nbt.NBTTagList;
+import net.minecraft.network.NetworkManager;
+import net.minecraft.network.Packet;
+import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.AxisAlignedBB;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+
+/**
+ * Created by plusplus_F on 2015/09/23.
+ */
+public class TileEntityAlchemyCauldron extends TileEntity implements IInventory{
+ public static final int MATERIAL=0;
+ public static final int PRODUCT=1;
+ public static final int RECIPE=2;
+ public ItemStack[] itemStacks=new ItemStack[3];
+ public ArrayList<ItemStack> inputMaterial=new ArrayList<ItemStack>();
+ public ArrayList<MaterialPair> materials=new ArrayList<MaterialPair>(); //描画用
+
+ protected ItemStack lastMaterialItemStack;
+ protected ItemStack lastProductItemStack;
+ protected ItemStack lastRecipeItemStack;
+ public AlchemyRegistry.Recipe cachedRecipe;
+
+ @Override
+ public Packet getDescriptionPacket() {
+ NBTTagCompound nbtTagCompound = new NBTTagCompound();
+ this.writeToNBT(nbtTagCompound);
+ return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 1, nbtTagCompound);
+ }
+
+ @Override
+ public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
+ this.readFromNBT(pkt.func_148857_g());
+ }
+
+ @Override
+ public void readFromNBT(NBTTagCompound par1NBTTagCompound) {
+ super.readFromNBT(par1NBTTagCompound);
+
+ //アイテムスロット
+ boolean productFlag=itemStacks[PRODUCT]==null;
+ NBTTagList nbttaglist = (NBTTagList) par1NBTTagCompound.getTag("Items");
+ itemStacks = new ItemStack[getSizeInventory()];
+ for (int i = 0; i < nbttaglist.tagCount(); i++) {
+ NBTTagCompound nbt = nbttaglist.getCompoundTagAt(i);
+ byte b0 = nbt.getByte("Slot");
+
+ if (b0 >= 0 && b0 < itemStacks.length) {
+ itemStacks[b0] = ItemStack.loadItemStackFromNBT(nbt);
+ }
+ }
+
+ //投入済み素材
+ nbttaglist = (NBTTagList) par1NBTTagCompound.getTag("InputMaterials");
+ inputMaterial.clear();
+ for (int i = 0; i < nbttaglist.tagCount(); i++) {
+ NBTTagCompound nbt = nbttaglist.getCompoundTagAt(i);
+ inputMaterial.add(ItemStack.loadItemStackFromNBT(nbt));
+ }
+
+ //描画用素材リスト
+ nbttaglist = (NBTTagList) par1NBTTagCompound.getTag("Materials");
+ materials.clear();
+ for (int i = 0; i < nbttaglist.tagCount(); i++) {
+ NBTTagCompound nbt = nbttaglist.getCompoundTagAt(i);
+ MaterialPair p=new MaterialPair(nbt.getString("Name"));
+ if(nbt.getBoolean("Satisfy")) p.set(true);
+ materials.add(p);
+ }
+
+ //キャッシュたち
+ if(par1NBTTagCompound.hasKey("LastMaterial")) lastMaterialItemStack=ItemStack.loadItemStackFromNBT(par1NBTTagCompound.getCompoundTag("LastMaterial"));
+ else lastMaterialItemStack=null;
+
+ if(par1NBTTagCompound.hasKey("LastProduct")) lastProductItemStack=ItemStack.loadItemStackFromNBT(par1NBTTagCompound.getCompoundTag("LastProduct"));
+ else lastProductItemStack=null;
+
+ if(par1NBTTagCompound.hasKey("LastRecipe")) lastRecipeItemStack=ItemStack.loadItemStackFromNBT(par1NBTTagCompound.getCompoundTag("LastRecipe"));
+ else lastRecipeItemStack=null;
+
+ if(par1NBTTagCompound.hasKey("CachedRecipe")) cachedRecipe=AlchemyRegistry.GetRecipe(ItemStack.loadItemStackFromNBT(par1NBTTagCompound.getCompoundTag("CachedRecipe")));
+ else cachedRecipe=null;
+
+ }
+
+ @Override
+ public void writeToNBT(NBTTagCompound par1NBTTagCompound){
+ super.writeToNBT(par1NBTTagCompound);
+
+ //アイテムスロット
+ NBTTagList nbttaglist = new NBTTagList();
+ for (int i=0;i<itemStacks.length;i++){
+ if (itemStacks[i] != null){
+ NBTTagCompound nbt = new NBTTagCompound();
+ nbt.setByte("Slot", (byte) i);
+ itemStacks[i].writeToNBT(nbt);
+ nbttaglist.appendTag(nbt);
+ }
+ }
+ par1NBTTagCompound.setTag("Items", nbttaglist);
+
+ //投入済み素材
+ nbttaglist = new NBTTagList();
+ for (int i=0;i<inputMaterial.size();i++) {
+ NBTTagCompound nbt = new NBTTagCompound();
+ inputMaterial.get(i).writeToNBT(nbt);
+ nbttaglist.appendTag(nbt);
+ }
+ par1NBTTagCompound.setTag("InputMaterials", nbttaglist);
+
+ //描画用素材リスト
+ nbttaglist = new NBTTagList();
+ for (int i=0;i<materials.size();i++) {
+ NBTTagCompound nbt = new NBTTagCompound();
+ MaterialPair p=materials.get(i);
+ nbt.setString("Name", p.getName());
+ nbt.setBoolean("Satisfy", p.get());
+ nbttaglist.appendTag(nbt);
+ }
+ par1NBTTagCompound.setTag("Materials", nbttaglist);
+
+ //キャッシュたち
+ if(lastMaterialItemStack!=null){
+ NBTTagCompound nbt=new NBTTagCompound();
+ lastMaterialItemStack.writeToNBT(nbt);
+ par1NBTTagCompound.setTag("LastMaterial", nbt);
+ }
+ if(lastProductItemStack!=null){
+ NBTTagCompound nbt=new NBTTagCompound();
+ lastProductItemStack.writeToNBT(nbt);
+ par1NBTTagCompound.setTag("LastProduct", nbt);
+ }
+ if(lastRecipeItemStack!=null){
+ NBTTagCompound nbt=new NBTTagCompound();
+ lastRecipeItemStack.writeToNBT(nbt);
+ par1NBTTagCompound.setTag("LastRecipe", nbt);
+ }
+ if(cachedRecipe!=null){
+ NBTTagCompound nbt=new NBTTagCompound();
+ cachedRecipe.getKey().writeToNBT(nbt);
+ par1NBTTagCompound.setTag("CachedRecipe", nbt);
+ }
+ }
+
+ @Override
+ public void updateEntity(){
+ boolean recipeChanged=false;
+ boolean materialsChanged=false;
+ boolean productChanged=false;
+
+ //-----------------------------------------------------------------------
+ // 完成品スロットの更新
+ //-----------------------------------------------------------------------
+ if(itemStacks[PRODUCT]!=lastProductItemStack){
+ productChanged=true;
+ lastProductItemStack=itemStacks[PRODUCT];
+ }
+
+ //-----------------------------------------------------------------------
+ // レシピの更新
+ //-----------------------------------------------------------------------
+ if(itemStacks[RECIPE]!=lastRecipeItemStack){
+ AlchemyRegistry.Recipe last=cachedRecipe;
+
+ if(itemStacks[RECIPE]!=null) cachedRecipe=AlchemyRegistry.GetRecipe(itemStacks[RECIPE]);
+ else cachedRecipe=null;
+
+ if(last!=cachedRecipe){
+ recipeChanged=true;
+ //アイテムのドロップ
+ if(!worldObj.isRemote){
+ for(ItemStack it : inputMaterial){
+ dropItemStack(it);
+ }
+ }
+ inputMaterial.clear();
+
+ //素材リストの更新
+ materials.clear();
+ if(cachedRecipe!=null){
+ for(String str : cachedRecipe.getMaterialList()){
+ materials.add(new MaterialPair(str));
+ }
+ }
+ }
+ }
+ lastRecipeItemStack=itemStacks[RECIPE];
+
+ //-----------------------------------------------------------------------
+ // 投入素材の更新
+ //-----------------------------------------------------------------------
+ if(itemStacks[RECIPE]!=null && cachedRecipe!=null && (recipeChanged || productChanged || itemStacks[MATERIAL]!=lastMaterialItemStack)){
+ //素材スロットの更新
+ while(itemStacks[MATERIAL]!=null && AlchemyRegistry.IsMaterial(cachedRecipe, itemStacks[MATERIAL], inputMaterial)){
+ materialsChanged=true;
+
+ //素材リストの更新
+ for(MaterialPair it : materials){
+ if(!it.get() && AlchemyRegistry.IsMatching(it.getName(), itemStacks[MATERIAL])){
+ it.set(true);
+ break;
+ }
+ }
+ ItemStack itc=itemStacks[MATERIAL].copy();
+ itc.stackSize=1;
+ inputMaterial.add(itc);
+
+ //素材スロットの更新
+ itemStacks[MATERIAL].stackSize--;
+ if(itemStacks[MATERIAL].stackSize<=0) setInventorySlotContents(MATERIAL, null);
+
+ }
+ }
+ lastMaterialItemStack=itemStacks[MATERIAL];
+
+ //-----------------------------------------------------------------------
+ // 完成品の生成
+ //-----------------------------------------------------------------------
+ /*
+ if((productChanged || materialsChanged) && itemStacks[PRODUCT]==null && AlchemyRegistry.IsSatisfied(cachedRecipe, inputMaterial)){
+ if(!worldObj.isRemote) setInventorySlotContents(PRODUCT, AlchemyRegistry.GetAlchemyProduct(cachedRecipe, inputMaterial));
+ inputMaterial.clear();
+
+ //素材リストの更新
+ materials.clear();
+ if(cachedRecipe!=null){
+ for(String str : cachedRecipe.getMaterialList()){
+ materials.add(new MaterialPair(str));
+ }
+ }
+ productChanged=true;
+ }
+ */
+
+ if(materialsChanged || productChanged || recipeChanged) markDirty();
+ }
+
+ /**
+ * 周囲にアイテムスタックを落とす
+ * @param itemStack
+ */
+ protected void dropItemStack(ItemStack itemStack){
+ if (itemStack != null){
+ float f = AlchemyRegistry.getRandom().nextFloat() * 0.8F + 0.1F;
+ float f1 = AlchemyRegistry.getRandom().nextFloat() * 0.8F + 0.1F;
+ float f2 = AlchemyRegistry.getRandom().nextFloat() * 0.8F + 0.1F;
+
+ while (itemStack.stackSize > 0){
+ int k1 = AlchemyRegistry.getRandom().nextInt(21) + 10;
+
+ if (k1 > itemStack.stackSize){
+ k1 = itemStack.stackSize;
+ }
+
+ itemStack.stackSize -= k1;
+ EntityItem entityitem = new EntityItem(worldObj, (double)((float)xCoord + f), (double)((float)yCoord + f1), (double)((float)zCoord + f2), new ItemStack(itemStack.getItem(), k1, itemStack.getItemDamage()));
+
+ if (itemStack.hasTagCompound()){
+ entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemStack.getTagCompound().copy());
+ }
+
+ float f3 = 0.05F;
+ entityitem.motionX = (double)((float)AlchemyRegistry.getRandom().nextGaussian() * f3);
+ entityitem.motionY = (double)((float)AlchemyRegistry.getRandom().nextGaussian() * f3 + 0.2F);
+ entityitem.motionZ = (double)((float)AlchemyRegistry.getRandom().nextGaussian() * f3);
+ worldObj.spawnEntityInWorld(entityitem);
+ }
+ }
+ }
+
+ public float getCompoundingProbability(EntityPlayer ep){
+ int mLv=FBSEntityPropertiesAPI.GetMagicLevel(ep);
+ int lv=cachedRecipe.getLevel();
+
+ float p=cachedRecipe.getProb()+0.02f*Math.max(mLv-lv, 0);
+ if(p<0) p=0;
+ if(p>5.f) p=5.f;
+
+ return p;
+ }
+
+ public boolean canCompounding(){
+ return itemStacks[PRODUCT]==null && AlchemyRegistry.IsSatisfied(cachedRecipe, inputMaterial);
+ }
+
+ /**
+ * 調合をする
+ * @param ep
+ */
+ public void tryCompounding(EntityPlayer ep){
+ if(this.cachedRecipe==null) return;
+
+ //成功判定
+ float pr=getCompoundingProbability(ep);
+ if(worldObj.rand.nextFloat()<pr){
+ setInventorySlotContents(PRODUCT, AlchemyRegistry.GetAlchemyProduct(cachedRecipe, inputMaterial));
+
+ //品質の向上
+ if(pr>1.f){
+ ItemStack product=getStackInSlot(PRODUCT);
+ if(product!=null){
+ ArrayList<CharacteristicBase> cbs=AlchemyRegistry.ReadCharacteristicFromNBT(product.getTagCompound());
+
+ while(pr>1.f){
+ float pp=pr-1.f;
+ if(worldObj.rand.nextFloat()<pp){
+ //品質は2,(null),0,1の順で変化する
+ CharacteristicQuality cq=null;
+ for(CharacteristicBase cb : cbs){
+ if(cb instanceof CharacteristicQuality){
+ cq=(CharacteristicQuality)cb;
+ break;
+ }
+ }
+ if(cq==null){
+ cq=new CharacteristicQuality();
+ cq.setValue(0);
+ cbs.add(cq);
+ }
+
+ if(cq.getValue()==0) cq.setValue(1);
+ else if(cq.getValue()==2) cbs.remove(cq);
+ }
+
+ pr-=1.f;
+ }
+ NBTTagCompound nbt=new NBTTagCompound();
+ AlchemyRegistry.WriteCharacteristicToNBT(nbt, cbs);
+ product.setTagCompound(nbt);
+ }
+ }
+ }
+
+ //素材の消費
+ inputMaterial.clear();
+
+ //素材リストの更新
+ materials.clear();
+ if(cachedRecipe!=null){
+ for(String str : cachedRecipe.getMaterialList()){
+ materials.add(new MaterialPair(str));
+ }
+ }
+
+ markDirty();
+ }
+
+ @SideOnly(Side.CLIENT)
+ public AxisAlignedBB getRenderBoundingBox() {
+ return AxisAlignedBB.getBoundingBox(xCoord-1,yCoord,zCoord-1,xCoord+2,yCoord+1,zCoord+2);
+ }
+
+ //--------------------------------------------------------------------------------------------
+
+ @Override
+ public int getSizeInventory() {
+ return itemStacks.length;
+ }
+
+ @Override
+ public ItemStack getStackInSlot(int p_70301_1_) {
+ if(p_70301_1_<0 || p_70301_1_>=itemStacks.length) return null;
+ return itemStacks[p_70301_1_];
+ }
+
+ @Override
+ public ItemStack decrStackSize(int i, int j) {
+ if (itemStacks[i] != null){
+ ItemStack itemstack;
+
+ if (itemStacks[i].stackSize <= j){
+ itemstack = itemStacks[i];
+ itemStacks[i] = null;
+ markDirty();
+ return itemstack;
+ }
+ else{
+ itemstack = itemStacks[i].splitStack(j);
+
+ if (itemStacks[i].stackSize == 0){
+ itemStacks[i] = null;
+ }
+ markDirty();
+ return itemstack;
+ }
+ }
+ else{
+ return null;
+ }
+ }
+
+ @Override
+ public ItemStack getStackInSlotOnClosing(int i) {
+ if (itemStacks[i] != null){
+ ItemStack itemstack = itemStacks[i];
+ itemStacks[i] = null;
+ markDirty();
+ return itemstack;
+ }
+ else{
+ return null;
+ }
+ }
+
+ @Override
+ public void setInventorySlotContents(int i, ItemStack itemStack) {
+ itemStacks[i] = itemStack;
+ if (itemStack != null && itemStack.stackSize > this.getInventoryStackLimit()){
+ itemStack.stackSize = getInventoryStackLimit();
+ }
+ markDirty();
+ }
+
+ @Override
+ public String getInventoryName() {
+ return getBlockType().getLocalizedName();
+ }
+
+ @Override
+ public boolean hasCustomInventoryName() {
+ return false;
+ }
+ @Override
+ public int getInventoryStackLimit() {
+ return 64;
+ }
+
+ @Override
+ public boolean isUseableByPlayer(EntityPlayer entityPlayer) {
+ return worldObj.getTileEntity(xCoord, yCoord, zCoord) != this ? false : entityPlayer.getDistanceSq((double)xCoord+0.5D, (double)yCoord+0.5D, (double)zCoord+0.5D) <= 64.0D;
+ }
+
+ @Override
+ public void openInventory() {
+
+ }
+
+ @Override
+ public void closeInventory() {
+
+ }
+
+ @Override
+ public boolean isItemValidForSlot(int p_94041_1_, ItemStack p_94041_2_) {
+ return false;
+ }
+
+ public class MaterialPair{
+ public String name;
+ public boolean satisfy;
+
+ public MaterialPair(String name){
+ this.name=name;
+ }
+ public void set(boolean flag){ satisfy=flag; }
+ public boolean get(){ return satisfy; }
+ public String getName(){ return name; }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/tileentity/TileEntityExtractingFurnace.class b/src/main/java/jp/plusplus/fbs/tileentity/TileEntityExtractingFurnace.class Binary files differnew file mode 100644 index 0000000..5858a7e --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/tileentity/TileEntityExtractingFurnace.class diff --git a/src/main/java/jp/plusplus/fbs/tileentity/TileEntityExtractingFurnace.java b/src/main/java/jp/plusplus/fbs/tileentity/TileEntityExtractingFurnace.java new file mode 100644 index 0000000..28e55d2 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/tileentity/TileEntityExtractingFurnace.java @@ -0,0 +1,351 @@ +package jp.plusplus.fbs.tileentity;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.Registry;
+import jp.plusplus.fbs.block.BlockCore;
+import jp.plusplus.fbs.block.BlockExtractingFurnace;
+import jp.plusplus.fbs.item.ItemBookSorcery;
+import jp.plusplus.fbs.item.ItemCore;
+import jp.plusplus.fbs.item.ItemOldBook;
+import net.minecraft.client.resources.I18n;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.ISidedInventory;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.nbt.NBTTagList;
+import net.minecraft.network.NetworkManager;
+import net.minecraft.network.Packet;
+import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.IIcon;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.*;
+
+/**
+ * Createdby pluslus_Fon 2015/06/08.
+ */
+public class TileEntityExtractingFurnace extends TileEntity implements ISidedInventory,IFluidHandler {
+ public static final int TANK_CAPACITY=8000;
+ public TankFBS tank=new TankFBS(TANK_CAPACITY);
+
+ private static final int[] slots=new int[]{0,1}, slotsBook=new int[]{2};
+ public ItemStack[] itemStacks=new ItemStack[3];
+
+ public static final short MAX_PROGRESS=20*10;
+ public short progress;
+ public boolean state;
+
+ @Override
+ public void readFromNBT(NBTTagCompound par1NBTTagCompound){
+ super.readFromNBT(par1NBTTagCompound);
+
+ state=par1NBTTagCompound.getBoolean("FurnaceState");
+ progress= par1NBTTagCompound.getShort("Progress");
+
+ NBTTagList nbttaglist = (NBTTagList)par1NBTTagCompound.getTag("Items");
+ itemStacks = new ItemStack[getSizeInventory()];
+ for (int i=0;i<nbttaglist.tagCount();i++){
+ NBTTagCompound nbt = nbttaglist.getCompoundTagAt(i);
+ byte b0 = nbt.getByte("Slot");
+
+ if (b0>=0 && b0<itemStacks.length){
+ itemStacks[b0] = ItemStack.loadItemStackFromNBT(nbt);
+ }
+ }
+
+ tank = new TankFBS(TANK_CAPACITY);
+ if (par1NBTTagCompound.hasKey("Tank")) {
+ tank.readFromNBT(par1NBTTagCompound.getCompoundTag("Tank"));
+ }
+ }
+ @Override
+ public void writeToNBT(NBTTagCompound par1NBTTagCompound){
+ super.writeToNBT(par1NBTTagCompound);
+
+ par1NBTTagCompound.setBoolean("FurnaceState", state);
+ par1NBTTagCompound.setShort("Progress", progress);
+
+ NBTTagList nbttaglist = new NBTTagList();
+ for (int i=0;i<itemStacks.length;i++){
+ if (itemStacks[i] != null){
+ NBTTagCompound nbt = new NBTTagCompound();
+ nbt.setByte("Slot", (byte) i);
+ itemStacks[i].writeToNBT(nbt);
+ nbttaglist.appendTag(nbt);
+ }
+ }
+ par1NBTTagCompound.setTag("Items", nbttaglist);
+
+ NBTTagCompound nbt = new NBTTagCompound();
+ tank.writeToNBT(nbt);
+ par1NBTTagCompound.setTag("Tank", nbt);
+ }
+
+ @Override
+ public Packet getDescriptionPacket() {
+ NBTTagCompound nbtTagCompound = new NBTTagCompound();
+ this.writeToNBT(nbtTagCompound);
+ return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 1, nbtTagCompound);
+ }
+
+ @Override
+ public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
+ this.readFromNBT(pkt.func_148857_g());
+ }
+
+ @Override
+ public void updateEntity() {
+ if (worldObj.isRemote) return;
+
+ //------------ extracting -----------
+ if (itemStacks[2] != null) {
+ int amount=0;
+
+ if(itemStacks[2].getItem() == ItemCore.bookOld || itemStacks[2].getItem() == ItemCore.bookSorcery){
+ //本の場合、魔力量を計算する
+ Registry.BookData bd = Registry.GetBookDataFromItemStack(itemStacks[2]);
+ if (bd.isMagic) {
+ Registry.MagicData md=Registry.GetMagic(bd.title);
+ amount = 200 + 50 * bd.lv;
+ amount=(int)(amount*(1+(float)ItemBookSorcery.getMagicMaxUse(itemStacks[2])/md.maxUse));
+ } else{
+ amount = 300 + 80 * bd.lv;
+ }
+ }
+ else{
+ //それ以外の場合、Registryに問い合わせる
+ amount=Registry.GetContainsMana(itemStacks[2]);
+ }
+
+ if (amount>0) {
+ if (tank.getFluidAmount() + amount <= tank.getCapacity()) {
+ if(!state){
+ state=true;
+ BlockExtractingFurnace.updateFurnaceBlockState(true, worldObj, xCoord, yCoord, zCoord);
+ }
+
+ if (progress >= MAX_PROGRESS) {
+ itemStacks[2].stackSize--;
+ if (itemStacks[2].stackSize == 0) {
+ setInventorySlotContents(2, null);
+ }
+
+ tank.fill(new FluidStack(BlockCore.mana, amount), true);
+ markDirty();
+ progress = 0;
+ }
+
+ progress++;
+ }
+ }
+ } else {
+ if(state){
+ state=false;
+ BlockExtractingFurnace.updateFurnaceBlockState(false, worldObj, xCoord, yCoord, zCoord);
+ }
+ progress = 0;
+ }
+
+ //------------ bucket ---------------
+
+ //checking inventory
+ if (itemStacks[0] == null) return;
+ if (itemStacks[0].stackSize <= 0) {
+ itemStacks[0] = null;
+ return;
+ }
+
+ FluidStack fluid = tank.getFluid();
+ if (fluid != null && fluid.getFluid() != null) {
+
+ ItemStack get = FluidContainerRegistry.fillFluidContainer(fluid.copy(), itemStacks[0]);
+ if (get != null) {
+ int cap = FluidContainerRegistry.getContainerCapacity(get);
+ if (fluid.amount < cap) return;
+
+ if (itemStacks[1] != null) {
+ if (!itemStacks[1].isItemEqual(get)) return;
+ if (itemStacks[1].stackSize + get.stackSize > itemStacks[1].getMaxStackSize()) return;
+ }
+
+ if (itemStacks[1] == null || itemStacks[1].stackSize <= 0) {
+ setInventorySlotContents(1, get);
+ } else {
+ itemStacks[1].stackSize += get.stackSize;
+ }
+
+ itemStacks[0].stackSize--;
+ if (itemStacks[0].stackSize <= 0) {
+ setInventorySlotContents(0, null);
+ }
+
+ drain(ForgeDirection.UNKNOWN, cap, true);
+ markDirty();
+ }
+
+ }
+ }
+
+
+ public int getProgressScaled(int par1){
+ return par1*this.progress/MAX_PROGRESS;
+ }
+ @SideOnly(Side.CLIENT)
+ public IIcon getFluidIcon(){
+ Fluid fluid = tank.getFluidType();
+ return fluid != null ? fluid.getIcon() : null;
+ }
+
+ //-------------------------------------------------------------------------------------
+
+ @Override
+ public int fill(ForgeDirection from, FluidStack resource, boolean doFill) {
+ if (resource == null || resource.getFluid() == null){
+ return 0;
+ }
+
+ FluidStack current = tank.getFluid();
+ FluidStack resourceCopy = resource.copy();
+ if (current != null && current.amount > 0 && !current.isFluidEqual(resourceCopy)){
+ return 0;
+ }
+
+ int i = 0;
+ int used = tank.fill(resourceCopy, doFill);
+ resourceCopy.amount -= used;
+ i += used;
+
+ return i;
+ }
+
+ @Override
+ public FluidStack drain(ForgeDirection forgeDirection, FluidStack resource, boolean doDrain) {
+ if (resource == null) {
+ return null;
+ }
+ if (tank.getFluidType() == resource.getFluid()) {
+ return tank.drain(resource.amount, doDrain);
+ }
+ return null;
+ }
+ @Override
+ public FluidStack drain(ForgeDirection forgeDirection, int max, boolean b) {
+ return tank.drain(max, b);
+ }
+
+ @Override
+ public boolean canFill(ForgeDirection from, Fluid fluid) {
+ return fluid == BlockCore.mana;
+ }
+
+ @Override
+ public boolean canDrain(ForgeDirection from, Fluid fluid) {
+ return !tank.isEmpty();
+ }
+
+ @Override
+ public FluidTankInfo[] getTankInfo(ForgeDirection from) {
+ return new FluidTankInfo[0];
+ }
+
+ //------------------------------------------------------------------
+ @Override
+ public int getSizeInventory() {
+ return itemStacks.length;
+ }
+ @Override
+ public ItemStack getStackInSlot(int i) {
+ return itemStacks[i];
+ }
+ @Override
+ public ItemStack decrStackSize(int i, int j) {
+ if (itemStacks[i] != null){
+ ItemStack itemstack;
+
+ if (itemStacks[i].stackSize <= j){
+ itemstack = itemStacks[i];
+ itemStacks[i] = null;
+ markDirty();
+ return itemstack;
+ }
+ else{
+ itemstack = itemStacks[i].splitStack(j);
+
+ if (itemStacks[i].stackSize == 0){
+ itemStacks[i] = null;
+ }
+ markDirty();
+ return itemstack;
+ }
+ }
+ else{
+ return null;
+ }
+ }
+ @Override
+ public ItemStack getStackInSlotOnClosing(int i) {
+ if (itemStacks[i] != null){
+ ItemStack itemstack = itemStacks[i];
+ itemStacks[i] = null;
+ markDirty();
+ return itemstack;
+ }
+ else{
+ return null;
+ }
+ }
+ @Override
+ public void setInventorySlotContents(int i, ItemStack itemStack) {
+ itemStacks[i] = itemStack;
+ if (itemStack != null && itemStack.stackSize > this.getInventoryStackLimit()){
+ itemStack.stackSize = getInventoryStackLimit();
+ }
+ markDirty();
+ }
+ @Override
+ public String getInventoryName() {
+ return BlockCore.extractingFurnace.getLocalizedName();
+ }
+ @Override
+ public boolean hasCustomInventoryName() {
+ return false;
+ }
+ @Override
+ public int getInventoryStackLimit() {
+ return 64;
+ }
+ @Override
+ public boolean isUseableByPlayer(EntityPlayer entityPlayer) {
+ return worldObj.getTileEntity(xCoord, yCoord, zCoord) != this ? false : entityPlayer.getDistanceSq((double)xCoord+0.5D, (double)yCoord+0.5D, (double)zCoord+0.5D) <= 64.0D;
+ }
+ @Override
+ public void openInventory() {
+ }
+ @Override
+ public void closeInventory() {
+ }
+ @Override
+ public boolean isItemValidForSlot(int i, ItemStack itemstack) {
+ if(i==0) {
+ if(itemstack.getItem()== ItemCore.bookSorcery || itemstack.getItem()== ItemCore.bookOld) return false;
+ return FluidContainerRegistry.fillFluidContainer(tank.getFluid(), itemstack) != null;
+ }
+ else if(i==2){
+ return itemstack.getItem()== ItemCore.bookSorcery || itemstack.getItem()== ItemCore.bookOld;
+ }
+ return false;
+ }
+ @Override
+ public int[] getAccessibleSlotsFromSide(int var1) {
+ return (var1<2)?slots:slotsBook;
+ }
+ @Override
+ public boolean canInsertItem(int i, ItemStack itemstack, int j) {
+ return i!=1 && isItemValidForSlot(i, itemstack);
+ }
+ @Override
+ public boolean canExtractItem(int i, ItemStack itemstack, int j) {
+ return i==1;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/tileentity/TileEntityFBSWorkbench.class b/src/main/java/jp/plusplus/fbs/tileentity/TileEntityFBSWorkbench.class Binary files differnew file mode 100644 index 0000000..aaacffb --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/tileentity/TileEntityFBSWorkbench.class diff --git a/src/main/java/jp/plusplus/fbs/tileentity/TileEntityFBSWorkbench.java b/src/main/java/jp/plusplus/fbs/tileentity/TileEntityFBSWorkbench.java new file mode 100644 index 0000000..f31230f --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/tileentity/TileEntityFBSWorkbench.java @@ -0,0 +1,341 @@ +package jp.plusplus.fbs.tileentity;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.Registry;
+import jp.plusplus.fbs.block.BlockCore;
+import jp.plusplus.fbs.container.ContainerDummy;
+import jp.plusplus.fbs.item.ItemCore;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.Container;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.inventory.ISidedInventory;
+import net.minecraft.inventory.InventoryCrafting;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.nbt.NBTTagList;
+import net.minecraft.network.NetworkManager;
+import net.minecraft.network.Packet;
+import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.IIcon;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.*;
+
+/**
+ * Created by pluslus_F on 2015/06/14.
+ */
+public class TileEntityFBSWorkbench extends TileEntity implements ISidedInventory,IFluidHandler {
+ public static final int TANK_CAPACITY=4000;
+ public TankFBS tank=new TankFBS(TANK_CAPACITY);
+
+ private static final int[] slotsMaterial=new int[]{0,1,2,3,4,5,6,7,8}, slotsProduct=new int[]{9}, slotsMana=new int[]{10,11};
+ public ItemStack[] itemStacks=new ItemStack[12];
+ public Container dummy=new ContainerDummy();
+ public InventoryCrafting dummyInv=new InventoryCrafting(dummy,3,3);
+ public Registry.RecipePair product;
+
+
+ @Override
+ public void readFromNBT(NBTTagCompound par1NBTTagCompound){
+ super.readFromNBT(par1NBTTagCompound);
+
+ NBTTagList nbttaglist = (NBTTagList)par1NBTTagCompound.getTag("Items");
+ itemStacks = new ItemStack[getSizeInventory()];
+ for (int i=0;i<nbttaglist.tagCount();i++){
+ NBTTagCompound nbt = nbttaglist.getCompoundTagAt(i);
+ byte b0 = nbt.getByte("Slot");
+
+ if (b0>=0 && b0<itemStacks.length){
+ itemStacks[b0] = ItemStack.loadItemStackFromNBT(nbt);
+ }
+ }
+
+ tank = new TankFBS(TANK_CAPACITY);
+ if (par1NBTTagCompound.hasKey("Tank")) {
+ tank.readFromNBT(par1NBTTagCompound.getCompoundTag("Tank"));
+ }
+
+ onInventoryChange();
+ }
+ @Override
+ public void writeToNBT(NBTTagCompound par1NBTTagCompound){
+ super.writeToNBT(par1NBTTagCompound);
+
+ NBTTagList nbttaglist = new NBTTagList();
+ for (int i=0;i<itemStacks.length;i++){
+ if (itemStacks[i] != null){
+ NBTTagCompound nbt = new NBTTagCompound();
+ nbt.setByte("Slot", (byte) i);
+ itemStacks[i].writeToNBT(nbt);
+ nbttaglist.appendTag(nbt);
+ }
+ }
+ par1NBTTagCompound.setTag("Items", nbttaglist);
+
+ NBTTagCompound nbt = new NBTTagCompound();
+ tank.writeToNBT(nbt);
+ par1NBTTagCompound.setTag("Tank", nbt);
+ }
+
+ @Override
+ public Packet getDescriptionPacket() {
+ NBTTagCompound nbtTagCompound = new NBTTagCompound();
+ this.writeToNBT(nbtTagCompound);
+ return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 1, nbtTagCompound);
+ }
+
+ @Override
+ public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
+ this.readFromNBT(pkt.func_148857_g());
+ }
+
+ public void updateEntity(){
+ //checking inventory
+ ItemStack fc=itemStacks[slotsMana[0]];
+ ItemStack ec=itemStacks[slotsMana[1]];
+ if (fc == null) return;
+ if (fc.stackSize <= 0) {
+ fc = null;
+ return;
+ }
+
+ FluidStack fluid2 = FluidContainerRegistry.getFluidForFilledItem(fc);
+ if(fluid2 != null && fluid2.getFluid()!=null && fluid2.getFluid()==BlockCore.mana) {
+ int put = fill(ForgeDirection.UNKNOWN, fluid2, false);
+
+ if (put == fluid2.amount) {
+ ItemStack emptyContainer = FluidContainerRegistry.drainFluidContainer(fc);
+ if (emptyContainer != null) {
+ if (ec != null) {
+ if (!ec.isItemEqual(emptyContainer)) return;
+ if (ec.stackSize + emptyContainer.stackSize > ec.getMaxStackSize()) return;
+ ec.stackSize+=emptyContainer.stackSize;
+ }
+ else {
+ setInventorySlotContents(slotsMana[1], emptyContainer);
+ }
+ }
+
+ fc.stackSize--;
+ if(fc.stackSize<=1){
+ setInventorySlotContents(slotsMana[0], null);
+ }
+
+ fill(ForgeDirection.UNKNOWN, fluid2, true);
+ markDirty();
+ }
+ }
+ else{
+ FluidStack fluid = tank.getFluid();
+ if (fluid != null && fluid.getFluid() != null) {
+
+ ItemStack get = FluidContainerRegistry.fillFluidContainer(fluid.copy(), fc);
+ if (get != null) {
+ int cap = FluidContainerRegistry.getContainerCapacity(get);
+ if (fluid.amount < cap) return;
+
+ if (ec != null) {
+ if (!ec.isItemEqual(get)) return;
+ if (ec.stackSize + get.stackSize > fc.getMaxStackSize()) return;
+ }
+
+ if (ec == null || ec.stackSize <= 0) {
+ setInventorySlotContents(slotsMana[1], get);
+ } else {
+ ec.stackSize += get.stackSize;
+ }
+
+ fc.stackSize--;
+ if (fc.stackSize <= 1) {
+ setInventorySlotContents(slotsMana[0], null);
+ }
+
+ drain(ForgeDirection.UNKNOWN, cap, true);
+ markDirty();
+ }
+ }
+ }
+ }
+
+ //-----------------------------------------------------------------------------
+ @Override
+ public int fill(ForgeDirection from, FluidStack resource, boolean doFill) {
+ if (resource == null || resource.getFluid() == null){
+ return 0;
+ }
+
+ FluidStack current = tank.getFluid();
+ FluidStack resourceCopy = resource.copy();
+ if (current != null && current.amount > 0 && !current.isFluidEqual(resourceCopy)){
+ return 0;
+ }
+
+ int i = 0;
+ int used = tank.fill(resourceCopy, doFill);
+ resourceCopy.amount -= used;
+ i += used;
+
+ return i;
+ }
+
+ @Override
+ public FluidStack drain(ForgeDirection forgeDirection, FluidStack resource, boolean doDrain) {
+ if (resource == null) {
+ return null;
+ }
+ if (tank.getFluidType() == resource.getFluid()) {
+ return tank.drain(resource.amount, doDrain);
+ }
+ return null;
+ }
+ @Override
+ public FluidStack drain(ForgeDirection forgeDirection, int max, boolean b) {
+ return tank.drain(max, b);
+ }
+
+ @Override
+ public boolean canFill(ForgeDirection from, Fluid fluid) {
+ return fluid == BlockCore.mana;
+ }
+
+ @Override
+ public boolean canDrain(ForgeDirection from, Fluid fluid) {
+ return !tank.isEmpty();
+ }
+
+ @Override
+ public FluidTankInfo[] getTankInfo(ForgeDirection from) {
+ return new FluidTankInfo[0];
+ }
+
+ @SideOnly(Side.CLIENT)
+ public IIcon getFluidIcon(){
+ Fluid fluid = tank.getFluidType();
+ return fluid != null ? fluid.getIcon() : null;
+ }
+
+ public void onInventoryChange() {
+ for (int i = 0; i < slotsMaterial.length; i++) {
+ dummyInv.setInventorySlotContents(i, itemStacks[slotsMaterial[i]]);
+ }
+ product = Registry.FindMatchingRecipe(dummyInv, worldObj);
+ if (product != null && tank.getFluidAmount()>=product.mana) setInventorySlotContents(slotsProduct[0], product.recipe.getCraftingResult(dummyInv));
+ else setInventorySlotContents(slotsProduct[0], null);
+ }
+
+ //------------------------------------------------------------------
+ @Override
+ public int getSizeInventory() {
+ return itemStacks.length;
+ }
+ @Override
+ public ItemStack getStackInSlot(int i) {
+ return itemStacks[i];
+ }
+ @Override
+ public ItemStack decrStackSize(int i, int j) {
+ if (itemStacks[i] != null){
+ ItemStack itemstack;
+
+ if (itemStacks[i].stackSize <= j){
+ itemstack = itemStacks[i];
+ itemStacks[i] = null;
+
+ if(i==slotsProduct[0] && product!=null){
+ tank.drain(product.mana*itemstack.stackSize, true);
+ }
+ onInventoryChange();
+
+ markDirty();
+ return itemstack;
+ }
+ else{
+ itemstack = itemStacks[i].splitStack(j);
+
+ if (itemStacks[i].stackSize == 0){
+ itemStacks[i] = null;
+ }
+
+ if(i==slotsProduct[0] && product!=null){
+ tank.drain(product.mana*itemstack.stackSize, true);
+ }
+ onInventoryChange();
+
+ markDirty();
+ return itemstack;
+ }
+ }
+ else{
+ return null;
+ }
+ }
+ @Override
+ public ItemStack getStackInSlotOnClosing(int i) {
+ if (itemStacks[i] != null){
+ ItemStack itemstack = itemStacks[i];
+ itemStacks[i] = null;
+ markDirty();
+ return itemstack;
+ }
+ else{
+ return null;
+ }
+ }
+ @Override
+ public void setInventorySlotContents(int i, ItemStack itemStack) {
+ itemStacks[i] = itemStack;
+ if (itemStack != null && itemStack.stackSize > this.getInventoryStackLimit()){
+ itemStack.stackSize = getInventoryStackLimit();
+ }
+ if(i!=slotsProduct[0]) onInventoryChange();
+ markDirty();
+ }
+ @Override
+ public String getInventoryName() {
+ return BlockCore.workbench.getLocalizedName();
+ }
+ @Override
+ public boolean hasCustomInventoryName() {
+ return false;
+ }
+ @Override
+ public int getInventoryStackLimit() {
+ return 64;
+ }
+ @Override
+ public boolean isUseableByPlayer(EntityPlayer entityPlayer) {
+ return worldObj.getTileEntity(xCoord, yCoord, zCoord) != this ? false : entityPlayer.getDistanceSq((double)xCoord+0.5D, (double)yCoord+0.5D, (double)zCoord+0.5D) <= 64.0D;
+ }
+ @Override
+ public void openInventory() {
+ }
+ @Override
+ public void closeInventory() {
+ }
+ @Override
+ public boolean isItemValidForSlot(int i, ItemStack itemstack) {
+ if(i==10){
+ FluidStack f=FluidContainerRegistry.getFluidForFilledItem(itemstack);
+ return f!=null && f.getFluid()==BlockCore.mana;
+ }
+ return false;
+ }
+
+ @Override
+ public int[] getAccessibleSlotsFromSide(int p_94128_1_) {
+ return slotsMana;
+ }
+
+ @Override
+ public boolean canInsertItem(int p_102007_1_, ItemStack p_102007_2_, int p_102007_3_) {
+ if(p_102007_1_!=slotsMana[0]) return false;
+ FluidStack fc=FluidContainerRegistry.getFluidForFilledItem(p_102007_2_);
+ return fc!=null && fc.getFluid()==BlockCore.mana;
+ }
+
+ @Override
+ public boolean canExtractItem(int p_102008_1_, ItemStack p_102008_2_, int p_102008_3_) {
+ return p_102008_1_==slotsMana[1];
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/tileentity/TileEntityFillingTable.class b/src/main/java/jp/plusplus/fbs/tileentity/TileEntityFillingTable.class Binary files differnew file mode 100644 index 0000000..4fcaf68 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/tileentity/TileEntityFillingTable.class diff --git a/src/main/java/jp/plusplus/fbs/tileentity/TileEntityFillingTable.java b/src/main/java/jp/plusplus/fbs/tileentity/TileEntityFillingTable.java new file mode 100644 index 0000000..ebd9628 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/tileentity/TileEntityFillingTable.java @@ -0,0 +1,357 @@ +package jp.plusplus.fbs.tileentity;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.Registry;
+import jp.plusplus.fbs.block.BlockCore;
+import jp.plusplus.fbs.item.ItemBookSorcery;
+import jp.plusplus.fbs.item.ItemCore;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.ISidedInventory;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.nbt.NBTTagList;
+import net.minecraft.network.NetworkManager;
+import net.minecraft.network.Packet;
+import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.IIcon;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.*;
+
+/**
+ * Createdby pluslus_Fon 2015/06/14.
+ */
+public class TileEntityFillingTable extends TileEntity implements ISidedInventory,IFluidHandler {
+ public static final int TANK_CAPACITY=4000;
+ public TankFBS tank=new TankFBS(TANK_CAPACITY);
+
+ private static final int[] slotsBook=new int[]{0}, slotsFluid=new int[]{1,2};
+ public ItemStack[] itemStacks=new ItemStack[3];
+
+ public static final short MAX_PROGRESS=20*10;
+ public short progress;
+
+ @Override
+ public void readFromNBT(NBTTagCompound par1NBTTagCompound){
+ super.readFromNBT(par1NBTTagCompound);
+
+ progress= par1NBTTagCompound.getShort("Progress");
+
+ NBTTagList nbttaglist = (NBTTagList)par1NBTTagCompound.getTag("Items");
+ itemStacks = new ItemStack[getSizeInventory()];
+ for (int i=0;i<nbttaglist.tagCount();i++){
+ NBTTagCompound nbt = nbttaglist.getCompoundTagAt(i);
+ byte b0 = nbt.getByte("Slot");
+
+ if (b0>=0 && b0<itemStacks.length){
+ itemStacks[b0] = ItemStack.loadItemStackFromNBT(nbt);
+ }
+ }
+
+ tank = new TankFBS(TANK_CAPACITY);
+ if (par1NBTTagCompound.hasKey("Tank")) {
+ tank.readFromNBT(par1NBTTagCompound.getCompoundTag("Tank"));
+ }
+ }
+ @Override
+ public void writeToNBT(NBTTagCompound par1NBTTagCompound){
+ super.writeToNBT(par1NBTTagCompound);
+
+ par1NBTTagCompound.setShort("Progress", progress);
+
+ NBTTagList nbttaglist = new NBTTagList();
+ for (int i=0;i<itemStacks.length;i++){
+ if (itemStacks[i] != null){
+ NBTTagCompound nbt = new NBTTagCompound();
+ nbt.setByte("Slot", (byte) i);
+ itemStacks[i].writeToNBT(nbt);
+ nbttaglist.appendTag(nbt);
+ }
+ }
+ par1NBTTagCompound.setTag("Items", nbttaglist);
+
+ NBTTagCompound nbt = new NBTTagCompound();
+ tank.writeToNBT(nbt);
+ par1NBTTagCompound.setTag("Tank", nbt);
+ }
+
+ @Override
+ public Packet getDescriptionPacket() {
+ NBTTagCompound nbtTagCompound = new NBTTagCompound();
+ this.writeToNBT(nbtTagCompound);
+ return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 1, nbtTagCompound);
+ }
+
+ @Override
+ public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
+ this.readFromNBT(pkt.func_148857_g());
+ }
+
+ @Override
+ public void updateEntity() {
+ if(worldObj.isRemote) return;
+
+ //------------ filling --------------
+ if(itemStacks[0]!=null && itemStacks[0].getItem()==ItemCore.bookSorcery){
+ Registry.BookData bd=Registry.GetBookDataFromItemStack(itemStacks[0]);
+ if(bd!=null && bd.isMagic){
+ int amount=40*bd.lv;
+ if(tank.getFluidAmount()>=amount){
+ if (progress >= MAX_PROGRESS) {
+ tank.drain(amount, true);
+
+ //一定確率で失敗する
+ float pr;
+ if(bd.lv<=5) pr=1.0f;
+ else if(bd.lv<40) pr=1.0f-0.02f*(bd.lv-5);
+ else pr=0.3f;
+ if(worldObj.rand.nextFloat()<pr){
+ ItemBookSorcery.setMagicMaxUse(itemStacks[0], ItemBookSorcery.getMagicMaxUse(itemStacks[0])+1);
+ }
+ else{
+ setInventorySlotContents(0, new ItemStack(ItemCore.bookBroken, 1, itemStacks[0].getItemDamage()));
+ }
+
+ markDirty();
+ progress=0;
+ }
+
+ progress++;
+ }
+ }
+ }
+ else{
+ progress=0;
+ }
+
+ //------------ bucket ---------------
+
+ //checking inventory
+ if (itemStacks[1] == null) return;
+ if (itemStacks[1].stackSize <= 0) {
+ itemStacks[1] = null;
+ return;
+ }
+
+ FluidStack fluid2 = FluidContainerRegistry.getFluidForFilledItem(itemStacks[1]);
+ if(fluid2 != null && fluid2.getFluid()!=null && fluid2.getFluid()==BlockCore.mana) {
+ int put = fill(ForgeDirection.UNKNOWN, fluid2, false);
+
+ if (put == fluid2.amount) {
+ ItemStack emptyContainer = FluidContainerRegistry.drainFluidContainer(itemStacks[1]);
+ if (emptyContainer != null) {
+ if (itemStacks[2] != null) {
+ if (!itemStacks[2].isItemEqual(emptyContainer)) return;
+ if (itemStacks[2].stackSize + emptyContainer.stackSize > itemStacks[2].getMaxStackSize()) return;
+ itemStacks[2].stackSize+=emptyContainer.stackSize;
+ }
+ else {
+ setInventorySlotContents(2, emptyContainer);
+ }
+ }
+
+ itemStacks[1].stackSize--;
+ if(itemStacks[1].stackSize<=1){
+ setInventorySlotContents(1, null);
+ }
+
+ fill(ForgeDirection.UNKNOWN, fluid2, true);
+ markDirty();
+ }
+ }
+ else{
+ FluidStack fluid = tank.getFluid();
+ if (fluid != null && fluid.getFluid() != null) {
+
+ ItemStack get = FluidContainerRegistry.fillFluidContainer(fluid.copy(), itemStacks[1]);
+ if (get != null) {
+ int cap = FluidContainerRegistry.getContainerCapacity(get);
+ if (fluid.amount < cap) return;
+
+ if (itemStacks[2] != null) {
+ if (!itemStacks[2].isItemEqual(get)) return;
+ if (itemStacks[2].stackSize + get.stackSize > itemStacks[1].getMaxStackSize()) return;
+ }
+
+ if (itemStacks[2] == null || itemStacks[2].stackSize <= 0) {
+ setInventorySlotContents(2, get);
+ } else {
+ itemStacks[2].stackSize += get.stackSize;
+ }
+
+ itemStacks[1].stackSize--;
+ if (itemStacks[1].stackSize <= 1) {
+ setInventorySlotContents(1, null);
+ }
+
+ drain(ForgeDirection.UNKNOWN, cap, true);
+ markDirty();
+ }
+ }
+ }
+ }
+
+ //-------------------------------------------------------------------------------------
+
+ @Override
+ public int fill(ForgeDirection from, FluidStack resource, boolean doFill) {
+ if (resource == null || resource.getFluid() == null){
+ return 0;
+ }
+
+ FluidStack current = tank.getFluid();
+ FluidStack resourceCopy = resource.copy();
+ if (current != null && current.amount > 0 && !current.isFluidEqual(resourceCopy)){
+ return 0;
+ }
+
+ int i = 0;
+ int used = tank.fill(resourceCopy, doFill);
+ resourceCopy.amount -= used;
+ i += used;
+
+ return i;
+ }
+
+ @Override
+ public FluidStack drain(ForgeDirection forgeDirection, FluidStack resource, boolean doDrain) {
+ if (resource == null) {
+ return null;
+ }
+ if (tank.getFluidType() == resource.getFluid()) {
+ return tank.drain(resource.amount, doDrain);
+ }
+ return null;
+ }
+ @Override
+ public FluidStack drain(ForgeDirection forgeDirection, int max, boolean b) {
+ return tank.drain(max, b);
+ }
+
+ @Override
+ public boolean canFill(ForgeDirection from, Fluid fluid) {
+ return fluid == BlockCore.mana;
+ }
+
+ @Override
+ public boolean canDrain(ForgeDirection from, Fluid fluid) {
+ return !tank.isEmpty();
+ }
+
+ @Override
+ public FluidTankInfo[] getTankInfo(ForgeDirection from) {
+ return new FluidTankInfo[0];
+ }
+
+ public int getProgressScaled(int par1){
+ return par1*this.progress/MAX_PROGRESS;
+ }
+ @SideOnly(Side.CLIENT)
+ public IIcon getFluidIcon(){
+ Fluid fluid = tank.getFluidType();
+ return fluid != null ? fluid.getIcon() : null;
+ }
+
+ //------------------------------------------------------------------
+ @Override
+ public int getSizeInventory() {
+ return itemStacks.length;
+ }
+ @Override
+ public ItemStack getStackInSlot(int i) {
+ return itemStacks[i];
+ }
+ @Override
+ public ItemStack decrStackSize(int i, int j) {
+ if (itemStacks[i] != null){
+ ItemStack itemstack;
+
+ if (itemStacks[i].stackSize <= j){
+ itemstack = itemStacks[i];
+ itemStacks[i] = null;
+ markDirty();
+ return itemstack;
+ }
+ else{
+ itemstack = itemStacks[i].splitStack(j);
+
+ if (itemStacks[i].stackSize == 0){
+ itemStacks[i] = null;
+ }
+ markDirty();
+ return itemstack;
+ }
+ }
+ else{
+ return null;
+ }
+ }
+ @Override
+ public ItemStack getStackInSlotOnClosing(int i) {
+ if (itemStacks[i] != null){
+ ItemStack itemstack = itemStacks[i];
+ itemStacks[i] = null;
+ markDirty();
+ return itemstack;
+ }
+ else{
+ return null;
+ }
+ }
+ @Override
+ public void setInventorySlotContents(int i, ItemStack itemStack) {
+ itemStacks[i] = itemStack;
+ if (itemStack != null && itemStack.stackSize > this.getInventoryStackLimit()){
+ itemStack.stackSize = getInventoryStackLimit();
+ }
+ markDirty();
+ }
+ @Override
+ public String getInventoryName() {
+ return BlockCore.fillingTable.getLocalizedName();
+ }
+ @Override
+ public boolean hasCustomInventoryName() {
+ return false;
+ }
+ @Override
+ public int getInventoryStackLimit() {
+ return 64;
+ }
+ @Override
+ public boolean isUseableByPlayer(EntityPlayer entityPlayer) {
+ return worldObj.getTileEntity(xCoord, yCoord, zCoord) != this ? false : entityPlayer.getDistanceSq((double)xCoord+0.5D, (double)yCoord+0.5D, (double)zCoord+0.5D) <= 64.0D;
+ }
+ @Override
+ public void openInventory() {
+ }
+ @Override
+ public void closeInventory() {
+ }
+ @Override
+ public boolean isItemValidForSlot(int i, ItemStack itemstack) {
+ if(i==0) {
+ return itemstack.getItem()==ItemCore.bookSorcery;
+ }
+ else if(i==1){
+ if(itemstack.getItem()==ItemCore.bookSorcery) return false;
+ FluidStack f=FluidContainerRegistry.getFluidForFilledItem(itemstack);
+ return f!=null && f.getFluid()==BlockCore.mana;
+ }
+ return false;
+ }
+ @Override
+ public int[] getAccessibleSlotsFromSide(int var1) {
+ if(var1==0 || var1==1) return slotsBook;
+ return slotsFluid;
+ }
+ @Override
+ public boolean canInsertItem(int i, ItemStack itemstack, int j) {
+ return i!=2 && isItemValidForSlot(i, itemstack);
+ }
+ @Override
+ public boolean canExtractItem(int i, ItemStack itemstack, int j) {
+ return i==0 || i==2;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/tileentity/TileEntityForRender.class b/src/main/java/jp/plusplus/fbs/tileentity/TileEntityForRender.class Binary files differnew file mode 100644 index 0000000..2485bb5 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/tileentity/TileEntityForRender.class diff --git a/src/main/java/jp/plusplus/fbs/tileentity/TileEntityForRender.java b/src/main/java/jp/plusplus/fbs/tileentity/TileEntityForRender.java new file mode 100644 index 0000000..e4571fa --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/tileentity/TileEntityForRender.java @@ -0,0 +1,19 @@ +package jp.plusplus.fbs.tileentity;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.block.BlockCore;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.AxisAlignedBB;
+
+/**
+ * Created by plusplus_F on 2015/09/25.
+ * 毎度おなじみレンダーのためだけのTE
+ */
+public class TileEntityForRender extends TileEntity {
+ @SideOnly(Side.CLIENT)
+ public AxisAlignedBB getRenderBoundingBox() {
+ if(getBlockType()== BlockCore.tableAlchemist) return AxisAlignedBB.getBoundingBox(xCoord-1,yCoord,zCoord-1,xCoord+2,yCoord+1,zCoord+2);
+ else return super.getRenderBoundingBox();
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/tileentity/TileEntityHavestable.class b/src/main/java/jp/plusplus/fbs/tileentity/TileEntityHavestable.class Binary files differnew file mode 100644 index 0000000..bc5bef5 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/tileentity/TileEntityHavestable.class diff --git a/src/main/java/jp/plusplus/fbs/tileentity/TileEntityHavestable.java b/src/main/java/jp/plusplus/fbs/tileentity/TileEntityHavestable.java new file mode 100644 index 0000000..622a75e --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/tileentity/TileEntityHavestable.java @@ -0,0 +1,165 @@ +package jp.plusplus.fbs.tileentity;
+
+import jp.plusplus.fbs.Registry;
+import net.minecraft.block.BlockEndPortal;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.nbt.NBTTagList;
+import net.minecraft.network.NetworkManager;
+import net.minecraft.network.Packet;
+import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.world.biome.BiomeGenBase;
+import net.minecraftforge.common.BiomeManager;
+
+import java.util.Random;
+
+/**
+ * Created by plusplus_F on 2015/11/09.
+ * 10秒ごとに1つ成長する
+ */
+public class TileEntityHavestable extends TileEntity {
+ public int glowingTicks;
+ public int age;
+ public int ageMax;
+ public int meta;
+
+ public TileEntityHavestable(){
+ ageMax=60;
+ }
+ public TileEntityHavestable(int ageMax, int meta){
+ this();
+ this.ageMax=ageMax;
+ this.meta=meta;
+ }
+ //---------------------------------------------------------------------------------------------------------
+ public boolean canGlow(){
+ if(age>=ageMax) return false;
+ BiomeGenBase bgb=worldObj.getBiomeGenForCoords(xCoord, zCoord);
+
+ boolean flag=false;
+ if(meta==0){
+ //ベースハーブはどこでも育つ
+ flag=true;
+ }
+ else if(meta==4){
+ //ソウルハーブは狭間なら育つ
+ flag=bgb==Registry.biomeCrack;
+ }
+ else if(meta==5){
+ //マンドレイクはy=32未満で育つ
+ flag=yCoord<32 && yCoord!=worldObj.getHeightValue(xCoord, zCoord);
+ }
+ else if(meta==6){
+ //ゴールドハーブはy=20未満で育つ
+ flag=yCoord<20 && yCoord!=worldObj.getHeightValue(xCoord, zCoord);
+ }
+ else if(meta==7){
+ //エンダーハーブはエンドなら育つ
+ flag=worldObj.provider.dimensionId==1;
+ }
+ else if(meta==8){
+ //エクスプローシブハーブはネザーなら育つ
+ flag=worldObj.provider.dimensionId==-1;
+ }
+ else{
+ //直射日光があたらなければ育つ
+ flag=yCoord!=worldObj.getHeightValue(xCoord, zCoord);
+
+ if(!flag){
+ switch (meta){
+ case 1:
+ //ブラッディハーブは温暖なら育つ
+ for(BiomeManager.BiomeEntry be : BiomeManager.getBiomes(BiomeManager.BiomeType.WARM)){
+ if(bgb==be.biome){
+ flag=true;
+ break;
+ }
+ }
+ break;
+
+ case 2:
+ //マナハーブは秋なら育つ
+ flag=bgb==Registry.biomeAutumn;
+ break;
+
+ case 3:
+ //スタミナハーブは砂漠なら育つ
+ flag=(bgb==BiomeGenBase.desert || bgb==BiomeGenBase.desertHills || bgb==BiomeGenBase.savanna || bgb==BiomeGenBase.savannaPlateau || bgb==BiomeGenBase.mesa || bgb==BiomeGenBase.mesaPlateau|| bgb==BiomeGenBase.mesaPlateau_F);
+ if(!flag){
+ for(BiomeManager.BiomeEntry be : BiomeManager.getBiomes(BiomeManager.BiomeType.DESERT)){
+ if(bgb==be.biome){
+ flag=true;
+ break;
+ }
+ }
+ }
+ break;
+ }
+ }
+
+ }
+
+ return flag;
+ }
+ public boolean canHarvest(){
+ return age>=ageMax;
+ }
+ public void glow(Random rand){
+ age+=1+rand.nextInt(3);
+ }
+ public void onHarvest(){
+ age=0;
+ markDirty();
+ worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
+ }
+ //---------------------------------------------------------------------------------------------------------
+ @Override
+ public void readFromNBT(NBTTagCompound par1NBTTagCompound){
+ super.readFromNBT(par1NBTTagCompound);
+
+ age=par1NBTTagCompound.getInteger("Age");
+ ageMax=par1NBTTagCompound.getInteger("AgeMax");
+ glowingTicks=par1NBTTagCompound.getInteger("GlowingTicks");
+ meta=par1NBTTagCompound.getInteger("Meta");
+ }
+ @Override
+ public void writeToNBT(NBTTagCompound par1NBTTagCompound){
+ super.writeToNBT(par1NBTTagCompound);
+
+ par1NBTTagCompound.setInteger("Age", age);
+ par1NBTTagCompound.setInteger("AgeMax", ageMax);
+ par1NBTTagCompound.setInteger("GlowingTicks", glowingTicks);
+ par1NBTTagCompound.setInteger("Meta", meta);
+ }
+
+ @Override
+ public Packet getDescriptionPacket() {
+ NBTTagCompound nbtTagCompound = new NBTTagCompound();
+ this.writeToNBT(nbtTagCompound);
+ return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 1, nbtTagCompound);
+ }
+
+ @Override
+ public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
+ this.readFromNBT(pkt.func_148857_g());
+ }
+
+ @Override
+ public void updateEntity(){
+ if(!worldObj.isRemote) {
+ glowingTicks++;
+ if (glowingTicks >= 200) {
+ glowingTicks = 0;
+ if (canGlow()) {
+ age++;
+ if (age > ageMax) {
+ age = ageMax;
+ }
+ markDirty();
+ worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
+ }
+ }
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/tileentity/TileEntityHavestableGrass.class b/src/main/java/jp/plusplus/fbs/tileentity/TileEntityHavestableGrass.class Binary files differnew file mode 100644 index 0000000..0522a42 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/tileentity/TileEntityHavestableGrass.class diff --git a/src/main/java/jp/plusplus/fbs/tileentity/TileEntityHavestableGrass.java b/src/main/java/jp/plusplus/fbs/tileentity/TileEntityHavestableGrass.java new file mode 100644 index 0000000..ebb62fa --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/tileentity/TileEntityHavestableGrass.java @@ -0,0 +1,21 @@ +package jp.plusplus.fbs.tileentity;
+
+import net.minecraft.block.BlockSapling;
+
+/**
+ * Created by plusplus_F on 2016/02/23.
+ */
+public class TileEntityHavestableGrass extends TileEntityHavestable {
+ public TileEntityHavestableGrass(){
+
+ }
+ public TileEntityHavestableGrass(int ageMax, int meta) {
+ super(ageMax, meta);
+ }
+
+ @Override
+ public boolean canGlow(){
+ return worldObj.getBlockLightValue(xCoord, yCoord+1, zCoord)>=9;
+ //return worldObj.is;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/tileentity/TileEntityHavestableMushroom.class b/src/main/java/jp/plusplus/fbs/tileentity/TileEntityHavestableMushroom.class Binary files differnew file mode 100644 index 0000000..2745afe --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/tileentity/TileEntityHavestableMushroom.class diff --git a/src/main/java/jp/plusplus/fbs/tileentity/TileEntityHavestableMushroom.java b/src/main/java/jp/plusplus/fbs/tileentity/TileEntityHavestableMushroom.java new file mode 100644 index 0000000..2b2c617 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/tileentity/TileEntityHavestableMushroom.java @@ -0,0 +1,18 @@ +package jp.plusplus.fbs.tileentity;
+
+/**
+ * Created by plusplus_F on 2016/02/23.
+ */
+public class TileEntityHavestableMushroom extends TileEntityHavestable {
+ public TileEntityHavestableMushroom(){
+
+ }
+ public TileEntityHavestableMushroom(int ageMax, int meta) {
+ super(ageMax, meta);
+ }
+
+ @Override
+ public boolean canGlow(){
+ return getBlockMetadata()==0 || worldObj.getBlockLightValue(xCoord, yCoord, zCoord)<=8;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/tileentity/TileEntityMagicCore.class b/src/main/java/jp/plusplus/fbs/tileentity/TileEntityMagicCore.class Binary files differnew file mode 100644 index 0000000..3fd42e5 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/tileentity/TileEntityMagicCore.class diff --git a/src/main/java/jp/plusplus/fbs/tileentity/TileEntityMagicCore.java b/src/main/java/jp/plusplus/fbs/tileentity/TileEntityMagicCore.java new file mode 100644 index 0000000..2b3b267 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/tileentity/TileEntityMagicCore.java @@ -0,0 +1,134 @@ +package jp.plusplus.fbs.tileentity;
+
+import jp.plusplus.fbs.container.inventory.InventoryMagic;
+import jp.plusplus.fbs.entity.EntityButterfly;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.network.NetworkManager;
+import net.minecraft.network.Packet;
+import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
+import net.minecraft.tileentity.TileEntity;
+
+/**
+ * Created by pluslus_F on 2015/06/17.
+ */
+public class TileEntityMagicCore extends TileEntity {
+ public int ticks;
+ protected String circleName="null";
+ protected int circleRadius;
+
+ public InventoryMagic inv;
+ public int progressMax;
+ public int progress;
+
+ public void setInventory(InventoryMagic inv){
+ this.inv=inv;
+ }
+ public void removeInventory(){
+ inv=null;
+ }
+
+ public void setProgressMax(int p){
+ progressMax=p;
+ markDirty();
+ }
+ public void resetProgress(){
+ progress=0;
+ progressMax=0;
+ markDirty();
+ }
+
+ @Override
+ public void readFromNBT(NBTTagCompound par1NBTTagCompound){
+ super.readFromNBT(par1NBTTagCompound);
+
+ circleName=par1NBTTagCompound.getString("CircleName");
+ circleRadius= par1NBTTagCompound.getInteger("CircleRadius");
+
+ progress=par1NBTTagCompound.getInteger("Progress");
+ progressMax=par1NBTTagCompound.getInteger("ProgressMax");
+ }
+ @Override
+ public void writeToNBT(NBTTagCompound par1NBTTagCompound){
+ super.writeToNBT(par1NBTTagCompound);
+
+ par1NBTTagCompound.setString("CircleName", circleName);
+ par1NBTTagCompound.setInteger("CircleRadius", circleRadius);
+
+ par1NBTTagCompound.setInteger("Progress", progress);
+ par1NBTTagCompound.setInteger("ProgressMax", progressMax);
+ }
+
+ @Override
+ public Packet getDescriptionPacket() {
+ NBTTagCompound nbtTagCompound = new NBTTagCompound();
+ this.writeToNBT(nbtTagCompound);
+ return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 1, nbtTagCompound);
+ }
+
+ @Override
+ public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
+ this.readFromNBT(pkt.func_148857_g());
+ }
+
+ @Override
+ public void updateEntity() {
+ ticks++;
+
+ if(worldObj.isRemote) return;
+ if(inv!=null && progressMax>0){
+ progress++;
+ if(progress>=progressMax){
+ inv.work();
+ progress=0;
+ }
+ }
+
+ if (ticks % 60 != 0) return;
+
+ //checking magic
+ if (circleName.equals("null")) return;
+ int bx = xCoord - circleRadius, bz = zCoord - circleRadius;
+ int size = 2 * circleRadius + 1;
+ for (int i = 0; i < size; i++) {
+ for (int k = 0; k < size; k++) {
+ if (i == size / 2 && i == k) continue;
+ if (!worldObj.isAirBlock(bx + k, yCoord, bz + i) && worldObj.isBlockNormalCubeDefault(bx+k, yCoord, bz+i, false)) {
+ setMagicCircle("null", 1);
+ markDirty();
+ return;
+ }
+ }
+ }
+
+ /*
+ if(ticks%180!=0 || worldObj.rand.nextFloat()<=0.8f) return;
+ EntityButterfly eb=new EntityButterfly(worldObj, xCoord, yCoord+1, zCoord);
+ worldObj.spawnEntityInWorld(eb);
+ */
+ }
+
+ public void setMagicCircle(String name, int radius){
+ circleName=(name==null?"null":name);
+ circleRadius=radius;
+ markDirty();
+ worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
+ }
+ public void clearCharms() {
+ if (circleName.equals("null")) return;
+ int bx = xCoord - circleRadius, bz = zCoord - circleRadius;
+ int size = 2 * circleRadius + 1;
+ for (int i = 0; i < size; i++) {
+ for (int k = 0; k < size; k++) {
+ if (i == size / 2 && i == k) continue;
+ worldObj.setBlockToAir(bx + k, yCoord, bz + i);
+ }
+ }
+ }
+
+ public String getCircleName(){
+ return circleName;
+ }
+ public int getCircleRadius(){
+ return circleRadius;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/tileentity/TileEntityMirror.class b/src/main/java/jp/plusplus/fbs/tileentity/TileEntityMirror.class Binary files differnew file mode 100644 index 0000000..529e716 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/tileentity/TileEntityMirror.class diff --git a/src/main/java/jp/plusplus/fbs/tileentity/TileEntityMirror.java b/src/main/java/jp/plusplus/fbs/tileentity/TileEntityMirror.java new file mode 100644 index 0000000..41e580a --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/tileentity/TileEntityMirror.java @@ -0,0 +1,11 @@ +package jp.plusplus.fbs.tileentity;
+
+import net.minecraft.tileentity.TileEntity;
+
+/**
+ * Created by pluslus_F on 2015/06/24.
+ * MCE2ショップ、魔女の鏡
+ */
+public class TileEntityMirror extends TileEntity {
+
+}
diff --git a/src/main/java/jp/plusplus/fbs/tileentity/TileEntityPortalWarp.class b/src/main/java/jp/plusplus/fbs/tileentity/TileEntityPortalWarp.class Binary files differnew file mode 100644 index 0000000..beb4c2a --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/tileentity/TileEntityPortalWarp.class diff --git a/src/main/java/jp/plusplus/fbs/tileentity/TileEntityPortalWarp.java b/src/main/java/jp/plusplus/fbs/tileentity/TileEntityPortalWarp.java new file mode 100644 index 0000000..ba0852b --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/tileentity/TileEntityPortalWarp.java @@ -0,0 +1,42 @@ +package jp.plusplus.fbs.tileentity;
+
+import jp.plusplus.fbs.exprop.FBSEntityProperties;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.nbt.NBTTagList;
+import net.minecraft.network.NetworkManager;
+import net.minecraft.network.Packet;
+import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
+import net.minecraft.tileentity.TileEntity;
+
+/**
+ * Created by plusplus_F on 2015/10/28.
+ */
+public class TileEntityPortalWarp extends TileEntity {
+ public FBSEntityProperties.WarpPosition destination=new FBSEntityProperties.WarpPosition(1,0,0,0);
+
+ @Override
+ public void readFromNBT(NBTTagCompound par1NBTTagCompound){
+ super.readFromNBT(par1NBTTagCompound);
+ destination=new FBSEntityProperties.WarpPosition(par1NBTTagCompound.getCompoundTag("Dest"));
+ }
+ @Override
+ public void writeToNBT(NBTTagCompound par1NBTTagCompound){
+ super.writeToNBT(par1NBTTagCompound);
+ NBTTagCompound nbt=new NBTTagCompound();
+ destination.writeToNBT(nbt);
+ par1NBTTagCompound.setTag("Dest", nbt);
+ }
+
+ @Override
+ public Packet getDescriptionPacket() {
+ NBTTagCompound nbtTagCompound = new NBTTagCompound();
+ this.writeToNBT(nbtTagCompound);
+ return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 1, nbtTagCompound);
+ }
+
+ @Override
+ public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
+ this.readFromNBT(pkt.func_148857_g());
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/tileentity/render/RenderExtractingFurnace.class b/src/main/java/jp/plusplus/fbs/tileentity/render/RenderExtractingFurnace.class Binary files differnew file mode 100644 index 0000000..15616b0 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/tileentity/render/RenderExtractingFurnace.class diff --git a/src/main/java/jp/plusplus/fbs/tileentity/render/RenderExtractingFurnace.java b/src/main/java/jp/plusplus/fbs/tileentity/render/RenderExtractingFurnace.java new file mode 100644 index 0000000..e0057f4 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/tileentity/render/RenderExtractingFurnace.java @@ -0,0 +1,15 @@ +package jp.plusplus.fbs.tileentity.render;
+
+import net.minecraft.client.model.ModelBase;
+import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
+import net.minecraft.tileentity.TileEntity;
+
+/**
+ * Createdby pluslus_Fon 2015/06/09.
+ */
+public class RenderExtractingFurnace extends TileEntitySpecialRenderer {
+ @Override
+ public void renderTileEntityAt(TileEntity entity, double x, double y, double z, float p_147500_8_) {
+
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/tileentity/render/RenderMagicCircle.class b/src/main/java/jp/plusplus/fbs/tileentity/render/RenderMagicCircle.class Binary files differnew file mode 100644 index 0000000..880e317 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/tileentity/render/RenderMagicCircle.class diff --git a/src/main/java/jp/plusplus/fbs/tileentity/render/RenderMagicCircle.java b/src/main/java/jp/plusplus/fbs/tileentity/render/RenderMagicCircle.java new file mode 100644 index 0000000..1f662d4 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/tileentity/render/RenderMagicCircle.java @@ -0,0 +1,92 @@ +package jp.plusplus.fbs.tileentity.render;
+
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.ProxyClient;
+import jp.plusplus.fbs.tileentity.TileEntityMagicCore;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.renderer.Tessellator;
+import net.minecraft.client.renderer.texture.TextureMap;
+import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
+import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.IIcon;
+import org.lwjgl.opengl.GL11;
+import org.lwjgl.opengl.GL12;
+
+import java.util.HashMap;
+
+/**
+ * Created by pluslus_F on 2015/06/18.
+ */
+public class RenderMagicCircle extends TileEntitySpecialRenderer {
+ private static HashMap<String, IIcon> icons=new HashMap<String, IIcon>();
+ public static RenderMagicCircle renderer;
+
+ public void renderTileEntityCupAt(TileEntityMagicCore par1Tile, double par2, double par4, double par6, float par8) {
+ this.setRotation(par1Tile, (float) par2, (float) par4, (float) par6);
+ }
+
+ public void setTileEntityRenderer(TileEntityRendererDispatcher par1TileEntityRenderer) {
+ super.func_147497_a(par1TileEntityRenderer);
+ renderer = this;
+ }
+
+ public void setRotation(TileEntityMagicCore par0Tile, float par1, float par2, float par3) {
+ //テセレータを使って、一枚の平面テクスチャとして表示させる。
+
+ Tessellator tessellator = Tessellator.instance;
+ String name = par0Tile.getCircleName();
+ float tick = FBS.proxy.getRenderPartialTicks();
+
+ if (!name.equals("null")) {
+ float r = par0Tile.getCircleRadius();
+
+ //コメントアウト部分を復帰させると、水面の描写が半透明になる。
+ GL11.glPushMatrix();
+ GL11.glEnable(GL12.GL_RESCALE_NORMAL);
+ GL11.glEnable(GL11.GL_BLEND);
+ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
+ GL11.glColor4f(2.0F, 2.0F, 2.0F, 0.75F);
+ GL11.glTranslatef((float) par1 + 0.5f, (float) par2, (float) par3 + 0.5f);
+ GL11.glRotatef(360.0f / 120.0f * ((par0Tile.ticks % 120) + tick), 0f, 1f, 0f);
+
+
+ IIcon iicon = GetMagicCircleIcon(name);
+ float f14 = iicon.getMinU();
+ float f15 = iicon.getMaxU();
+ float f4 = iicon.getMinV();
+ float f5 = iicon.getMaxV();
+
+ this.bindTexture(TextureMap.locationBlocksTexture);
+
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(0.0F, 1.0F, 0.0F);
+ tessellator.addVertexWithUV(-0.5f - r, 0.0625D, 0.5f + r, (double) f15, (double) f4);
+ tessellator.addVertexWithUV(0.5f + r, 0.0625D, 0.5f + r, (double) f14, (double) f4);
+ tessellator.addVertexWithUV(0.5f + r, 0.0625D, -0.5f - r, (double) f14, (double) f5);
+ tessellator.addVertexWithUV(-0.5f - r, 0.0625D, -0.5f - r, (double) f15, (double) f5);
+ tessellator.draw();
+
+
+ GL11.glDisable(GL12.GL_RESCALE_NORMAL);
+ GL11.glDisable(GL11.GL_BLEND);
+ GL11.glPopMatrix();
+ }
+ }
+
+ public void renderTileEntityAt(TileEntity par1TileEntity, double par2, double par4, double par6, float par8) {
+ this.renderTileEntityCupAt((TileEntityMagicCore) par1TileEntity, par2, par4, par6, par8);
+ }
+
+ public static void ClearMagicCircleIcons(){
+ icons.clear();
+ }
+ public static void RegisterMagicCircleIcon(String name, TextureMap ir, String iconName){
+ if(icons.containsKey(name)) icons.remove(name);
+ icons.put(name, ir.registerIcon(iconName));
+ }
+ public static IIcon GetMagicCircleIcon(String name){
+ return icons.get(name);
+ }
+
+}
diff --git a/src/main/java/jp/plusplus/fbs/trouble/TroubleBase.class b/src/main/java/jp/plusplus/fbs/trouble/TroubleBase.class Binary files differnew file mode 100644 index 0000000..abad123 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/trouble/TroubleBase.class diff --git a/src/main/java/jp/plusplus/fbs/trouble/TroubleBase.java b/src/main/java/jp/plusplus/fbs/trouble/TroubleBase.java new file mode 100644 index 0000000..70c8b21 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/trouble/TroubleBase.java @@ -0,0 +1,24 @@ +package jp.plusplus.fbs.trouble;
+
+import jp.plusplus.fbs.Registry;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.world.World;
+
+/**
+ * Created by plusplus_F on 2015/09/17.
+ * 解読に失敗したときとかのいたずら
+ */
+public abstract class TroubleBase {
+ /**
+ * 出現し始める適性魔術レベル
+ */
+ protected int minLv;
+
+ public TroubleBase(int min){
+ minLv=min;
+ }
+
+ public int getMinimumMagicLv(){ return minLv; }
+ public abstract void done(World world, EntityPlayer player, Registry.BookData bd);
+ public String getMessage(){ return "info.fbs.book.trouble"; };
+}
diff --git a/src/main/java/jp/plusplus/fbs/trouble/TroubleDamage.class b/src/main/java/jp/plusplus/fbs/trouble/TroubleDamage.class Binary files differnew file mode 100644 index 0000000..61f6705 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/trouble/TroubleDamage.class diff --git a/src/main/java/jp/plusplus/fbs/trouble/TroubleDamage.java b/src/main/java/jp/plusplus/fbs/trouble/TroubleDamage.java new file mode 100644 index 0000000..82707c7 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/trouble/TroubleDamage.java @@ -0,0 +1,27 @@ +package jp.plusplus.fbs.trouble;
+
+import jp.plusplus.fbs.Registry;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.util.DamageSource;
+import net.minecraft.world.World;
+import shift.sextiarysector.player.CustomPlayerData;
+import shift.sextiarysector.player.EntityPlayerManager;
+import shift.sextiarysector.player.MoistureStats;
+
+/**
+ * Created by plusplus_F on 2015/09/17.
+ */
+public class TroubleDamage extends TroubleBase {
+ public TroubleDamage() {
+ super(10);
+ }
+
+ @Override
+ public void done(World world, EntityPlayer player, Registry.BookData bd) {
+ int amount=2+(int)(18.0*bd.lv/50.0);
+ player.attackEntityFrom(new DamageSource("evil.0"), amount);
+ }
+
+ @Override
+ public String getMessage(){ return super.getMessage()+".damage"; }
+}
diff --git a/src/main/java/jp/plusplus/fbs/trouble/TroubleDry.class b/src/main/java/jp/plusplus/fbs/trouble/TroubleDry.class Binary files differnew file mode 100644 index 0000000..235e6a6 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/trouble/TroubleDry.class diff --git a/src/main/java/jp/plusplus/fbs/trouble/TroubleDry.java b/src/main/java/jp/plusplus/fbs/trouble/TroubleDry.java new file mode 100644 index 0000000..852a2f6 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/trouble/TroubleDry.java @@ -0,0 +1,33 @@ +package jp.plusplus.fbs.trouble;
+
+import jp.plusplus.fbs.Registry;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.EntityPlayerMP;
+import net.minecraft.server.management.PlayerManager;
+import net.minecraft.util.FoodStats;
+import net.minecraft.world.World;
+import shift.sextiarysector.api.SextiarySectorAPI;
+import shift.sextiarysector.packet.PacketPlayerData;
+import shift.sextiarysector.packet.SSPacketHandler;
+import shift.sextiarysector.player.CustomPlayerData;
+import shift.sextiarysector.player.EntityPlayerManager;
+import shift.sextiarysector.player.MoistureStats;
+
+/**
+ * Created by plusplus_F on 2015/09/17.
+ */
+public class TroubleDry extends TroubleBase {
+ public TroubleDry() {
+ super(1);
+ }
+
+ @Override
+ public void done(World world, EntityPlayer player, Registry.BookData bd) {
+ float amount = Math.min(4 + 36.f * bd.lv / 25.f, 40.f);
+ SextiarySectorAPI.addMoistureExhaustion(player, amount);
+ if(player instanceof EntityPlayerMP) SSPacketHandler.INSTANCE.sendTo(new PacketPlayerData(EntityPlayerManager.getCustomPlayerData(player)), (EntityPlayerMP)player);
+ }
+
+ @Override
+ public String getMessage(){ return super.getMessage()+".dry"; }
+}
diff --git a/src/main/java/jp/plusplus/fbs/trouble/TroubleHunger.class b/src/main/java/jp/plusplus/fbs/trouble/TroubleHunger.class Binary files differnew file mode 100644 index 0000000..2eb159a --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/trouble/TroubleHunger.class diff --git a/src/main/java/jp/plusplus/fbs/trouble/TroubleHunger.java b/src/main/java/jp/plusplus/fbs/trouble/TroubleHunger.java new file mode 100644 index 0000000..6cbd144 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/trouble/TroubleHunger.java @@ -0,0 +1,27 @@ +package jp.plusplus.fbs.trouble;
+
+import jp.plusplus.fbs.Registry;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemFood;
+import net.minecraft.util.FoodStats;
+import net.minecraft.world.World;
+
+/**
+ * Created by plusplus_F on 2015/09/17.
+ */
+public class TroubleHunger extends TroubleBase {
+ public TroubleHunger() {
+ super(1);
+ }
+
+ @Override
+ public void done(World world, EntityPlayer player, Registry.BookData bd) {
+ int amount=5+(35*bd.lv/20);
+
+ FoodStats fs=player.getFoodStats();
+ if(fs.getFoodLevel()>0) fs.addExhaustion(amount);
+ }
+
+ @Override
+ public String getMessage(){ return super.getMessage()+".hunger"; }
+}
diff --git a/src/main/java/jp/plusplus/fbs/trouble/TroubleTiredness.class b/src/main/java/jp/plusplus/fbs/trouble/TroubleTiredness.class Binary files differnew file mode 100644 index 0000000..773ea87 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/trouble/TroubleTiredness.class diff --git a/src/main/java/jp/plusplus/fbs/trouble/TroubleTiredness.java b/src/main/java/jp/plusplus/fbs/trouble/TroubleTiredness.java new file mode 100644 index 0000000..54c7d10 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/trouble/TroubleTiredness.java @@ -0,0 +1,32 @@ +package jp.plusplus.fbs.trouble;
+
+import jp.plusplus.fbs.Registry;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.EntityPlayerMP;
+import net.minecraft.world.World;
+import shift.sextiarysector.api.SextiarySectorAPI;
+import shift.sextiarysector.packet.PacketPlayerData;
+import shift.sextiarysector.packet.SSPacketHandler;
+import shift.sextiarysector.player.CustomPlayerData;
+import shift.sextiarysector.player.EntityPlayerManager;
+import shift.sextiarysector.player.MoistureStats;
+import shift.sextiarysector.player.StaminaStats;
+
+/**
+ * Created by plusplus_F on 2015/09/17.
+ */
+public class TroubleTiredness extends TroubleBase {
+ public TroubleTiredness() {
+ super(1);
+ }
+
+ @Override
+ public void done(World world, EntityPlayer player, Registry.BookData bd) {
+ float amount = Math.min(10 + 90.f * bd.lv / 25.f, 100.f)*10;
+ SextiarySectorAPI.addStaminaExhaustion(player, amount);
+ if(player instanceof EntityPlayerMP) SSPacketHandler.INSTANCE.sendTo(new PacketPlayerData(EntityPlayerManager.getCustomPlayerData(player)), (EntityPlayerMP)player);
+ }
+
+ @Override
+ public String getMessage(){ return super.getMessage()+".tiredness"; }
+}
diff --git a/src/main/java/jp/plusplus/fbs/world/TeleporterWarp.class b/src/main/java/jp/plusplus/fbs/world/TeleporterWarp.class Binary files differnew file mode 100644 index 0000000..07fb0f1 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/TeleporterWarp.class diff --git a/src/main/java/jp/plusplus/fbs/world/TeleporterWarp.java b/src/main/java/jp/plusplus/fbs/world/TeleporterWarp.java new file mode 100644 index 0000000..961ee25 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/TeleporterWarp.java @@ -0,0 +1,44 @@ +package jp.plusplus.fbs.world;
+
+import net.minecraft.block.Block;
+import net.minecraft.entity.Entity;
+import net.minecraft.init.Blocks;
+import net.minecraft.util.Direction;
+import net.minecraft.util.MathHelper;
+import net.minecraft.world.ChunkCoordIntPair;
+import net.minecraft.world.Teleporter;
+import net.minecraft.world.WorldServer;
+
+/**
+ * Created by plusplus_F on 2015/11/08.
+ */
+public class TeleporterWarp extends Teleporter {
+ public TeleporterWarp(WorldServer p_i1963_1_) {
+ super(p_i1963_1_);
+ }
+
+ @Override
+ public void placeInPortal(Entity p_77185_1_, double p_77185_2_, double p_77185_4_, double p_77185_6_, float p_77185_8_) {
+ int i = MathHelper.floor_double(p_77185_1_.posX);
+ int j = MathHelper.floor_double(p_77185_1_.posY) - 1;
+ int k = MathHelper.floor_double(p_77185_1_.posZ);
+ p_77185_1_.setLocationAndAngles((double) i, (double) j, (double) k, p_77185_1_.rotationYaw, 0.0F);
+ p_77185_1_.motionX = p_77185_1_.motionY = p_77185_1_.motionZ = 0.0D;
+ }
+
+ @Override
+ public boolean placeInExistingPortal(Entity p_77184_1_, double p_77184_2_, double p_77184_4_, double p_77184_6_, float p_77184_8_) {
+ p_77184_1_.setLocationAndAngles(p_77184_1_.posX, p_77184_1_.posY, p_77184_1_.posZ, p_77184_1_.rotationYaw, p_77184_1_.rotationPitch);
+ p_77184_1_.motionX = p_77184_1_.motionY = p_77184_1_.motionZ = 0.0D;
+ return true;
+ }
+
+ @Override
+ public boolean makePortal(Entity p_85188_1_) {
+ return true;
+ }
+
+ @Override
+ public void removeStalePortalLocations(long p_85189_1_){}
+
+}
diff --git a/src/main/java/jp/plusplus/fbs/world/WorldGenGrass.class b/src/main/java/jp/plusplus/fbs/world/WorldGenGrass.class Binary files differnew file mode 100644 index 0000000..9e5e2c8 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/WorldGenGrass.class diff --git a/src/main/java/jp/plusplus/fbs/world/WorldGenGrass.java b/src/main/java/jp/plusplus/fbs/world/WorldGenGrass.java new file mode 100644 index 0000000..9428ff4 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/WorldGenGrass.java @@ -0,0 +1,49 @@ +package jp.plusplus.fbs.world;
+
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.Registry;
+import jp.plusplus.fbs.block.BlockCore;
+import jp.plusplus.fbs.tileentity.TileEntityHavestable;
+import net.minecraft.block.Block;
+import net.minecraft.world.World;
+import net.minecraft.world.biome.BiomeGenBase;
+import net.minecraft.world.gen.feature.WorldGenerator;
+
+import java.util.Random;
+
+/**
+ * Created by plusplus_F on 2015/2/23.
+ */
+public class WorldGenGrass extends WorldGenerator {
+ private Block field_150552_a;
+ public WorldGenGrass() {
+ field_150552_a = BlockCore.harvestableGrass;
+ }
+
+ public boolean generate(World world, Random rand, int bx, int by, int bz) {
+ BiomeGenBase bgb = world.getBiomeGenForCoords(bx, bz);
+ int id = world.provider.dimensionId;
+
+ //地表
+ if (bgb == BiomeGenBase.forest || bgb == BiomeGenBase.plains || bgb == BiomeGenBase.taiga || bgb == BiomeGenBase.taigaHills || bgb == BiomeGenBase.extremeHills ||
+ bgb == BiomeGenBase.extremeHillsEdge || bgb == BiomeGenBase.extremeHillsPlus || bgb == BiomeGenBase.birchForest || bgb == BiomeGenBase.birchForestHills ||
+ bgb == BiomeGenBase.roofedForest || bgb==BiomeGenBase.jungle || bgb==BiomeGenBase.jungleEdge || bgb==BiomeGenBase.jungleHills ||
+ bgb == Registry.biomeCrack || bgb==Registry.biomeAutumn) {
+
+ for (int l = 0; l < 10; ++l) {
+ int x = bx + rand.nextInt(8) - rand.nextInt(8);
+ int y = by + rand.nextInt(4) - rand.nextInt(4);
+ int z = bz + rand.nextInt(8) - rand.nextInt(8);
+
+ if (world.isAirBlock(x, y, z) && y < 255 && this.field_150552_a.canPlaceBlockAt(world, x, y, z)) {
+ if (world.setBlock(x, y, z, this.field_150552_a, 0, 2)) {
+ TileEntityHavestable te = (TileEntityHavestable) world.getTileEntity(x, y, z);
+ te.age = te.ageMax;
+ te.markDirty();
+ }
+ }
+ }
+ }
+ return true;
+ }
+}
\ No newline at end of file diff --git a/src/main/java/jp/plusplus/fbs/world/WorldGenHerbs.class b/src/main/java/jp/plusplus/fbs/world/WorldGenHerbs.class Binary files differnew file mode 100644 index 0000000..9cbd630 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/WorldGenHerbs.class diff --git a/src/main/java/jp/plusplus/fbs/world/WorldGenHerbs.java b/src/main/java/jp/plusplus/fbs/world/WorldGenHerbs.java new file mode 100644 index 0000000..cc83c8e --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/WorldGenHerbs.java @@ -0,0 +1,194 @@ +package jp.plusplus.fbs.world;
+
+import jp.plusplus.fbs.Registry;
+import jp.plusplus.fbs.block.BlockCore;
+import jp.plusplus.fbs.tileentity.TileEntityHavestable;
+import net.minecraft.block.Block;
+import net.minecraft.world.World;
+import net.minecraft.world.WorldProviderHell;
+import net.minecraft.world.biome.BiomeGenBase;
+import net.minecraft.world.biome.BiomeGenEnd;
+import net.minecraft.world.gen.ChunkProviderEnd;
+import net.minecraft.world.gen.ChunkProviderHell;
+import net.minecraft.world.gen.feature.WorldGenerator;
+import net.minecraftforge.common.BiomeManager;
+
+import java.util.Random;
+
+/**
+ * Created by plusplus_F on 2015/11/22.
+ */
+public class WorldGenHerbs extends WorldGenerator {
+ private Block field_150552_a;
+ private boolean isTop;
+
+ public WorldGenHerbs(boolean isTop) {
+ field_150552_a= BlockCore.harvestableHerb;
+ this.isTop=isTop;
+ }
+
+ public boolean generate(World world, Random rand, int bx, int by, int bz) {
+ if(isTop) generateOnGround(world, rand, bx, by, bz);
+ else generateUnderGround(world, rand, bx, by, bz);
+ return true;
+ }
+
+ private void generateOnGround(World world, Random rand, int bx, int by, int bz){
+ BiomeGenBase bgb=world.getBiomeGenForCoords(bx,bz);
+ int meta=0;
+
+ //--------------------------条件によって生成するハーブのmeta値を変える-------------------------------------
+ for(BiomeManager.BiomeEntry be : BiomeManager.getBiomes(BiomeManager.BiomeType.WARM)) {
+ if (bgb == be.biome) {
+ if(rand.nextFloat()<0.4f) meta=1;
+ break;
+ }
+ }
+
+ boolean flag=false;
+ flag=(bgb==BiomeGenBase.desert || bgb==BiomeGenBase.desertHills || bgb==BiomeGenBase.savanna || bgb==BiomeGenBase.savannaPlateau || bgb==BiomeGenBase.mesa || bgb==BiomeGenBase.mesaPlateau|| bgb==BiomeGenBase.mesaPlateau_F);
+ if(!flag){
+ for(BiomeManager.BiomeEntry be : BiomeManager.getBiomes(BiomeManager.BiomeType.DESERT)) {
+ if (bgb == be.biome) {
+ flag=true;
+ break;
+ }
+ }
+ }
+ if(flag && rand.nextFloat()<0.65f){
+ meta=3;
+ }
+
+ if(bgb==Registry.biomeAutumn && rand.nextFloat()<0.4f){
+ meta=2;
+ }
+ if(bgb==Registry.biomeCrack){
+ meta=4;
+ }
+ if(bgb==BiomeGenBase.hell){
+ meta=8;
+ }
+ if(bgb==BiomeGenBase.sky){
+ meta=7;
+ }
+
+ //--------------------------ハーブを生成する-------------------------------------
+ if(meta!=7 && meta!=8){
+ for (int l = 0; l < 16; ++l) {
+ int x = bx + rand.nextInt(8) - rand.nextInt(8);
+ int y = by + rand.nextInt(4) - rand.nextInt(4);
+ int z = bz + rand.nextInt(8) - rand.nextInt(8);
+
+ if (world.isAirBlock(x, y, z) && (!world.provider.hasNoSky || y < 255) && this.field_150552_a.canPlaceBlockAt(world, x, y, z)) {
+ if (world.setBlock(x, y, z, this.field_150552_a, meta, 2)) {
+ TileEntityHavestable te = (TileEntityHavestable) world.getTileEntity(x, y, z);
+ te.age = te.ageMax;
+ te.markDirty();
+ }
+ }
+ }
+ }
+ else{
+ for (int l = 0; l < 16; ++l) {
+ int x = bx + rand.nextInt(8) - rand.nextInt(8);
+ int y = by + rand.nextInt(4) - rand.nextInt(4);
+ int z = bz + rand.nextInt(8) - rand.nextInt(8);
+
+ if (world.isAirBlock(x, y, z) && y<255 && this.field_150552_a.canPlaceBlockAt(world, x, y, z)) {
+ if (world.setBlock(x, y, z, this.field_150552_a, meta, 2)) {
+ TileEntityHavestable te = (TileEntityHavestable) world.getTileEntity(x, y, z);
+ te.age = te.ageMax;
+ te.markDirty();
+ }
+ }
+ }
+ }
+ }
+ private void generateUnderGround(World world, Random rand, int bx, int by, int bz){
+ BiomeGenBase bgb=world.getBiomeGenForCoords(bx,bz);
+
+ if(bgb==BiomeGenBase.hell){
+ for (int l = 0; l < 16; ++l) {
+ int x = bx + rand.nextInt(4) - rand.nextInt(4);
+ int y = by + rand.nextInt(2) - rand.nextInt(2);
+ int z = bz + rand.nextInt(4) - rand.nextInt(4);
+
+ if (world.isAirBlock(x, y, z) && this.field_150552_a.canPlaceBlockAt(world, x, y, z)) {
+ if (world.setBlock(x, y, z, this.field_150552_a, 8, 2)) {
+ TileEntityHavestable te = (TileEntityHavestable) world.getTileEntity(x, y, z);
+ te.age = te.ageMax;
+ te.markDirty();
+ }
+ }
+ }
+ }
+ else
+ if(bgb==BiomeGenBase.sky){
+ for (int l = 0; l < 8; ++l) {
+ int x = bx + rand.nextInt(4) - rand.nextInt(4);
+ int y = by + rand.nextInt(2) - rand.nextInt(2);
+ int z = bz + rand.nextInt(4) - rand.nextInt(4);
+
+ if (world.isAirBlock(x, y, z) && this.field_150552_a.canPlaceBlockAt(world, x, y, z)) {
+ if (world.setBlock(x, y, z, this.field_150552_a, 7, 2)) {
+ TileEntityHavestable te = (TileEntityHavestable) world.getTileEntity(x, y, z);
+ te.age = te.ageMax;
+ te.markDirty();
+ }
+ }
+ }
+ }
+ else {
+ if(by<32+2){
+ //ゴールドかマンドレイクか。確率
+ if(by<20+2 && rand.nextFloat()<0.5f){
+ for (int l = 0; l < 16; ++l) {
+ int x = bx + rand.nextInt(4) - rand.nextInt(4);
+ int y = by + rand.nextInt(2) - rand.nextInt(2);
+ int z = bz + rand.nextInt(4) - rand.nextInt(4);
+
+ if (world.isAirBlock(x, y, z) && y<16 && this.field_150552_a.canPlaceBlockAt(world, x, y, z)) {
+ if (world.setBlock(x, y, z, this.field_150552_a, 6, 2)) {
+ TileEntityHavestable te = (TileEntityHavestable) world.getTileEntity(x, y, z);
+ te.age = te.ageMax;
+ te.markDirty();
+ }
+ }
+ }
+ }
+ else{
+ for (int l = 0; l < 16; ++l) {
+ int x = bx + rand.nextInt(4) - rand.nextInt(4);
+ int y = by + rand.nextInt(2) - rand.nextInt(2);
+ int z = bz + rand.nextInt(4) - rand.nextInt(4);
+
+ if (world.isAirBlock(x, y, z) && y<32 && this.field_150552_a.canPlaceBlockAt(world, x, y, z)) {
+ if (world.setBlock(x, y, z, this.field_150552_a, 5, 2)) {
+ TileEntityHavestable te = (TileEntityHavestable) world.getTileEntity(x, y, z);
+ te.age = te.ageMax;
+ te.markDirty();
+ }
+ }
+ }
+ }
+ }
+ else{
+ //y>=32+2ではテケトーに
+ int meta=rand.nextInt(4);
+ for (int l = 0; l < 32; ++l) {
+ int x = bx + rand.nextInt(4) - rand.nextInt(4);
+ int y = by + rand.nextInt(2) - rand.nextInt(2);
+ int z = bz + rand.nextInt(4) - rand.nextInt(4);
+
+ if (world.isAirBlock(x, y, z) && this.field_150552_a.canPlaceBlockAt(world, x, y, z)) {
+ if (world.setBlock(x, y, z, this.field_150552_a, meta, 2)) {
+ TileEntityHavestable te = (TileEntityHavestable) world.getTileEntity(x, y, z);
+ te.age = te.ageMax;
+ te.markDirty();
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file diff --git a/src/main/java/jp/plusplus/fbs/world/WorldGenMushroom.class b/src/main/java/jp/plusplus/fbs/world/WorldGenMushroom.class Binary files differnew file mode 100644 index 0000000..16d15bf --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/WorldGenMushroom.class diff --git a/src/main/java/jp/plusplus/fbs/world/WorldGenMushroom.java b/src/main/java/jp/plusplus/fbs/world/WorldGenMushroom.java new file mode 100644 index 0000000..9a9cabb --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/WorldGenMushroom.java @@ -0,0 +1,123 @@ +package jp.plusplus.fbs.world;
+
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.Registry;
+import jp.plusplus.fbs.block.BlockCore;
+import jp.plusplus.fbs.tileentity.TileEntityHavestable;
+import net.minecraft.block.Block;
+import net.minecraft.world.World;
+import net.minecraft.world.biome.BiomeGenBase;
+import net.minecraft.world.gen.feature.WorldGenerator;
+import net.minecraftforge.common.BiomeManager;
+
+import java.util.Random;
+
+/**
+ * Created by plusplus_F on 2015/2/23.
+ */
+public class WorldGenMushroom extends WorldGenerator {
+ private Block field_150552_a;
+ private boolean isTop;
+
+ public WorldGenMushroom(boolean isTop) {
+ field_150552_a = BlockCore.harvestableMushroom;
+ this.isTop = isTop;
+ }
+
+ public boolean generate(World world, Random rand, int bx, int by, int bz) {
+ if (isTop) generateOnGround(world, rand, bx, by, bz);
+ else generateUnderGround(world, rand, bx, by, bz);
+ return true;
+ }
+
+ private void generateOnGround(World world, Random rand, int bx, int by, int bz) {
+ BiomeGenBase bgb = world.getBiomeGenForCoords(bx, bz);
+ int id = world.provider.dimensionId;
+
+ //地表
+ if (id == 0 || id == FBS.dimensionAutumnId || id == FBS.dimensionCrackId) {
+ for (int l = 0; l < 8; ++l) {
+ int x = bx + rand.nextInt(8) - rand.nextInt(8);
+ int y = by + rand.nextInt(4) - rand.nextInt(4);
+ int z = bz + rand.nextInt(8) - rand.nextInt(8);
+
+ if (world.isAirBlock(x, y, z) && y < 255 && this.field_150552_a.canPlaceBlockAt(world, x, y, z)) {
+ if (world.setBlock(x, y, z, this.field_150552_a, 0, 2)) {
+ TileEntityHavestable te = (TileEntityHavestable) world.getTileEntity(x, y, z);
+ te.age = te.ageMax;
+ te.markDirty();
+ }
+ }
+ }
+ }
+
+ //ネザ
+ if (id == -1) {
+ for (int l = 0; l < 16; ++l) {
+ int x = bx + rand.nextInt(8) - rand.nextInt(8);
+ int y = by + rand.nextInt(4) - rand.nextInt(4);
+ int z = bz + rand.nextInt(8) - rand.nextInt(8);
+
+ if (world.isAirBlock(x, y, z) && y < 255 && this.field_150552_a.canPlaceBlockAt(world, x, y, z)) {
+ if (world.setBlock(x, y, z, this.field_150552_a, 1, 2)) {
+ TileEntityHavestable te = (TileEntityHavestable) world.getTileEntity(x, y, z);
+ te.age = te.ageMax;
+ te.markDirty();
+ }
+ }
+ }
+ }
+
+
+ }
+
+ private void generateUnderGround(World world, Random rand, int bx, int by, int bz) {
+ if (world.provider.dimensionId != 0) return;
+
+ if (by < 50 + 2) {
+ if (by < 30 + 2 && rand.nextFloat() < 0.5f) {
+ for (int l = 0; l < 16; ++l) {
+ int x = bx + rand.nextInt(4) - rand.nextInt(4);
+ int y = by + rand.nextInt(2) - rand.nextInt(2);
+ int z = bz + rand.nextInt(4) - rand.nextInt(4);
+
+ if (world.isAirBlock(x, y, z) && y < 16 && this.field_150552_a.canPlaceBlockAt(world, x, y, z)) {
+ if (world.setBlock(x, y, z, this.field_150552_a, 2, 2)) {
+ TileEntityHavestable te = (TileEntityHavestable) world.getTileEntity(x, y, z);
+ te.age = te.ageMax;
+ te.markDirty();
+ }
+ }
+ }
+ } else {
+ for (int l = 0; l < 16; ++l) {
+ int x = bx + rand.nextInt(4) - rand.nextInt(4);
+ int y = by + rand.nextInt(2) - rand.nextInt(2);
+ int z = bz + rand.nextInt(4) - rand.nextInt(4);
+
+ if (world.isAirBlock(x, y, z) && y < 32 && this.field_150552_a.canPlaceBlockAt(world, x, y, z)) {
+ if (world.setBlock(x, y, z, this.field_150552_a, 1, 2)) {
+ TileEntityHavestable te = (TileEntityHavestable) world.getTileEntity(x, y, z);
+ te.age = te.ageMax;
+ te.markDirty();
+ }
+ }
+ }
+ }
+ } else {
+ for (int l = 0; l < 32; ++l) {
+ int x = bx + rand.nextInt(4) - rand.nextInt(4);
+ int y = by + rand.nextInt(2) - rand.nextInt(2);
+ int z = bz + rand.nextInt(4) - rand.nextInt(4);
+
+ if (world.isAirBlock(x, y, z) && this.field_150552_a.canPlaceBlockAt(world, x, y, z)) {
+ if (world.setBlock(x, y, z, this.field_150552_a, 0, 2)) {
+ TileEntityHavestable te = (TileEntityHavestable) world.getTileEntity(x, y, z);
+ te.age = te.ageMax;
+ te.markDirty();
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file diff --git a/src/main/java/jp/plusplus/fbs/world/autumn/ChunkProviderAutumn.class b/src/main/java/jp/plusplus/fbs/world/autumn/ChunkProviderAutumn.class Binary files differnew file mode 100644 index 0000000..2f44634 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/autumn/ChunkProviderAutumn.class diff --git a/src/main/java/jp/plusplus/fbs/world/autumn/ChunkProviderAutumn.java b/src/main/java/jp/plusplus/fbs/world/autumn/ChunkProviderAutumn.java new file mode 100644 index 0000000..925dbb4 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/autumn/ChunkProviderAutumn.java @@ -0,0 +1,123 @@ +package jp.plusplus.fbs.world.autumn;
+
+import cpw.mods.fml.common.eventhandler.Event;
+import net.minecraft.block.Block;
+import net.minecraft.block.BlockFalling;
+import net.minecraft.block.material.Material;
+import net.minecraft.entity.EnumCreatureType;
+import net.minecraft.init.Blocks;
+import net.minecraft.util.IProgressUpdate;
+import net.minecraft.util.MathHelper;
+import net.minecraft.world.ChunkPosition;
+import net.minecraft.world.SpawnerAnimals;
+import net.minecraft.world.World;
+import net.minecraft.world.biome.BiomeGenBase;
+import net.minecraft.world.chunk.Chunk;
+import net.minecraft.world.chunk.IChunkProvider;
+import net.minecraft.world.gen.ChunkProviderGenerate;
+import net.minecraft.world.gen.NoiseGenerator;
+import net.minecraft.world.gen.NoiseGeneratorOctaves;
+import net.minecraft.world.gen.feature.WorldGenDungeons;
+import net.minecraft.world.gen.feature.WorldGenLakes;
+import net.minecraft.world.gen.structure.MapGenMineshaft;
+import net.minecraftforge.common.MinecraftForge;
+import net.minecraftforge.event.terraingen.ChunkProviderEvent;
+import net.minecraftforge.event.terraingen.PopulateChunkEvent;
+import net.minecraftforge.event.terraingen.TerrainGen;
+
+import java.util.List;
+import java.util.Random;
+
+import static net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.*;
+import static net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.ICE;
+
+/**
+ * Created by plusplus_F on 2015/10/29.
+ */
+public class ChunkProviderAutumn extends ChunkProviderGenerate implements IChunkProvider {
+ private World worldObj;
+ private Random rand = new Random();
+ private boolean mapFeaturesEnabled;
+ private MapGenMineshaft mineshaftGenerator = new MapGenMineshaft();
+
+ public ChunkProviderAutumn(World par1World, long par2, boolean par4) {
+ super(par1World, par2, par4);
+ worldObj = par1World;
+ mapFeaturesEnabled = par4;
+
+ }
+
+ @Override
+ public void populate(IChunkProvider p_73153_1_, int p_73153_2_, int p_73153_3_) {
+ BlockFalling.fallInstantly = true;
+ int k = p_73153_2_ * 16;
+ int l = p_73153_3_ * 16;
+ BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(k + 16, l + 16);
+ this.rand.setSeed(this.worldObj.getSeed());
+ long i1 = this.rand.nextLong() / 2L * 2L + 1L;
+ long j1 = this.rand.nextLong() / 2L * 2L + 1L;
+ this.rand.setSeed((long) p_73153_2_ * i1 + (long) p_73153_3_ * j1 ^ this.worldObj.getSeed());
+ boolean flag = false;
+
+ MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag));
+
+ if (this.mapFeaturesEnabled) {
+ this.mineshaftGenerator.generateStructuresInChunk(this.worldObj, this.rand, p_73153_2_, p_73153_3_);
+ }
+
+ int k1;
+ int l1;
+ int i2;
+
+ if (this.rand.nextInt(4) == 0 && TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, LAKE)) {
+ k1 = k + this.rand.nextInt(16) + 8;
+ l1 = this.rand.nextInt(256);
+ i2 = l + this.rand.nextInt(16) + 8;
+ (new WorldGenLakes(Blocks.water)).generate(this.worldObj, this.rand, k1, l1, i2);
+ }
+
+ if (TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, LAVA) && !flag && this.rand.nextInt(8) == 0) {
+ k1 = k + this.rand.nextInt(16) + 8;
+ l1 = this.rand.nextInt(this.rand.nextInt(248) + 8);
+ i2 = l + this.rand.nextInt(16) + 8;
+
+ if (l1 < 63 || this.rand.nextInt(10) == 0) {
+ (new WorldGenLakes(Blocks.lava)).generate(this.worldObj, this.rand, k1, l1, i2);
+ }
+ }
+
+ boolean doGen = TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, DUNGEON);
+ for (k1 = 0; doGen && k1 < 8; ++k1) {
+ l1 = k + this.rand.nextInt(16) + 8;
+ i2 = this.rand.nextInt(256);
+ int j2 = l + this.rand.nextInt(16) + 8;
+ (new WorldGenDungeons()).generate(this.worldObj, this.rand, l1, i2, j2);
+ }
+
+ biomegenbase.decorate(this.worldObj, this.rand, k, l);
+ if (TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, ANIMALS)) {
+ SpawnerAnimals.performWorldGenSpawning(this.worldObj, biomegenbase, k + 8, l + 8, 16, 16, this.rand);
+ }
+ k += 8;
+ l += 8;
+
+ doGen = TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, ICE);
+ for (k1 = 0; doGen && k1 < 16; ++k1) {
+ for (l1 = 0; l1 < 16; ++l1) {
+ i2 = this.worldObj.getPrecipitationHeight(k + k1, l + l1);
+
+ if (this.worldObj.isBlockFreezable(k1 + k, i2 - 1, l1 + l)) {
+ this.worldObj.setBlock(k1 + k, i2 - 1, l1 + l, Blocks.ice, 0, 2);
+ }
+
+ if (this.worldObj.func_147478_e(k1 + k, i2, l1 + l, true)) {
+ this.worldObj.setBlock(k1 + k, i2, l1 + l, Blocks.snow_layer, 0, 2);
+ }
+ }
+ }
+
+ MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag));
+
+ BlockFalling.fallInstantly = false;
+ }
+}
\ No newline at end of file diff --git a/src/main/java/jp/plusplus/fbs/world/autumn/TeleporterAutumn.class b/src/main/java/jp/plusplus/fbs/world/autumn/TeleporterAutumn.class Binary files differnew file mode 100644 index 0000000..229e639 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/autumn/TeleporterAutumn.class diff --git a/src/main/java/jp/plusplus/fbs/world/autumn/TeleporterAutumn.java b/src/main/java/jp/plusplus/fbs/world/autumn/TeleporterAutumn.java new file mode 100644 index 0000000..8ff296a --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/autumn/TeleporterAutumn.java @@ -0,0 +1,354 @@ +package jp.plusplus.fbs.world.autumn;
+
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.block.BlockCore;
+import net.minecraft.block.Block;
+import net.minecraft.block.BlockPortal;
+import net.minecraft.entity.Entity;
+import net.minecraft.init.Blocks;
+import net.minecraft.util.Direction;
+import net.minecraft.util.LongHashMap;
+import net.minecraft.util.MathHelper;
+import net.minecraft.world.ChunkCoordIntPair;
+import net.minecraft.world.Teleporter;
+import net.minecraft.world.WorldServer;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Random;
+
+/**
+ * Created by plusplus_F on 2015/11/07.
+ */
+public class TeleporterAutumn extends Teleporter {
+ private final LongHashMap destinationCoordinateCache = new LongHashMap();
+ private final List destinationCoordinateKeys = new ArrayList();
+ private final WorldServer worldServerInstance;
+ private final Random random;
+
+ public TeleporterAutumn(WorldServer p_i1963_1_) {
+ super(p_i1963_1_);
+ worldServerInstance=p_i1963_1_;
+ random=new Random();
+ }
+
+ // 近くにポータルがあったらそこに出現させる処理
+ // このサンプルではネザーポータルの処理をそのまま利用する
+ @Override
+ public boolean placeInExistingPortal(Entity entity, double p_77184_2_, double p_77184_4_, double p_77184_6_, float p_77184_8_) {
+ short short1 = 128;
+ double d3 = -1.0D;
+ int i = 0;
+ int j = 0;
+ int k = 0;
+ int l = MathHelper.floor_double(entity.posX);
+ int i1 = MathHelper.floor_double(entity.posZ);
+ long j1 = ChunkCoordIntPair.chunkXZ2Int(l, i1);
+ boolean flag = true;
+ double z;
+ int l3;
+
+ if (this.destinationCoordinateCache.containsItem(j1)) {
+ Teleporter.PortalPosition portalposition = (Teleporter.PortalPosition) this.destinationCoordinateCache.getValueByKey(j1);
+ d3 = 0.0D;
+ i = portalposition.posX;
+ j = portalposition.posY;
+ k = portalposition.posZ;
+ portalposition.lastUpdateTime = this.worldServerInstance.getTotalWorldTime();
+ flag = false;
+ } else {
+ for (l3 = l - short1; l3 <= l + short1; ++l3) {
+ double d4 = (double) l3 + 0.5D - entity.posX;
+
+ for (int l1 = i1 - short1; l1 <= i1 + short1; ++l1) {
+ double d5 = (double) l1 + 0.5D - entity.posZ;
+
+ for (int i2 = this.worldServerInstance.getActualHeight() - 1; i2 >= 0; --i2) {
+ if (this.worldServerInstance.getBlock(l3, i2, l1) == BlockCore.portal2) {
+ while (this.worldServerInstance.getBlock(l3, i2 - 1, l1) == BlockCore.portal2) {
+ --i2;
+ }
+
+ z = (double) i2 + 0.5D - entity.posY;
+ double d8 = d4 * d4 + z * z + d5 * d5;
+
+ if (d3 < 0.0D || d8 < d3) {
+ d3 = d8;
+ i = l3;
+ j = i2;
+ k = l1;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (d3 >= 0.0D) {
+ if (flag) {
+ this.destinationCoordinateCache.add(j1, new Teleporter.PortalPosition(i, j, k, this.worldServerInstance.getTotalWorldTime()));
+ this.destinationCoordinateKeys.add(Long.valueOf(j1));
+ }
+
+ double x = (double) i + 0.5D;
+ double y = (double) j + 0.5D;
+ z = (double) k + 0.5D;
+
+ entity.motionX = entity.motionY = entity.motionZ = 0.0D;
+
+ entity.setLocationAndAngles(x, y+1, z, entity.rotationYaw, entity.rotationPitch);
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ // ポータルを作成する処理
+ // このサンプルではネザーポータルの処理をそのまま利用する
+ @Override
+ public boolean makePortal(Entity p_85188_1_) {
+ byte b0 = 16;
+ double d0 = -1.0D;
+ int i = MathHelper.floor_double(p_85188_1_.posX);
+ int j = MathHelper.floor_double(p_85188_1_.posY);
+ int k = MathHelper.floor_double(p_85188_1_.posZ);
+ int l = i;
+ int i1 = j;
+ int j1 = k;
+ int k1 = 0;
+ int l1 = this.random.nextInt(4);
+ int x;
+ double d1;
+ int z;
+ double d2;
+ int y;
+ int j3;
+ int k3;
+ int l3;
+ int i4;
+ int j4;
+ int k4;
+ int x2;
+ int y2;
+ double d3;
+ double d4;
+
+ for (x = i - b0; x <= i + b0; ++x) {
+ d1 = (double) x + 0.5D - p_85188_1_.posX;
+
+ for (z = k - b0; z <= k + b0; ++z) {
+ d2 = (double) z + 0.5D - p_85188_1_.posZ;
+ label274:
+
+ for (y = this.worldServerInstance.getActualHeight() - 1; y >= 0; --y) {
+ if (this.worldServerInstance.isAirBlock(x, y, z)) {
+ while (y > 0 && this.worldServerInstance.isAirBlock(x, y - 1, z)) {
+ --y;
+ }
+
+ for (j3 = l1; j3 < l1 + 4; ++j3) {
+ k3 = j3 % 2;
+ l3 = 1 - k3;
+
+ if (j3 % 4 >= 2) {
+ k3 = -k3;
+ l3 = -l3;
+ }
+
+ for (i4 = 0; i4 < 3; ++i4) {
+ for (j4 = 0; j4 < 4; ++j4) {
+ for (k4 = -1; k4 < 4; ++k4) {
+ x2 = x + (j4 - 1) * k3 + i4 * l3;
+ y2 = y + k4;
+ int z2 = z + (j4 - 1) * l3 - i4 * k3;
+
+ if (k4 < 0 && !this.worldServerInstance.getBlock(x2, y2, z2).getMaterial().isSolid() || k4 >= 0 && !this.worldServerInstance.isAirBlock(x2, y2, z2)) {
+ continue label274;
+ }
+ }
+ }
+ }
+
+ d3 = (double) y + 0.5D - p_85188_1_.posY;
+ d4 = d1 * d1 + d3 * d3 + d2 * d2;
+
+ if (d0 < 0.0D || d4 < d0) {
+ d0 = d4;
+ l = x;
+ i1 = y;
+ j1 = z;
+ k1 = j3 % 4;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (d0 < 0.0D) {
+ for (x = i - b0; x <= i + b0; ++x) {
+ d1 = (double) x + 0.5D - p_85188_1_.posX;
+
+ for (z = k - b0; z <= k + b0; ++z) {
+ d2 = (double) z + 0.5D - p_85188_1_.posZ;
+ label222:
+
+ for (y = this.worldServerInstance.getActualHeight() - 1; y >= 0; --y) {
+ if (this.worldServerInstance.isAirBlock(x, y, z)) {
+ while (y > 0 && this.worldServerInstance.isAirBlock(x, y - 1, z)) {
+ --y;
+ }
+
+ for (j3 = l1; j3 < l1 + 2; ++j3) {
+ k3 = j3 % 2;
+ l3 = 1 - k3;
+
+ for (i4 = 0; i4 < 4; ++i4) {
+ for (j4 = -1; j4 < 4; ++j4) {
+ k4 = x + (i4 - 1) * k3;
+ x2 = y + j4;
+ y2 = z + (i4 - 1) * l3;
+
+ if (j4 < 0 && !this.worldServerInstance.getBlock(k4, x2, y2).getMaterial().isSolid() || j4 >= 0 && !this.worldServerInstance.isAirBlock(k4, x2, y2)) {
+ continue label222;
+ }
+ }
+ }
+
+ d3 = (double) y + 0.5D - p_85188_1_.posY;
+ d4 = d1 * d1 + d3 * d3 + d2 * d2;
+
+ if (d0 < 0.0D || d4 < d0) {
+ d0 = d4;
+ l = x;
+ i1 = y;
+ j1 = z;
+ k1 = j3 % 2;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ int k5 = l;
+ int j2 = i1;
+ z = j1;
+ int l5 = k1 % 2;
+ int l2 = 1 - l5;
+
+ if (k1 % 4 >= 2) {
+ l5 = -l5;
+ l2 = -l2;
+ }
+
+ boolean flag;
+
+ if (d0 < 0.0D) {
+ if (i1 < 70) {
+ i1 = 70;
+ }
+
+ if (i1 > this.worldServerInstance.getActualHeight() - 10) {
+ i1 = this.worldServerInstance.getActualHeight() - 10;
+ }
+
+ j2 = i1;
+
+ for (y = -1; y <= 1; ++y) {
+ for (j3 = 1; j3 < 3; ++j3) {
+ for (k3 = -1; k3 < 3; ++k3) {
+ l3 = k5 + (j3 - 1) * l5 + y * l2;
+ i4 = j2 + k3;
+ j4 = z + (j3 - 1) * l2 - y * l5;
+ flag = k3 < 0;
+ this.worldServerInstance.setBlock(l3, i4, j4, flag ? BlockCore.plank : Blocks.air);
+ }
+ }
+ }
+ }
+
+ worldServerInstance.setBlock(k5, j2-1, z, BlockCore.portal2, 0, 2);
+ /*
+ for (y = 0; y < 4; ++y) {
+ for (j3 = 0; j3 < 4; ++j3) {
+ for (k3 = -1; k3 < 4; ++k3) {
+ l3 = k5 + (j3 - 1) * l5;
+ i4 = j2 + k3;
+ j4 = z + (j3 - 1) * l2;
+ flag = j3 == 0 || j3 == 3 || k3 == -1 || k3 == 3;
+ this.worldServerInstance.setBlock(l3, i4, j4, (Block) (flag ? BlockCore.plank : BlockCore.portal2), 0, 2);
+ }
+ }
+
+ for (j3 = 0; j3 < 4; ++j3) {
+ for (k3 = -1; k3 < 4; ++k3) {
+ l3 = k5 + (j3 - 1) * l5;
+ i4 = j2 + k3;
+ j4 = z + (j3 - 1) * l2;
+ this.worldServerInstance.notifyBlocksOfNeighborChange(l3, i4, j4, this.worldServerInstance.getBlock(l3, i4, j4));
+ }
+ }
+ }
+ */
+
+ return true;
+ }
+
+ public void removeStalePortalLocations(long p_85189_1_) {
+ if (p_85189_1_ % 100L == 0L) {
+ Iterator iterator = this.destinationCoordinateKeys.iterator();
+ long j = p_85189_1_ - 600L;
+
+ while (iterator.hasNext()) {
+ Long olong = (Long) iterator.next();
+ Teleporter.PortalPosition portalposition = (Teleporter.PortalPosition) this.destinationCoordinateCache.getValueByKey(olong.longValue());
+
+ if (portalposition == null || portalposition.lastUpdateTime < j) {
+ iterator.remove();
+ this.destinationCoordinateCache.remove(olong.longValue());
+ }
+ }
+ }
+ }
+
+ @Override
+ public void placeInPortal(Entity p_77185_1_, double p_77185_2_, double p_77185_4_, double p_77185_6_, float p_77185_8_) {
+ if (!this.placeInExistingPortal(p_77185_1_, p_77185_2_, p_77185_4_, p_77185_6_, p_77185_8_)) {
+ this.makePortal(p_77185_1_);
+ this.placeInExistingPortal(p_77185_1_, p_77185_2_, p_77185_4_, p_77185_6_, p_77185_8_);
+ }
+
+ /*
+ if (this.worldServerInstance.provider.dimensionId != FBS.dimensionAutumnId) {
+ if (!this.placeInExistingPortal(p_77185_1_, p_77185_2_, p_77185_4_, p_77185_6_, p_77185_8_)) {
+ this.makePortal(p_77185_1_);
+ this.placeInExistingPortal(p_77185_1_, p_77185_2_, p_77185_4_, p_77185_6_, p_77185_8_);
+ }
+ } else {
+ int i = MathHelper.floor_double(p_77185_1_.posX);
+ int j = MathHelper.floor_double(p_77185_1_.posY) - 1;
+ int k = MathHelper.floor_double(p_77185_1_.posZ);
+ byte b0 = 1;
+ byte b1 = 0;
+
+ for (int l = -4; l <= 4; ++l) {
+ for (int i1 = -4; i1 <= 4; ++i1) {
+ for (int j1 = -1; j1 < 3; ++j1) {
+ int blockX = i + i1 * b0 + l * b1;
+ int blockY = j + j1;
+ int blockZ = k + i1 * b1 - l * b0;
+ boolean flag = j1 < 0;
+ this.worldServerInstance.setBlock(blockX, blockY, blockZ, flag ? BlockCore.plank : Blocks.air);
+ }
+ }
+ }
+
+ p_77185_1_.setLocationAndAngles((double) i+2, (double) j, (double) k+2, p_77185_1_.rotationYaw, 0.0F);
+ p_77185_1_.motionX = p_77185_1_.motionY = p_77185_1_.motionZ = 0.0D;
+ }
+ */
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/world/autumn/WorldChunkManagerAutumn.class b/src/main/java/jp/plusplus/fbs/world/autumn/WorldChunkManagerAutumn.class Binary files differnew file mode 100644 index 0000000..21d5e51 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/autumn/WorldChunkManagerAutumn.class diff --git a/src/main/java/jp/plusplus/fbs/world/autumn/WorldChunkManagerAutumn.java b/src/main/java/jp/plusplus/fbs/world/autumn/WorldChunkManagerAutumn.java new file mode 100644 index 0000000..9c38067 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/autumn/WorldChunkManagerAutumn.java @@ -0,0 +1,202 @@ +package jp.plusplus.fbs.world.autumn;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.Registry;
+import net.minecraft.world.ChunkPosition;
+import net.minecraft.world.World;
+import net.minecraft.world.WorldType;
+import net.minecraft.world.biome.BiomeCache;
+import net.minecraft.world.biome.BiomeGenBase;
+import net.minecraft.world.biome.WorldChunkManager;
+import net.minecraft.world.gen.layer.GenLayer;
+import net.minecraft.world.gen.layer.IntCache;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Random;
+
+/**
+ * Created by plusplus_F on 2015/10/29.
+ */
+public class WorldChunkManagerAutumn extends WorldChunkManager {
+ // WorldChunkManagerのプライベート変数にはアクセスできないので専用の変数を作成
+ private GenLayer genBiomes;
+ private GenLayer biomeIndexLayer;
+ private BiomeCache biomeCache;
+ private List biomesToSpawnIn;
+
+ public static final BiomeGenBase[] biomeList = new BiomeGenBase[256];
+
+ static {
+ for (int i = 0; i < biomeList.length; ++i) {
+ biomeList[i]=Registry.biomeAutumn;
+ /*
+ if (i % 2 == 0) {
+ biomeList[i] = mushroomIsland;
+ } else if (i % 2 == 1) {
+ biomeList[i] = mesa;
+ }
+ */
+ }
+ }
+
+ protected WorldChunkManagerAutumn() {
+ this.biomeCache = new BiomeCache(this);
+ this.biomesToSpawnIn = new ArrayList();
+ this.biomesToSpawnIn.add(Registry.biomeAutumn);
+ //this.biomesToSpawnIn.addAll(allowedBiomes);
+ }
+
+ public WorldChunkManagerAutumn(long par1, WorldType par3WorldType) {
+ this();
+ GenLayer[] var4 = GenLayer.initializeAllBiomeGenerators(par1, par3WorldType);
+ this.genBiomes = var4[0];
+ this.biomeIndexLayer = var4[1];
+ }
+
+ public WorldChunkManagerAutumn(World par1World) {
+ this(par1World.getSeed(), par1World.getWorldInfo().getTerrainType());
+ }
+
+ ///////////////////////////////////////////////////////////////////////
+ // WorldChunkManagerのプライベート変数を使用するメソッドはすべて再実装
+
+ @Override
+ public List getBiomesToSpawnIn() {
+ return this.biomesToSpawnIn;
+ }
+
+ @Override
+ public BiomeGenBase getBiomeGenAt(int par1, int par2) {
+ return this.biomeCache.getBiomeGenAt(par1, par2);
+ }
+
+ @Override
+ public float[] getRainfall(float[] par1ArrayOfFloat, int par2, int par3, int par4, int par5) {
+ IntCache.resetIntCache();
+
+ if (par1ArrayOfFloat == null || par1ArrayOfFloat.length < par4 * par5) {
+ par1ArrayOfFloat = new float[par4 * par5];
+ }
+
+ int[] var6 = this.biomeIndexLayer.getInts(par2, par3, par4, par5);
+
+ for (int var7 = 0; var7 < par4 * par5; ++var7) {
+ float var8 = (float) biomeList[var6[var7]].getIntRainfall() / 65536.0F;
+
+ if (var8 > 1.0F) {
+ var8 = 1.0F;
+ }
+
+ par1ArrayOfFloat[var7] = var8;
+ }
+
+ return par1ArrayOfFloat;
+ }
+
+ @SideOnly(Side.CLIENT)
+ @Override
+ public float getTemperatureAtHeight(float par1, int par2) {
+ return par1;
+ }
+
+ @Override
+ public BiomeGenBase[] getBiomesForGeneration(BiomeGenBase[] par1ArrayOfBiomeGenBase, int par2, int par3, int par4, int par5) {
+ IntCache.resetIntCache();
+
+ if (par1ArrayOfBiomeGenBase == null || par1ArrayOfBiomeGenBase.length < par4 * par5) {
+ par1ArrayOfBiomeGenBase = new BiomeGenBase[par4 * par5];
+ }
+
+ int[] var6 = this.genBiomes.getInts(par2, par3, par4, par5);
+
+ for (int var7 = 0; var7 < par4 * par5; ++var7) {
+ par1ArrayOfBiomeGenBase[var7] = biomeList[var6[var7]];
+ }
+
+ return par1ArrayOfBiomeGenBase;
+ }
+
+ @Override
+ public BiomeGenBase[] loadBlockGeneratorData(BiomeGenBase[] par1ArrayOfBiomeGenBase, int par2, int par3, int par4, int par5) {
+ return this.getBiomeGenAt(par1ArrayOfBiomeGenBase, par2, par3, par4, par5, true);
+ }
+
+ @Override
+ public BiomeGenBase[] getBiomeGenAt(BiomeGenBase[] par1ArrayOfBiomeGenBase, int par2, int par3, int par4, int par5, boolean par6) {
+ IntCache.resetIntCache();
+
+ if (par1ArrayOfBiomeGenBase == null || par1ArrayOfBiomeGenBase.length < par4 * par5) {
+ par1ArrayOfBiomeGenBase = new BiomeGenBase[par4 * par5];
+ }
+
+ if (par6 && par4 == 16 && par5 == 16 && (par2 & 15) == 0 && (par3 & 15) == 0) {
+ BiomeGenBase[] var9 = this.biomeCache.getCachedBiomes(par2, par3);
+ System.arraycopy(var9, 0, par1ArrayOfBiomeGenBase, 0, par4 * par5);
+ return par1ArrayOfBiomeGenBase;
+ } else {
+ int[] var7 = this.biomeIndexLayer.getInts(par2, par3, par4, par5);
+
+ for (int var8 = 0; var8 < par4 * par5; ++var8) {
+ par1ArrayOfBiomeGenBase[var8] = biomeList[var7[var8]];
+ }
+
+ return par1ArrayOfBiomeGenBase;
+ }
+ }
+
+ @Override
+ public boolean areBiomesViable(int par1, int par2, int par3, List par4List) {
+ IntCache.resetIntCache();
+ int var5 = par1 - par3 >> 2;
+ int var6 = par2 - par3 >> 2;
+ int var7 = par1 + par3 >> 2;
+ int var8 = par2 + par3 >> 2;
+ int var9 = var7 - var5 + 1;
+ int var10 = var8 - var6 + 1;
+ int[] var11 = this.genBiomes.getInts(var5, var6, var9, var10);
+
+ for (int var12 = 0; var12 < var9 * var10; ++var12) {
+ BiomeGenBase var13 = biomeList[var11[var12]];
+
+ if (!par4List.contains(var13)) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ @Override
+ public ChunkPosition findBiomePosition(int par1, int par2, int par3, List par4List, Random par5Random) {
+ IntCache.resetIntCache();
+ int var6 = par1 - par3 >> 2;
+ int var7 = par2 - par3 >> 2;
+ int var8 = par1 + par3 >> 2;
+ int var9 = par2 + par3 >> 2;
+ int var10 = var8 - var6 + 1;
+ int var11 = var9 - var7 + 1;
+ int[] var12 = this.genBiomes.getInts(var6, var7, var10, var11);
+ ChunkPosition var13 = null;
+ int var14 = 0;
+
+ for (int var15 = 0; var15 < var10 * var11; ++var15) {
+ int var16 = var6 + var15 % var10 << 2;
+ int var17 = var7 + var15 / var10 << 2;
+ BiomeGenBase var18 = biomeList[var12[var15]];
+
+ if (par4List.contains(var18) && (var13 == null || par5Random.nextInt(var14 + 1) == 0)) {
+ var13 = new ChunkPosition(var16, 0, var17);
+ ++var14;
+ }
+ }
+
+ return var13;
+ }
+
+ @Override
+ public void cleanupCache() {
+ this.biomeCache.cleanupCache();
+ }
+}
\ No newline at end of file diff --git a/src/main/java/jp/plusplus/fbs/world/autumn/WorldProviderAutumn.class b/src/main/java/jp/plusplus/fbs/world/autumn/WorldProviderAutumn.class Binary files differnew file mode 100644 index 0000000..a320bb1 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/autumn/WorldProviderAutumn.class diff --git a/src/main/java/jp/plusplus/fbs/world/autumn/WorldProviderAutumn.java b/src/main/java/jp/plusplus/fbs/world/autumn/WorldProviderAutumn.java new file mode 100644 index 0000000..8622a1b --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/autumn/WorldProviderAutumn.java @@ -0,0 +1,57 @@ +package jp.plusplus.fbs.world.autumn;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.FBS;
+import net.minecraft.util.ChunkCoordinates;
+import net.minecraft.world.WorldProvider;
+import net.minecraft.world.chunk.IChunkProvider;
+
+/**
+ * Created by plusplus_F on 2015/11/07.
+ */
+public class WorldProviderAutumn extends WorldProvider {
+
+ @Override
+ public String getDimensionName() {
+ return "Eternal Autumn";
+ }
+
+ // 独自のワールドタイプやワールドチャンクマネージャーを設定
+ @Override
+ protected void registerWorldChunkManager() {
+ worldObj.getWorldInfo().setTerrainType(WorldTypeAutumn.worldType);
+ worldChunkMgr = new WorldChunkManagerAutumn(worldObj);
+ setDimension(FBS.dimensionAutumnId);
+ }
+
+ @Override
+ public IChunkProvider createChunkGenerator() {
+ return new ChunkProviderAutumn(worldObj, worldObj.getSeed(), worldObj.getWorldInfo().isMapFeaturesEnabled());
+ }
+
+ @Override
+ public boolean canRespawnHere() {
+ return false;
+ }
+
+ @Override
+ public boolean isSurfaceWorld() {
+ return true;
+ }
+
+ @Override
+ public boolean canCoordinateBeSpawn(int p_76566_1_, int p_76566_2_) {
+ return this.worldObj.getTopBlock(p_76566_1_, p_76566_2_).getMaterial().blocksMovement();
+ }
+
+ @Override
+ public String getWelcomeMessage() {
+ return "Entering the Eternal Autumn";
+ }
+
+ @Override
+ public String getDepartMessage() {
+ return "Leaving the Eternal Autumn";
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/world/autumn/WorldTypeAutumn.class b/src/main/java/jp/plusplus/fbs/world/autumn/WorldTypeAutumn.class Binary files differnew file mode 100644 index 0000000..74691f6 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/autumn/WorldTypeAutumn.class diff --git a/src/main/java/jp/plusplus/fbs/world/autumn/WorldTypeAutumn.java b/src/main/java/jp/plusplus/fbs/world/autumn/WorldTypeAutumn.java new file mode 100644 index 0000000..9bdbcda --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/autumn/WorldTypeAutumn.java @@ -0,0 +1,29 @@ +package jp.plusplus.fbs.world.autumn;
+
+import jp.plusplus.fbs.world.crack.ChunkProviderCrack;
+import jp.plusplus.fbs.world.crack.WorldChunkManagerCrack;
+import net.minecraft.world.World;
+import net.minecraft.world.WorldType;
+import net.minecraft.world.biome.WorldChunkManager;
+import net.minecraft.world.chunk.IChunkProvider;
+
+/**
+ * Created by plusplus_F on 2015/10/29.
+ */
+public class WorldTypeAutumn extends WorldType {
+ public static WorldType worldType = new WorldTypeAutumn("Eternal Autumn");
+
+ private WorldTypeAutumn(String name) {
+ super(name);
+ }
+
+ @Override
+ public WorldChunkManager getChunkManager(World world) {
+ return new WorldChunkManagerAutumn(world);
+ }
+
+ @Override
+ public IChunkProvider getChunkGenerator(World world, String generatorOptions) {
+ return new ChunkProviderAutumn(world, world.getSeed(), true);
+ }
+}
\ No newline at end of file diff --git a/src/main/java/jp/plusplus/fbs/world/biome/BiomeAutumn.class b/src/main/java/jp/plusplus/fbs/world/biome/BiomeAutumn.class Binary files differnew file mode 100644 index 0000000..5fc0aea --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/biome/BiomeAutumn.class diff --git a/src/main/java/jp/plusplus/fbs/world/biome/BiomeAutumn.java b/src/main/java/jp/plusplus/fbs/world/biome/BiomeAutumn.java new file mode 100644 index 0000000..b975f60 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/biome/BiomeAutumn.java @@ -0,0 +1,115 @@ +package jp.plusplus.fbs.world.biome;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.block.BlockCore;
+import jp.plusplus.fbs.entity.EntityButterfly;
+import net.minecraft.block.BlockFlower;
+import net.minecraft.entity.passive.EntityWolf;
+import net.minecraft.init.Blocks;
+import net.minecraft.util.MathHelper;
+import net.minecraft.world.World;
+import net.minecraft.world.biome.BiomeGenBase;
+import net.minecraft.world.biome.BiomeGenForest;
+import net.minecraft.world.gen.feature.WorldGenAbstractTree;
+import net.minecraft.world.gen.feature.WorldGenBigMushroom;
+
+import java.util.Random;
+
+/**
+ * Created by plusplus_F on 2015/08/20.
+ * 「魔力の秋」バイオーム
+ */
+public class BiomeAutumn extends BiomeGenBase {
+ private int biomeType;
+ protected final WorldGenDirtyOak genOak = new WorldGenDirtyOak(false, false);
+ protected final WorldGenDirtyOak genOakBig = new WorldGenDirtyOak(false, true);
+ protected final WorldGenDirtyOak genBirch = new WorldGenDirtyBirch(false);
+
+ public BiomeAutumn(int id) {
+ super(id);
+ this.biomeType = 0;
+ this.theBiomeDecorator.treesPerChunk = 10;
+ this.theBiomeDecorator.grassPerChunk = 4;
+ setBiomeName("Magical Autumn");
+
+ //表面のブロックは落ち葉
+ this.topBlock= BlockCore.fallenLeaves;
+ this.field_150604_aj=0;
+
+ //地中は土
+ this.fillerBlock=Blocks.dirt;
+ this.field_76754_C=0;
+
+ //知らん
+ this.func_76733_a(5159473);
+ this.setTemperatureRainfall(0.7F, 0.8F);
+
+ //狼と蝶がスポーン
+ this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityWolf.class, 5, 4, 4));
+ //this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityButterfly.class, 8, 4, 4));
+ }
+
+ @Override
+ public WorldGenAbstractTree func_150567_a(Random p_150567_1_) {
+ int r=p_150567_1_.nextInt(100);
+
+ if(r<10) return genOakBig;
+ else if(r<10+15) return genBirch;
+ return genOak;
+ }
+
+ @Override
+ public void decorate(World p_76728_1_, Random p_76728_2_, int p_76728_3_, int p_76728_4_) {
+ int k;
+ int l;
+ int i1;
+ int j1;
+ int k1;
+
+ k = p_76728_2_.nextInt(5) - 3;
+
+ l = 0;
+
+ while (l < k) {
+ i1 = p_76728_2_.nextInt(3);
+
+ if (i1 == 0) {
+ genTallFlowers.func_150548_a(1);
+ } else if (i1 == 1) {
+ genTallFlowers.func_150548_a(4);
+ } else if (i1 == 2) {
+ genTallFlowers.func_150548_a(5);
+ }
+
+ j1 = 0;
+
+ while (true) {
+ if (j1 < 5) {
+ k1 = p_76728_3_ + p_76728_2_.nextInt(16) + 8;
+ int i2 = p_76728_4_ + p_76728_2_.nextInt(16) + 8;
+ int l1 = p_76728_2_.nextInt(p_76728_1_.getHeightValue(k1, i2) + 32);
+
+ if (!genTallFlowers.generate(p_76728_1_, p_76728_2_, k1, l1, i2)) {
+ ++j1;
+ continue;
+ }
+ }
+
+ ++l;
+ break;
+ }
+ }
+
+ super.decorate(p_76728_1_, p_76728_2_, p_76728_3_, p_76728_4_);
+ }
+
+ /**
+ * Provides the basic grass color based on the biome temperature and rainfall
+ */
+ @SideOnly(Side.CLIENT)
+ public int getBiomeGrassColor(int p_150558_1_, int p_150558_2_, int p_150558_3_) {
+ int l = super.getBiomeGrassColor(p_150558_1_, p_150558_2_, p_150558_3_);
+ return (l & 0x00f000)+0xff0f00;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/world/biome/WorldGenDirtyBirch.class b/src/main/java/jp/plusplus/fbs/world/biome/WorldGenDirtyBirch.class Binary files differnew file mode 100644 index 0000000..070c08f --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/biome/WorldGenDirtyBirch.class diff --git a/src/main/java/jp/plusplus/fbs/world/biome/WorldGenDirtyBirch.java b/src/main/java/jp/plusplus/fbs/world/biome/WorldGenDirtyBirch.java new file mode 100644 index 0000000..93a3e60 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/biome/WorldGenDirtyBirch.java @@ -0,0 +1,13 @@ +package jp.plusplus.fbs.world.biome;
+
+/**
+ * Created by plusplus_F on 2015/08/20.
+ * 紅葉した白樺
+ */
+public class WorldGenDirtyBirch extends WorldGenDirtyOak {
+ public WorldGenDirtyBirch(boolean notify) {
+ super(notify, false);
+ woodMeta=2;
+ leaveMeta=1;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/world/biome/WorldGenDirtyOak.class b/src/main/java/jp/plusplus/fbs/world/biome/WorldGenDirtyOak.class Binary files differnew file mode 100644 index 0000000..6b88474 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/biome/WorldGenDirtyOak.class diff --git a/src/main/java/jp/plusplus/fbs/world/biome/WorldGenDirtyOak.java b/src/main/java/jp/plusplus/fbs/world/biome/WorldGenDirtyOak.java new file mode 100644 index 0000000..3559b62 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/biome/WorldGenDirtyOak.java @@ -0,0 +1,122 @@ +package jp.plusplus.fbs.world.biome;
+
+import jp.plusplus.fbs.block.BlockCore;
+import net.minecraft.block.Block;
+import net.minecraft.block.BlockSapling;
+import net.minecraft.init.Blocks;
+import net.minecraft.world.World;
+import net.minecraft.world.gen.feature.WorldGenAbstractTree;
+import net.minecraft.world.gen.feature.WorldGenTrees;
+import net.minecraftforge.common.util.ForgeDirection;
+
+import java.util.Random;
+
+/**
+ * Created by plusplus_F on 2015/08/20.
+ * 「魔力の秋」に生成される紅葉した樫の木
+ */
+public class WorldGenDirtyOak extends WorldGenAbstractTree {
+ private boolean bigger;
+ protected Block wood;
+ protected int woodMeta;
+ protected Block leave;
+ protected int leaveMeta=2;
+
+ public WorldGenDirtyOak(boolean notify, boolean isBig) {
+ super(notify);
+ this.bigger = isBig;
+ wood= Blocks.log;
+ woodMeta=0;
+ leave=BlockCore.leaves;
+ leaveMeta=0;
+ }
+
+ public boolean generate(World p_76484_1_, Random p_76484_2_, int p_76484_3_, int p_76484_4_, int p_76484_5_) {
+ int l = p_76484_2_.nextInt(3) + 5;
+
+ if (this.bigger) {
+ l += p_76484_2_.nextInt(7);
+ }
+
+ boolean flag = true;
+
+ if (p_76484_4_ >= 1 && p_76484_4_ + l + 1 <= 256) {
+ int j1;
+ int k1;
+
+ for (int i1 = p_76484_4_; i1 <= p_76484_4_ + 1 + l; ++i1) {
+ byte b0 = 1;
+
+ if (i1 == p_76484_4_) {
+ b0 = 0;
+ }
+
+ if (i1 >= p_76484_4_ + 1 + l - 2) {
+ b0 = 2;
+ }
+
+ for (j1 = p_76484_3_ - b0; j1 <= p_76484_3_ + b0 && flag; ++j1) {
+ for (k1 = p_76484_5_ - b0; k1 <= p_76484_5_ + b0 && flag; ++k1) {
+ if (i1 >= 0 && i1 < 256) {
+ Block block = p_76484_1_.getBlock(j1, i1, k1);
+
+ if (!this.isReplaceable(p_76484_1_, j1, i1, k1)) {
+ flag = false;
+ }
+ } else {
+ flag = false;
+ }
+ }
+ }
+ }
+
+ if (!flag) {
+ return false;
+ } else {
+ Block block2 = p_76484_1_.getBlock(p_76484_3_, p_76484_4_ - 1, p_76484_5_);
+
+ //boolean isSoil = block2.canSustainPlant(p_76484_1_, p_76484_3_, p_76484_4_ - 1, p_76484_5_, ForgeDirection.UP, (BlockSapling) Blocks.sapling);
+ boolean isSoil=(block2==BlockCore.fallenLeaves);
+ if (isSoil && p_76484_4_ < 256 - l - 1) {
+ block2.onPlantGrow(p_76484_1_, p_76484_3_, p_76484_4_ - 1, p_76484_5_, p_76484_3_, p_76484_4_, p_76484_5_);
+ int k2;
+
+ for (k2 = p_76484_4_ - 3 + l; k2 <= p_76484_4_ + l; ++k2) {
+ j1 = k2 - (p_76484_4_ + l);
+ k1 = 1 - j1 / 2;
+
+ for (int l2 = p_76484_3_ - k1; l2 <= p_76484_3_ + k1; ++l2) {
+ int l1 = l2 - p_76484_3_;
+
+ for (int i2 = p_76484_5_ - k1; i2 <= p_76484_5_ + k1; ++i2) {
+ int j2 = i2 - p_76484_5_;
+
+ if (Math.abs(l1) != k1 || Math.abs(j2) != k1 || p_76484_2_.nextInt(2) != 0 && j1 != 0) {
+ Block block1 = p_76484_1_.getBlock(l2, k2, i2);
+
+ if (block1.isAir(p_76484_1_, l2, k2, i2) || block1.isLeaves(p_76484_1_, l2, k2, i2)) {
+ this.setBlockAndNotifyAdequately(p_76484_1_, l2, k2, i2, leave, leaveMeta);
+ }
+ }
+ }
+ }
+ }
+
+ for (k2 = 0; k2 < l; ++k2) {
+ Block block3 = p_76484_1_.getBlock(p_76484_3_, p_76484_4_ + k2, p_76484_5_);
+
+ if (block3.isAir(p_76484_1_, p_76484_3_, p_76484_4_ + k2, p_76484_5_) || block3.isLeaves(p_76484_1_, p_76484_3_, p_76484_4_ + k2, p_76484_5_)) {
+ this.setBlockAndNotifyAdequately(p_76484_1_, p_76484_3_, p_76484_4_ + k2, p_76484_5_, wood, woodMeta);
+ }
+ }
+
+ return true;
+ } else {
+ return false;
+ }
+ }
+ } else {
+ return false;
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/world/crack/ChunkProviderCrack$Generator.class b/src/main/java/jp/plusplus/fbs/world/crack/ChunkProviderCrack$Generator.class Binary files differnew file mode 100644 index 0000000..1aeb3f9 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/crack/ChunkProviderCrack$Generator.class diff --git a/src/main/java/jp/plusplus/fbs/world/crack/ChunkProviderCrack.class b/src/main/java/jp/plusplus/fbs/world/crack/ChunkProviderCrack.class Binary files differnew file mode 100644 index 0000000..67b10d2 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/crack/ChunkProviderCrack.class diff --git a/src/main/java/jp/plusplus/fbs/world/crack/ChunkProviderCrack.java b/src/main/java/jp/plusplus/fbs/world/crack/ChunkProviderCrack.java new file mode 100644 index 0000000..a678f33 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/crack/ChunkProviderCrack.java @@ -0,0 +1,406 @@ +package jp.plusplus.fbs.world.crack;
+
+import cpw.mods.fml.common.eventhandler.Event;
+import jp.plusplus.fbs.world.crack.structure.MapGenSchool;
+import net.minecraft.block.Block;
+import net.minecraft.block.BlockFalling;
+import net.minecraft.block.material.Material;
+import net.minecraft.entity.EnumCreatureType;
+import net.minecraft.init.Blocks;
+import net.minecraft.util.IProgressUpdate;
+import net.minecraft.util.MathHelper;
+import net.minecraft.world.ChunkPosition;
+import net.minecraft.world.World;
+import net.minecraft.world.biome.BiomeGenBase;
+import net.minecraft.world.chunk.Chunk;
+import net.minecraft.world.chunk.IChunkProvider;
+import net.minecraft.world.gen.ChunkProviderGenerate;
+import net.minecraft.world.gen.NoiseGenerator;
+import net.minecraft.world.gen.NoiseGeneratorOctaves;
+import net.minecraftforge.common.MinecraftForge;
+import net.minecraftforge.event.terraingen.ChunkProviderEvent;
+import net.minecraftforge.event.terraingen.PopulateChunkEvent;
+import net.minecraftforge.event.terraingen.TerrainGen;
+
+import java.util.List;
+import java.util.Random;
+
+/**
+ * Created by plusplus_F on 2015/10/29.
+ */
+public class ChunkProviderCrack implements IChunkProvider {
+ private Random endRNG;
+ private NoiseGeneratorOctaves noiseGen1;
+ private NoiseGeneratorOctaves noiseGen2;
+ private NoiseGeneratorOctaves noiseGen3;
+ public NoiseGeneratorOctaves noiseGen4;
+ public NoiseGeneratorOctaves noiseGen5;
+ private World world;
+ private double[] densities;
+ /**
+ * The biomes that are used to generate the chunk
+ */
+ private BiomeGenBase[] biomesForGeneration;
+ double[] noiseData1;
+ double[] noiseData2;
+ double[] noiseData3;
+ double[] noiseData4;
+ double[] noiseData5;
+ int[][] field_73203_h = new int[32][32];
+
+ private MapGenSchool mapGenSchool=new MapGenSchool();
+
+ public ChunkProviderCrack(World p_i2007_1_, long p_i2007_2_) {
+ this.world = p_i2007_1_;
+ this.endRNG = new Random(p_i2007_2_);
+ this.noiseGen1 = new NoiseGeneratorOctaves(this.endRNG, 16);
+ this.noiseGen2 = new NoiseGeneratorOctaves(this.endRNG, 16);
+ this.noiseGen3 = new NoiseGeneratorOctaves(this.endRNG, 8);
+ this.noiseGen4 = new NoiseGeneratorOctaves(this.endRNG, 10);
+ this.noiseGen5 = new NoiseGeneratorOctaves(this.endRNG, 16);
+
+ NoiseGenerator[] noiseGens = {noiseGen1, noiseGen2, noiseGen3, noiseGen4, noiseGen5};
+ noiseGens = TerrainGen.getModdedNoiseGenerators(p_i2007_1_, this.endRNG, noiseGens);
+ this.noiseGen1 = (NoiseGeneratorOctaves) noiseGens[0];
+ this.noiseGen2 = (NoiseGeneratorOctaves) noiseGens[1];
+ this.noiseGen3 = (NoiseGeneratorOctaves) noiseGens[2];
+ this.noiseGen4 = (NoiseGeneratorOctaves) noiseGens[3];
+ this.noiseGen5 = (NoiseGeneratorOctaves) noiseGens[4];
+ }
+
+ public void generateChunk(int chunkX, int chunkZ, Block[] blocks, BiomeGenBase[] biomes) {
+ byte base = 2;
+ int noiseWidth = base + 1;
+ byte noiseHeight = 33;
+ int noiseDepth = base + 1;
+ this.densities = this.initializeNoiseField(this.densities, chunkX * base, 0, chunkZ * base, noiseWidth, noiseHeight, noiseDepth);
+
+ for (int i1 = 0; i1 < base; ++i1) {
+ for (int j1 = 0; j1 < base; ++j1) {
+ for (int k1 = 0; k1 < 32; ++k1) {
+ double d0 = 0.25D;
+ double d1 = this.densities[((i1 + 0) * noiseDepth + j1 + 0) * noiseHeight + k1 + 0];
+ double d2 = this.densities[((i1 + 0) * noiseDepth + j1 + 1) * noiseHeight + k1 + 0];
+ double d3 = this.densities[((i1 + 1) * noiseDepth + j1 + 0) * noiseHeight + k1 + 0];
+ double d4 = this.densities[((i1 + 1) * noiseDepth + j1 + 1) * noiseHeight + k1 + 0];
+ double d5 = (this.densities[((i1 + 0) * noiseDepth + j1 + 0) * noiseHeight + k1 + 1] - d1) * d0;
+ double d6 = (this.densities[((i1 + 0) * noiseDepth + j1 + 1) * noiseHeight + k1 + 1] - d2) * d0;
+ double d7 = (this.densities[((i1 + 1) * noiseDepth + j1 + 0) * noiseHeight + k1 + 1] - d3) * d0;
+ double d8 = (this.densities[((i1 + 1) * noiseDepth + j1 + 1) * noiseHeight + k1 + 1] - d4) * d0;
+
+ for (int l1 = 0; l1 < 4; ++l1) {
+ double scale = 0.125D;
+ double d10 = d1;
+ double d11 = d2;
+ double d12 = (d3 - d1) * scale;
+ double d13 = (d4 - d2) * scale;
+
+ for (int i2 = 0; i2 < 8; ++i2) {
+ int index = i2 + i1 * 8 << 11 | 0 + j1 * 8 << 7 | k1 * 4 + l1;
+ short short1 = 128;
+ double d14 = 0.125D;
+ double d15 = d10;
+ double d16 = (d11 - d10) * d14;
+
+ for (int k2 = 0; k2 < 8; ++k2) {
+ Block block = Blocks.air;
+
+ if (d15 > 0.0D) {
+ block = Blocks.dirt;
+ }
+
+ blocks[index] = block;
+ index += short1;
+ d15 += d16;
+ }
+
+ d10 += d12;
+ d11 += d13;
+ }
+
+ d1 += d5;
+ d2 += d6;
+ d3 += d7;
+ d4 += d8;
+ }
+ }
+ }
+ }
+ }
+
+ @Deprecated // Supply metadata to the below function.
+ public void func_147421_b(int p_147421_1_, int p_147421_2_, Block[] p_147421_3_, BiomeGenBase[] p_147421_4_) {
+ replaceBiomeBlocks(p_147421_1_, p_147421_2_, p_147421_3_, p_147421_4_, new byte[p_147421_3_.length]);
+ }
+
+ public void replaceBiomeBlocks(int chunkX, int chunkZ, Block[] blocks, BiomeGenBase[] biomes, byte[] meta) {
+ ChunkProviderEvent.ReplaceBiomeBlocks event = new ChunkProviderEvent.ReplaceBiomeBlocks(this, chunkX, chunkZ, blocks, meta, biomes, this.world);
+ MinecraftForge.EVENT_BUS.post(event);
+ if (event.getResult() == Event.Result.DENY) return;
+
+ for (int x = 0; x < 16; ++x) {
+ for (int z = 0; z < 16; ++z) {
+ int dirtCount=0;
+ int dirtToStone=5+endRNG.nextInt(3);
+ for (int j1 = 127; j1 >= 0; --j1) {
+ int index = (z * 16 + x) * 128 + j1;
+ Block block2 = blocks[index];
+
+ if(block2==Blocks.dirt){
+ //地表を草ブロックにする
+ if(dirtCount==0) blocks[index]=Blocks.grass;
+
+ //地中は石にする
+ if(dirtCount>dirtToStone) blocks[index]=Blocks.stone;
+
+ dirtCount++;
+ }
+ }
+ }
+ }
+
+ }
+
+ /**
+ * loads or generates the chunk at the chunk location specified
+ */
+ public Chunk loadChunk(int p_73158_1_, int p_73158_2_) {
+ return this.provideChunk(p_73158_1_, p_73158_2_);
+ }
+
+ /**
+ * Will return back a chunk, if it doesn't exist and its not a MP client it will generates all the blocks for the
+ * specified chunk from the map seed and chunk seed
+ * チャンクを生成する
+ */
+ public Chunk provideChunk(int chunkX, int chunkZ) {
+ this.endRNG.setSeed((long) chunkX * 341873128712L + (long) chunkZ * 132897987541L);
+ Block[] ablock = new Block[32768];
+ byte[] meta = new byte[ablock.length];
+ this.biomesForGeneration = this.world.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration, chunkX * 16, chunkZ * 16, 16, 16);
+
+ //チャンク内のブロックをまるごと決定する
+ this.generateChunk(chunkX, chunkZ, ablock, this.biomesForGeneration);
+
+ this.replaceBiomeBlocks(chunkX, chunkZ, ablock, this.biomesForGeneration, meta);
+ Chunk chunk = new Chunk(this.world, ablock, meta, chunkX, chunkZ);
+ byte[] abyte = chunk.getBiomeArray();
+
+ for (int k = 0; k < abyte.length; ++k) {
+ abyte[k] = (byte) this.biomesForGeneration[k].biomeID;
+ }
+ chunk.generateSkylightMap();
+ return chunk;
+ }
+
+ /**
+ * generates a subset of the level's terrain data. Takes 7 arguments: the [empty] noise array, the position, and the
+ * size.
+ */
+ private double[] initializeNoiseField(double[] noise, int x, int y, int z, int width, int height, int depth) {
+ ChunkProviderEvent.InitNoiseField event = new ChunkProviderEvent.InitNoiseField(this, noise, x, y, z, width, height, depth);
+ MinecraftForge.EVENT_BUS.post(event);
+ if (event.getResult() == Event.Result.DENY) return event.noisefield;
+
+ if (noise == null) {
+ noise = new double[width * height * depth];
+ }
+
+ double d0 = 684.412D;
+ double d1 = 684.412D;
+ this.noiseData4 = this.noiseGen4.generateNoiseOctaves(this.noiseData4, x, z, width, depth, 1.121D, 1.121D, 0.5D);
+ this.noiseData5 = this.noiseGen5.generateNoiseOctaves(this.noiseData5, x, z, width, depth, 200.0D, 200.0D, 0.5D);
+ d0 *= 2.0D;
+ this.noiseData1 = this.noiseGen3.generateNoiseOctaves(this.noiseData1, x, y, z, width, height, depth, d0 / 80.0D, d1 / 160.0D, d0 / 80.0D);
+ this.noiseData2 = this.noiseGen1.generateNoiseOctaves(this.noiseData2, x, y, z, width, height, depth, d0, d1, d0);
+ this.noiseData3 = this.noiseGen2.generateNoiseOctaves(this.noiseData3, x, y, z, width, height, depth, d0, d1, d0);
+ int k1 = 0;
+ int l1 = 0;
+
+ for (int i2 = 0; i2 < width; ++i2) {
+ for (int j2 = 0; j2 < depth; ++j2) {
+ double d2 = (this.noiseData4[l1] + 256.0D) / 512.0D;
+
+ if (d2 > 1.0D) {
+ d2 = 1.0D;
+ }
+
+ double d3 = this.noiseData5[l1] / 8000.0D;
+
+ if (d3 < 0.0D) {
+ d3 = -d3 * 0.3D;
+ }
+
+ d3 = d3 * 3.0D - 2.0D;
+ float f = (float) (i2 + x - 0) / 1.0F;
+ float f1 = (float) (j2 + z - 0) / 1.0F;
+ float f2 = 100.0F - MathHelper.sqrt_float(f * f + f1 * f1) * 8.0F;
+
+ if (f2 > 80.0F) {
+ f2 = 80.0F;
+ }
+
+ if (f2 < -100.0F) {
+ f2 = -100.0F;
+ }
+
+ if (d3 > 1.0D) {
+ d3 = 1.0D;
+ }
+
+ d3 /= 8.0D;
+ d3 = 0.0D;
+
+ if (d2 < 0.0D) {
+ d2 = 0.0D;
+ }
+
+ d2 += 0.5D;
+ d3 = d3 * (double) height / 16.0D;
+ ++l1;
+ double d4 = (double) height / 2.0D;
+
+ for (int k2 = 0; k2 < height; ++k2) {
+ double d5 = 0.0D;
+ double d6 = ((double) k2 - d4) * 8.0D / d2;
+
+ if (d6 < 0.0D) {
+ d6 *= -1.0D;
+ }
+
+ double d7 = this.noiseData2[k1] / 512.0D;
+ double d8 = this.noiseData3[k1] / 512.0D;
+ double d9 = (this.noiseData1[k1] / 10.0D + 1.0D) / 2.0D;
+
+ if (d9 < 0.0D) {
+ d5 = d7;
+ } else if (d9 > 1.0D) {
+ d5 = d8;
+ } else {
+ d5 = d7 + (d8 - d7) * d9;
+ }
+
+ d5 -= 8.0D;
+ d5 += (double) f2;
+ byte b0 = 2;
+ double d10;
+
+ if (k2 > height / 2 - b0) {
+ d10 = (double) ((float) (k2 - (height / 2 - b0)) / 64.0F);
+
+ if (d10 < 0.0D) {
+ d10 = 0.0D;
+ }
+
+ if (d10 > 1.0D) {
+ d10 = 1.0D;
+ }
+
+ d5 = d5 * (1.0D - d10) + -3000.0D * d10;
+ }
+
+ b0 = 8;
+
+ if (k2 < b0) {
+ d10 = (double) ((float) (b0 - k2) / ((float) b0 - 1.0F));
+ d5 = d5 * (1.0D - d10) + -30.0D * d10;
+ }
+
+ noise[k1] = d5;
+ ++k1;
+ }
+ }
+ }
+
+ return noise;
+ }
+
+ /**
+ * Checks to see if a chunk exists at x, y
+ */
+ public boolean chunkExists(int p_73149_1_, int p_73149_2_) {
+ return true;
+ }
+
+ /**
+ * Populates chunk with ores etc etc
+ */
+ public void populate(IChunkProvider p_73153_1_, int p_73153_2_, int p_73153_3_) {
+ BlockFalling.fallInstantly = true;
+
+ MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(p_73153_1_, world, world.rand, p_73153_2_, p_73153_3_, false));
+
+ int k = p_73153_2_ * 16;
+ int l = p_73153_3_ * 16;
+ BiomeGenBase biomegenbase = this.world.getBiomeGenForCoords(k + 16, l + 16);
+ biomegenbase.decorate(this.world, this.world.rand, k, l);
+
+ mapGenSchool.func_151539_a(this, world, p_73153_2_, p_73153_3_, null);
+ mapGenSchool.generateStructuresInChunk(this.world, this.endRNG, p_73153_2_, p_73153_3_);
+
+ MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post(p_73153_1_, world, world.rand, p_73153_2_, p_73153_3_, false));
+
+ BlockFalling.fallInstantly = false;
+ }
+
+ /**
+ * Two modes of operation: if passed true, save all Chunks in one go. If passed false, save up to two chunks.
+ * Return true if all chunks have been saved.
+ */
+ public boolean saveChunks(boolean p_73151_1_, IProgressUpdate p_73151_2_) {
+ return true;
+ }
+
+ /**
+ * Save extra data not associated with any Chunk. Not saved during autosave, only during world unload. Currently
+ * unimplemented.
+ */
+ public void saveExtraData() {
+ }
+
+ /**
+ * Unloads chunks that are marked to be unloaded. This is not guaranteed to unload every such chunk.
+ */
+ public boolean unloadQueuedChunks() {
+ return false;
+ }
+
+ /**
+ * Returns if the IChunkProvider supports saving.
+ */
+ public boolean canSave() {
+ return true;
+ }
+
+ /**
+ * Converts the instance data to a readable string.
+ */
+ public String makeString() {
+ return "RandomLevelSource";
+ }
+
+ /**
+ * Returns a list of creatures of the specified type that can spawn at the given location.
+ */
+ public List getPossibleCreatures(EnumCreatureType p_73155_1_, int p_73155_2_, int p_73155_3_, int p_73155_4_) {
+ BiomeGenBase biomegenbase = this.world.getBiomeGenForCoords(p_73155_2_, p_73155_4_);
+ return biomegenbase.getSpawnableList(p_73155_1_);
+ }
+
+ public ChunkPosition func_147416_a(World p_147416_1_, String p_147416_2_, int p_147416_3_, int p_147416_4_, int p_147416_5_) {
+ return null;
+ }
+
+ public int getLoadedChunkCount() {
+ return 0;
+ }
+
+ public void recreateStructures(int p_82695_1_, int p_82695_2_) {
+ }
+
+ public static class Generator extends ChunkProviderGenerate{
+ public Generator(World p_i2006_1_, long p_i2006_2_, boolean p_i2006_4_) {
+ super(p_i2006_1_, p_i2006_2_, p_i2006_4_);
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/world/crack/TeleporterToCrack.class b/src/main/java/jp/plusplus/fbs/world/crack/TeleporterToCrack.class Binary files differnew file mode 100644 index 0000000..42d4b98 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/crack/TeleporterToCrack.class diff --git a/src/main/java/jp/plusplus/fbs/world/crack/TeleporterToCrack.java b/src/main/java/jp/plusplus/fbs/world/crack/TeleporterToCrack.java new file mode 100644 index 0000000..b57f490 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/crack/TeleporterToCrack.java @@ -0,0 +1,239 @@ +package jp.plusplus.fbs.world.crack;
+
+import jp.plusplus.fbs.block.BlockCore;
+import jp.plusplus.fbs.tileentity.TileEntityMagicCore;
+import net.minecraft.block.Block;
+import net.minecraft.block.BlockEndPortal;
+import net.minecraft.entity.Entity;
+import net.minecraft.init.Blocks;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.MathHelper;
+import net.minecraft.world.Teleporter;
+import net.minecraft.world.WorldServer;
+
+import java.util.Random;
+
+/**
+ * Created by plusplus_F on 2015/10/29.
+ */
+public class TeleporterToCrack extends Teleporter {
+ private final WorldServer worldServerInstance;
+ private Random random=new Random();
+
+ public TeleporterToCrack(WorldServer p_i1963_1_) {
+ super(p_i1963_1_);
+ worldServerInstance=p_i1963_1_;
+ }
+
+ // 近くにポータルがあったらそこに出現させる処理
+ // このサンプルではネザーポータルの処理をそのまま利用する
+ @Override
+ public boolean placeInExistingPortal(Entity p_77184_1_, double p_77184_2_, double p_77184_4_, double p_77184_6_, float p_77184_8_) {
+ return super.placeInExistingPortal(p_77184_1_, p_77184_2_, p_77184_4_, p_77184_6_, p_77184_8_);
+ }
+
+ // ポータルを作成する処理
+ @Override
+ public boolean makePortal(Entity p_85188_1_) {
+ byte b0 = 16;
+ double distance = -1.0D;
+ int i = MathHelper.floor_double(p_85188_1_.posX);
+ int j = MathHelper.floor_double(p_85188_1_.posY);
+ int k = MathHelper.floor_double(p_85188_1_.posZ);
+ int l = i;
+ int i1 = j;
+ int j1 = k;
+ int k1 = 0;
+ int l1 = this.random.nextInt(4);
+ int x;
+ double posX;
+ int z;
+ double posZ;
+ int y;
+ int j3;
+ int k3;
+ int l3;
+ int addX;
+ int addZ;
+ int addY;
+ int blockX;
+ int blockY;
+ double tmpY;
+ double tmpDistance;
+
+ for (x = i - b0; x <= i + b0; ++x) {
+ posX = (double) x + 0.5D - p_85188_1_.posX;
+
+ for (z = k - b0; z <= k + b0; ++z) {
+ posZ = (double) z + 0.5D - p_85188_1_.posZ;
+ label274:
+
+ for (y = this.worldServerInstance.getActualHeight() - 1; y >= 0; --y) {
+ if (this.worldServerInstance.isAirBlock(x, y, z)) {
+ while (y > 0 && this.worldServerInstance.isAirBlock(x, y - 1, z)) {
+ --y;
+ }
+
+ for (j3 = l1; j3 < l1 + 4; ++j3) {
+ k3 = j3 % 2;
+ l3 = 1 - k3;
+
+ if (j3 % 4 >= 2) {
+ k3 = -k3;
+ l3 = -l3;
+ }
+
+ for (addX = 0; addX < 5; ++addX) {
+ for (addZ = 0; addZ < 5; ++addZ) {
+ for (addY = -1; addY < 4; ++addY) {
+ blockX = x + (addZ - 1) * k3 + addX * l3;
+ blockY = y + addY;
+ int blockZ = z + (addZ - 1) * l3 - addX * k3;
+
+ if (addY < 0 && !this.worldServerInstance.getBlock(blockX, blockY, blockZ).getMaterial().isSolid() || addY >= 0 && !this.worldServerInstance.isAirBlock(blockX, blockY, blockZ)) {
+ continue label274;
+ }
+ }
+ }
+ }
+
+ tmpY = (double) y + 0.5D - p_85188_1_.posY;
+ tmpDistance = posX * posX + tmpY * tmpY + posZ * posZ;
+
+ if (distance < 0.0D || tmpDistance < distance) {
+ distance = tmpDistance;
+ l = x;
+ i1 = y;
+ j1 = z;
+ k1 = j3 % 4;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (distance < 0.0D) {
+ for (x = i - b0; x <= i + b0; ++x) {
+ posX = (double) x + 0.5D - p_85188_1_.posX;
+
+ for (z = k - b0; z <= k + b0; ++z) {
+ posZ = (double) z + 0.5D - p_85188_1_.posZ;
+ label222:
+
+ for (y = this.worldServerInstance.getActualHeight() - 1; y >= 0; --y) {
+ if (this.worldServerInstance.isAirBlock(x, y, z)) {
+ while (y > 0 && this.worldServerInstance.isAirBlock(x, y - 1, z)) {
+ --y;
+ }
+
+ for (j3 = l1; j3 < l1 + 2; ++j3) {
+ k3 = j3 % 2;
+ l3 = 1 - k3;
+
+ for (addX = 0; addX < 5; ++addX) {
+ for (addZ = -1; addZ < 5; ++addZ) {
+ addY = x + (addX - 1) * k3;
+ blockX = y + addZ;
+ blockY = z + (addX - 1) * l3;
+
+ if (addZ < 0 && !this.worldServerInstance.getBlock(addY, blockX, blockY).getMaterial().isSolid() || addZ >= 0 && !this.worldServerInstance.isAirBlock(addY, blockX, blockY)) {
+ continue label222;
+ }
+ }
+ }
+
+ tmpY = (double) y + 0.5D - p_85188_1_.posY;
+ tmpDistance = posX * posX + tmpY * tmpY + posZ * posZ;
+
+ if (distance < 0.0D || tmpDistance < distance) {
+ distance = tmpDistance;
+ l = x;
+ i1 = y;
+ j1 = z;
+ k1 = j3 % 2;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ int k5 = l;
+ int j2 = i1;
+ z = j1;
+ int l5 = k1 % 2;
+ int l2 = 1 - l5;
+
+ if (k1 % 4 >= 2) {
+ l5 = -l5;
+ l2 = -l2;
+ }
+
+ boolean flag;
+
+ //ポータルの生成処理
+ if (distance < 0.0D) {
+ if (i1 < 70) {
+ i1 = 70;
+ }
+
+ if (i1 > this.worldServerInstance.getActualHeight() - 10) {
+ i1 = this.worldServerInstance.getActualHeight() - 10;
+ }
+
+ j2 = i1;
+
+ for (y = -2; y <= 2; ++y) {
+ for (j3 = -2; j3 < 2; ++j3) {
+ for (k3 = -2; k3 < 3; ++k3) {
+ l3 = k5 + y;
+ addX = j2 + k3;
+ addZ = z + j3;
+ flag = k3 < 0;
+ this.worldServerInstance.setBlock(l3, addX, addZ, flag ? Blocks.obsidian : Blocks.air);
+ }
+ }
+ }
+ }
+
+ this.worldServerInstance.setBlock(k5, j2, z, BlockCore.magicCore);
+ TileEntity te=this.worldServerInstance.getTileEntity(k5, j2, z);
+ if(te instanceof TileEntityMagicCore){
+ ((TileEntityMagicCore) te).setMagicCircle("fbs.warp", 2);
+ }
+
+ /*
+ for (y = 0; y < 4; ++y) {
+ for (j3 = 0; j3 < 4; ++j3) {
+ for (k3 = -1; k3 < 4; ++k3) {
+ l3 = k5 + (j3 - 1) * l5;
+ addX = j2 + k3;
+ addZ = z + (j3 - 1) * l2;
+ flag = j3 == 0 || j3 == 3 || k3 == -1 || k3 == 3;
+ this.worldServerInstance.setBlock(l3, addX, addZ, (Block) (flag ? Blocks.obsidian : Blocks.portal), 0, 2);
+ }
+ }
+
+ for (j3 = 0; j3 < 4; ++j3) {
+ for (k3 = -1; k3 < 4; ++k3) {
+ l3 = k5 + (j3 - 1) * l5;
+ addX = j2 + k3;
+ addZ = z + (j3 - 1) * l2;
+ this.worldServerInstance.notifyBlocksOfNeighborChange(l3, addX, addZ, this.worldServerInstance.getBlock(l3, addX, addZ));
+ }
+ }
+ }
+ */
+
+ return true;
+ }
+
+ // プレイヤーをポータルに出現させる処理
+ // このサンプルではネザーポータルの処理をそのまま利用する
+ @Override
+ public void placeInPortal(Entity p_77185_1_, double p_77185_2_, double p_77185_4_, double p_77185_6_, float p_77185_8_) {
+ super.placeInPortal(p_77185_1_, p_77185_2_, p_77185_4_, p_77185_6_, p_77185_8_);
+ }
+}
\ No newline at end of file diff --git a/src/main/java/jp/plusplus/fbs/world/crack/WorldChunkManagerCrack.class b/src/main/java/jp/plusplus/fbs/world/crack/WorldChunkManagerCrack.class Binary files differnew file mode 100644 index 0000000..e9e30f6 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/crack/WorldChunkManagerCrack.class diff --git a/src/main/java/jp/plusplus/fbs/world/crack/WorldChunkManagerCrack.java b/src/main/java/jp/plusplus/fbs/world/crack/WorldChunkManagerCrack.java new file mode 100644 index 0000000..c4b7855 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/crack/WorldChunkManagerCrack.java @@ -0,0 +1,209 @@ +package jp.plusplus.fbs.world.crack;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.Registry;
+import jp.plusplus.fbs.world.crack.biome.BiomeGenCrack;
+import net.minecraft.world.ChunkPosition;
+import net.minecraft.world.World;
+import net.minecraft.world.WorldType;
+import net.minecraft.world.biome.BiomeCache;
+import net.minecraft.world.biome.BiomeGenBase;
+import net.minecraft.world.biome.WorldChunkManager;
+import net.minecraft.world.gen.layer.GenLayer;
+import net.minecraft.world.gen.layer.IntCache;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Random;
+
+import static net.minecraft.world.biome.BiomeGenBase.mesa;
+import static net.minecraft.world.biome.BiomeGenBase.mushroomIsland;
+
+/**
+ * Created by plusplus_F on 2015/10/29.
+ */
+public class WorldChunkManagerCrack extends WorldChunkManager {
+
+ // WorldChunkManagerのプライベート変数にはアクセスできないので専用の変数を作成
+ private GenLayer genBiomes;
+ private GenLayer biomeIndexLayer;
+ private BiomeCache biomeCache;
+ private List biomesToSpawnIn;
+
+ public static final BiomeGenBase[] biomeList = new BiomeGenBase[256];
+
+ static {
+ for (int i = 0; i < biomeList.length; ++i) {
+ biomeList[i]=Registry.biomeCrack;
+ /*
+ if (i % 2 == 0) {
+ biomeList[i] = mushroomIsland;
+ } else if (i % 2 == 1) {
+ biomeList[i] = mesa;
+ }
+ */
+ }
+ }
+
+ protected WorldChunkManagerCrack() {
+ this.biomeCache = new BiomeCache(this);
+ this.biomesToSpawnIn = new ArrayList();
+ this.biomesToSpawnIn.add(Registry.biomeCrack);
+ //this.biomesToSpawnIn.addAll(allowedBiomes);
+ }
+
+ public WorldChunkManagerCrack(long par1, WorldType par3WorldType) {
+ this();
+ GenLayer[] var4 = GenLayer.initializeAllBiomeGenerators(par1, par3WorldType);
+ this.genBiomes = var4[0];
+ this.biomeIndexLayer = var4[1];
+ }
+
+ public WorldChunkManagerCrack(World par1World) {
+ this(par1World.getSeed(), par1World.getWorldInfo().getTerrainType());
+ }
+
+ ///////////////////////////////////////////////////////////////////////
+ // WorldChunkManagerのプライベート変数を使用するメソッドはすべて再実装
+
+ @Override
+ public List getBiomesToSpawnIn() {
+ return this.biomesToSpawnIn;
+ }
+
+ @Override
+ public BiomeGenBase getBiomeGenAt(int par1, int par2) {
+ return this.biomeCache.getBiomeGenAt(par1, par2);
+ }
+
+ @Override
+ public float[] getRainfall(float[] par1ArrayOfFloat, int par2, int par3, int par4, int par5) {
+ IntCache.resetIntCache();
+
+ if (par1ArrayOfFloat == null || par1ArrayOfFloat.length < par4 * par5) {
+ par1ArrayOfFloat = new float[par4 * par5];
+ }
+
+ int[] var6 = this.biomeIndexLayer.getInts(par2, par3, par4, par5);
+
+ for (int var7 = 0; var7 < par4 * par5; ++var7) {
+ float var8 = (float) biomeList[var6[var7]].getIntRainfall() / 65536.0F;
+
+ if (var8 > 1.0F) {
+ var8 = 1.0F;
+ }
+
+ par1ArrayOfFloat[var7] = var8;
+ }
+
+ return par1ArrayOfFloat;
+ }
+
+ @SideOnly(Side.CLIENT)
+ @Override
+ public float getTemperatureAtHeight(float par1, int par2) {
+ return par1;
+ }
+
+ @Override
+ public BiomeGenBase[] getBiomesForGeneration(BiomeGenBase[] par1ArrayOfBiomeGenBase, int par2, int par3, int par4, int par5) {
+ IntCache.resetIntCache();
+
+ if (par1ArrayOfBiomeGenBase == null || par1ArrayOfBiomeGenBase.length < par4 * par5) {
+ par1ArrayOfBiomeGenBase = new BiomeGenBase[par4 * par5];
+ }
+
+ int[] var6 = this.genBiomes.getInts(par2, par3, par4, par5);
+
+ for (int var7 = 0; var7 < par4 * par5; ++var7) {
+ par1ArrayOfBiomeGenBase[var7] = biomeList[var6[var7]];
+ }
+
+ return par1ArrayOfBiomeGenBase;
+ }
+
+ @Override
+ public BiomeGenBase[] loadBlockGeneratorData(BiomeGenBase[] par1ArrayOfBiomeGenBase, int par2, int par3, int par4, int par5) {
+ return this.getBiomeGenAt(par1ArrayOfBiomeGenBase, par2, par3, par4, par5, true);
+ }
+
+ @Override
+ public BiomeGenBase[] getBiomeGenAt(BiomeGenBase[] par1ArrayOfBiomeGenBase, int par2, int par3, int par4, int par5, boolean par6) {
+ IntCache.resetIntCache();
+
+ if (par1ArrayOfBiomeGenBase == null || par1ArrayOfBiomeGenBase.length < par4 * par5) {
+ par1ArrayOfBiomeGenBase = new BiomeGenBase[par4 * par5];
+ }
+
+ if (par6 && par4 == 16 && par5 == 16 && (par2 & 15) == 0 && (par3 & 15) == 0) {
+ BiomeGenBase[] var9 = this.biomeCache.getCachedBiomes(par2, par3);
+ System.arraycopy(var9, 0, par1ArrayOfBiomeGenBase, 0, par4 * par5);
+ return par1ArrayOfBiomeGenBase;
+ } else {
+ int[] var7 = this.biomeIndexLayer.getInts(par2, par3, par4, par5);
+
+ for (int var8 = 0; var8 < par4 * par5; ++var8) {
+ //par1ArrayOfBiomeGenBase[var8] = biomeList[var7[var8]];
+ par1ArrayOfBiomeGenBase[var8]=biomeList[0];
+ }
+
+ return par1ArrayOfBiomeGenBase;
+ }
+ }
+
+ @Override
+ public boolean areBiomesViable(int par1, int par2, int par3, List par4List) {
+ IntCache.resetIntCache();
+ int var5 = par1 - par3 >> 2;
+ int var6 = par2 - par3 >> 2;
+ int var7 = par1 + par3 >> 2;
+ int var8 = par2 + par3 >> 2;
+ int var9 = var7 - var5 + 1;
+ int var10 = var8 - var6 + 1;
+ int[] var11 = this.genBiomes.getInts(var5, var6, var9, var10);
+
+ for (int var12 = 0; var12 < var9 * var10; ++var12) {
+ BiomeGenBase var13 = biomeList[var11[var12]];
+
+ if (!par4List.contains(var13)) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ @Override
+ public ChunkPosition findBiomePosition(int par1, int par2, int par3, List par4List, Random par5Random) {
+ IntCache.resetIntCache();
+ int var6 = par1 - par3 >> 2;
+ int var7 = par2 - par3 >> 2;
+ int var8 = par1 + par3 >> 2;
+ int var9 = par2 + par3 >> 2;
+ int var10 = var8 - var6 + 1;
+ int var11 = var9 - var7 + 1;
+ int[] var12 = this.genBiomes.getInts(var6, var7, var10, var11);
+ ChunkPosition var13 = null;
+ int var14 = 0;
+
+ for (int var15 = 0; var15 < var10 * var11; ++var15) {
+ int var16 = var6 + var15 % var10 << 2;
+ int var17 = var7 + var15 / var10 << 2;
+ BiomeGenBase var18 = biomeList[var12[var15]];
+
+ if (par4List.contains(var18) && (var13 == null || par5Random.nextInt(var14 + 1) == 0)) {
+ var13 = new ChunkPosition(var16, 0, var17);
+ ++var14;
+ }
+ }
+
+ return var13;
+ }
+
+ @Override
+ public void cleanupCache() {
+ this.biomeCache.cleanupCache();
+ }
+}
\ No newline at end of file diff --git a/src/main/java/jp/plusplus/fbs/world/crack/WorldProviderCrack.class b/src/main/java/jp/plusplus/fbs/world/crack/WorldProviderCrack.class Binary files differnew file mode 100644 index 0000000..d3ae467 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/crack/WorldProviderCrack.class diff --git a/src/main/java/jp/plusplus/fbs/world/crack/WorldProviderCrack.java b/src/main/java/jp/plusplus/fbs/world/crack/WorldProviderCrack.java new file mode 100644 index 0000000..64eb846 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/crack/WorldProviderCrack.java @@ -0,0 +1,119 @@ +package jp.plusplus.fbs.world.crack;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.FBS;
+import net.minecraft.util.ChunkCoordinates;
+import net.minecraft.util.MathHelper;
+import net.minecraft.util.Vec3;
+import net.minecraft.world.WorldProvider;
+import net.minecraft.world.WorldProviderEnd;
+import net.minecraft.world.WorldProviderHell;
+import net.minecraft.world.chunk.IChunkProvider;
+
+/**
+ * Created by plusplus_F on 2015/10/29.
+ */
+public class WorldProviderCrack extends WorldProvider {
+ private float[] skyColors=new float[4];
+
+ @Override
+ public String getDimensionName() {
+ return "Dimension Crack";
+ }
+
+ // 独自のワールドタイプやワールドチャンクマネージャーを設定
+ @Override
+ protected void registerWorldChunkManager() {
+ worldObj.getWorldInfo().setTerrainType(WorldTypeCrack.worldType);
+ worldChunkMgr = new WorldChunkManagerCrack(worldObj);
+ setDimension(FBS.dimensionCrackId);
+ }
+
+ @Override
+ public IChunkProvider createChunkGenerator() {
+ return new ChunkProviderCrack(worldObj, worldObj.getSeed());
+ }
+
+ //太陽の高さ
+ @Override
+ public float calculateCelestialAngle(long p_76563_1_, float p_76563_3_) {
+ int j = (int)(p_76563_1_ % 24000L);
+ float f1 = ((float)j + p_76563_3_) / 24000.0F - 0.25F;
+
+ if (f1 < 0.0F)
+ {
+ ++f1;
+ }
+
+ if (f1 > 1.0F)
+ {
+ --f1;
+ }
+
+ float f2 = f1;
+ f1 = 1.0F - (float)((Math.cos((double)f1 * Math.PI) + 1.0D) / 2.0D);
+ f1 = f2 + (f1 - f2) / 3.0F;
+ return f1;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public float[] calcSunriseSunsetColors(float p_76560_1_, float p_76560_2_) {
+ skyColors[0]=0.35f;
+ skyColors[1]=0.f;
+ skyColors[2]=0.35f;
+ skyColors[3]=1.f;
+ return skyColors;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public Vec3 getFogColor(float p_76562_1_, float p_76562_2_) {
+ return Vec3.createVectorHelper(0.35, 0, 0.35);
+ }
+
+ @Override
+ public boolean canRespawnHere() {
+ return false;
+ }
+
+ @Override
+ public boolean isSurfaceWorld() {
+ return false;
+ }
+
+ @Override
+ public boolean canCoordinateBeSpawn(int p_76566_1_, int p_76566_2_) {
+ return this.worldObj.getTopBlock(p_76566_1_, p_76566_2_).getMaterial().blocksMovement();
+ }
+
+ @Override
+ public ChunkCoordinates getEntrancePortalLocation() {
+ return new ChunkCoordinates(0, 80, 0);
+ }
+
+ @Override
+ public int getAverageGroundLevel() {
+ return 50;
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public boolean doesXZShowFog(int p_76568_1_, int p_76568_2_) {
+ return true;
+ }
+
+ public boolean isDaytime()
+ {
+ return false;
+ }
+
+ @Override
+ public String getWelcomeMessage() {
+ return "Entering the Dimension Crack";
+ }
+
+ @Override
+ public String getDepartMessage() {
+ return "Leaving the Dimension Crack";
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/world/crack/WorldTypeCrack.class b/src/main/java/jp/plusplus/fbs/world/crack/WorldTypeCrack.class Binary files differnew file mode 100644 index 0000000..9499586 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/crack/WorldTypeCrack.class diff --git a/src/main/java/jp/plusplus/fbs/world/crack/WorldTypeCrack.java b/src/main/java/jp/plusplus/fbs/world/crack/WorldTypeCrack.java new file mode 100644 index 0000000..9f86782 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/crack/WorldTypeCrack.java @@ -0,0 +1,34 @@ +package jp.plusplus.fbs.world.crack;
+
+import net.minecraft.world.World;
+import net.minecraft.world.WorldType;
+import net.minecraft.world.biome.BiomeGenEnd;
+import net.minecraft.world.biome.WorldChunkManager;
+import net.minecraft.world.chunk.IChunkProvider;
+
+/**
+ * Created by plusplus_F on 2015/10/29.
+ */
+public class WorldTypeCrack extends WorldType {
+ public static WorldType worldType = new WorldTypeCrack("Dimension Crack");
+
+ private WorldTypeCrack(String name) {
+ super(name);
+ }
+
+ @Override
+ public WorldChunkManager getChunkManager(World world) {
+ return new WorldChunkManagerCrack(world);
+ }
+
+ @Override
+ public IChunkProvider getChunkGenerator(World world, String generatorOptions) {
+ return new ChunkProviderCrack(world, world.getSeed());
+ }
+
+ @Override
+ public boolean hasVoidParticles(boolean flag)
+ {
+ return false;
+ }
+}
\ No newline at end of file diff --git a/src/main/java/jp/plusplus/fbs/world/crack/biome/BiomeGenCrack$BiomeCrackDecorator.class b/src/main/java/jp/plusplus/fbs/world/crack/biome/BiomeGenCrack$BiomeCrackDecorator.class Binary files differnew file mode 100644 index 0000000..cb5559a --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/crack/biome/BiomeGenCrack$BiomeCrackDecorator.class diff --git a/src/main/java/jp/plusplus/fbs/world/crack/biome/BiomeGenCrack.class b/src/main/java/jp/plusplus/fbs/world/crack/biome/BiomeGenCrack.class Binary files differnew file mode 100644 index 0000000..78ce6c3 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/crack/biome/BiomeGenCrack.class diff --git a/src/main/java/jp/plusplus/fbs/world/crack/biome/BiomeGenCrack.java b/src/main/java/jp/plusplus/fbs/world/crack/biome/BiomeGenCrack.java new file mode 100644 index 0000000..6787c5b --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/crack/biome/BiomeGenCrack.java @@ -0,0 +1,61 @@ +package jp.plusplus.fbs.world.crack.biome;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.FBS;
+import net.minecraft.entity.boss.EntityDragon;
+import net.minecraft.entity.monster.EntityEnderman;
+import net.minecraft.entity.monster.EntityZombie;
+import net.minecraft.init.Blocks;
+import net.minecraft.world.WorldProviderEnd;
+import net.minecraft.world.biome.*;
+import net.minecraft.world.gen.feature.WorldGenAbstractTree;
+import net.minecraft.world.gen.feature.WorldGenSpikes;
+import net.minecraft.world.gen.feature.WorldGenerator;
+import net.minecraftforge.event.terraingen.TerrainGen;
+
+import java.util.Random;
+
+import static net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.TREE;
+
+/**
+ * Created by plusplus_F on 2015/10/29.
+ */
+public class BiomeGenCrack extends BiomeGenBase {
+ public BiomeGenCrack(int p_i1990_1_) {
+ super(p_i1990_1_, true);
+ this.spawnableMonsterList.clear();
+ this.spawnableCreatureList.clear();
+ this.spawnableWaterCreatureList.clear();
+ this.spawnableCaveCreatureList.clear();
+ this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityZombie.class, 10, 4, 4));
+ this.topBlock = Blocks.dirt;
+ this.fillerBlock = Blocks.dirt;
+ this.theBiomeDecorator = new BiomeCrackDecorator();
+ this.theBiomeDecorator.treesPerChunk = 2;
+ this.theBiomeDecorator.grassPerChunk = 3;
+ this.theBiomeDecorator.flowersPerChunk = 2;
+ this.setTemperatureRainfall(0.7F, 0.F);
+ setBiomeName("Dimension Crack");
+ }
+
+ @SideOnly(Side.CLIENT)
+ public int getSkyColorByTemp(float p_76731_1_) {
+ //return 0xfa000000;
+ return 0xffffffff;
+ }
+
+ @Override
+ public WorldGenAbstractTree func_150567_a(Random p_150567_1_) {
+ return (WorldGenAbstractTree) this.worldGeneratorTrees;
+ }
+
+ public static class BiomeCrackDecorator extends BiomeDecorator {
+ public BiomeCrackDecorator() {
+ }
+
+ protected void genDecorations(BiomeGenBase p_150513_1_) {
+ super.genDecorations(p_150513_1_);
+ }
+ }
+}
\ No newline at end of file diff --git a/src/main/java/jp/plusplus/fbs/world/crack/structure/MapGenSchool$Entrance.class b/src/main/java/jp/plusplus/fbs/world/crack/structure/MapGenSchool$Entrance.class Binary files differnew file mode 100644 index 0000000..d80c022 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/crack/structure/MapGenSchool$Entrance.class diff --git a/src/main/java/jp/plusplus/fbs/world/crack/structure/MapGenSchool$Hall1.class b/src/main/java/jp/plusplus/fbs/world/crack/structure/MapGenSchool$Hall1.class Binary files differnew file mode 100644 index 0000000..6bb9ddd --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/crack/structure/MapGenSchool$Hall1.class diff --git a/src/main/java/jp/plusplus/fbs/world/crack/structure/MapGenSchool$Hall2.class b/src/main/java/jp/plusplus/fbs/world/crack/structure/MapGenSchool$Hall2.class Binary files differnew file mode 100644 index 0000000..05920c0 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/crack/structure/MapGenSchool$Hall2.class diff --git a/src/main/java/jp/plusplus/fbs/world/crack/structure/MapGenSchool$RoomBase.class b/src/main/java/jp/plusplus/fbs/world/crack/structure/MapGenSchool$RoomBase.class Binary files differnew file mode 100644 index 0000000..1348c27 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/crack/structure/MapGenSchool$RoomBase.class diff --git a/src/main/java/jp/plusplus/fbs/world/crack/structure/MapGenSchool$RoomClassroom.class b/src/main/java/jp/plusplus/fbs/world/crack/structure/MapGenSchool$RoomClassroom.class Binary files differnew file mode 100644 index 0000000..70b7f2f --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/crack/structure/MapGenSchool$RoomClassroom.class diff --git a/src/main/java/jp/plusplus/fbs/world/crack/structure/MapGenSchool$RoomStudy.class b/src/main/java/jp/plusplus/fbs/world/crack/structure/MapGenSchool$RoomStudy.class Binary files differnew file mode 100644 index 0000000..3fcf404 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/crack/structure/MapGenSchool$RoomStudy.class diff --git a/src/main/java/jp/plusplus/fbs/world/crack/structure/MapGenSchool$RoomZombie.class b/src/main/java/jp/plusplus/fbs/world/crack/structure/MapGenSchool$RoomZombie.class Binary files differnew file mode 100644 index 0000000..f7ff795 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/crack/structure/MapGenSchool$RoomZombie.class diff --git a/src/main/java/jp/plusplus/fbs/world/crack/structure/MapGenSchool$Stairway.class b/src/main/java/jp/plusplus/fbs/world/crack/structure/MapGenSchool$Stairway.class Binary files differnew file mode 100644 index 0000000..02004b6 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/crack/structure/MapGenSchool$Stairway.class diff --git a/src/main/java/jp/plusplus/fbs/world/crack/structure/MapGenSchool$Start.class b/src/main/java/jp/plusplus/fbs/world/crack/structure/MapGenSchool$Start.class Binary files differnew file mode 100644 index 0000000..ef76b04 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/crack/structure/MapGenSchool$Start.class diff --git a/src/main/java/jp/plusplus/fbs/world/crack/structure/MapGenSchool.class b/src/main/java/jp/plusplus/fbs/world/crack/structure/MapGenSchool.class Binary files differnew file mode 100644 index 0000000..f55291e --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/crack/structure/MapGenSchool.class diff --git a/src/main/java/jp/plusplus/fbs/world/crack/structure/MapGenSchool.java b/src/main/java/jp/plusplus/fbs/world/crack/structure/MapGenSchool.java new file mode 100644 index 0000000..8a07ad1 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/crack/structure/MapGenSchool.java @@ -0,0 +1,630 @@ +package jp.plusplus.fbs.world.crack.structure;
+
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.Registry;
+import jp.plusplus.fbs.block.BlockCore;
+import jp.plusplus.fbs.block.BlockSchoolTable;
+import net.minecraft.block.BlockMobSpawner;
+import net.minecraft.block.BlockStairs;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.tileentity.TileEntityChest;
+import net.minecraft.tileentity.TileEntityMobSpawner;
+import net.minecraft.world.World;
+import net.minecraft.world.gen.structure.MapGenStructure;
+import net.minecraft.world.gen.structure.StructureBoundingBox;
+import net.minecraft.world.gen.structure.StructureComponent;
+import net.minecraft.world.gen.structure.StructureStart;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Random;
+
+/**
+ * Created by plusplus_F on 2015/11/08.
+ * がっこう!
+ */
+public class MapGenSchool extends MapGenStructure {
+ public static final int HALL_WIDTH =5;
+ public static final int FLOOR_HEIGHT =6;
+ public static final int ROOM_SIZE =9;
+ public static final int HALL1_NUM =3;
+ public static final int FLOOR_NUM =3;
+
+ @Override
+ public String func_143025_a() {
+ return "School";
+ }
+
+ @Override
+ protected boolean canSpawnStructureAtCoords(int p_75047_1_, int p_75047_2_) {
+ return p_75047_1_==0 & p_75047_2_==0;
+ }
+
+ @Override
+ protected StructureStart getStructureStart(int i, int j) {
+ return new Start(this.worldObj, this.rand, i, j);
+ }
+
+ public static class Start extends StructureStart{
+ public Start(){}
+
+ public Start(World p_i2060_1_, Random rand, int x, int z) {
+ super(x, z);// 構造物の構成パーツを決定する
+ // 基点はComponentSampleDungeon1
+
+ //高さを求める
+ int maxY=300;
+ for(int i=0;i<16;i++){
+ for(int k=0;k<16;k++){
+ int t= p_i2060_1_.getHeightValue(x, z);
+ if(maxY>t) maxY=t;
+ }
+ }
+
+ Hall1 hall1 = new Hall1(0, rand, (x << 4) + 2, maxY, (z << 4) + 2);
+ this.components.add(hall1);
+
+ // 次のパーツを得る
+ hall1.buildComponent(hall1, components, rand);
+
+ // 次のパーツが決定していないパーツは一時的にstructureComponentsに保持されるので、空になるまで次のパーツの決定を続ける
+ List<StructureComponent> list = hall1.structureComponents;
+ while(!list.isEmpty()) {
+ int k = rand.nextInt(list.size());
+ StructureComponent structurecomponent = list.remove(k);
+ structurecomponent.buildComponent(hall1, this.components, rand);
+ }
+
+ // 構造物全体の占有範囲を更新する
+ this.updateBoundingBox();
+ }
+ }
+
+ public static class Hall1 extends StructureComponent{
+ // 構成パーツリストを記憶するためのリスト
+ public ArrayList<StructureComponent> structureComponents = new ArrayList();
+ public int count;
+
+ public Hall1() {}
+ public Hall1(int par1, Random par2Random, int x, int y, int z) {
+ this(par1, par2Random, x, y, z, 3, 0);
+ }
+ public Hall1(int par1, Random par2Random, int x, int y, int z, int dir, int c){
+ this.coordBaseMode = dir;
+ switch(this.coordBaseMode) {
+ case 0:
+ this.boundingBox=new StructureBoundingBox(x,y,z,x+ HALL_WIDTH,y+ FLOOR_HEIGHT,z+ ROOM_SIZE);
+ break;
+ case 1:
+ this.boundingBox=new StructureBoundingBox(x,y,z,x+ ROOM_SIZE,y+ FLOOR_HEIGHT,z+ HALL_WIDTH);
+ break;
+ case 2:
+ this.boundingBox=new StructureBoundingBox(x,y,z,x+ HALL_WIDTH,y+ FLOOR_HEIGHT,z+ ROOM_SIZE);
+ break;
+ case 3:
+ this.boundingBox=new StructureBoundingBox(x,y,z,x+ ROOM_SIZE,y+ FLOOR_HEIGHT,z+ HALL_WIDTH);
+ break;
+ }
+ count=c;
+ }
+
+ @Override
+ public void buildComponent(StructureComponent par1StructureComponent, List par2List, Random par3Random) {
+ FBS.logger.info("coord:"+coordBaseMode);
+
+ //廊下
+ int cx = this.boundingBox.minX, cy = this.boundingBox.minY, cz = this.boundingBox.minZ;
+ switch (this.coordBaseMode) {
+ case 0:
+ cx = this.boundingBox.minX;
+ cz = this.boundingBox.minZ - (ROOM_SIZE + 1);
+ break;
+ case 1:
+ cx = this.boundingBox.maxX + 1;
+ cz = this.boundingBox.minZ;
+ break;
+ case 2:
+ cx = this.boundingBox.minX;
+ cz = this.boundingBox.maxZ + 1;
+ break;
+ case 3:
+ cx = this.boundingBox.minX - (ROOM_SIZE + 1);
+ cz = this.boundingBox.minZ;
+ break;
+ }
+ Hall2 h1 = new Hall2(0, par3Random, cx, cy, cz, coordBaseMode, 0, true);
+ ((Hall1) par1StructureComponent).structureComponents.add(h1);
+ par2List.add(h1);
+
+ switch (this.coordBaseMode) {
+ case 2:
+ cx = this.boundingBox.minX;
+ cz = this.boundingBox.minZ - (ROOM_SIZE + 1);
+ break;
+ case 3:
+ cx = this.boundingBox.maxX + 1;
+ cz = this.boundingBox.minZ;
+ break;
+ case 0:
+ cx = this.boundingBox.minX;
+ cz = this.boundingBox.maxZ + 1;
+ break;
+ case 1:
+ cx = this.boundingBox.minX - (ROOM_SIZE + 1);
+ cz = this.boundingBox.minZ;
+ break;
+ }
+ h1 = new Hall2(0, par3Random, cx, cy, cz, coordBaseMode, 0, false);
+ ((Hall1) par1StructureComponent).structureComponents.add(h1);
+ par2List.add(h1);
+
+ //階段
+ if(count<FLOOR_NUM){
+ int rx = boundingBox.minX, ry = boundingBox.minY, rz = boundingBox.minZ;
+ switch (this.coordBaseMode) {
+ case 0:
+ rx = this.boundingBox.minX - (ROOM_SIZE + 1);
+ rz = this.boundingBox.minZ;
+ break;
+ case 1:
+ rx = this.boundingBox.maxX;
+ rz = this.boundingBox.minZ + (ROOM_SIZE + 1);
+ break;
+ case 2:
+ rx = this.boundingBox.minX - (ROOM_SIZE + 1);
+ rz = this.boundingBox.maxZ;
+ break;
+ case 3:
+ rx = this.boundingBox.minX;
+ rz = this.boundingBox.minZ - (ROOM_SIZE + 1);
+ break;
+ }
+ Stairway rm = new Stairway(0, par3Random, rx, ry, rz, coordBaseMode, count);
+ ((Hall1) par1StructureComponent).structureComponents.add(rm);
+ par2List.add(rm);
+ }
+ }
+
+ @Override
+ protected void func_143012_a(NBTTagCompound nbttagcompound) {}
+ @Override
+ protected void func_143011_b(NBTTagCompound nbttagcompound) {}
+
+ @Override
+ public boolean addComponentParts(World world, Random random, StructureBoundingBox structureboundingbox) {
+ // 占有範囲(structureboundingbox)内の指定範囲を指定ブロック&メタデータで埋める
+ // 占有範囲(structureboundingbox)内の指定範囲を空気ブロックで埋める
+ this.fillWithMetadataBlocks(world, structureboundingbox, 0, 0, 0, HALL_WIDTH, FLOOR_HEIGHT, ROOM_SIZE, BlockCore.plank, 0, Blocks.air, 0, false);
+ this.fillWithAir(world, structureboundingbox, 1, 1, 1, HALL_WIDTH - 1, FLOOR_HEIGHT - 1, ROOM_SIZE - 1);
+
+ //道を空ける
+ this.fillWithAir(world, structureboundingbox, 1, 1, 0, HALL_WIDTH - 1, FLOOR_HEIGHT - 1, 0);
+ this.fillWithAir(world, structureboundingbox, 1, 1, ROOM_SIZE, HALL_WIDTH - 1, FLOOR_HEIGHT - 1, ROOM_SIZE);
+
+ //接続用の道を空ける
+ this.fillWithAir(world, structureboundingbox, 0, 1, 1, 0, FLOOR_HEIGHT - 1, ROOM_SIZE - 1);
+ if(count==0) this.fillWithAir(world, structureboundingbox, HALL_WIDTH, 1, 3, HALL_WIDTH, 3, 6);
+ return true;
+ }
+ }
+ public static class Hall2 extends Hall1{
+ boolean nextDir;
+ public Hall2(int par1, Random par2Random, int x, int y, int z, int dir, int c, boolean next){
+ super(par1, par2Random, x, y, z, dir, c);
+ nextDir=next;
+ }
+
+ @Override
+ public void buildComponent(StructureComponent par1StructureComponent, List par2List, Random par3Random) {
+ //廊下
+ if (count < HALL1_NUM) {
+ int cx = this.boundingBox.minX, cy = this.boundingBox.minY, cz = this.boundingBox.minZ;
+ if (nextDir) {
+ //入り口から向かって右(北側)
+ switch (this.coordBaseMode) {
+ case 0:
+ cx = this.boundingBox.minX;
+ cz = this.boundingBox.minZ - (ROOM_SIZE + 1);
+ break;
+ case 1:
+ cx = this.boundingBox.maxX + 1;
+ cz = this.boundingBox.minZ;
+ break;
+ case 2:
+ cx = this.boundingBox.minX;
+ cz = this.boundingBox.maxZ + 1;
+ break;
+ case 3:
+ cx = this.boundingBox.minX - (ROOM_SIZE + 1);
+ cz = this.boundingBox.minZ;
+ break;
+ }
+ } else {
+ switch (this.coordBaseMode) {
+ case 2:
+ cx = this.boundingBox.minX;
+ cz = this.boundingBox.minZ - (ROOM_SIZE + 1);
+ break;
+ case 3:
+ cx = this.boundingBox.maxX + 1;
+ cz = this.boundingBox.minZ;
+ break;
+ case 1:
+ cx = this.boundingBox.minX;
+ cz = this.boundingBox.maxZ + 1;
+ break;
+ case 0:
+ cx = this.boundingBox.minX - (ROOM_SIZE + 1);
+ cz = this.boundingBox.minZ;
+ break;
+ }
+ }
+ Hall2 h2 = new Hall2(0, par3Random, cx, cy, cz, coordBaseMode, count + 1, nextDir);
+ ((Hall1) par1StructureComponent).structureComponents.add(h2);
+ par2List.add(h2);
+ }
+ //ランダムで部屋を1つ
+ int rx = boundingBox.minX, ry = boundingBox.minY, rz = boundingBox.minZ;
+ switch (this.coordBaseMode) {
+ case 0:
+ rx = this.boundingBox.minX - (ROOM_SIZE + 1);
+ rz = this.boundingBox.minZ;
+ break;
+ case 1:
+ rx = this.boundingBox.maxX;
+ rz = this.boundingBox.minZ - (ROOM_SIZE + 1);
+ break;
+ case 2:
+ rx = this.boundingBox.minX - (ROOM_SIZE + 1);
+ rz = this.boundingBox.maxZ;
+ break;
+ case 3:
+ rx = this.boundingBox.minX;
+ rz = this.boundingBox.minZ - (ROOM_SIZE + 1);
+ break;
+ }
+
+ RoomBase rm;
+ int rr=par3Random.nextInt(3);
+ if(rr==0) rm = new RoomStudy(0, par3Random, rx, ry, rz, coordBaseMode);
+ else if(rr==1) rm = new RoomZombie(0, par3Random, rx, ry, rz, coordBaseMode);
+ else rm = new RoomClassroom(0, par3Random, rx, ry, rz, coordBaseMode);
+
+ ((Hall1) par1StructureComponent).structureComponents.add(rm);
+ par2List.add(rm);
+ }
+
+ @Override
+ public boolean addComponentParts(World world, Random random, StructureBoundingBox structureboundingbox) {
+ // 占有範囲(structureboundingbox)内の指定範囲を指定ブロック&メタデータで埋める
+ // 占有範囲(structureboundingbox)内の指定範囲を空気ブロックで埋める
+ this.fillWithMetadataBlocks(world, structureboundingbox, 0, 0, 0, HALL_WIDTH, FLOOR_HEIGHT, ROOM_SIZE, BlockCore.plank, 0, Blocks.air, 0, false);
+ this.fillWithAir(world, structureboundingbox, 1, 1, 1, HALL_WIDTH - 1, FLOOR_HEIGHT - 1, ROOM_SIZE - 1);
+
+ //道を空ける
+ if (count == HALL1_NUM) {
+ if (nextDir)
+ this.fillWithAir(world, structureboundingbox, 1, 1, ROOM_SIZE, HALL_WIDTH - 1, FLOOR_HEIGHT - 1, ROOM_SIZE);
+ else this.fillWithAir(world, structureboundingbox, 1, 1, 0, HALL_WIDTH - 1, FLOOR_HEIGHT - 1, 0);
+ } else {
+ this.fillWithAir(world, structureboundingbox, 1, 1, 0, HALL_WIDTH - 1, FLOOR_HEIGHT - 1, 0);
+ if (count < 5)
+ this.fillWithAir(world, structureboundingbox, 1, 1, ROOM_SIZE, HALL_WIDTH - 1, FLOOR_HEIGHT - 1, ROOM_SIZE);
+ }
+
+ //接続用の道を空ける
+ this.fillWithAir(world, structureboundingbox, 0, 1, 2, 0, 3, 3);
+ this.fillWithAir(world, structureboundingbox, 0, 1, 6, 0, 3, 7);
+
+ //窓
+ this.fillWithMetadataBlocks(world, structureboundingbox, HALL_WIDTH, 2, 2, HALL_WIDTH, FLOOR_HEIGHT - 2, 7, Blocks.glass_pane, 0, Blocks.air, 0, false);
+
+ return true;
+ }
+ }
+
+ public static class Stairway extends StructureComponent{
+ public int count;
+ public Stairway() {}
+ public Stairway(int par1, Random par2Random, int x, int y, int z, int dir, int count){
+ this.coordBaseMode = dir;
+ this.count=count;
+ switch(this.coordBaseMode) {
+ case 0:
+ this.boundingBox=new StructureBoundingBox(x,y,z,x+ ROOM_SIZE,y+ FLOOR_HEIGHT*2,z+ ROOM_SIZE);
+ break;
+ case 1:
+ this.boundingBox=new StructureBoundingBox(x,y,z,x+ ROOM_SIZE,y+ FLOOR_HEIGHT*2,z+ ROOM_SIZE);
+ break;
+ case 2:
+ this.boundingBox=new StructureBoundingBox(x,y,z,x+ ROOM_SIZE,y+ FLOOR_HEIGHT*2,z+ ROOM_SIZE);
+ break;
+ case 3:
+ this.boundingBox=new StructureBoundingBox(x,y,z,x+ ROOM_SIZE,y+ FLOOR_HEIGHT*2,z+ ROOM_SIZE);
+ break;
+ }
+ }
+
+ @Override
+ public void buildComponent(StructureComponent par1StructureComponent, List par2List, Random par3Random) {
+ //階段
+ int rx = boundingBox.minX, ry = boundingBox.maxY-FLOOR_HEIGHT, rz = boundingBox.minZ;
+
+ switch (this.coordBaseMode) {
+ case 2:
+ rx = this.boundingBox.maxX+1;
+ rz = this.boundingBox.minZ;
+ break;
+ case 3:
+ rx = this.boundingBox.minX;
+ rz = this.boundingBox.maxZ+1;
+ break;
+ case 0:
+ rx = this.boundingBox.minX-(ROOM_SIZE+1);
+ rz = this.boundingBox.minZ;
+ break;
+ case 1:
+ rx = this.boundingBox.minX;
+ rz = this.boundingBox.maxZ-(ROOM_SIZE+1);
+ break;
+ }
+ /*
+ switch (this.coordBaseMode) {
+ case 2:
+ rx = this.boundingBox.maxX+1;
+ rz = this.boundingBox.minZ+ROOM_SIZE;
+ break;
+ case 3:
+ rx = this.boundingBox.maxX+ROOM_SIZE;
+ rz = this.boundingBox.maxZ+1;
+ break;
+ case 0:
+ rx = this.boundingBox.minX - (HALL_WIDTH + 1);
+ rz = this.boundingBox.minZ;
+ break;
+ case 1:
+ rx = this.boundingBox.minX - ROOM_SIZE;
+ rz = this.boundingBox.minZ - (HALL_WIDTH + 1);
+ break;
+ }
+ */
+
+ Hall1 h1 = new Hall1(0, par3Random, rx, ry, rz, coordBaseMode, count + 1);
+ ((Hall1) par1StructureComponent).structureComponents.add(h1);
+ par2List.add(h1);
+ }
+
+ @Override
+ protected void func_143012_a(NBTTagCompound p_143012_1_) {}
+
+ @Override
+ protected void func_143011_b(NBTTagCompound p_143011_1_) {}
+
+ @Override
+ public boolean addComponentParts(World world, Random p_74875_2_, StructureBoundingBox structureboundingbox) {
+ this.fillWithMetadataBlocks(world, structureboundingbox, 0, 0, 0, ROOM_SIZE, FLOOR_HEIGHT*2, ROOM_SIZE, BlockCore.plank, 0, Blocks.air, 0, false);
+ this.fillWithAir(world, structureboundingbox, 1, 1, 1, ROOM_SIZE-1, FLOOR_HEIGHT*2-1, ROOM_SIZE-1);
+
+ int metaL=getMetadataWithOffset(Blocks.oak_stairs, 1), metaR=getMetadataWithOffset(Blocks.oak_stairs, 0);
+
+ //接続穴
+ this.fillWithAir(world, structureboundingbox, ROOM_SIZE, 1, 1, ROOM_SIZE, FLOOR_HEIGHT*2-1, ROOM_SIZE-1);
+ if(count>0){
+ this.fillWithAir(world, structureboundingbox, 1, 0, 1, ROOM_SIZE, 0, ROOM_SIZE-1);
+
+ this.placeBlockAtCurrentPosition(world, Blocks.oak_stairs, metaR, ROOM_SIZE, 0, 3, structureboundingbox);
+ this.placeBlockAtCurrentPosition(world, Blocks.oak_stairs, metaR, ROOM_SIZE, 0, 4, structureboundingbox);
+ this.placeBlockAtCurrentPosition(world, Blocks.oak_stairs, metaR, ROOM_SIZE, 0, 5, structureboundingbox);
+ this.placeBlockAtCurrentPosition(world, Blocks.oak_stairs, metaR, ROOM_SIZE, 0, 6, structureboundingbox);
+ }
+
+ //階段 0x4=0,
+ for(int i=0;i<3;i++){
+ this.placeBlockAtCurrentPosition(world, Blocks.oak_stairs, metaL, ROOM_SIZE-i, 1+i, 1, structureboundingbox);
+ this.placeBlockAtCurrentPosition(world, Blocks.oak_stairs, metaL, ROOM_SIZE-i, 1+i, 2, structureboundingbox);
+ this.placeBlockAtCurrentPosition(world, Blocks.oak_stairs, metaL, ROOM_SIZE-i, 1+i, 7, structureboundingbox);
+ this.placeBlockAtCurrentPosition(world, Blocks.oak_stairs, metaL, ROOM_SIZE-i, 1+i, 8, structureboundingbox);
+
+ this.placeBlockAtCurrentPosition(world, Blocks.oak_stairs, metaR, ROOM_SIZE+i-2, 4+i, 3, structureboundingbox);
+ this.placeBlockAtCurrentPosition(world, Blocks.oak_stairs, metaR, ROOM_SIZE+i-2, 4+i, 4, structureboundingbox);
+ this.placeBlockAtCurrentPosition(world, Blocks.oak_stairs, metaR, ROOM_SIZE+i-2, 4+i, 5, structureboundingbox);
+ this.placeBlockAtCurrentPosition(world, Blocks.oak_stairs, metaR, ROOM_SIZE+i-2, 4+i, 6, structureboundingbox);
+ }
+
+ this.fillWithMetadataBlocks(world, structureboundingbox, 1, 3, 1, 6, 3, ROOM_SIZE-1, BlockCore.plank, 0, Blocks.air, 0, false);
+
+ return true;
+ }
+
+ }
+
+ public static class Entrance extends StructureComponent{
+ public Entrance() {}
+ public Entrance(int par1, Random par2Random, int x, int y, int z, int dir) {
+ this.coordBaseMode=dir;
+ this.boundingBox=new StructureBoundingBox(x,y,z,x+ HALL_WIDTH,y+ FLOOR_HEIGHT,z+ HALL_WIDTH);
+ }
+
+ @Override
+ protected void func_143012_a(NBTTagCompound p_143012_1_) {}
+
+ @Override
+ protected void func_143011_b(NBTTagCompound p_143011_1_) {}
+
+ @Override
+ public boolean addComponentParts(World world, Random p_74875_2_, StructureBoundingBox structureboundingbox) {
+ this.fillWithMetadataBlocks(world, structureboundingbox, 0, 0, 0, HALL_WIDTH, FLOOR_HEIGHT, HALL_WIDTH, BlockCore.plank, 0, Blocks.air, 0, false);
+ this.fillWithAir(world, structureboundingbox, 1, 1, 1, HALL_WIDTH -1, FLOOR_HEIGHT -1, HALL_WIDTH -1);
+
+ this.fillWithAir(world, structureboundingbox, 1, 1, 0, HALL_WIDTH-1, 3, 0);
+ this.fillWithAir(world, structureboundingbox, 1, 1, HALL_WIDTH, HALL_WIDTH-1, 3, HALL_WIDTH);
+
+ return true;
+ }
+
+ }
+
+ public static class RoomBase extends StructureComponent {
+ public RoomBase() {}
+ public RoomBase(int par1, Random par2Random, int x, int y, int z, int dir) {
+ this.coordBaseMode = dir;
+ this.boundingBox = new StructureBoundingBox(x, y, z, x + ROOM_SIZE, y+FLOOR_HEIGHT, z + ROOM_SIZE);
+ }
+
+ protected boolean hasWindow(){ return true; }
+
+ @Override
+ protected void func_143012_a(NBTTagCompound nbttagcompound) {}
+ @Override
+ protected void func_143011_b(NBTTagCompound nbttagcompound) {}
+
+ @Override
+ public void buildComponent(StructureComponent par1StructureComponent, List par2List, Random par3Random) {
+ //何にも派生しない
+ }
+
+ @Override
+ public boolean addComponentParts(World world, Random random, StructureBoundingBox structureboundingbox) {
+ this.fillWithMetadataBlocks(world, structureboundingbox, 0, 0, 0, ROOM_SIZE, FLOOR_HEIGHT, ROOM_SIZE, BlockCore.plank, 0, Blocks.air, 0, false);
+ this.fillWithAir(world, structureboundingbox, 1, 1, 1, ROOM_SIZE-1, FLOOR_HEIGHT-1, ROOM_SIZE-1);
+
+ this.fillWithAir(world, structureboundingbox, ROOM_SIZE, 1, 2, ROOM_SIZE, 3, 3);
+ this.fillWithAir(world, structureboundingbox, ROOM_SIZE, 1, 6, ROOM_SIZE, 3, 7);
+
+ if(hasWindow()){
+ this.fillWithMetadataBlocks(world, structureboundingbox, 0, 2, 2, 0, FLOOR_HEIGHT - 2, 3, Blocks.glass_pane, 0, Blocks.air, 0, false);
+ this.fillWithMetadataBlocks(world, structureboundingbox, 0, 2, 6, 0, FLOOR_HEIGHT - 2, 7, Blocks.glass_pane, 0, Blocks.air, 0, false);
+ }
+
+ return true;
+ }
+ }
+
+ public static class RoomStudy extends RoomBase{
+ public RoomStudy() {}
+ public RoomStudy(int par1, Random par2Random, int x, int y, int z, int dir) {
+ super(par1, par2Random, x, y, z, dir);}
+
+ @Override
+ protected boolean hasWindow(){ return true; }
+
+ @Override
+ public boolean addComponentParts(World world, Random random, StructureBoundingBox structureboundingbox) {
+ super.addComponentParts(world, random, structureboundingbox);
+
+ //本
+ for(int y=1;y<=FLOOR_HEIGHT-2;y++){
+ for(int z=1;z<=ROOM_SIZE-1;z++){
+ //this.placeBlockAtCurrentPosition(world, BlockCore.bookshelf, getBookNum(random, 3), 1, y, z, structureboundingbox);
+
+ if(z!=4 && z!=5){
+ this.placeBlockAtCurrentPosition(world, BlockCore.bookshelf, getBookNum(random, 3), 3, y, z, structureboundingbox);
+ this.placeBlockAtCurrentPosition(world, BlockCore.bookshelf, getBookNum(random, 3), 5, y, z, structureboundingbox);
+ }
+ else {
+ this.placeBlockAtCurrentPosition(world, BlockCore.bookshelf, getBookNum(random, 3), 7, y, z, structureboundingbox);
+ }
+ }
+ }
+
+ return true;
+ }
+
+ protected int getBookNum(Random rand, int max){
+ return 2+rand.nextInt(max);
+ }
+ }
+
+ public static class RoomClassroom extends RoomBase{
+ public RoomClassroom() {}
+ public RoomClassroom(int par1, Random par2Random, int x, int y, int z, int dir) {
+ super(par1, par2Random, x, y, z, dir);
+ }
+
+ @Override
+ public boolean addComponentParts(World world, Random random, StructureBoundingBox structureboundingbox) {
+ super.addComponentParts(world, random, structureboundingbox);
+
+ int meta=0;
+ switch (coordBaseMode){
+ case 0:
+ meta=2;
+ break;
+ case 1:
+ meta=5;
+ break;
+ case 2:
+ meta=3;
+ break;
+ case 3:
+ meta=4;
+ break;
+ }
+
+ //学校の机
+ for(int i=0;i<3;i++){
+ for(int k=0;k<4;k++){
+ placeBlockAtCurrentPosition(world, BlockCore.schoolTable, meta, 1+k*2, 1, 2+i*2, structureboundingbox);
+ }
+ }
+
+ //教壇
+ fillWithMetadataBlocks(world, structureboundingbox, 2, 1, 8, 7, 1, 8, Blocks.wooden_slab, 0, Blocks.air, 0, false);
+
+ return true;
+ }
+ }
+
+ public static class RoomZombie extends RoomBase{
+ private boolean chest=false;
+
+ public RoomZombie() {}
+ public RoomZombie(int par1, Random par2Random, int x, int y, int z, int dir) {
+ super(par1, par2Random, x, y, z, dir);
+ }
+
+ @Override
+ protected void func_143012_a(NBTTagCompound tag) {
+ tag.setBoolean("Chest", this.chest);
+ }
+ @Override
+ protected void func_143011_b(NBTTagCompound tag) {
+ chest = tag.getBoolean("Chest");
+ }
+
+ @Override
+ public boolean addComponentParts(World world, Random random, StructureBoundingBox structureboundingbox) {
+ super.addComponentParts(world, random, structureboundingbox);
+
+ placeBlockAtCurrentPosition(world, Blocks.mob_spawner, 0, 4, 1, 4, structureboundingbox);
+ TileEntity te=world.getTileEntity(getXWithOffset(4, 4), getYWithOffset(1), getZWithOffset(4, 4));
+ if(te instanceof TileEntityMobSpawner){
+ ((TileEntityMobSpawner) te).func_145881_a().setEntityName("Zombie");
+ te.markDirty();
+ }
+
+ //chest
+ if(!chest){
+ int cx=getXWithOffset(1, ROOM_SIZE-1), cy=getYWithOffset(1), cz=getZWithOffset(1, ROOM_SIZE-1);
+ if(structureboundingbox.isVecInside(cx, cy, cz) && world.getBlock(cx, cy, cz)!=Blocks.chest){
+ world.setBlock(cx, cy, cz, Blocks.chest, 0, 2);
+ te=world.getTileEntity(cx,cy,cz);
+ if(te instanceof TileEntityChest){
+ TileEntityChest e=(TileEntityChest)te;
+ ItemStack[] items=new ItemStack[e.getSizeInventory()];
+ Registry.GetChestContents(2, items, 0.25f);
+ for(int i=0;i<items.length;i++){
+ e.setInventorySlotContents(i, items[i]);
+ }
+ }
+ chest=true;
+ }
+ }
+
+ return true;
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/world/structure/MapGenSealdLib.class b/src/main/java/jp/plusplus/fbs/world/structure/MapGenSealdLib.class Binary files differnew file mode 100644 index 0000000..2301f28 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/structure/MapGenSealdLib.class diff --git a/src/main/java/jp/plusplus/fbs/world/structure/MapGenSealdLib.java b/src/main/java/jp/plusplus/fbs/world/structure/MapGenSealdLib.java new file mode 100644 index 0000000..4baa9bb --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/structure/MapGenSealdLib.java @@ -0,0 +1,75 @@ +package jp.plusplus.fbs.world.structure;
+
+import jp.plusplus.fbs.FBS;
+import net.minecraft.entity.item.EntityEnderEye;
+import net.minecraft.item.ItemEnderEye;
+import net.minecraft.world.World;
+import net.minecraft.world.gen.structure.MapGenScatteredFeature;
+import net.minecraft.world.gen.structure.MapGenStructure;
+import net.minecraft.world.gen.structure.StructureStart;
+
+import java.util.Random;
+
+/**
+ * Createdby pluslus_Fon 2015/06/06.
+ */
+public class MapGenSealdLib extends MapGenStructure {
+ public MapGenSealdLib() {
+ }
+
+ @Override
+ public String func_143025_a() {
+ return "Sealed Library";
+ }
+
+ @Override
+ protected boolean canSpawnStructureAtCoords(int i, int j) {
+ boolean f=isLibraryChunk(worldObj, i, j);
+ //if(f) FBS.logger.info("generated at:"+i+","+j);
+ //EntityEnderEye
+ //ItemEnderEye
+ return f;
+ }
+
+ @Override
+ protected StructureStart getStructureStart(int i, int j) {
+ return new StructureSealedLibStart(this.worldObj, this.rand, i, j);
+ }
+
+ /**
+ * それが図書館生成チャンクであるかどうか
+ *
+ * @param x
+ * @param z
+ * @return
+ */
+ public static boolean isLibraryChunk(World w, int x, int z) {
+ int max = 4;
+ int min = 1;
+
+ int k = x;
+ int l = z;
+
+ if (x < 0) {
+ x -= max - 1;
+ }
+
+ if (z < 0) {
+ z -= max - 1;
+ }
+
+ int i1 = x / max;
+ int j1 = z / max;
+
+ long seed = (long) i1 * 341873128712L + (long) j1 * 132897987541L + w.getWorldInfo().getSeed() + (long) 14357617;
+ Random random = new Random(seed);
+
+ i1 *= max;
+ j1 *= max;
+ i1 += random.nextInt(max - min);
+ j1 += random.nextInt(max - min);
+
+ return (k == i1 && l == j1);
+ }
+
+}
\ No newline at end of file diff --git a/src/main/java/jp/plusplus/fbs/world/structure/MapGenStudy$Start.class b/src/main/java/jp/plusplus/fbs/world/structure/MapGenStudy$Start.class Binary files differnew file mode 100644 index 0000000..b077be6 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/structure/MapGenStudy$Start.class diff --git a/src/main/java/jp/plusplus/fbs/world/structure/MapGenStudy$Structure.class b/src/main/java/jp/plusplus/fbs/world/structure/MapGenStudy$Structure.class Binary files differnew file mode 100644 index 0000000..c572eae --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/structure/MapGenStudy$Structure.class diff --git a/src/main/java/jp/plusplus/fbs/world/structure/MapGenStudy.class b/src/main/java/jp/plusplus/fbs/world/structure/MapGenStudy.class Binary files differnew file mode 100644 index 0000000..504b193 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/structure/MapGenStudy.class diff --git a/src/main/java/jp/plusplus/fbs/world/structure/MapGenStudy.java b/src/main/java/jp/plusplus/fbs/world/structure/MapGenStudy.java new file mode 100644 index 0000000..7114085 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/structure/MapGenStudy.java @@ -0,0 +1,379 @@ +package jp.plusplus.fbs.world.structure;
+
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.Registry;
+import jp.plusplus.fbs.block.BlockCore;
+import net.minecraft.block.Block;
+import net.minecraft.block.BlockRotatedPillar;
+import net.minecraft.block.BlockStairs;
+import net.minecraft.init.Blocks;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.world.World;
+import net.minecraft.world.biome.BiomeGenBase;
+import net.minecraft.world.gen.structure.*;
+
+import java.util.Random;
+
+/**
+ * Created by plusplus_F on 2015/08/24.
+ * 「魔力の秋」にのみ生成される、地上でありながら書物を得られる構造物
+ *
+ * こんなクッソ面倒な仕様にしやがって!
+ * もっと他にやり方あっただろ!
+ */
+public class MapGenStudy extends MapGenStructure {
+ private int maxDistanceBetweenScatteredFeatures=12;
+ private int minDistanceBetweenScatteredFeatures=3;
+
+ @Override
+ public String func_143025_a() {
+ return "Study";
+ }
+
+ @Override
+ protected boolean canSpawnStructureAtCoords(int p_75047_1_, int p_75047_2_) {
+ int k = p_75047_1_;
+ int l = p_75047_2_;
+
+ //
+ //if(k%4==0 || l%4==0) return true;
+
+ if (p_75047_1_ < 0) {
+ p_75047_1_ -= this.maxDistanceBetweenScatteredFeatures - 1;
+ }
+
+ if (p_75047_2_ < 0) {
+ p_75047_2_ -= this.maxDistanceBetweenScatteredFeatures - 1;
+ }
+
+ int i1 = p_75047_1_ / this.maxDistanceBetweenScatteredFeatures;
+ int j1 = p_75047_2_ / this.maxDistanceBetweenScatteredFeatures;
+ Random random = this.worldObj.setRandomSeed(i1, j1, 14357617);
+ i1 *= this.maxDistanceBetweenScatteredFeatures;
+ j1 *= this.maxDistanceBetweenScatteredFeatures;
+ i1 += random.nextInt(this.maxDistanceBetweenScatteredFeatures - this.minDistanceBetweenScatteredFeatures);
+ j1 += random.nextInt(this.maxDistanceBetweenScatteredFeatures - this.minDistanceBetweenScatteredFeatures);
+
+ if (k == i1 && l == j1) {
+ //FBS.logger.info("generated at:"+p_75047_1_+","+p_75047_2_);
+
+ BiomeGenBase biomegenbase = this.worldObj.getWorldChunkManager().getBiomeGenAt(k * 16 + 8, l * 16 + 8);
+ if(biomegenbase== Registry.biomeAutumn){
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ @Override
+ protected StructureStart getStructureStart(int i, int j) {
+ return new Start(this.worldObj, this.rand, i, j);
+ }
+
+ //----------------------------------------------------------------------------------
+ // 起点
+ //----------------------------------------------------------------------------------
+ public static class Start extends StructureStart {
+ public Start() {
+ }
+
+ public Start(World p_i2060_1_, Random rand, int x, int z) {
+ super(x, z);
+ components.add(new Structure(rand, x*16,100,z*16));
+ this.updateBoundingBox();
+ }
+ }
+
+ public static class Structure extends StructureComponent {
+ protected int width;
+ protected int height;
+ protected int depth;
+ protected int field_74936_d = -1;
+ protected boolean[] hasShelf={false, false, false};
+ protected boolean[] judged={false, false, false};
+
+ public Structure() {
+ }
+
+ protected Structure(Random rand, int x, int y, int z) {
+ super(0);
+ this.width = 27;
+ this.height = 9;
+ this.depth = 17;
+ this.coordBaseMode = rand.nextInt(4);
+
+ switch (this.coordBaseMode) {
+ case 0:
+ case 2:
+ this.boundingBox = new StructureBoundingBox(x, y, z, x + width - 1, y + height - 1, z + depth - 1);
+ break;
+ default:
+ this.boundingBox = new StructureBoundingBox(x, y, z, x + depth - 1, y + height - 1, z + width - 1);
+ }
+ }
+
+ protected void func_143012_a(NBTTagCompound p_143012_1_) {
+ p_143012_1_.setInteger("Width", this.width);
+ p_143012_1_.setInteger("Height", this.height);
+ p_143012_1_.setInteger("Depth", this.depth);
+ p_143012_1_.setInteger("HPos", this.field_74936_d);
+ for(int i=0;i<3;i++){
+ p_143012_1_.setBoolean("Judged"+i, judged[i]);
+ p_143012_1_.setBoolean("HasShelf"+i, hasShelf[i]);
+ }
+ }
+
+ protected void func_143011_b(NBTTagCompound p_143011_1_) {
+ this.width = p_143011_1_.getInteger("Width");
+ this.height = p_143011_1_.getInteger("Height");
+ this.depth = p_143011_1_.getInteger("Depth");
+ this.field_74936_d = p_143011_1_.getInteger("HPos");
+ for(int i=0;i<3;i++){
+ judged[i]=p_143011_1_.getBoolean("Judged"+i);
+ hasShelf[i]=p_143011_1_.getBoolean("HasShelf"+i);
+ }
+ }
+
+ /**
+ * offsetYを計算する
+ * @param p_74935_1_
+ * @param p_74935_2_
+ * @param p_74935_3_
+ * @return
+ */
+ protected boolean func_74935_a(World p_74935_1_, StructureBoundingBox p_74935_2_, int p_74935_3_) {
+ if (this.field_74936_d >= 0) {
+ return true;
+ } else {
+ int j = 0;
+ int k = 0;
+ int maxY=0;
+
+ for (int l = this.boundingBox.minZ; l <= this.boundingBox.maxZ; ++l) {
+ for (int i1 = this.boundingBox.minX; i1 <= this.boundingBox.maxX; ++i1) {
+ if (p_74935_2_.isVecInside(i1, 70, l)) {
+ int __i=Math.max(p_74935_1_.getTopSolidOrLiquidBlock(i1, l), p_74935_1_.provider.getAverageGroundLevel());
+ j += __i;
+ ++k;
+ if(maxY<__i) maxY=__i;
+ }
+ }
+ }
+
+ if (k == 0) {
+ return false;
+ } else {
+ this.field_74936_d = j / k;
+ field_74936_d=maxY;
+ this.boundingBox.offset(0, this.field_74936_d - this.boundingBox.minY + p_74935_3_, 0);
+ return true;
+ }
+ }
+ }
+
+ @Override
+ public boolean addComponentParts(World w, Random rand, StructureBoundingBox box) {
+ if (!this.func_74935_a(w, box, 0)){
+ return false;
+ }
+
+ int west,east,north,south;
+
+ fillWithAir(w, box, 0,0,0,26,8,16);
+
+ //-----------------------------------------------------------------
+ // 階段の設置
+ //-----------------------------------------------------------------
+ west=getMetadataWithOffset(Blocks.oak_stairs, 4);
+ east=getMetadataWithOffset(Blocks.oak_stairs, 5);
+ north=getMetadataWithOffset(Blocks.oak_stairs, 2);
+ south=getMetadataWithOffset(Blocks.oak_stairs, 3);
+ fillWithMetadataBlocks(w, box, 12, 0, 1, 14, 0, 1, Blocks.oak_stairs, south, Blocks.oak_stairs, south, false);
+ fillWithMetadataBlocks(w, box, 12, 1, 2, 14, 1, 2, Blocks.oak_stairs, south, Blocks.oak_stairs, south, false);
+
+ fillWithMetadataBlocks(w, box, 11, 0, 0, 11, 0, 2, Blocks.fence, 0, Blocks.fence, 0, false);
+ fillWithMetadataBlocks(w, box, 11, 1, 1, 11, 1, 2, Blocks.fence, 0, Blocks.fence, 0, false);
+ fillWithMetadataBlocks(w, box, 11, 2, 2, 11, 2, 2, Blocks.fence, 0, Blocks.fence, 0, false);
+ fillWithMetadataBlocks(w, box, 15, 0, 0, 15, 0, 2, Blocks.fence, 0, Blocks.fence, 0, false);
+ fillWithMetadataBlocks(w, box, 15, 1, 1, 15, 1, 2, Blocks.fence, 0, Blocks.fence, 0, false);
+ fillWithMetadataBlocks(w, box, 15, 2, 2, 15, 2, 2, Blocks.fence, 0, Blocks.fence, 0, false);
+
+ //-----------------------------------------------------------------
+ // 屋根の設置
+ //-----------------------------------------------------------------
+ west=getMetadataWithOffset(Blocks.stone_brick_stairs, 0);
+ east=getMetadataWithOffset(Blocks.stone_brick_stairs, 1);
+ north=getMetadataWithOffset(Blocks.stone_brick_stairs, 2);
+ south=getMetadataWithOffset(Blocks.stone_brick_stairs, 3);
+ fillWithMetadataBlocks(w, box, 0, 5, 2, 26, 5, 2, Blocks.stone_brick_stairs, south, Blocks.stone_brick_stairs, south, false);
+ fillWithMetadataBlocks(w, box, 0, 5, 16, 26, 5, 16, Blocks.stone_brick_stairs, north, Blocks.stone_brick_stairs, north, false);
+ fillWithMetadataBlocks(w, box, 0, 5, 3, 0, 5, 15, Blocks.stone_brick_stairs, west, Blocks.stone_brick_stairs, west, false);
+ fillWithMetadataBlocks(w, box, 26, 5, 3, 26, 5, 15, Blocks.stone_brick_stairs, east, Blocks.stone_brick_stairs, east, false);
+
+ fillWithMetadataBlocks(w, box, 1, 6, 3, 25, 6, 3, Blocks.stone_brick_stairs, south, Blocks.stone_brick_stairs, south, false);
+ fillWithMetadataBlocks(w, box, 1, 6, 15, 25, 6, 15, Blocks.stone_brick_stairs, north, Blocks.stone_brick_stairs, north, false);
+ fillWithMetadataBlocks(w, box, 1, 6, 4, 1, 6, 14, Blocks.stone_brick_stairs, west, Blocks.stone_brick_stairs, west, false);
+ fillWithMetadataBlocks(w, box, 25, 6, 4, 25, 6, 14, Blocks.stone_brick_stairs, east, Blocks.stone_brick_stairs, east, false);
+
+ fillWithMetadataBlocks(w, box, 2, 7, 4, 24, 7, 4, Blocks.stone_brick_stairs, south, Blocks.stone_brick_stairs, south, false);
+ fillWithMetadataBlocks(w, box, 2, 7, 14, 24, 7, 14, Blocks.stone_brick_stairs, north, Blocks.stone_brick_stairs, north, false);
+ fillWithMetadataBlocks(w, box, 2, 7, 5, 2, 7, 13, Blocks.stone_brick_stairs, west, Blocks.stone_brick_stairs, west, false);
+ fillWithMetadataBlocks(w, box, 24, 7, 5, 24, 7, 13, Blocks.stone_brick_stairs, east, Blocks.stone_brick_stairs, east, false);
+
+ fillWithMetadataBlocks(w, box, 3, 8, 5, 23, 8, 13, Blocks.stone_slab, 5, Blocks.stone_slab, 5, false);
+
+ //-----------------------------------------------------------------
+ // 土台の設置
+ //-----------------------------------------------------------------
+ //原木の向き
+ west=east=(coordBaseMode==0 || coordBaseMode==2)?8:4;
+ north=south=(coordBaseMode==0 || coordBaseMode==2)?4:8;
+
+ //柵 基礎
+ fillWithMetadataBlocks(w, box, 1, 0, 3, 25, 0, 3, Blocks.fence, 0, Blocks.fence, 0, false);
+ fillWithMetadataBlocks(w, box, 1, 0, 15, 25, 0, 15, Blocks.fence, 0, Blocks.fence, 0, false);
+ fillWithMetadataBlocks(w, box, 1, 0, 4, 1, 0, 14, Blocks.fence, 0, Blocks.fence, 0, false);
+ fillWithMetadataBlocks(w, box, 25, 0, 4, 25, 0, 14, Blocks.fence, 0, Blocks.fence, 0, false);
+ int my;
+
+ /*
+ for(int dx=boundingBox.minX;dx<=boundingBox.maxX;dx++){
+ for(my=w.getHeightValue(dx, boundingBox.minZ);my<=boundingBox.minY;my++){
+ w.setBlock(dx, my, boundingBox.minZ, Blocks.fence);
+ }
+ for(my=w.getHeightValue(dx, boundingBox.maxZ);my<=boundingBox.minY;my++){
+ w.setBlock(dx, my, boundingBox.minZ, Blocks.fence);
+ }
+ }
+ for(int dz=boundingBox.minZ+1;dz<=boundingBox.maxZ-1;dz++){
+ for(my=w.getHeightValue(boundingBox.minX, dz);my<=boundingBox.minY;my++){
+ w.setBlock(boundingBox.minX, my, dz, Blocks.fence);
+ }
+ for(my=w.getHeightValue(boundingBox.maxX, dz);my<=boundingBox.minY;my++){
+ w.setBlock(boundingBox.maxX, my, dz, Blocks.fence);
+ }
+ }
+ */
+
+ //木材
+ fillWithMetadataBlocks(w, box, 1,1,3, 25,1,15, Blocks.planks, 0, Blocks.planks, 0, false);
+
+ //原木 外枠
+ fillWithMetadataBlocks(w, box, 1, 1, 3, 25, 1, 3, Blocks.log, south, Blocks.log, south, false);
+ fillWithMetadataBlocks(w, box, 1, 1, 15, 25, 1, 15, Blocks.log, south, Blocks.log, south, false);
+ fillWithMetadataBlocks(w, box, 1, 1, 4, 1, 1, 14, Blocks.log, west, Blocks.log, west, false);
+ fillWithMetadataBlocks(w, box, 25, 1, 4, 25, 1, 14, Blocks.log, west, Blocks.log, west, false);
+
+ //原木 内枠
+ fillWithMetadataBlocks(w, box, 4, 1, 6, 22, 1, 6, Blocks.log, south, Blocks.log, south, false);
+ fillWithMetadataBlocks(w, box, 4, 1, 12, 22, 1, 12, Blocks.log, west, Blocks.log, west, false);
+ for(int i=0;i<4;i++){
+ fillWithMetadataBlocks(w, box, 4+i*6, 1, 7, 4+i*6, 1, 11, Blocks.log, west, Blocks.log, west, false);
+ }
+
+ //-----------------------------------------------------------------
+ // 障子の設置
+ //-----------------------------------------------------------------
+ fillWithMetadataBlocks(w, box, 4, 2, 6, 22, 4, 12, Blocks.wool, 0, Blocks.wool, 0, false);
+ for(int i=0;i<3;i++){
+ fillWithAir(w, box, 5+i*6,2,7, 9+i*6,4,11);
+ }
+
+ //-----------------------------------------------------------------
+ // 柵の設置
+ //-----------------------------------------------------------------
+ fillWithMetadataBlocks(w, box, 1, 2, 3, 11, 2, 3, Blocks.fence, 0, Blocks.fence, 0, false);
+ fillWithMetadataBlocks(w, box, 15, 2, 3, 25, 2, 3, Blocks.fence, 0, Blocks.fence, 0, false);
+ fillWithMetadataBlocks(w, box, 1, 2, 15, 25, 2, 15, Blocks.fence, 0, Blocks.fence, 0, false);
+ fillWithMetadataBlocks(w, box, 1, 2, 3, 1, 2, 15, Blocks.fence, 0, Blocks.fence, 0, false);
+ fillWithMetadataBlocks(w, box, 25, 2, 3, 25, 2, 15, Blocks.fence, 0, Blocks.fence, 0, false);
+
+ fillWithMetadataBlocks(w, box, 4, 6, 6, 22, 7, 6, Blocks.fence, 0, Blocks.fence, 0, false);
+ fillWithMetadataBlocks(w, box, 4, 6, 12, 22, 7, 12, Blocks.fence, 0, Blocks.fence, 0, false);
+ for(int i=0;i<4;i++){
+ fillWithMetadataBlocks(w, box, 4+6*i, 6, 6, 4+6*i, 7, 12, Blocks.fence, 0, Blocks.fence, 0, false);
+ }
+
+
+ for(int i=0;i<11;i++){
+ if(i!=5) fillWithMetadataBlocks(w, box, 3+2*i, 3, 3, 3+2*i, 4, 3, Blocks.fence, 0, Blocks.fence, 0, false);
+ fillWithMetadataBlocks(w, box, 3+2*i, 3, 15, 3+2*i, 4, 15, Blocks.fence, 0, Blocks.fence, 0, false);
+ }
+ for(int i=0;i<5;i++){
+ fillWithMetadataBlocks(w, box, 1, 3, 5+2*i, 1, 4, 5+2*i, Blocks.fence, 0, Blocks.fence, 0, false);
+ fillWithMetadataBlocks(w, box, 25, 3, 5+2*i, 25, 4, 5+2*i, Blocks.fence, 0, Blocks.fence, 0, false);
+ }
+
+ //-----------------------------------------------------------------
+ // 枠組みの設置
+ //-----------------------------------------------------------------
+ fillWithMetadataBlocks(w, box, 1, 5, 3, 25, 5, 3, Blocks.log, south, Blocks.log, south, false);
+ fillWithMetadataBlocks(w, box, 1, 5, 15, 25, 5, 15, Blocks.log, south, Blocks.log, south, false);
+ fillWithMetadataBlocks(w, box, 1, 5, 3, 1, 5, 15, Blocks.log, west, Blocks.log, west, false);
+ fillWithMetadataBlocks(w, box, 25, 5, 3, 25, 5, 15, Blocks.log, west, Blocks.log, west, false);
+
+ fillWithMetadataBlocks(w, box, 1, 0, 3, 1, 5, 3, Blocks.log, 0, Blocks.log, 0, false);
+ fillWithMetadataBlocks(w, box, 1, 0, 15, 1, 5, 15, Blocks.log, 0, Blocks.log, 0, false);
+ fillWithMetadataBlocks(w, box, 25, 0, 3, 25, 5, 3, Blocks.log, 0, Blocks.log, 0, false);
+ fillWithMetadataBlocks(w, box, 25, 0, 15, 25, 5, 15, Blocks.log, 0, Blocks.log, 0, false);
+
+ fillWithMetadataBlocks(w, box, 4, 5, 6, 22, 5, 6, Blocks.log, south, Blocks.log, south, false);
+ fillWithMetadataBlocks(w, box, 4, 5, 12, 22, 5, 12, Blocks.log, south, Blocks.log, south, false);
+ for(int i=0;i<4;i++){
+ fillWithMetadataBlocks(w, box, 4+i*6, 5, 7, 4+i*6, 5, 12, Blocks.log, west, Blocks.log, west, false);
+ fillWithMetadataBlocks(w, box, 4+i*6, 0, 6, 4+i*6, 7, 6, Blocks.log, 0, Blocks.log, 0, false);
+ fillWithMetadataBlocks(w, box, 4+i*6, 0, 12, 4+i*6, 7, 12, Blocks.log, 0, Blocks.log, 0, false);
+ }
+
+
+ //-----------------------------------------------------------------
+ // 本棚の設置
+ //-----------------------------------------------------------------
+ for(int i=0;i<3;i++){
+ if(!judged[i]){
+ judged[i]=true;
+ hasShelf[i]=rand.nextFloat()<0.65f;
+ }
+ if(hasShelf[i]) {
+ for (int xx = 6; xx <= 8; xx++) {
+ for (int zz = 8; zz <= 10; zz++) {
+ placeBlockAtCurrentPosition(w, BlockCore.bookshelf, getNum(rand, 4), xx + 6 * i, 2, zz, box);
+ }
+ }
+ }
+ }
+
+ //-----------------------------------------------------------------
+ // たいまつの設置
+ //-----------------------------------------------------------------
+ int[]tx={5, 7, 9, 7};
+ int[]tz={9, 11, 9, 7};
+
+ placeBlockAtCurrentPosition(w, Blocks.torch, 0, 7, 5, 5, box);
+ placeBlockAtCurrentPosition(w, Blocks.torch, 0, 13, 5, 5, box);
+ placeBlockAtCurrentPosition(w, Blocks.torch, 0, 19, 5, 5, box);
+ placeBlockAtCurrentPosition(w, Blocks.torch, 0, 7, 5, 13, box);
+ placeBlockAtCurrentPosition(w, Blocks.torch, 0, 13, 5, 13, box);
+ placeBlockAtCurrentPosition(w, Blocks.torch, 0, 19, 5, 13, box);
+ placeBlockAtCurrentPosition(w, Blocks.torch, 0, 7, 5, 5, box);
+ placeBlockAtCurrentPosition(w, Blocks.torch, 0, 13, 5, 5, box);
+ placeBlockAtCurrentPosition(w, Blocks.torch, 0, 3, 5, 9, box);
+ placeBlockAtCurrentPosition(w, Blocks.torch, 0, 23, 5, 9, box);
+ for(int k=0;k<3;k++){
+ for(int i=0;i<4;i++){
+ placeBlockAtCurrentPosition(w, Blocks.torch, 0, tx[i]+k*6, 5, tz[i], box);
+ }
+ }
+
+ return true;
+ }
+
+ protected int getNum(Random rand, int max){
+ if(rand.nextFloat()<=0.8f){
+ return 1+rand.nextInt(max);
+ }
+ return 0;
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/world/structure/StructureSealedLib1.class b/src/main/java/jp/plusplus/fbs/world/structure/StructureSealedLib1.class Binary files differnew file mode 100644 index 0000000..8484f6d --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/structure/StructureSealedLib1.class diff --git a/src/main/java/jp/plusplus/fbs/world/structure/StructureSealedLib1.java b/src/main/java/jp/plusplus/fbs/world/structure/StructureSealedLib1.java new file mode 100644 index 0000000..7f2428f --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/structure/StructureSealedLib1.java @@ -0,0 +1,115 @@ +package jp.plusplus.fbs.world.structure;
+
+import jp.plusplus.fbs.Registry;
+import jp.plusplus.fbs.block.BlockCore;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.tileentity.TileEntityChest;
+import net.minecraft.world.World;
+import net.minecraft.world.gen.structure.StructureBoundingBox;
+import net.minecraft.world.gen.structure.StructureComponent;
+
+import java.util.Random;
+
+/**
+ * Createdby pluslus_Fon 2015/06/06.
+ * 1つの図書館からだいたい16.8冊手に入る?
+ */
+public class StructureSealedLib1 extends StructureComponent {
+ private boolean chest=false;
+
+ public StructureSealedLib1(){}
+ public StructureSealedLib1(int par1, Random rand, int x, int y, int z) {
+ this.coordBaseMode = 0;
+
+ //y=6+rand.nextInt(40-6+1);
+ this.boundingBox = new StructureBoundingBox(x, y, z, x + 11, y+6, z + 11);
+ }
+ @Override
+ protected void func_143012_a(NBTTagCompound tag) {
+ tag.setBoolean("Chest", this.chest);
+ }
+
+ @Override
+ protected void func_143011_b(NBTTagCompound tag) {
+ chest = tag.getBoolean("Chest");
+ }
+
+ @Override
+ public boolean addComponentParts(World world, Random rand, StructureBoundingBox box) {
+ int[] bx={1,1,2,3, 7,8,9,9, 9,9,8,7, 3,2,1,1};
+ int[] bz={3,2,1,1, 1,1,2,3, 7,8,9,9, 9,9,8,7};
+ int[] wx={1,9,9,1};
+ int[] wz={1,1,9,9};
+ int[] tx={1,5,9,5};
+ int[] tz={5,1,5,9};
+
+ this.fillWithBlocks(world, box, 0, 0, 0, 10, 5, 10, BlockCore.plank, BlockCore.plank, false);
+ this.fillWithBlocks(world, box, 1, 1, 1, 9, 4, 9, Blocks.air, Blocks.air, false);
+
+ for(int i=0;i<bx.length;i++){
+ for(int k=0;k<4;k++){
+ this.placeBlockAtCurrentPosition(world, BlockCore.bookshelf, getNum(rand, 2), bx[i], 1+k, bz[i], box);
+ }
+ }
+ for(int i=0;i<wx.length;i++){
+ for(int k=0;k<4;k++){
+ this.placeBlockAtCurrentPosition(world, BlockCore.plank, 0, wx[i], 1+k, wz[i], box);
+ }
+ }
+
+ for(int i=0;i<3;i++){
+ for(int n=0;n<3;n++){
+ for(int k=0;k<4;k++){
+ if(i==1 && n==1){
+ //if(k>0) this.placeBlockAtCurrentPosition(world, BlockCore.plank, 0, 4+i, 1+k, 4+n, box);
+ }
+ else this.placeBlockAtCurrentPosition(world, BlockCore.bookshelf, getNum(rand, 4), 4+i, 1+k, 4+n, box);
+ }
+ }
+ }
+ /*
+ for(int k=0;k<4;k++){
+ this.placeBlockAtCurrentPosition(world, BlockCore.plank, 0, 5, 1+k, 5, box);
+ }
+ */
+
+ for(int i=0;i<tx.length;i++){
+ this.placeBlockAtCurrentPosition(world, Blocks.torch, 0, tx[i], 2, tz[i], box);
+ }
+
+ //chest
+ if(!chest){
+ int cx=getXWithOffset(5, 5), cy=getYWithOffset(1), cz=getZWithOffset(5, 5);
+
+ if(box.isVecInside(cx, cy, cz) && world.getBlock(cx, cy, cz)!=Blocks.chest){
+ world.setBlock(cx, cy, cz, Blocks.chest, 0, 2);
+ TileEntity te=world.getTileEntity(cx,cy,cz);
+ if(te instanceof TileEntityChest){
+ TileEntityChest e=(TileEntityChest)te;
+ ItemStack[] items=new ItemStack[e.getSizeInventory()];
+ Registry.GetChestContents(0, items, 0.15f);
+ for(int i=0;i<items.length;i++){
+ e.setInventorySlotContents(i, items[i]);
+ }
+ }
+ chest=true;
+ }
+ }
+ //placeBlockAtCurrentPosition(world, Blocks.chest, 0, 5, 1, 5, box);
+
+ //world.setBlock(i1, j1, k1, Blocks.chest, 0, 2);
+
+ //FMLLog.severe("generated at "+box.getCenterX()+","+box.getCenterY()+","+box.getCenterZ());
+ return true;
+ }
+
+ protected int getNum(Random rand, int max){
+ if(rand.nextFloat()<=0.15f){
+ return 1+rand.nextInt(max);
+ }
+ return 0;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/world/structure/StructureSealedLibStart.class b/src/main/java/jp/plusplus/fbs/world/structure/StructureSealedLibStart.class Binary files differnew file mode 100644 index 0000000..82a6b27 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/structure/StructureSealedLibStart.class diff --git a/src/main/java/jp/plusplus/fbs/world/structure/StructureSealedLibStart.java b/src/main/java/jp/plusplus/fbs/world/structure/StructureSealedLibStart.java new file mode 100644 index 0000000..403f788 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/structure/StructureSealedLibStart.java @@ -0,0 +1,49 @@ +package jp.plusplus.fbs.world.structure;
+
+import net.minecraft.block.Block;
+import net.minecraft.block.material.Material;
+import net.minecraft.util.MathHelper;
+import net.minecraft.world.World;
+import net.minecraft.world.gen.structure.StructureStart;
+
+import java.util.Random;
+
+/**
+ * Createdby pluslus_Fon 2015/06/06.
+ */
+public class StructureSealedLibStart extends StructureStart {
+
+ public StructureSealedLibStart() {}
+
+ public StructureSealedLibStart(World par1World, Random par2Random, int par3, int par4) {
+ super(par3, par4);
+ // 構造物の構成パーツを決定する
+
+ //decides Position
+ int x=par3*16+2,y,z=par4*16+2;
+ /*
+ int sy=0, sym=8*par2Random.nextInt(4);
+ Block b2;
+ do{
+ sy+=8;
+ b2=par1World.getBlock(x,12+sy,z);
+ }while(b2.getMaterial() != Material.water && b2.getMaterial() !=Material.lava && b2.getMaterial()!=Material.air && sy<sym);
+
+ y=12+sy-8;
+ */
+
+ y=par1World.getChunkHeightMapMinimum(x, z)-10-12;
+ if(y<0) y=10;
+ else y=12+par2Random.nextInt(Math.min(y, 50));
+
+ //y=100;
+ StructureSealedLib1 ssl1 = new StructureSealedLib1(0, par2Random, x,y,z);
+ this.components.add(ssl1);
+
+ // 次のパーツを得る
+ ssl1.buildComponent(ssl1, components, par2Random);
+
+ // 構造物全体の占有範囲を更新する
+ this.updateBoundingBox();
+ }
+}
|
