Jump to content

Hirvio

Members
  • Posts

    9
  • Joined

  • Last visited

Everything posted by Hirvio

  1. I keep getting FAILURE: Build failed with an exception. * What went wrong: A problem was found with the configuration of task ':reobf'. > No value has been specified for property 'deobfFile'. * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. BUILD FAILED when i try to build my mod, I tried gradlew cleancache --refresh-dependencies but it didn't solve anything, anything i done wrong? The code itself runs fine in the development environment here is my build.gradle
  2. My client wont start while the server starts just fine. I set this up using Gradle and IntelliJ. no idea what to do, i tried most things i can think off Error:
  3. From what little i have experimented with this i found out Chunk c = worldObj.getChunkFromBlockCoords(xCoord, zCoord); worldObj.getChunkProvider().loadChunk(c.xPosition, c.zPosition); Loads it some what well but i have no idea how often to call it to make it efficient and anything like that.
  4. I'm gonna make a really stupid comment here. I don't fully yet understand how it works but wouldn't it be possible to make a static list and whenever a tileEntity is created it adds to the list and whenever it's gets destroyed it removes itself?
  5. Nevermind fixed it now Thanks alot <3
  6. Hello Guys, I'm currently trying to make an tileEntity that burns item and when i'm opening the gui my equivalent to the burning flame in the furnace block doesn't update and i tried long to try solve this and apprently when i get the value from the tileEntity it returns 0 without actually getting the value in the tileEntity shows. i basicly made 2 printlns 1 in the tileEntity and 1 in the gui and they showed 2 diffrent numbers whereby the one in tileEntity is correct Source code: TileEntity package projectnavitas; import net.minecraft.src.EntityPlayer; import net.minecraft.src.IInventory; import net.minecraft.src.ItemStack; import net.minecraft.src.NBTTagCompound; import net.minecraft.src.NBTTagList; import net.minecraft.src.TileEntity; import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.common.ISidedInventory; public class TileEntityDefuser extends TileEntity implements IInventory{ public ItemStack[] inv; public int energyBuffer = 0; public int energy = 1; public TileEntityDefuser(){ inv = new ItemStack[1]; } public void readFromNBT(NBTTagCompound par1NBTTagCompound) { super.readFromNBT(par1NBTTagCompound); NBTTagList var2 = par1NBTTagCompound.getTagList("Items"); this.inv = new ItemStack[this.getSizeInventory()]; for (int var3 = 0; var3 < var2.tagCount(); ++var3) { NBTTagCompound var4 = (NBTTagCompound)var2.tagAt(var3); byte var5 = var4.getByte("Slot"); if (var5 >= 0 && var5 < this.inv.length) { this.inv[var5] = ItemStack.loadItemStackFromNBT(var4); } } energy = par1NBTTagCompound.getInteger("energy"); energyBuffer = par1NBTTagCompound.getInteger("energyBuffer"); } public void writeToNBT(NBTTagCompound par1NBTTagCompound) { super.writeToNBT(par1NBTTagCompound); par1NBTTagCompound.setInteger("energy", energy); par1NBTTagCompound.setInteger("energyBuffer", energyBuffer); NBTTagList var2 = new NBTTagList(); for (int var3 = 0; var3 < this.inv.length; ++var3) { if (this.inv[var3] != null) { NBTTagCompound var4 = new NBTTagCompound(); var4.setByte("Slot", (byte)var3); this.inv[var3].writeToNBT(var4); var2.appendTag(var4); } } par1NBTTagCompound.setTag("Items", var2); } public int getSizeInventory(){ return inv.length; } public ItemStack getStackInSlot(int slot){ return inv[slot]; } public void setInventorySlotContents(int slot, ItemStack items){ inv[slot] = items; if(items != null && items.stackSize > getInventoryStackLimit()){ items.stackSize = getInventoryStackLimit(); } } public ItemStack decrStackSize(int slot, int amt) { ItemStack stack = getStackInSlot(slot); if (stack != null) { if (stack.stackSize <= amt) { setInventorySlotContents(slot, null); } else { stack = stack.splitStack(amt); if (stack.stackSize == 0) { setInventorySlotContents(slot, null); } } } return stack; } public ItemStack getStackInSlotOnClosing(int slot) { ItemStack stack = getStackInSlot(slot); if (stack != null) { setInventorySlotContents(slot, null); } return stack; } public int getInventoryStackLimit() { return 64; } public String getInvName() { return "CrystalDefuser"; } public boolean isUseableByPlayer(EntityPlayer player) { return worldObj.getBlockTileEntity(xCoord, yCoord, zCoord) == this && player.getDistanceSq(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5) < 64; } public void updateEntity(){ if(inv[0] != null){ if(energy > 0){ --energy; ++energyBuffer; } } if (!this.worldObj.isRemote){ if(energy < 1){ if(inv[0] != null){ energy = 100; --this.inv[0].stackSize; if (this.inv[0].stackSize == 0) { this.inv[0] = this.inv[0].getItem().getContainerItemStack(inv[0]); } } } } } public int getEner(){ return energy; } public int getEnergy(){ return energy*32 / 100; } @Override public void openChest() { } @Override public void closeChest() { } } Gui: package projectnavitas; import net.minecraft.src.ContainerFurnace; import net.minecraft.src.GuiContainer; import net.minecraft.src.InventoryPlayer; import net.minecraft.src.StatCollector; import net.minecraft.src.TileEntityFurnace; import org.lwjgl.opengl.GL11; import cpw.mods.fml.common.Side; import cpw.mods.fml.common.asm.SideOnly; @SideOnly(Side.CLIENT) public class GuiDefuser extends GuiContainer{ private TileEntityDefuser tile; public GuiDefuser(InventoryPlayer par1InventoryPlayer, TileEntityDefuser ent) { super(new ContainerDefuser(par1InventoryPlayer, ent)); this.tile = ent; } protected void drawGuiContainerForegroundLayer(int par1, int par2) { fontRenderer.drawString("Defuser", 8, 6, 4210752); fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), 8, ySize - 96 + 2, 4210752); } protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { int texture = mc.renderEngine.getTexture("/projectnavitas/defuser.png"); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.mc.renderEngine.bindTexture(texture); int x = (width - xSize) / 2; int y = (height - ySize) / 2; this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize); int t; t = tile.energy; System.out.println(tile.getEner()); this.drawTexturedModalRect(x+40, y+32, 176, 0, 32,t); } } Container: package projectnavitas; import net.minecraft.src.Container; import net.minecraft.src.EntityPlayer; import net.minecraft.src.InventoryPlayer; import net.minecraft.src.ItemStack; import net.minecraft.src.Slot; public class ContainerDefuser extends Container{ protected TileEntityDefuser tilee; public ContainerDefuser(InventoryPlayer ivplayer, TileEntityDefuser tile){ tilee = tile; addSlotToContainer(new Slot(tilee, 0, 79, 13)); bindPlayerInventory(ivplayer); } public boolean canInteractWith(EntityPlayer player) { return tilee.isUseableByPlayer(player); } protected void bindPlayerInventory(InventoryPlayer inventoryPlayer) { for (int i = 0; i < 3; i++) { for (int j = 0; j < 9; j++) { addSlotToContainer(new Slot(inventoryPlayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); } } for (int i = 0; i < 9; i++) { addSlotToContainer(new Slot(inventoryPlayer, i, 8 + i * 18, 142)); } } public void updateEnergy(int e ,int f){ f = tilee.energy; } public ItemStack transferStackInSlot(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 tileEntity if (slot == 0) { if (!mergeItemStack(stackInSlot, 1, inventorySlots.size(), true)) { return null; } //places it into the tileEntity is possible since its in the player inventory } else if (!mergeItemStack(stackInSlot, 0, 1, false)) { return null; } if (stackInSlot.stackSize == 0) { slotObject.putStack(null); } else { slotObject.onSlotChanged(); } } return stack; } } Block package projectnavitas; import net.minecraft.src.BlockContainer; import net.minecraft.src.CreativeTabs; import net.minecraft.src.EntityPlayer; import net.minecraft.src.Material; import net.minecraft.src.TileEntity; import net.minecraft.src.World; public class BlockDefuser extends BlockContainer{ public BlockDefuser(int id, int texture){ super(id,texture, Material.iron); setHardness(2.0F); setResistance(5.0F); setBlockName("Defuser"); setCreativeTab(CreativeTabs.tabBlock); } public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int var1, float var2, float var3, float var4){ TileEntity tile = world.getBlockTileEntity(x, y, z); if(tile == null || player.isSneaking()){ return false; } player.openGui(ProjectNavitas.instance, 2, world, x, y, z); return true; } public String getTextureFile(){ return "/projectnavitas/blocks.png"; } public TileEntity createNewTileEntity(World var1) { return new TileEntityDefuser(); } } GuI handler package projectnavitas; //Meter == 37 units long import net.minecraft.src.EntityPlayer; import net.minecraft.src.TileEntity; import net.minecraft.src.World; import cpw.mods.fml.common.network.IGuiHandler; public class GuiHandler implements IGuiHandler { public Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) { TileEntity tileEntity = world.getBlockTileEntity(x, y, z); if(id == 1){ if(tileEntity instanceof TileEntityBeamFurnace){ return new ContainerBeamfurnace(player.inventory, (TileEntityBeamFurnace) tileEntity); } } if(id == 2){ if(tileEntity instanceof TileEntityDefuser){ return new ContainerDefuser(player.inventory, (TileEntityDefuser) tileEntity); } } return null; } public Object getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) { TileEntity tileEntity = world.getBlockTileEntity(x, y, z); switch(id){ case 1: if(tileEntity instanceof TileEntityBeamFurnace){ return new GuiBeamFurnace(player.inventory, (TileEntityBeamFurnace) tileEntity); } break; case 2: if(tileEntity instanceof TileEntityDefuser){ TileEntityDefuser tile = (TileEntityDefuser) tileEntity; System.out.println(tile.energy); return new GuiDefuser(player.inventory, (TileEntityDefuser) tileEntity); } break; } return null; } } if there is any other files you need just tell me and ill provide. And thanks for any help you might provide
  7. I having a custom block renderer and when i place it ingame it will show nothing Here is the code: Main File: package net.minecraft.projectnavitas; import net.minecraft.src.BaseMod; import net.minecraft.src.Block; import net.minecraft.src.CreativeTabs; import net.minecraft.src.Item; import net.minecraft.src.ModLoader; import net.minecraft.src.RenderBlocks; import net.minecraft.src.TileEntityRenderer; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.Init; import cpw.mods.fml.common.Mod.Instance; import cpw.mods.fml.common.Mod.PostInit; import cpw.mods.fml.common.Mod.PreInit; import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.network.NetworkMod; import cpw.mods.fml.common.network.NetworkMod.SidedPacketHandler; import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.LanguageRegistry; @Mod(modid="ProjectNavitas",name="Project Navitas",version="0.1") @NetworkMod(clientSideRequired=true, serverSideRequired=false, clientPacketHandlerSpec = @SidedPacketHandler(channels = {"ProjectNavitas" }, packetHandler = ClientPacketHandler.class), serverPacketHandlerSpec = @SidedPacketHandler(channels = {"ProjectNavitas" }, packetHandler = ServerPacketHandler.class)) public class ProjectNavitas{ @Instance("ProjectNavitas") public static ProjectNavitas instance = new ProjectNavitas(); @SidedProxy(clientSide="net.minecraft.projectnavitas.ClientProxy", serverSide= "net.minecraft.projectnavitas.CommonProxy") public static CommonProxy proxy; public static GuiHandler guiHandler = new GuiHandler(); public static final Item WhiteCrystalShard = new ItemWhiteCrystalShard(4000, CreativeTabs.tabMaterials, 0, "WhiteCrystalShard"); public static final Block WhiteCrystal = new BlockWhiteCrystal(3000, 0); @Init public void Init(FMLInitializationEvent event){ GameRegistry.registerBlock(WhiteCrystal); proxy.init(); LanguageRegistry.addName(WhiteCrystalShard, "White Crystal Shard"); LanguageRegistry.addName(WhiteCrystal, "White Crystal"); NetworkRegistry.instance().registerGuiHandler(this, guiHandler); } public void renderInvBlock(RenderBlocks var1, Block var2, int var3, int var4){ if (var4 == WhiteCrystal.getRenderType()) { TileEntityRenderer.instance.renderTileEntityAt(new TileEntityCrystal(), 0.0D, 0.0D, 0.0D, 0.0F); } } @PreInit public void PreInit(FMLPreInitializationEvent event){ } @PostInit public void PostInit(FMLPostInitializationEvent event){ } } BlockWhiteCrystal: package net.minecraft.projectnavitas; import java.util.Random; import net.minecraft.src.Block; import net.minecraft.src.CreativeTabs; import net.minecraft.src.Material; import net.minecraft.src.TileEntity; public class BlockWhiteCrystal extends Block{ public BlockWhiteCrystal(int id, int texture) { super(id, texture, Material.rock); setHardness(1.0F); setResistance(2.0F); setCreativeTab(CreativeTabs.tabBlock); } public boolean isOpaqueCube() { return false; } public boolean renderAsNormalBlock() { return false; } public int getRenderType() { return -1; } public TileEntity getBlockEntity() { try{ return (TileEntity)TileEntityCrystal.class.newInstance(); } catch(Exception exception){ throw new RuntimeException(exception); } } public TileEntity TileEntity(){ return new TileEntityCrystal(); } } ClientProxy package net.minecraft.projectnavitas; import cpw.mods.fml.client.registry.ClientRegistry; import cpw.mods.fml.client.registry.RenderingRegistry; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.LanguageRegistry; public class ClientProxy extends CommonProxy{ public void init(){ initTileEntities(); LanguageRegistry.instance().addNameForObject(ProjectNavitas.WhiteCrystal, "en_US", "White Crystal"); } public void initTileEntities(){ GameRegistry.registerTileEntity(TileEntityCrystal.class, "tileCrystal"); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityCrystal.class, new TileEntityCrystalRenderer()); } } CommonProxy import java.util.Objects; import net.minecraft.src.EnumRarity; import cpw.mods.fml.client.registry.ClientRegistry; import cpw.mods.fml.common.registry.GameRegistry; public class CommonProxy{ public void preInit() { registerGuiHandler(); } public void init() { initRenderingAndTextures(); initCustomRarityTypes(); initTileEntities(); } /** * Post-Initialization event handler method. Everything within this method is called after all * mods are done loading. */ public void postInit() { } public void registerRenderInformation() {} public void initRenderingAndTextures() {} public void initCustomRarityTypes() {} public void initTileEntities() { GameRegistry.registerTileEntity(TileEntityCrystal.class, "tileCrystal"); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityCrystal.class, new TileEntityCrystalRenderer()); } public EnumRarity getCustomRarityType(String customRarity) { return null; } public void registerGuiHandler() {} } Model package net.minecraft.projectnavitas; import net.minecraft.src.Entity; import net.minecraft.src.ModelBase; import net.minecraft.src.ModelRenderer; public class ModelProjector extends ModelBase{ //fields ModelRenderer Shape1; ModelRenderer Piece1; private int xyzz; ModelRenderer rendermap[] = new ModelRenderer[4096]; public ModelProjector() { textureWidth = 64; textureHeight = 32; xyzz = 0; for(float i = -8F; i<8F; i++){ for(float j = 8F; j<24F; j++){ for(float k = -8F; k<8F; k++){ rendermap[xyzz] = new ModelRenderer(this, 0, 0); rendermap[xyzz].addBox(i, j, k, 1, 1, 1); rendermap[xyzz].setRotationPoint(0F, 0F, 0F); rendermap[xyzz].setTextureSize(64, 32); setRotation(rendermap[xyzz], 0F, 0F, 0F); xyzz++; } } } Shape1 = new ModelRenderer(this, 0, 0); Shape1.addBox(-8F, -8F, -8F, 16, 15, 16); Shape1.setRotationPoint(0F, 0F, 0F); Shape1.setTextureSize(64, 32); Shape1.mirror = true; setRotation(Shape1, 0F, 0F, 0F); Piece1 = new ModelRenderer(this, "Piece1"); Piece1.setRotationPoint(0F, 0F, 0F); setRotation(Piece1, 0F, 0F, 0F); Piece1.mirror = true; } public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { super.render(entity, f, f1, f2, f3, f4, f5); setRotationAngles(f, f1, f2, f3, f4, f5); Shape1.render(f5); for(int i = 0;i< 4096; i++){ rendermap[i].render(f5); } Piece1.render(f5); } private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; } public void renderModel(float f1) { Shape1.render(f1); for(int i = 0;i< 4096; i++){ rendermap[i].render(f1); } Piece1.render(f1); } public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5) { super.setRotationAngles(f, f1, f2, f3, f4, f5); } } TileEntityCrystalRenderer package net.minecraft.projectnavitas; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; import net.minecraft.src.Tessellator; import net.minecraft.src.TileEntity; import net.minecraft.src.TileEntitySpecialRenderer; public class TileEntityCrystalRenderer extends TileEntitySpecialRenderer{ public TileEntityCrystalRenderer(){ model = new ModelProjector(); } public void renderAModelAt(TileEntityCrystal tile, double d, double d1, double d2, float f) { GL11.glPushMatrix(); GL11.glTranslatef((float)d + 0.5F, (float)d1 + 0.5F, (float)d2 + 0.5F); bindTextureByName("/projectnavitas/Projector.png"); GL11.glPushMatrix(); model.renderModel(0.625F); GL11.glPopMatrix(); GL11.glPopMatrix(); } public void renderTileEntityAt(TileEntity tileentity, double d, double d1, double d2, float f) { renderAModelAt((TileEntityCrystal) tileentity, d, d1, d2, f); //where to render } private ModelProjector model; } TileEntityCrystal package net.minecraft.projectnavitas; import net.minecraft.src.TileEntity; public class TileEntityCrystal extends TileEntity{ public TileEntityCrystal(){ } } Thanks in befor hand //Hirvio
×
×
  • Create New...

Important Information

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