chest

Published by manababel on Sun, 10/16/2016 - 02:58
Share this on:
Downloads:
106
Upvotes: 0

Jump to downloads

hello

this is 6 news chest

 

Category
Release type
In development
Latest supported Minecraft version
1.10.2
Modification files
chest.jar135.26 KB

Submitted by kwpugh on Mon, 10/17/2016 - 15:20

Hi,

I have been trying to figure out how to make chests, but have had no luck. Could you describe the steps you followed to create these chests?

Thank you

Submitted by ohadk123 on Wed, 10/26/2016 - 13:04

im joining kwpugh question, i would like to know how you did it

Submitted by manababel on Thu, 10/27/2016 - 13:20

sorry , i don't speak english .

1 . create block ( chest )
2 . create gui with one slot input only
3 . associate both ( block & gui )
4 . add mamual coding on gui only
5 . draw new gui on \forge\scr\main\recouses\assets\minecraft

code for obsidian chest gui :

package mod.mcreator;

import org.lwjgl.opengl.GL11;
import org.lwjgl.input.Keyboard;

import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.FMLCommonHandler;

import net.minecraft.world.World;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.ResourceLocation;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.server.MinecraftServer;
import net.minecraft.item.ItemStack;
import net.minecraft.inventory.Slot;
import net.minecraft.inventory.InventoryBasic;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Container;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.Minecraft;

import java.util.Random;

@SuppressWarnings("unchecked")
public class mcreator_guiObsidianChest {

public static Object instance;

public static int GUIID = 5;

public mcreator_guiObsidianChest() {
}

public void load(FMLInitializationEvent event) {
}

public void registerRenderers() {
}

public void generateNether(World world, Random random, int chunkX, int chunkZ) {
}

public void generateSurface(World world, Random random, int chunkX, int chunkZ) {
}

public int addFuel(ItemStack fuel) {
return 0;
}

public void serverLoad(FMLServerStartingEvent event) {
}

public void preInit(FMLPreInitializationEvent event) {
}

public static IInventory inherited;

public static class GuiContainerMod extends Container {

World world = null;
EntityPlayer entity = null;
int i, j, k;

public GuiContainerMod(World world, int i, int j, int k, EntityPlayer player) {

this.world = world;
this.entity = player;
this.i = i;
this.j = j;
this.k = k;

TileEntity ent = world.getTileEntity(new BlockPos(i, j, k));
if (ent != null && (ent instanceof mcreator_obsidianChest.TileEntityCustom))
inherited = (IInventory) ent;
else
inherited = new InventoryBasic("", true, 255);

int x, y;
for (y = 0; y < 9; ++y) {
for (x = 0; x < 14; ++x) {
this.addSlotToContainer(new Slot(inherited, x + ((y * 14)), 3 + (x * 18), 3 + (y * 18)) {
public void onSlotChanged() {
super.onSlotChanged();
if (getHasStack()) {
EntityPlayer entity = Minecraft.getMinecraft().thePlayer;
int i = (int) entity.posX;
int j = (int) entity.posY;
int k = (int) entity.posZ;
MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
World world = server.worldServers[0];

}
}
});
}
}
bindPlayerInventory(player.inventory);

}

@Override
public boolean canInteractWith(EntityPlayer player) {
return true;
}

protected void bindPlayerInventory(InventoryPlayer inventoryPlayer) {
int i;
int j;

for (i = 0; i < 3; ++i) {
for (j = 0; j < 9; ++j) {
this.addSlotToContainer(new Slot(inventoryPlayer, j + (i + 1) * 9, 48 + j * 18, 167 + i * 18));
}
}

for (i = 0; i < 9; ++i) {
this.addSlotToContainer(new Slot(inventoryPlayer, i, 48 + i * 18, 223));
}
}

@Override
public ItemStack transferStackInSlot(EntityPlayer playerIn, int index) {
ItemStack itemstack = null;
Slot slot = (Slot) this.inventorySlots.get(index);

if (slot != null && slot.getHasStack()) {
ItemStack itemstack1 = slot.getStack();
itemstack = itemstack1.copy();

if (index < 9) {
if (!this.mergeItemStack(itemstack1, 9, (126+36), true)) {// fixes
// shiftclick
// error
return null;
}
} else if (!this.mergeItemStack(itemstack1, 0, 9, false)) {
return null;
}

if (itemstack1.stackSize == 0) {
slot.putStack((ItemStack) null);
} else {
slot.onSlotChanged();
}

if (itemstack1.stackSize == itemstack.stackSize) {
return null;
}

slot.onPickupFromSlot(playerIn, itemstack1);
}

return itemstack;
}

public void onContainerClosed(EntityPlayer playerIn) {
super.onContainerClosed(playerIn);

}
}

public static class GuiWindow extends GuiContainer {

int i = 0;
int j = 0;
int k = 0;
EntityPlayer entity = null;

public GuiWindow(World world, int i, int j, int k, EntityPlayer entity) {
super(new GuiContainerMod(world, i, j, k, entity));
this.i = i;
this.j = j;
this.k = k;
this.entity = entity;
this.xSize = 256;
this.ySize = 242;
}

private static final ResourceLocation texture = new ResourceLocation("GuiObsidianChest.png");

protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
int posX = (this.width) / 2;
int posY = (this.height) / 2;
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

this.mc.renderEngine.bindTexture(texture);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);

zLevel = 100.0F;

}

protected void mouseClicked(int par1, int par2, int par3) throws java.io.IOException {
super.mouseClicked(par1, par2, par3);

}

public void updateScreen() {
super.updateScreen();
int posX = (this.width) / 2;
int posY = (this.height) / 2;

}

@Override
protected void keyTyped(char par1, int par2) throws java.io.IOException {

super.keyTyped(par1, par2);

}

protected void drawGuiContainerForegroundLayer(int par1, int par2) {
int posX = (this.width) / 2;
int posY = (this.height) / 2;

}

public void onGuiClosed() {
super.onGuiClosed();
Keyboard.enableRepeatEvents(false);
}

public void initGui() {
super.initGui();
this.guiLeft = (this.width - 256) / 2;
this.guiTop = (this.height - 242) / 2;
Keyboard.enableRepeatEvents(true);
this.buttonList.clear();
int posX = (this.width) / 2;
int posY = (this.height) / 2;

}

protected void actionPerformed(GuiButton button) {
MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
World world = server.worldServers[0];

}

public boolean doesGuiPauseGame() {
return false;
}

}

}

Submitted by kwpugh on Mon, 12/05/2016 - 02:19

Hi,

I have been playing with this and can't seem to get it to work.

Would you be willing to share your workspace (.mcr) file as an export?

"Export Current Workspace to MCR file"

Regards.