Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

cookie545445

Members
  • Joined

  • Last visited

  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. How else should I sync the inventory, IMessage?
  4. Line 2 removed, for some reason original "vanilla" crash doesn't come back. And no, markBlockForUpdate ISN'T resending the packet.
  5. 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.
  6. 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.
  7. That's not sending the packet, it's setting the null delegate that caused the first crash.
  8. 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; } }
  9. I found that on another post as well, still didn't do anything.
  10. @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; }
  11. 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?
  12. 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.
  13. 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.
  14. That's what stopped the crash. It actually sets the delegate so there isn't an NPE when you use getItem().

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.