Everything posted by tiffit
-
[1.8]Help with entity that swims like the Guardian
"This is just a prompt for computer specs to be printed. THIS IS NOT A ERROR A detailed walkthrough of the error, its code path and all known details is as follows:" It literally contradicts itself. Plus, there is no stack trace, pretty weird... does this happen even without your new entity's code?
-
[1.7.10] [Solved] Changing a block's texture?
Here try this. Don't use IBlockState, as there are no block states in 1.8 (I think) Look at how wheat changes its textures, and make your block's texture change just like that, when a neighboring block changes
-
[1.7.10] [Solved] Changing a block's texture?
Just forget about that, if you aren't using it, then no need of it
-
[1.7.10] [Solved] Changing a block's texture?
Use: public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) {} and use block states to change the texture
-
[SOLVED][1.7.10] world.getBlock() treating lava and flowing_lava the same
Yes that is correct, All liquids have multiple damage values I think 0 is idle (not flowing), 1 and on is like the different heights and directions and all that
-
[1.8] Clone a mob
writeToNBT returns a void The only things that return an NBTTagCompound is .getEntityData() .func_174819_aU() and neither of them would work.
-
[Mod] Change item texture on Right Click with item in hand
Another easy way of doing it is to remove the item from the inventory and add a different item Although, this wont be as smooth as the method above, also the item might vanish from time to time
-
[1.8] Clone a mob
The entity that this gives me is null EntityLiving e = (EntityLiving) EntityList.createEntityFromNBT(entity.getEntityData(), this.worldObj); I did a check to see if 'e' was null, and it was
-
[1.8] Clone a mob
I could use NBT, but my entity is stored as an EntityLiving as I want to be able to store all kinds of mobs. My problem comes when I want to create a new entity, but I don't know exactly which one. If it was only a pig, for example, then I could create a new pig with EntityPig pig = new EntityPig(worldObj); but my entity could be anything from a cow, to a zombie, to a random mob from a different mod.
-
[1.8] Clone a mob
So my tile entity stores an entity, now what I want to do is spawn in a clone of that entity. This means that they don't share health or anything, but the clone starts of with the same stats as the original.
-
Removing item from tileentity
Ok. I get everything setup, but it keeps giving me an NPE on the onMessage part of it. Here is my Message class: package tiffit.tiffitsmachines.packets; import io.netty.buffer.ByteBuf; import net.minecraft.util.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.common.network.simpleimpl.IMessage; import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; import tiffit.tiffitsmachines.tileEntity.TileEntityControlledStriker; public class ControlledStrikerPackets implements IMessage { public int x; public int y; public int z; public World w; public ControlledStrikerPackets() {} public ControlledStrikerPackets(int x, int y, int z, World w) { this.x = x; this.y = y; this.z = z; this.w = w; } @Override public void fromBytes(ByteBuf buf) { } @Override public void toBytes(ByteBuf buf) { } public static class Handler implements IMessageHandler<ControlledStrikerPackets, IMessage> { @Override public IMessage onMessage(ControlledStrikerPackets message, MessageContext ctx){ System.out.print(message != null); TileEntityControlledStriker te = (TileEntityControlledStriker) message.w.getTileEntity(new BlockPos(message.x, message.y, message.z)); if(!te.isStriking && te.stacks[1] != null && te.stacks[0] != null){ te.isStriking = true; }else{ te.timeUntilNextStrike = 100; te.isStriking = false; } return null; } } } Apparently, the "message" object (ControlledStrikerPackets) that it gives me is empty. By empty, I mean all of its fields are null, even though I set them when I send a packet. This is how I send my packet: Main.network.sendToServer(new ControlledStrikerPackets(te.getPos().getX(), te.getPos().getY(), te.getPos().getZ(), te.getWorld())); EDIT: Nevermind, completely forgot about the byte bufs, I got it working now
-
Removing item from tileentity
Sorry for the (probably) stupid questions, but can you define "stuff"
-
Removing item from tileentity
That was the first place I was going to check anyways... lol. I remember you making a packeting tutorial Edit: What do I do after I do (so many dos) MyMod.network.sendToServer(new MyMessage("foobar")); I mean, come on, it can't be that simple, can it?
-
Removing item from tileentity
Alright, time to start researching on packers
-
Removing item from tileentity
Sorry for these "stupid" questions, I am still getting used to packeting. So would I use description packets?
-
Removing item from tileentity
I am confused, can you go into more detail please? What exactly do I need to do?
-
Removing item from tileentity
Ok here it is Container: Gui: GuiHandler:
-
Removing item from tileentity
I am using a GuiHandler. Also, I am pretty new to packets, could you show me how to do this?
-
Removing item from tileentity
So I have my own tile entity with a GUI. Everything works fine, except for 1 thing. Whenever I have the plugin remove an item from a slot, on the client it looks fine. When you click on the itemstack, or exit out of the inventory, the item stacks returns to how it was before. So lets say I put in 10 diamond into the GUI. I let it use up 5 diamond. There is 5 diamond left in the GUI. When I close the GUI and open it up again, there is 10 diamonds in the GUI. I don't know if this is a miscommunication between the server and the client, or what. Below is my tile entity class. It is probably something really obvious, but I spent a while and couldn't find anything public class TileEntityControlledStriker extends TileEntity implements IInventory, IUpdatePlayerListBox{ public int storedMagic = 0; public boolean isStriking; public int timeUntilNextStrike = 100; public ItemStack[] stacks = new ItemStack[3]; protected String customName; public int getSizeInventory(){ return 3; } /** * Returns the stack in slot i */ public ItemStack getStackInSlot(int index) { return this.stacks[index]; } /** * Removes from an inventory slot (first arg) up to a specified number (second arg) of items and returns them in a * new stack. */ public ItemStack decrStackSize(int index, int count) { if (this.stacks[index] != null) { ItemStack itemstack; if (this.stacks[index].stackSize <= count) { itemstack = this.stacks[index]; this.stacks[index] = null; this.markDirty(); return itemstack; } else { itemstack = this.stacks[index].splitStack(count); if (this.stacks[index].stackSize == 0) { this.stacks[index] = null; } this.markDirty(); return itemstack; } } else { return null; } } /** * When some containers are closed they call this on each slot, then drop whatever it returns as an EntityItem - * like when you close a workbench GUI. */ public ItemStack getStackInSlotOnClosing(int index){ return null; } /** * Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections). */ public void setInventorySlotContents(int index, ItemStack stack){ this.stacks[index] = stack; if (stack != null && stack.stackSize > this.getInventoryStackLimit()){ stack.stackSize = this.getInventoryStackLimit(); } this.markDirty(); } /** * Gets the name of this command sender (usually username, but possibly "Rcon") */ public String getName() { return this.hasCustomName() ? this.customName : "container.dispenser"; } public void setCustomName(String customName) { this.customName = customName; } /** * Returns true if this thing is named */ public boolean hasCustomName() { return this.customName != null; } public int getInventoryStackLimit() { return 64; } /** * Do not make give this method the name canInteractWith because it clashes with Container */ public boolean isUseableByPlayer(EntityPlayer player) { return this.worldObj.getTileEntity(this.pos) != this ? false : player.getDistanceSq((double)this.pos.getX() + 0.5D, (double)this.pos.getY() + 0.5D, (double)this.pos.getZ() + 0.5D) <= 64.0D; } public void openInventory(EntityPlayer player) {} public void closeInventory(EntityPlayer player) {} /** * Returns true if automation is allowed to insert the given stack (ignoring stack size) into the given slot. */ public boolean isItemValidForSlot(int index, ItemStack stack) { return false; } public Container createContainer(InventoryPlayer playerInventory, EntityPlayer playerIn) { return new ContainerDispenser(playerInventory, this); } public int getField(int id) { return 0; } public void setField(int id, int value) {} public int getFieldCount() { return 0; } public void clear() { for (int i = 0; i < this.stacks.length; ++i) { this.stacks[i] = null; } } @Override public IChatComponent getDisplayName() { return null; } @Override public void readFromNBT(NBTTagCompound compound){ super.readFromNBT(compound); stacks = new ItemStack[3]; NBTTagList invStacksTag = compound.getTagList("stacks", 10); for(int i = 0; i < invStacksTag.tagCount(); i++){ NBTTagCompound t = invStacksTag.getCompoundTagAt(i); int index = t.getByte("index"); if(index >= 0 && index < stacks.length){ stacks[index] = ItemStack.loadItemStackFromNBT(t); } } this.storedMagic = compound.getInteger("storedMagic"); } @Override public void writeToNBT(NBTTagCompound compound){ super.writeToNBT(compound); NBTTagList invStacksTag = new NBTTagList(); for(int i = 0; i < stacks.length; i++){ ItemStack stack = stacks[i]; if(stack != null){ NBTTagCompound t = new NBTTagCompound(); stack.writeToNBT(t); t.setByte("index", (byte)i); invStacksTag.appendTag(t); } } compound.setTag("stacks", invStacksTag); compound.setInteger("storedMagic", this.storedMagic); } public void strike(){ EntityLightningBolt lightning = new EntityLightningBolt(this.worldObj, pos.getX(), pos.getY(), pos.getZ()); this.worldObj.spawnEntityInWorld(lightning); if(this.storedMagic != 1000){ this.storedMagic += 10; } this.stacks[0].stackSize--; this.stacks[1].stackSize--; Random r = new Random(); int dropChance = r.nextInt(10); if(dropChance == 4){ //TODO this.stacks[2].stackSize++; } this.markDirty(); } @Override public void update() { if(this.isStriking){ this.timeUntilNextStrike--; if(this.timeUntilNextStrike <= 0){ this.timeUntilNextStrike = 100; this.strike(); } } }
-
[1.7.10] Key Bindings wont work
I think its the player object and the player that won't work, is there something that I am supposed to use?
-
[1.7.10] Key Bindings wont work
it runs and all, its just that that specific line won't do anything. I try system.out.println, and it works.
-
[1.7.10] Key Bindings wont work
ok, all of that works, but just " soundHandler.onEntityPlay("gun", mc.thePlayer.worldObj, mc.thePlayer, 1, 1);" won't run, and its not the soundHandler class because I tested this out before.
-
[1.7.10] Key Bindings wont work
sorry, I meant to say where
-
[1.7.10] Key Bindings wont work
how am I supposed to call KeyBindings() in the proxy classes?
-
[1.7.10] Key Bindings wont work
Yes, I get that, but I am just confused on the "(exactly same name and inputs if any)" part/
IPS spam blocked by CleanTalk.