Jump to content

cookie545445

Members
  • Posts

    31
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

cookie545445's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. I managed to change the entity viewpoint relatively easily in 1.7.10, just change a field in Minecraft.getMinecraft(). I'll add the name of the field when I'm at home. EDIT: Minecraft.getMinecraft().renderViewEntity = (EntityLivingBase) event.target; is what I did. No reflection needed; renderViewEntity is public (this was in EntityInteractEvent handler).
  2. The block renders differently dependant on whether there's something in the slot or not.
  3. Line 2 removed, for some reason original "vanilla" crash doesn't come back. And no, markBlockForUpdate ISN'T resending the packet.
  4. I've installed the Baubles API what seems to me like correctly, with the API file linked to in Eclipse project setup and the deobf in the mods folder. Eclipse says there's no files in baubles.api unless I open it in the "navigator". I can't use the API because Eclipse just complains that IBauble doesn't exist and it won't tell me which unimplemented methods I need to add. Any help would be appreciated, also this probably isn't the right board to put this topic on . Edit: I solved this by referencing the deobf jar in eclipse instead of the api.
  5. Be more specific. Do you want everyone reading to spawn an entity in front of the player on item right click? If you mean a projectile, say so. If you mean a <? extends EntityLivingBase> then say so.
  6. That's not sending the packet, it's setting the null delegate that caused the first crash.
  7. Didn't do anything=no difference between before using markBlockForUpdate() and after. @Override public void setInventorySlotContents(int p_70299_1_, ItemStack p_70299_2_) { contents[p_70299_1_] = p_70299_2_; contents[p_70299_1_].func_150996_a(contents[p_70299_1_].getItem()); markDirty(); worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); } @Override public String getInventoryName() { return "Research Desk"; } @Override public boolean hasCustomInventoryName() { return false; } @Override public int getInventoryStackLimit() { return 64; } @Override public boolean isUseableByPlayer(EntityPlayer p_70300_1_) { return true; } @Override public void openInventory() {} @Override public void closeInventory() {} @Override public boolean isItemValidForSlot(int p_94041_1_, ItemStack p_94041_2_) { if (p_94041_2_ != null && p_94041_2_.getItem() == Item.itemRegistry.getObject("paper")) { return true; } else return false; } @Override public void readFromNBT(NBTTagCompound nbtTag) { super.readFromNBT(nbtTag); contents[0] = ItemStack.loadItemStackFromNBT(nbtTag.getCompoundTag("Item")); } @Override public void writeToNBT(NBTTagCompound nbtTag) { super.writeToNBT(nbtTag); NBTTagCompound item = new NBTTagCompound(); if (contents[0] != null) contents[0].writeToNBT(item); nbtTag.setTag("Item", item); } public ResourceLocation getBlockTexture() { if (contents[0] == null && contents[0] != new ItemStack((Item)null)) { return new ResourceLocation("soulwizardry:textures/blocks/ModelResearchDesk.png"); } else { return new ResourceLocation("soulwizardry:textures/blocks/ModelResearchDeskPaper.png"); } } @Override public Packet getDescriptionPacket() { NBTTagCompound tag = new NBTTagCompound(); writeToNBT(tag); return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 0, tag); } @Override public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) { System.out.println("Packet!"); readFromNBT(pkt.func_148857_g()); } public ItemStack tryAddItemToSlot(int slot, ItemStack item) { // TODO: Cut down on the 'if's if (isItemValidForSlot(slot, item)) { if (contents[slot] != null) { if (contents[slot].getItem() == item.getItem() && contents[slot].getTagCompound() == item.getTagCompound()) { contents[slot].stackSize += item.stackSize; item.stackSize = 0; if (contents[slot].stackSize > contents[slot].getMaxStackSize()) { item.stackSize = contents[slot].stackSize - contents[slot].getMaxStackSize(); contents[slot].stackSize = contents[slot].getMaxStackSize(); } this.worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); } else return null; } else { contents[slot] = item; return null; } } return item; } }
  8. I found that on another post as well, still didn't do anything.
  9. @Override public void updateTick(World world, int x, int y, int z, Random rand) { EntityPlayer player = world.getClosestPlayer(x+0.5, y+0.5, z+0.5, -1); if (player.getDistanceSq(x, y, z)>1 && player.inventory.hasItemStack(new ItemStack(MOD.ACTIVATED_ITEM, 1, 1))) { world.setBlock(x, y, z, Blocks.air, 0, 3); } } @Override public boolean getTickRandomly() { return true; // Seems to be the only way to make it actually tick at all, tried removing, nothing happened } @Override public int onBlockPlaced(World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int meta) { world.scheduleBlockUpdate(x, y, z, this, 5); return meta; }
  10. I tried this and my block still didn't tick, so I looked at the declaration of scheduleBlockUpdate() and it did the most useful thing ever: {}. Any different methods that actually do something?
  11. That statement makes no sense. You are assigning something to contents[0] in readFromNBT, so the value of contents[0] does not matter, whether it's null or not. Sorry, I got confused between the staticness of readFromNBT() (non-static) and loadItemStackFromNBT() (static). That isn't the problem though. I fixed the crash with func_150996_a() but now the S35PacketUpdateTileEntity only gets sent once when you load the world.
  12. I can't do that because if I do it crashes with an NPE because contents[0] is null when I try to call loadItemStackFromNBT(). I ran func_150996_a() to set the null delegate every time setInventorySlotContents() gets called and that fixed the bug. Now S35PacketUpdateTileEntity only gets sent on world load for some reason, but I'm not sure if it did that anyway. Also markDirty() doesn't do anything.
  13. That's what stopped the crash. It actually sets the delegate so there isn't an NPE when you use getItem().
×
×
  • Create New...

Important Information

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