Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by winnetrie

  1. I have overidden it: @Override public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos) { super.neighborChanged(state, worldIn, pos, blockIn, fromPos); TileEntity tileentity = worldIn.getTileEntity(pos); if (tileentity instanceof TileEntityModChest) { tileentity.updateContainingBlockInfo(); } } and in the tileentity: @Override public void updateContainingBlockInfo() { super.updateContainingBlockInfo(); this.adjacentChestChecked = false; doubleChestHandler = null; } I'm not sure if i need to change something. This is what vanilla have
  2. How exactly do i detect this? Is there a method for it? I used the vanilla code and i didn't changed it that much. I still can't find the problem..... EDIT: I just found out when i reload the game (closing the current map and then restart it) the chest have the right render. So somehow the rendering doesn't get updated when i destroy 1 side of the chest.
  3. Errors are gone now. Still got that rendering issue now I added screenshots to see what i mean. 1 picture represent a green doublechest where the left side has been destroyed. You can clearly see that it still renders as a double chest but the left side of the chest has gone. To prove it i builded a fence on that place. I also checked the inventory, that has been changed to a single chest inventory. So that is good. The other picture was a doublechest where i destroyed the right side. The left side stops rendering for a reason i don't know yet. It is still accesseble and the inventory is also like it should be. I think this is the last problem i have now. When i can fix the rendering problems, i would be happy.
  4. Alright i changed my ModChestUtility. class to ChestTypeEnum and it looks now like this: public enum ChestTypeEnum implements IStringSerializable{ SPRUCE("sprucechest",0,new ResourceLocation("tem:textures/models/entity/chest/test_green_normal.png"), new ResourceLocation("tem:textures/models/entity/chest/test_green_double.png")), BIRCH("birchchest",1,new ResourceLocation("tem:textures/models/entity/chest/test_brown_normal.png"), new ResourceLocation("tem:textures/models/entity/chest/test_brown_double.png")), JUNGLE("junglechest",2,new ResourceLocation("tem:textures/models/entity/chest/test_brown_normal.png"), new ResourceLocation("tem:textures/models/entity/chest/test_brown_double.png")); //ACACIA("acaciachest",3,texture_sprucechest_single, texture_sprucechest_double), //DARKOAK("darkoakchest",4,texture_sprucechest_single, texture_sprucechest_double); private final String chestname; private final int ID; private final ResourceLocation SingleChest; private final ResourceLocation DoubleChest; private ChestTypeEnum(String name, int id, ResourceLocation resloc, ResourceLocation resloc2){ this.chestname = name; this.ID = id; this.SingleChest = resloc; this.DoubleChest = resloc2; } public String getChestName(){ return chestname; } public int getChestID(){ return ID; } public ResourceLocation getSingleChestTexture(){ return SingleChest; } public ResourceLocation getDoubleChestTexture(){ return DoubleChest; } @Override public String getName() { // TODO Auto-generated method stub return null; } } and in my BlockModChest i added the blockstate:
  5. Do you mean implementing IStringSerializable? That doesn't change anything.
  6. I mean how can i acces the enums from ModChestUtility.class within BlockModChest.class Because when i try this: public PropertyEnum TYPE = PropertyEnum.create("type", ModChestUtility.chestType.class); It give me an error saying: Bound mismatch: The generic method create(String, Class<T>) of type PropertyEnum<T> is not applicable for the arguments (String, Class<ModChestUtility.chestType>). The inferred type ModChestUtility.chestType is not a valid substitute for the bounded parameter <T extends Enum<T> & IStringSerializable>
  7. Do you mean i should add the chest type as a property to the blockstate? I had that idea before, but i'm not sure how to acces the enum from another class.
  8. Oh right, my bad. It is working now. I think i'm almost there now, just a few bugs. My doublechest is working fine, but when i destroy the right side, it rendering doesn't change to singlechest. While it is in fact a single chest it looks like a double chest. When i destroy the left side first the right turns invisible. So i guess something isn't quite right in the tesr: @SideOnly(Side.CLIENT) public class ModTERChest extends TileEntitySpecialRenderer<TileEntityModChest> { private static final ResourceLocation TEXTURE_TRAPPED_DOUBLE = new ResourceLocation("minecraft:textures/entity/chest/trapped_double.png"); private static final ResourceLocation TEXTURE_CHRISTMAS_DOUBLE = new ResourceLocation("minecraft:textures/entity/chest/christmas_double.png"); private static final ResourceLocation TEXTURE_NORMAL_DOUBLE = new ResourceLocation("minecraft:textures/entity/chest/normal_double.png"); private static final ResourceLocation TEXTURE_TRAPPED = new ResourceLocation("minecraft:textures/entity/chest/trapped.png"); private static final ResourceLocation TEXTURE_CHRISTMAS = new ResourceLocation("minecraft:textures/entity/chest/christmas.png"); private static final ResourceLocation TEXTURE_NORMAL = new ResourceLocation("tem:textures/models/entity/chest/ironchest.png"); private final ModelChest simpleChest = new ModelChest(); private final ModelChest largeChest = new ModelLargeChest(); private boolean isChristmas; public ModTERChest() { Calendar calendar = Calendar.getInstance(); if (calendar.get(2) + 1 == 12 && calendar.get(5) >= 24 && calendar.get(5) <= 26) { this.isChristmas = true; } } @Override public void renderTileEntityAt(TileEntityModChest te, double x, double y, double z, float partialTicks, int destroyStage) { GlStateManager.enableDepth(); GlStateManager.depthFunc(515); GlStateManager.depthMask(true); int i; if (te.hasWorld()) { Block block = te.getBlockType(); i = te.getBlockMetadata(); if (block instanceof BlockModChest && i == 0) { ((BlockModChest)block).checkForSurroundingChests(te.getWorld(), te.getPos(), te.getWorld().getBlockState(te.getPos())); i = te.getBlockMetadata(); } te.checkForAdjacentChests(); } else { i = 0; } if (te.adjacentChestZNeg == null && te.adjacentChestXNeg == null) { ModelChest modelchest; if (te.adjacentChestXPos == null && te.adjacentChestZPos == null) { modelchest = this.simpleChest; if (destroyStage >= 0) { this.bindTexture(DESTROY_STAGES[destroyStage]); GlStateManager.matrixMode(5890); GlStateManager.pushMatrix(); GlStateManager.scale(4.0F, 4.0F, 1.0F); GlStateManager.translate(0.0625F, 0.0625F, 0.0625F); GlStateManager.matrixMode(5888); } else if (this.isChristmas) { this.bindTexture(TEXTURE_CHRISTMAS); } else { this.bindTexture(ModChestUtility.chestType.values()[te.TileEntityID].getSingleChestTexture()); } } else { modelchest = this.largeChest; if (destroyStage >= 0) { this.bindTexture(DESTROY_STAGES[destroyStage]); GlStateManager.matrixMode(5890); GlStateManager.pushMatrix(); GlStateManager.scale(8.0F, 4.0F, 1.0F); GlStateManager.translate(0.0625F, 0.0625F, 0.0625F); GlStateManager.matrixMode(5888); } else if (this.isChristmas) { this.bindTexture(TEXTURE_CHRISTMAS_DOUBLE); } else { this.bindTexture(ModChestUtility.chestType.values()[te.TileEntityID].getDoubleChestTexture()); } } GlStateManager.pushMatrix(); GlStateManager.enableRescaleNormal(); if (destroyStage < 0) { GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); } GlStateManager.translate((float)x, (float)y + 1.0F, (float)z + 1.0F); GlStateManager.scale(1.0F, -1.0F, -1.0F); GlStateManager.translate(0.5F, 0.5F, 0.5F); int j = 0; if (i == 2) { j = 180; } if (i == 3) { j = 0; } if (i == 4) { j = 90; } if (i == 5) { j = -90; } if (i == 2 && te.adjacentChestXPos != null) { GlStateManager.translate(1.0F, 0.0F, 0.0F); } if (i == 5 && te.adjacentChestZPos != null) { GlStateManager.translate(0.0F, 0.0F, -1.0F); } GlStateManager.rotate((float)j, 0.0F, 1.0F, 0.0F); GlStateManager.translate(-0.5F, -0.5F, -0.5F); float f = te.prevLidAngle + (te.lidAngle - te.prevLidAngle) * partialTicks; if (te.adjacentChestZNeg != null) { float f1 = te.adjacentChestZNeg.prevLidAngle + (te.adjacentChestZNeg.lidAngle - te.adjacentChestZNeg.prevLidAngle) * partialTicks; if (f1 > f) { f = f1; } } if (te.adjacentChestXNeg != null) { float f2 = te.adjacentChestXNeg.prevLidAngle + (te.adjacentChestXNeg.lidAngle - te.adjacentChestXNeg.prevLidAngle) * partialTicks; if (f2 > f) { f = f2; } } f = 1.0F - f; f = 1.0F - f * f * f; modelchest.chestLid.rotateAngleX = -(f * ((float)Math.PI / 2F)); modelchest.renderAll(); GlStateManager.disableRescaleNormal(); GlStateManager.popMatrix(); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); if (destroyStage >= 0) { GlStateManager.matrixMode(5890); GlStateManager.popMatrix(); GlStateManager.matrixMode(5888); } } } } I still need to delete some lines. I haven't done it yet.
  9. I think i'm doing it wrong. When 1 tileentity is enough is 1 block also enough? I tried to give a variable to the tileentity but it is always the same. when i create the chest it looks like this: chest = new BlockModChest("modchest", 0); chest2 = new BlockModChest("modchest2", 1); i give a number as argument. in the BlockModChest.class the constructor looks like this: public static int CHEST_ID; public BlockModChest(String blockname, int blockID) { super(Material.WOOD); this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH)); this.CHEST_ID = blockID; this.setCreativeTab(Tem.decortab); setUnlocalizedName(blockname); setRegistryName(blockname); } the i create the tileentity like this: @Override public TileEntity createNewTileEntity(World worldIn, int meta) { TileEntityModChest te = new TileEntityModChest(); te.TileEntityID = CHEST_ID; System.out.println("the block id is: "+ CHEST_ID); System.out.println("the chest id is: "+ te.TileEntityID); return te; } It turns out that the tileentity gets always the id from the last instance i created of BlockModChest I made also this class where the textures are defined: public class ModChestUtility { public static final ResourceLocation texture_sprucechest_single = new ResourceLocation("tem:textures/models/entity/chest/test_green_normal.png"); public static final ResourceLocation texture_sprucechest_double = new ResourceLocation("tem:textures/models/entity/chest/test_green_double.png"); public static final ResourceLocation texture_birchchest_single = new ResourceLocation("tem:textures/models/entity/chest/test_brown_normal.png"); public static final ResourceLocation texture_birchchest_double = new ResourceLocation("tem:textures/models/entity/chest/test_brown_double.png"); public static enum chestType{ SPRUCE("sprucechest",0,texture_sprucechest_single, texture_sprucechest_double), BIRCH("birchchest",1,texture_birchchest_single, texture_birchchest_double), JUNGLE("junglechest",2,texture_sprucechest_single, texture_sprucechest_double), ACACIA("acaciachest",3,texture_sprucechest_single, texture_sprucechest_double), DARKOAK("darkoakchest",4,texture_sprucechest_single, texture_sprucechest_double); private String chestname; private int ID; private ResourceLocation SingleChest; private ResourceLocation DoubleChest; chestType(String name, int id, ResourceLocation resloc, ResourceLocation resloc2){ this.chestname = name; this.ID = id; this.SingleChest = resloc; this.DoubleChest = resloc2; } public String getChestName(){ return chestname; } public int getChestID(){ return ID; } public ResourceLocation getSingleChestTexture(){ return SingleChest; } public ResourceLocation getDoubleChestTexture(){ return DoubleChest; } } } So in the TESR i get the texture like this: this.bindTexture(ModChestUtility.chestType.values()[te.TileEntityID].getDoubleChestTexture()); the texture is applied properly but all chests have the same textures because of te.TileEntityID is always the same
  10. Thank you, the problem has been solved. However i have another question. I was wondering how i would make multiple chest types? As far as i think to understand is the specialrenderer bounded to the tileentity. Like this: ClientRegistry.bindTileEntitySpecialRenderer(TileEntityModChest.class, new ModTERChest()); So does this means i need to create another tileentity and specialrenderer for each chest i make? For example in 5 other colors. The chestblock creates the tileentity. So could i make another enum that defines the 5 colors, then get from the constructor the parameter for the color and then give a new property to the blockstate with the defined color. Then when the tileentity has to be created , check the blockstate color and create the tileentity for that color. Is this how i should do? Or is there a better or more easy way?
  11. Aha i found a small bug! When the chest is turned into a double chest, 1 part of the chest is not rendered when it is almost out of screen. This only happens with doublechest and only on the left side of the screen. I added 2 screenshots, so you can see what i mean:
  12. I have sorted out all problems i had above! I have now perfectly working custom chests so far now ( i think) I also added my own doublechest handler, i registered all the renders and the TE. I had to add a blockstate file like this: { "forge_marker": 1, "defaults": { "model": "tem:modchest", "textures": { "particle": "minecraft:blocks/planks_oak", "chest": "minecraft:entity/chest/normal" } }, "variants": { "normal": [{}], "inventory": [{}], "facing=east":[{}], "facing=west":[{}], "facing=south":[{}], "facing=north":[{}] } } It was giving me blockstate errors about the facing variant before. So i added a "dummy" blockstate. I also added a reference to the item model (wich is in the block model folder or else it can't find it), because i needed an item model ofc. I added the texture for the item and the particle effect for the block. I hoped for some help from this forum, but i found out myself after all. :-)
  13. So i have tried myself and this is what i achieved so far: -I can place a custom chest down (with texture) -the chest can be opened and the gui works fine -it appears that the chest is working fine too (for now). I can place items in and out and. -If i brake the chest the items drop like it should -2 chests do not connect visualy, but they are in fact connected -the closing chest sound has a delay of 5-6 seconds for some reason (ennoying!) What i did is: -extended on BlockChest Extended on TileEntityChest: Extended on TileEntityChestRenderer: created a guichest class extending guicontainer:
  14. Need still some help. I'm not sure where to start.
  15. I want to create customs chest for example red, green, blue and yellow chest. What do i need to start with? I found these classes: BlockChest - ContainerChest - TileEntityChest - TileEntityChestRenderer - GuiChest Do i need to create them all? Can i extend on them? Should i also create my own chesthandler? I just finished my custom crafting table and i was wondering how to make custom chests. It seems to be a bit more complex then crafting table :-)
  16. Ah yes ofc i changed it to playerIn.openGui(Tem.instance, ModGuiHandler.MOD_WORKBENCH_GUI, worldIn, pos.getX(), pos.getY(), pos.getZ()); Works fine now! Where and how do i apply textures to the block now?
  17. I want for example to create a birch workbench. What do i need to do to make this work? This i think i need: -guihandler class -guicontainer -container class -block class I have these 4 made, but it isn't working right now. I also haven't found out where or how to add textures to the block. I guess it's not via .json blockstates! So the block is there ingame (pink/black squared for the moment) when right clicking you see a flashing of the gui. It looks like it is opening and closing almost instantly. guihandler: container: guicontainer: and the block:
  18. I have encountered another problem with the repairing I have created an ItemTemScythe class extended on the biomesoplenty 1. For some reason i cannot repair this item with the item i define. I have used the same technique for sword, shovel, axe and pickaxe public class ItemTemScythe extends ItemBOPScythe{ private ToolMaterial toolMat; public Item RepairItem; public ItemTemScythe(ToolMaterial material, Item repairitem, String unlocalizename, String registername) { super(material); setUnlocalizedName(unlocalizename); setRegistryName(registername); setCreativeTab(Tem.tooltab); toolMat = material; RepairItem = repairitem; } @Override public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) { return repair.getItem()==RepairItem || super.getIsRepairable(toRepair, repair); } @Override public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState state, BlockPos pos, EntityLivingBase entityLiving) { if (state.getBlock() == null || worldIn.getBlockState(pos).getBlock() == Blocks.AIR) {return false;} boolean isLeaves = state.getBlock().isLeaves(worldIn.getBlockState(pos), worldIn, pos); int radius = isLeaves ? 0 : 3; int height = isLeaves ? 0 : 4; if (toolMaterial == ToolMaterial.IRON || toolMaterial == ToolMaterial.GOLD) { radius = 4; height = 4; } else if (toolMaterial == ToolMaterial.DIAMOND || toolMat == ModItems.FELIRONTOOL) { radius = 5; height = 5; } // automatically damage the item once - for the block originally destroyed stack.damageItem(1, entityLiving); int numberTrimmed = 0; if (isLeaves) { numberTrimmed += trim(stack, entityLiving, worldIn, pos, height, radius, TrimType.TRIM_LEAVES, false, 40); } else { // trim once with the corners cut numberTrimmed += trim(stack, entityLiving, worldIn, pos, height, radius, TrimType.TRIM_GRASS_AND_FLOWERS, true, 70); if (worldIn.rand.nextInt(3) == 0) { // with one in 3 chance, also do another 'free' trim of a smaller radius, without the corners cut // ('free' in the sense that it does not damage the scythe) numberTrimmed += trim(stack, entityLiving, worldIn, pos, height, radius - 1, TrimType.TRIM_GRASS_AND_FLOWERS, false, 0); } } return numberTrimmed > 0; } }
  19. Ow yes you mean because i did this Item RepairItem= repairitem. Setting the 'Item' infront just makes local variable to the constructor and the private/public outside the constructor remains undeclared. Right I understand now. I'm a bit ashamed now, because this seems to be basic programming knowledge. I should not bothering you with this nonsens. Thank you very much!
  20. O i c , i changed it to public Item RepairItem; and "Item RepairItem = repairitem" to "RepairItem = repairitem" Works fine now. Thank you
  21. I have set up a custom ItemArmor class that looks like this: public class ItemTemArmor extends ItemArmor{ private Item RepairItem; public ItemTemArmor(String name, ArmorMaterial materialIn, Item repairitem, int renderIndexIn, EntityEquipmentSlot equipmentSlotIn) { super(materialIn, renderIndexIn, equipmentSlotIn); setUnlocalizedName(name); setRegistryName(name); setCreativeTab(Tem.itemstab); Item RepairItem = repairitem; } @Override public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) { return repair.isItemEqual(new ItemStack(RepairItem)) || super.getIsRepairable(toRepair, repair); } } As far as i know, this is working fine. However, it looks to simple and i'm afraid i have done it wrong.
  22. I want to add a new material called feliron wich is stronger then Diamond. The idea is to add tools and armor made of this material, but when does it become overpowered? Can i go over the 20 armor units and when i do will the player be invincible? I do not intend to make it that way. It should only be stronger. I believe someone said once before that low hits will be absorbed by the armor but higher hits will still do damage. If this is true, what formula is used to calculate the result or where can i find it? I always believed that adding more types of metals/ores wich can be used to make armor and tools are almost pointless because they do not really add something to improve the game. Still the idea to have a variety of metals at your disposel sounds great. So is it recommended to add some new ores/metals or better not? EDIT: I also saw there is something called thougness at addArmorMaterial. What does this do? Only diamond has a value of 2.0F all the other armors have 0.0F
  23. As far as i can see everything is lowercase for all the resources. I bet it is something small and very stupid, but can't find it.
  24. I still haven't solved this. Is there something i should activate in my modding workspace or....? When i start the game (in eclipse) it looks like minecraft/ forge is ignoring the folder tem/assets/minecraft. Like i said before it is ONLY in modding environment. Everything works fine in the real minecraft. This is an ennoying thing, because i have to test it in real minecraft to see if everything is alright. I also made a copy of those texture and blockstates and made a standalone texture pack and called it testpack. I can select that texture pack ingame (while in modding environment) and when selected, the game succesfully loads the texture pack and everything works fine. I'm out of ideas now.... So why does the game not load the resources that should overwrite the standard resources in modding environment, but does load it in real environment? I would be really happy if someone could help me.
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.