Jump to content

ThunderStrikeBlue

Members
  • Posts

    3
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

ThunderStrikeBlue's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Is anyone able to help? I haven't done much work on this in the past week and I was hoping somebody could help me with this by the end of this weekend.
  2. Here is my current code for reference. I did not add it in my original question as I was planning on completely restarting my Item and Block classes from scratch. I made a few edits to my code when I realised that the problem was that I was placing the Block version of the door, not the Item version. ItemMyDoor class: public class ItemMyDoor extends ItemDoor implements IHasModel { private final Block block; public ItemMyDoor(Block doorBlock, String name) { super(doorBlock); setUnlocalizedName(name); setRegistryName(name); this.block = doorBlock; setCreativeTab(CreativeTabs.BUILDING_BLOCKS); ModItems.ITEMS.add(this); } BlockMyDoor class: public class BlockMyDoor extends BlockDoor implements IHasModel{ public Item placerItem; public BlockMyDoor(String name, Item item, Material par2Material) { super(par2Material); setUnlocalizedName(name); setRegistryName(name); placerItem = item; ModBlocks.BLOCKS.add(this); } public void setDoorItem(Item doorItem) { this.placerItem = doorItem; } public Item getDoorItem() { return placerItem; } @Override public void registerModels() { Main.proxy.registerItemRenderer(Item.getItemFromBlock(this), 0, "inventory"); } public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, @Nullable ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { if (this.blockMaterial == Material.IRON) { return true; } else { BlockPos blockpos = state.getValue(HALF) == BlockDoor.EnumDoorHalf.LOWER ? pos : pos.down(); IBlockState iblockstate = pos.equals(blockpos) ? state : worldIn.getBlockState(blockpos); if (iblockstate.getBlock() != this) { return false; } else { state = iblockstate.cycleProperty(OPEN); worldIn.setBlockState(blockpos, state, 2); worldIn.markBlockRangeForRenderUpdate(blockpos, pos); return true; } } } } Initialisation Classes (ModBlocks & ModItems) public static final Block WHITE_DOOR = new BlockMyDoor("white_door", ModItems.WHITE_DOOR, Material.WOOD); public static final Item WHITE_DOOR = new ItemMyDoor(ModBlocks.WHITE_DOOR, "white_door"); I'm also pretty sure that my .json files are valid, as I copied them directly from a copy of the default texture pack and just replaced the names (acacia_door_bottom_rh became white_door_bottom_rh, etc.)
  3. I'm brand new to Java, however I have a fair amount of prior programming experience in other object oriented languages. For the past few days, I have been attempting to create a custom door, however I have had no luck. The top half of the door does not spawn, and the door is not placed on the correct side of the block. The game is not crashing, but I have attempted to fix this and I'm unsure what I have done wrong. I am considering starting over again from scratch as I have been referencing code from 1.8 and earlier, and as a result something has definitely gone wrong somewhere. If I were to start again from scratch, how would I (correctly) do this? I know I need to extend BlockDoor into a custom class, but I do not know which functions are necessary to port over as after deleting some, nothing changed. The same goes for the Item class - do I need to create a new class for the ItemDoor, or have to use any special functions to render/generate a second block? I would really appreciate it if somebody outlined the steps and functions I need to use to create a simple, retextured wooden door (I may create more complex ones when I have figured out how to do this). Thanks in advance
×
×
  • Create New...

Important Information

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