deerangle
Members-
Posts
259 -
Joined
-
Last visited
-
Days Won
1
Everything posted by deerangle
-
It was the condition, without it, it works! It seems, that getting the itemstack, returns "null".
-
if(tile.getStackInSlot(0) == new ItemStack(Items.diamond)){ tile.setInventorySlotContents(0, new ItemStack(ModItems.crystalVivium)); } it is
-
It is registered in the pre-init method. Is there a way to send the tileentity, istead of getting it by coordinates?
-
Im not calling the handler, all im doing, is this : MainRegistry.network.sendToServer(new SlotChangeMessage(tile)); Where do i call the handler?
-
Thanks, Its not crashing anymore, but it still doesnt do anything, i added a println statement, to check if the values are sent properly, and its recieving the values.
-
I have programmed my mod, so it will send a packet: public class SlotChangeMessage implements IMessage{ int x,y,z; public SlotChangeMessage(int x, int y, int z){ this.x = x; this.y = y; this.z = z; } @Override public void fromBytes(ByteBuf buf) { this.x = buf.readInt(); this.y = buf.readInt(); this.z = buf.readInt(); } @Override public void toBytes(ByteBuf buf) { buf.writeInt(x); buf.writeInt(y); buf.writeInt(z); } public static class Handler implements IMessageHandler<SlotChangeMessage, SlotChangeMessage>{ @Override public SlotChangeMessage onMessage(SlotChangeMessage message, MessageContext ctx) { World world = ctx.getServerHandler().playerEntity.worldObj; TileEntityTableLives tile = (TileEntityTableLives) world.getTileEntity(message.x, message.y, message.z); if(tile.getStackInSlot(0) == new ItemStack(Items.diamond)){ tile.setInventorySlotContents(0, new ItemStack(ModItems.crystalVivium)); } return null; } } } but it crashes! I have heared, that the constructor must be empty, but how do i then put the values into the packet?
-
[1.7.10] TileEntity.worldObj.setBlock() not working
deerangle replied to deerangle's topic in Modder Support
Thanks Ernio, sometimes my mistakes are so stupid! Sorry for wasting your time. -
I have created a method: private void sBlock(int x, int y, int z, Block b){ this.worldObj.setBlock(xCoord + x, xCoord + y, xCoord + z, b, 0, 2); } but when i call it, it does... nothing.
-
[1.7.10] Container Slot Content change on GuiButton click
deerangle replied to deerangle's topic in Modder Support
how would i recieve the packet, sent by the gui, in the container class -
[1.7.10] Container Slot Content change on GuiButton click
deerangle replied to deerangle's topic in Modder Support
Thank you! (this was quite obvious, but i wasn't sure) -
[1.7.10] Container Slot Content change on GuiButton click
deerangle posted a topic in Modder Support
I have got a Gui, and i want it, so if i click the guibutton, the content of my slot changes. How do i do this? -
I am using minecraft forge 1.7.10
-
What is "LayerArmorBase"? I didnt find a class/method/object anywhere
-
I am trying to make an armor, that has a grayscale texture, and gets colorized into for instance pink, (I want to colorize the armor, not the items) but I couldn't find any methods in the leather armor, except for these: @Override public int getColor(ItemStack item){ return color; } @Override @SideOnly(Side.CLIENT) public boolean hasColor(ItemStack item){ return true; } but it is still not working.
-
Thank you a lot, but one more question, except for colorizing the tesselator, is there an easier way to colorize it? EDIT - Solved it. THANK YOU SO MUCH!
-
I am trying to make a block class, that takes two textures, and colorizes one of them, before stitching them together... like the potions, they have a background and a overlay texture, that gets colored.
-
Now It is working. Thanks a lot for the help, and for extending my java knowledge about getters.
-
How Exactly do I use this method? I tried: Item item = new Item(); item.setUnlocalizedName(name); item.setTextureName(Reference.MODID + ":" + tex); item.setCreativeTab(tab); item.getColorFromItemStack(new ItemStack(item), color); GameRegistry.registerItem(item, name);
-
I did this before... just overwrite the items code, where is looses durability, to loose 0 durability: package com.yourmod.main; import net.minecraft.block.Block; import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemSword; import net.minecraft.world.World; public class ItemNoDamage extends ItemSword{ public ItemNoDamage(ToolMaterial mat) { super(mat); } @Override public boolean hitEntity(ItemStack item, EntityLivingBase entity, EntityLivingBase player) { item.damageItem(0, player); return true; } @Override public boolean onBlockDestroyed(ItemStack item, World world, Block block, int x, int y, int z, EntityLivingBase player) { if ((double)block.getBlockHardness(world, x, y, z) != 0.0D) { item.damageItem(0, player); } return true; } }
-
I am making a mod, that will have a lot of ingot textures, so lots of similar textures. So I am colorizing them on preinitialization... But I don't know, how I can read the files from the exported jar file, and where can I save the converted textures, to use them for items/blocks.
-
I created a custom slot class and set the "isitemValid" to similar to what was in the method from the tileentity and now it works. PS: i never made a more complex gui than a chest before. THANK YOU
-
package com.wizcraft.gui; import com.wizcraft.tile.entity.TileEntityTableWittle; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; public class ContainerTableWittle extends Container { protected TileEntityTableWittle tile; public ContainerTableWittle(InventoryPlayer invPlayer, TileEntityTableWittle tile){ this.tile = tile; this.addSlotToContainer(new Slot(tile, 0, 52, 7)); this.addSlotToContainer(new Slot(tile, 1, 52, 34)); this.addSlotToContainer(new Slot(tile, 2, 52, 61)); this.addSlotToContainer(new Slot(tile, 3, 25, 34)); this.addSlotToContainer(new Slot(tile, 4, 79, 34)); this.addSlotToContainer(new Slot(tile, 5, 131, 34)); bindPlayerInventory(invPlayer); } @Override public boolean canInteractWith(EntityPlayer player) { return tile.isUseableByPlayer(player); } protected void bindPlayerInventory(InventoryPlayer invPlayer) { for(int i = 0; i<3;i++){ for(int j = 0; j<9;j++){ this.addSlotToContainer(new Slot(invPlayer, 9+j+i*9, 8 + j*18, 84+i*18)); } } for(int i = 0; i<9;i++){ this.addSlotToContainer(new Slot(invPlayer, i, 8 + i*18, 142)); } } @Override public ItemStack transferStackInSlot(EntityPlayer player, int slot) { ItemStack stack = null; Slot slotObject = (Slot) inventorySlots.get(slot); //null checks and checks if the item can be stacked (maxStackSize > 1) if (slotObject != null && slotObject.getHasStack()) { ItemStack stackInSlot = slotObject.getStack(); stack = stackInSlot.copy(); //merges the item into player inventory since its in the tile if (slot < tile.getSizeInventory()) { if (!this.mergeItemStack(stackInSlot, tile.getSizeInventory(), 36+tile.getSizeInventory(), true)) { return null; } } //places it into the tile is possible since its in the player inventory else if (!this.mergeItemStack(stackInSlot, 0, tile.getSizeInventory(), false)) { return null; } if (stackInSlot.stackSize == 0) { slotObject.putStack(null); } else { slotObject.onSlotChanged(); } if (stackInSlot.stackSize == stack.stackSize) { return null; } slotObject.onPickupFromSlot(player, stackInSlot); } return stack; } }
-
thats how i tried it: @Override public boolean isItemValidForSlot(int slot, ItemStack item) { if(slot == 0 && item.getItem() == ModItems.toolOsniumKnife) return true; return false; }
-
I am trying to lock a slot in my inventory to a specific item, so i can oly inert THAT item in THAT slot and no other. i tried it with "isItemValidForSlot" but i couldnt get it to work that way.
-
changing texture based on tileentity time of day
deerangle replied to Mightydanp's topic in Modder Support
and you have to do the tessellating, using the texture afterwards. this.bindTexture(texture); Tessellator tess = new Tessellator.getInstance(); //tessellating stuffs tess.addVertexWithUV(0, 0, 0, 0, 0); //etc.