From 70c1354a4a96698758a88c032866288f79de6f5a Mon Sep 17 00:00:00 2001 From: Benjamin Culkin Date: Sat, 24 Aug 2024 08:16:37 -0400 Subject: Initial commit --- .../java/jp/plusplus/fbs/pottery/BlockJar.class | Bin 0 -> 1262 bytes .../java/jp/plusplus/fbs/pottery/BlockJar.java | 37 +++ .../java/jp/plusplus/fbs/pottery/BlockKiln.class | Bin 0 -> 8908 bytes .../java/jp/plusplus/fbs/pottery/BlockKiln.java | 215 ++++++++++++ .../java/jp/plusplus/fbs/pottery/BlockPot.class | Bin 0 -> 5623 bytes .../java/jp/plusplus/fbs/pottery/BlockPot.java | 127 ++++++++ .../plusplus/fbs/pottery/BlockPottersWheel.class | Bin 0 -> 6914 bytes .../jp/plusplus/fbs/pottery/BlockPottersWheel.java | 150 +++++++++ .../plusplus/fbs/pottery/BlockPotteryBase$1.class | Bin 0 -> 1379 bytes .../jp/plusplus/fbs/pottery/BlockPotteryBase.class | Bin 0 -> 13903 bytes .../jp/plusplus/fbs/pottery/BlockPotteryBase.java | 361 +++++++++++++++++++++ .../java/jp/plusplus/fbs/pottery/GuiKiln.class | Bin 0 -> 2621 bytes src/main/java/jp/plusplus/fbs/pottery/GuiKiln.java | 50 +++ .../jp/plusplus/fbs/pottery/GuiPottersWheel.class | Bin 0 -> 2287 bytes .../jp/plusplus/fbs/pottery/GuiPottersWheel.java | 38 +++ .../jp/plusplus/fbs/pottery/ItemBlockPottery.class | Bin 0 -> 5603 bytes .../jp/plusplus/fbs/pottery/ItemBlockPottery.java | 118 +++++++ .../fbs/pottery/PotteryRegistry$PotteryPair.class | Bin 0 -> 2547 bytes .../jp/plusplus/fbs/pottery/PotteryRegistry.class | Bin 0 -> 6318 bytes .../jp/plusplus/fbs/pottery/PotteryRegistry.java | 220 +++++++++++++ .../plusplus/fbs/pottery/RenderPottersWheel.class | Bin 0 -> 3579 bytes .../plusplus/fbs/pottery/RenderPottersWheel.java | 171 ++++++++++ .../jp/plusplus/fbs/pottery/RenderPottery.class | Bin 0 -> 3577 bytes .../jp/plusplus/fbs/pottery/RenderPottery.java | 96 ++++++ .../jp/plusplus/fbs/pottery/TileEntityKiln.class | Bin 0 -> 9813 bytes .../jp/plusplus/fbs/pottery/TileEntityKiln.java | 315 ++++++++++++++++++ .../fbs/pottery/TileEntityPottersWheel.class | Bin 0 -> 6152 bytes .../fbs/pottery/TileEntityPottersWheel.java | 188 +++++++++++ .../plusplus/fbs/pottery/TileEntityPottery.class | Bin 0 -> 6643 bytes .../jp/plusplus/fbs/pottery/TileEntityPottery.java | 162 +++++++++ .../plusplus/fbs/pottery/model/ModelJarLarge.class | Bin 0 -> 4062 bytes .../plusplus/fbs/pottery/model/ModelJarLarge.java | 178 ++++++++++ .../plusplus/fbs/pottery/model/ModelPotLarge.class | Bin 0 -> 5757 bytes .../plusplus/fbs/pottery/model/ModelPotLarge.java | 269 +++++++++++++++ .../fbs/pottery/model/ModelPotMedium.class | Bin 0 -> 5840 bytes .../plusplus/fbs/pottery/model/ModelPotMedium.java | 274 ++++++++++++++++ .../plusplus/fbs/pottery/model/ModelPotSmall.class | Bin 0 -> 4086 bytes .../plusplus/fbs/pottery/model/ModelPotSmall.java | 178 ++++++++++ .../fbs/pottery/usable/PotteryAppraisal.class | Bin 0 -> 2158 bytes .../fbs/pottery/usable/PotteryAppraisal.java | 40 +++ .../fbs/pottery/usable/PotteryBase$1.class | Bin 0 -> 889 bytes .../plusplus/fbs/pottery/usable/PotteryBase.class | Bin 0 -> 4431 bytes .../plusplus/fbs/pottery/usable/PotteryBase.java | 157 +++++++++ .../fbs/pottery/usable/PotteryChange.class | Bin 0 -> 3855 bytes .../plusplus/fbs/pottery/usable/PotteryChange.java | 74 +++++ .../fbs/pottery/usable/PotteryCrucible.class | Bin 0 -> 4222 bytes .../fbs/pottery/usable/PotteryCrucible.java | 107 ++++++ .../fbs/pottery/usable/PotteryEnchantment$1.class | Bin 0 -> 1026 bytes .../fbs/pottery/usable/PotteryEnchantment.class | Bin 0 -> 2944 bytes .../fbs/pottery/usable/PotteryEnchantment.java | 61 ++++ .../fbs/pottery/usable/PotteryFurnace.class | Bin 0 -> 2233 bytes .../fbs/pottery/usable/PotteryFurnace.java | 48 +++ .../plusplus/fbs/pottery/usable/PotteryKeep.class | Bin 0 -> 2124 bytes .../plusplus/fbs/pottery/usable/PotteryKeep.java | 39 +++ .../fbs/pottery/usable/PotteryLottery.class | Bin 0 -> 2276 bytes .../fbs/pottery/usable/PotteryLottery.java | 44 +++ .../fbs/pottery/usable/PotterySenaka.class | Bin 0 -> 1625 bytes .../plusplus/fbs/pottery/usable/PotterySenaka.java | 41 +++ .../plusplus/fbs/pottery/usable/PotteryTaboo.class | Bin 0 -> 3648 bytes .../plusplus/fbs/pottery/usable/PotteryTaboo.java | 72 ++++ .../fbs/pottery/usable/PotteryUnbreakable.class | Bin 0 -> 1563 bytes .../fbs/pottery/usable/PotteryUnbreakable.java | 39 +++ .../pottery/usable/PotteryUsableLimitted$1.class | Bin 0 -> 1408 bytes .../fbs/pottery/usable/PotteryUsableLimitted.class | Bin 0 -> 3268 bytes .../fbs/pottery/usable/PotteryUsableLimitted.java | 71 ++++ .../plusplus/fbs/pottery/usable/PotteryVoid.class | Bin 0 -> 1065 bytes .../plusplus/fbs/pottery/usable/PotteryVoid.java | 26 ++ .../container/ContainerPotteryUsableBase.class | Bin 0 -> 3277 bytes .../container/ContainerPotteryUsableBase.java | 95 ++++++ .../usable/container/GuiPotteryUsableBase.class | Bin 0 -> 2489 bytes .../usable/container/GuiPotteryUsableBase.java | 40 +++ .../container/InventoryPotteryUsable$1.class | Bin 0 -> 943 bytes .../usable/container/InventoryPotteryUsable.class | Bin 0 -> 6183 bytes .../usable/container/InventoryPotteryUsable.java | 175 ++++++++++ .../usable/container/SlotPotteryUsable.class | Bin 0 -> 1521 bytes .../usable/container/SlotPotteryUsable.java | 27 ++ 76 files changed, 4303 insertions(+) create mode 100644 src/main/java/jp/plusplus/fbs/pottery/BlockJar.class create mode 100644 src/main/java/jp/plusplus/fbs/pottery/BlockJar.java create mode 100644 src/main/java/jp/plusplus/fbs/pottery/BlockKiln.class create mode 100644 src/main/java/jp/plusplus/fbs/pottery/BlockKiln.java create mode 100644 src/main/java/jp/plusplus/fbs/pottery/BlockPot.class create mode 100644 src/main/java/jp/plusplus/fbs/pottery/BlockPot.java create mode 100644 src/main/java/jp/plusplus/fbs/pottery/BlockPottersWheel.class create mode 100644 src/main/java/jp/plusplus/fbs/pottery/BlockPottersWheel.java create mode 100644 src/main/java/jp/plusplus/fbs/pottery/BlockPotteryBase$1.class create mode 100644 src/main/java/jp/plusplus/fbs/pottery/BlockPotteryBase.class create mode 100644 src/main/java/jp/plusplus/fbs/pottery/BlockPotteryBase.java create mode 100644 src/main/java/jp/plusplus/fbs/pottery/GuiKiln.class create mode 100644 src/main/java/jp/plusplus/fbs/pottery/GuiKiln.java create mode 100644 src/main/java/jp/plusplus/fbs/pottery/GuiPottersWheel.class create mode 100644 src/main/java/jp/plusplus/fbs/pottery/GuiPottersWheel.java create mode 100644 src/main/java/jp/plusplus/fbs/pottery/ItemBlockPottery.class create mode 100644 src/main/java/jp/plusplus/fbs/pottery/ItemBlockPottery.java create mode 100644 src/main/java/jp/plusplus/fbs/pottery/PotteryRegistry$PotteryPair.class create mode 100644 src/main/java/jp/plusplus/fbs/pottery/PotteryRegistry.class create mode 100644 src/main/java/jp/plusplus/fbs/pottery/PotteryRegistry.java create mode 100644 src/main/java/jp/plusplus/fbs/pottery/RenderPottersWheel.class create mode 100644 src/main/java/jp/plusplus/fbs/pottery/RenderPottersWheel.java create mode 100644 src/main/java/jp/plusplus/fbs/pottery/RenderPottery.class create mode 100644 src/main/java/jp/plusplus/fbs/pottery/RenderPottery.java create mode 100644 src/main/java/jp/plusplus/fbs/pottery/TileEntityKiln.class create mode 100644 src/main/java/jp/plusplus/fbs/pottery/TileEntityKiln.java create mode 100644 src/main/java/jp/plusplus/fbs/pottery/TileEntityPottersWheel.class create mode 100644 src/main/java/jp/plusplus/fbs/pottery/TileEntityPottersWheel.java create mode 100644 src/main/java/jp/plusplus/fbs/pottery/TileEntityPottery.class create mode 100644 src/main/java/jp/plusplus/fbs/pottery/TileEntityPottery.java create mode 100644 src/main/java/jp/plusplus/fbs/pottery/model/ModelJarLarge.class create mode 100644 src/main/java/jp/plusplus/fbs/pottery/model/ModelJarLarge.java create mode 100644 src/main/java/jp/plusplus/fbs/pottery/model/ModelPotLarge.class create mode 100644 src/main/java/jp/plusplus/fbs/pottery/model/ModelPotLarge.java create mode 100644 src/main/java/jp/plusplus/fbs/pottery/model/ModelPotMedium.class create mode 100644 src/main/java/jp/plusplus/fbs/pottery/model/ModelPotMedium.java create mode 100644 src/main/java/jp/plusplus/fbs/pottery/model/ModelPotSmall.class create mode 100644 src/main/java/jp/plusplus/fbs/pottery/model/ModelPotSmall.java create mode 100644 src/main/java/jp/plusplus/fbs/pottery/usable/PotteryAppraisal.class create mode 100644 src/main/java/jp/plusplus/fbs/pottery/usable/PotteryAppraisal.java create mode 100644 src/main/java/jp/plusplus/fbs/pottery/usable/PotteryBase$1.class create mode 100644 src/main/java/jp/plusplus/fbs/pottery/usable/PotteryBase.class create mode 100644 src/main/java/jp/plusplus/fbs/pottery/usable/PotteryBase.java create mode 100644 src/main/java/jp/plusplus/fbs/pottery/usable/PotteryChange.class create mode 100644 src/main/java/jp/plusplus/fbs/pottery/usable/PotteryChange.java create mode 100644 src/main/java/jp/plusplus/fbs/pottery/usable/PotteryCrucible.class create mode 100644 src/main/java/jp/plusplus/fbs/pottery/usable/PotteryCrucible.java create mode 100644 src/main/java/jp/plusplus/fbs/pottery/usable/PotteryEnchantment$1.class create mode 100644 src/main/java/jp/plusplus/fbs/pottery/usable/PotteryEnchantment.class create mode 100644 src/main/java/jp/plusplus/fbs/pottery/usable/PotteryEnchantment.java create mode 100644 src/main/java/jp/plusplus/fbs/pottery/usable/PotteryFurnace.class create mode 100644 src/main/java/jp/plusplus/fbs/pottery/usable/PotteryFurnace.java create mode 100644 src/main/java/jp/plusplus/fbs/pottery/usable/PotteryKeep.class create mode 100644 src/main/java/jp/plusplus/fbs/pottery/usable/PotteryKeep.java create mode 100644 src/main/java/jp/plusplus/fbs/pottery/usable/PotteryLottery.class create mode 100644 src/main/java/jp/plusplus/fbs/pottery/usable/PotteryLottery.java create mode 100644 src/main/java/jp/plusplus/fbs/pottery/usable/PotterySenaka.class create mode 100644 src/main/java/jp/plusplus/fbs/pottery/usable/PotterySenaka.java create mode 100644 src/main/java/jp/plusplus/fbs/pottery/usable/PotteryTaboo.class create mode 100644 src/main/java/jp/plusplus/fbs/pottery/usable/PotteryTaboo.java create mode 100644 src/main/java/jp/plusplus/fbs/pottery/usable/PotteryUnbreakable.class create mode 100644 src/main/java/jp/plusplus/fbs/pottery/usable/PotteryUnbreakable.java create mode 100644 src/main/java/jp/plusplus/fbs/pottery/usable/PotteryUsableLimitted$1.class create mode 100644 src/main/java/jp/plusplus/fbs/pottery/usable/PotteryUsableLimitted.class create mode 100644 src/main/java/jp/plusplus/fbs/pottery/usable/PotteryUsableLimitted.java create mode 100644 src/main/java/jp/plusplus/fbs/pottery/usable/PotteryVoid.class create mode 100644 src/main/java/jp/plusplus/fbs/pottery/usable/PotteryVoid.java create mode 100644 src/main/java/jp/plusplus/fbs/pottery/usable/container/ContainerPotteryUsableBase.class create mode 100644 src/main/java/jp/plusplus/fbs/pottery/usable/container/ContainerPotteryUsableBase.java create mode 100644 src/main/java/jp/plusplus/fbs/pottery/usable/container/GuiPotteryUsableBase.class create mode 100644 src/main/java/jp/plusplus/fbs/pottery/usable/container/GuiPotteryUsableBase.java create mode 100644 src/main/java/jp/plusplus/fbs/pottery/usable/container/InventoryPotteryUsable$1.class create mode 100644 src/main/java/jp/plusplus/fbs/pottery/usable/container/InventoryPotteryUsable.class create mode 100644 src/main/java/jp/plusplus/fbs/pottery/usable/container/InventoryPotteryUsable.java create mode 100644 src/main/java/jp/plusplus/fbs/pottery/usable/container/SlotPotteryUsable.class create mode 100644 src/main/java/jp/plusplus/fbs/pottery/usable/container/SlotPotteryUsable.java (limited to 'src/main/java/jp/plusplus/fbs/pottery') diff --git a/src/main/java/jp/plusplus/fbs/pottery/BlockJar.class b/src/main/java/jp/plusplus/fbs/pottery/BlockJar.class new file mode 100644 index 0000000..b0df811 Binary files /dev/null and b/src/main/java/jp/plusplus/fbs/pottery/BlockJar.class differ 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 new file mode 100644 index 0000000..b100d27 Binary files /dev/null and b/src/main/java/jp/plusplus/fbs/pottery/BlockKiln.class differ 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 new file mode 100644 index 0000000..be0a92e Binary files /dev/null and b/src/main/java/jp/plusplus/fbs/pottery/BlockPot.class differ 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 getAllPattern() { + ArrayList 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 new file mode 100644 index 0000000..28c8af1 Binary files /dev/null and b/src/main/java/jp/plusplus/fbs/pottery/BlockPottersWheel.class differ 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 new file mode 100644 index 0000000..35dcdd6 Binary files /dev/null and b/src/main/java/jp/plusplus/fbs/pottery/BlockPotteryBase$1.class differ diff --git a/src/main/java/jp/plusplus/fbs/pottery/BlockPotteryBase.class b/src/main/java/jp/plusplus/fbs/pottery/BlockPotteryBase.class new file mode 100644 index 0000000..6d5cd2f Binary files /dev/null and b/src/main/java/jp/plusplus/fbs/pottery/BlockPotteryBase.class differ 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 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 getDrops(World world, int x, int y, int z, int metadata, int fortune) { + ArrayList ret = new ArrayList(); + + 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 getAllPattern() { + ArrayList ret = new ArrayList(); + + 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 new file mode 100644 index 0000000..d2ad30f Binary files /dev/null and b/src/main/java/jp/plusplus/fbs/pottery/GuiKiln.class differ 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 new file mode 100644 index 0000000..ddf9a58 Binary files /dev/null and b/src/main/java/jp/plusplus/fbs/pottery/GuiPottersWheel.class differ 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 new file mode 100644 index 0000000..3070b3c Binary files /dev/null and b/src/main/java/jp/plusplus/fbs/pottery/ItemBlockPottery.class differ 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 new file mode 100644 index 0000000..401f561 Binary files /dev/null and b/src/main/java/jp/plusplus/fbs/pottery/PotteryRegistry$PotteryPair.class differ diff --git a/src/main/java/jp/plusplus/fbs/pottery/PotteryRegistry.class b/src/main/java/jp/plusplus/fbs/pottery/PotteryRegistry.class new file mode 100644 index 0000000..90f070f Binary files /dev/null and b/src/main/java/jp/plusplus/fbs/pottery/PotteryRegistry.class differ 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 potteries=new ArrayList(); + private ArrayList potteryEffects=new ArrayList(); + 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 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>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 new file mode 100644 index 0000000..f749f0e Binary files /dev/null and b/src/main/java/jp/plusplus/fbs/pottery/TileEntityKiln.class differ 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= 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) 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 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=PROGRESS_MAX){ + progress[i]=0; + smeltItem(i); + flag1=true; + } + } + } else { + for(int i=0;i 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 new file mode 100644 index 0000000..f211e3f Binary files /dev/null and b/src/main/java/jp/plusplus/fbs/pottery/TileEntityPottersWheel.class differ 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=0 && b0 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 new file mode 100644 index 0000000..7a72032 Binary files /dev/null and b/src/main/java/jp/plusplus/fbs/pottery/TileEntityPottery.class differ 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 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 new file mode 100644 index 0000000..41c67e8 Binary files /dev/null and b/src/main/java/jp/plusplus/fbs/pottery/model/ModelJarLarge.class differ 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 new file mode 100644 index 0000000..ca4032c Binary files /dev/null and b/src/main/java/jp/plusplus/fbs/pottery/model/ModelPotLarge.class differ 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 new file mode 100644 index 0000000..e03d4e5 Binary files /dev/null and b/src/main/java/jp/plusplus/fbs/pottery/model/ModelPotMedium.class differ 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 new file mode 100644 index 0000000..ad1b677 Binary files /dev/null and b/src/main/java/jp/plusplus/fbs/pottery/model/ModelPotSmall.class differ 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 new file mode 100644 index 0000000..da08fcd Binary files /dev/null and b/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryAppraisal.class differ 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 new file mode 100644 index 0000000..90c8c4e Binary files /dev/null and b/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryBase$1.class differ diff --git a/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryBase.class b/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryBase.class new file mode 100644 index 0000000..fbff80e Binary files /dev/null and b/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryBase.class differ 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を返す
+ * ここで返した文字列がそのままローカライズに使用される + * @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 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 list=new ArrayList(); + 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 new file mode 100644 index 0000000..efc7d21 Binary files /dev/null and b/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryCrucible.class differ 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 mobNames=new ArrayList(); + + 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 new file mode 100644 index 0000000..0e6df6e Binary files /dev/null and b/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryEnchantment$1.class differ diff --git a/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryEnchantment.class b/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryEnchantment.class new file mode 100644 index 0000000..c7a020f Binary files /dev/null and b/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryEnchantment.class differ 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 new file mode 100644 index 0000000..7086075 Binary files /dev/null and b/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryFurnace.class differ 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 new file mode 100644 index 0000000..9675d30 Binary files /dev/null and b/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryKeep.class differ 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 new file mode 100644 index 0000000..beb0309 Binary files /dev/null and b/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryLottery.class differ 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 new file mode 100644 index 0000000..e75b8db Binary files /dev/null and b/src/main/java/jp/plusplus/fbs/pottery/usable/PotterySenaka.class differ 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 new file mode 100644 index 0000000..1b250ca Binary files /dev/null and b/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryTaboo.class differ 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 new file mode 100644 index 0000000..3843db3 Binary files /dev/null and b/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryUnbreakable.class differ 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 new file mode 100644 index 0000000..85bb083 Binary files /dev/null and b/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryUsableLimitted$1.class differ diff --git a/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryUsableLimitted.class b/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryUsableLimitted.class new file mode 100644 index 0000000..d63d7ce Binary files /dev/null and b/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryUsableLimitted.class differ 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 new file mode 100644 index 0000000..bc28a2a Binary files /dev/null and b/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryVoid.class differ 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 new file mode 100644 index 0000000..425e8ea Binary files /dev/null and b/src/main/java/jp/plusplus/fbs/pottery/usable/container/ContainerPotteryUsableBase.class differ 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 new file mode 100644 index 0000000..23856fb Binary files /dev/null and b/src/main/java/jp/plusplus/fbs/pottery/usable/container/GuiPotteryUsableBase.class differ 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 new file mode 100644 index 0000000..18ad90d Binary files /dev/null and b/src/main/java/jp/plusplus/fbs/pottery/usable/container/InventoryPotteryUsable$1.class differ 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 new file mode 100644 index 0000000..7f289ed Binary files /dev/null and b/src/main/java/jp/plusplus/fbs/pottery/usable/container/InventoryPotteryUsable.class differ 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