Jump to content

swordkorn

Members
  • Posts

    86
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by swordkorn

  1. You sir are a gem! Thank you very much! I take it the returns and everything will still work the same?
  2. I'm trying to create a block with TileEntity and the tutorial I'm following to set up the basics for the inventory slots has brought me grinding to a halt. It seems to not recognise the method getStackInSlotOnClosing anymore for ItemStack and I was just wondering if anyone knew of the new method required or if there's a better way of doing things now we're on 1.8.9? public ItemStack[] inv; public String name; public CropTilesBase() { this.inv = new ItemStack[this.getSizeInventory()]; } public String getCustomName() { return this.name; } public void setCustomName(String name) { this.name = name; } @Override public String getName() { return this.hasCustomName() ? this.name : "container.alchemicalDuster"; } @Override public boolean hasCustomName() { return this.name != null && !this.name.equals(""); } @Override public IChatComponent getDisplayName() { return this.hasCustomName() ? new ChatComponentText(this.getName()) : new ChatComponentTranslation(this.getName()); } @Override public int getSizeInventory() { return 3; } @Override public ItemStack getStackInSlot(int slot) { if(slot < 0 || slot >= this.getSizeInventory()) return null; return this.inv[slot]; } @Override public ItemStack decrStackSize(int slot, int amt) { if(this.getStackInSlot(slot) != null) { ItemStack stack; if(this.getStackInSlot(slot).stackSize <= amt) { stack = this.getStackInSlot(slot); this.setInventorySlotContents(slot, null); this.markDirty(); return stack; }else{ stack = this.getStackInSlot(slot).splitStack(amt); if(this.getStackInSlot(slot).stackSize <= 0) { this.setInventorySlotContents(slot, null); }else{ this.setInventorySlotContents(slot, this.getStackInSlot(slot)); } this.markDirty(); return stack; } }else{ return null; } } [b]@Override public ItemStack getStackInSlotOnClosing(int slot) { ItemStack stack = this.getStackInSlot(slot); this.setInventorySlotContents(slot, null); return stack;[/b] } It's not urgently needed as I have other things I can be getting on with in the mean time (wanting to add tool materials and custom tools and such) so it's not like I desperately need this, but I'd like to be able to come back to it at some point and get this sorted. Thanks guys!
  3. I just had a thought. You have 7 block states for your bush, right? Why are you trying to overcomplicate things for yourself? If I was you I'd write a method under onRightClick to simply reset the state to age 6, define age 6 as the full bush block - berries, and then your logic should get it to tick to 7 again over time. The way it sounds right now; you have nothing to state that when you harvest the berries, reset the growth back to age 6. Delete the use of a second block and make less work for yourself my friend.
  4. Thanks for the reply but I actually just this second fixed it! For some strange reason, the tutorial I was following was telling me to create a model in the blocks folder for my rendering.json file. I removed that file. Also, something not commonly mentioned in any solution to this kind of issue, is if the block isn't intended to render in a player's inventory then don't place "inventory" after the ModelResourceLocation declaration. You also don't necessarily have to override all the methods for BlockCrops/BlockBush respectively, or implement IGrowable. The base code is smart enough to figure that out. I did however due to wanting more control over how it grows.
  5. I'm still trying to figure this out myself in all fairness... but I've actually simplified this class a lot. If you simply extend BlockBush without implementing IGrowable, the base code of Minecraft handles all the IGrowable methods for your block automatically. I found this out by talking to a fellow modder and looking at his classes. I know this is a post for your issue, but I can't get my block to render in ages. 4, 5, 6 and 7 claim to not have a Renderer which is annoying me massively. Solved one problem, throwing another lol!
  6. Rewrote the whole thing to simplify. Getting a new error now... Upon launching Minecraft it can't find the Model definitions for age's 4, 5, 6 and 7 and renders the block as a cube when I wanted it to render as a cross.
  7. Try extending BlockBush implementing IGrowable and retest with the new methods included
  8. Are you telling it to update the block? Also, your else statement is checking for the exact same blockState as your if statement. You also never check to see if the blockState is set to .CLOSED in your if statement. Your code is only ever checking for the .OPEN state. This may be why it's not updating. The other glaringly obvious issue is you return true everywhere. Your main if(!world.isremote) should return false.
  9. Hi guys. I'm currently having some issues getting my crop block to render any texture in world. I have all the relevant .json files, including one for blockstates. Everything loads up fine and I receive no error from the console, yet in world I get the missing texture texture. The only reason I can think of as to what may be causing this is the lack of texture for the base block, but the block changes state based on its age. This has been defined as 7 stages and a defaultBlockState of 0. Any ideas?
×
×
  • Create New...

Important Information

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