Jump to content

Angus Young

Members
  • Posts

    14
  • Joined

  • Last visited

Everything posted by Angus Young

  1. From Shiginima Launcher, version 1.550. Just tried again with the new version 1.600 of Shiginima launcher and this is the full crash report:
  2. This is the crash report: Client> Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/logging/log4j/Level Client> at net.minecraft.launchwrapper.Launch.launch(Launch.java:94) Client> at net.minecraft.launchwrapper.Launch.main(Launch.java:28) Client> Caused by: java.lang.ClassNotFoundException: org.apache.logging.log4j.Level Client> at java.net.URLClassLoader$1.run(Unknown Source) Client> at java.net.URLClassLoader$1.run(Unknown Source) Client> at java.security.AccessController.doPrivileged(Native Method) Client> at java.net.URLClassLoader.findClass(Unknown Source) Client> at java.lang.ClassLoader.loadClass(Unknown Source) Client> at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) Client> at java.lang.ClassLoader.loadClass(Unknown Source) Client> ... 2 more Game ended with bad state (exit code 1) ------------------------------------------------------------------------------ Minecraft 1.8 vanilla runs fine and the library log4j is in the "library" folder. There are 2 folders inside ".minecraft\libraries\org\apache\logging\log4j", the first contains "log4j-api\2.0-beta9\log4j-api-2.0-beta9.jar" and the second one contains "log4j-core\2.0-beta9\log4j-core-2.0-beta9.jar". I don't know why minecraft can't start because the libraries aren't missing, maybe a new version of log4j should be installed? Any help would be appreciated. Thanks.
  3. Where is stored your GUI texture? It should be inside a packaged named: assets.yourmodname.textures.gui If your texture location is already correct try to replace your ResourceLocation in your GUI class with this: public static final ResourceLocation texture = new ResourceLocation(ScienceModMain.modid + ":" + "textures/gui/GuiDNAExtractor.png"); And to fix the shift click crash you should Override the method "transferStackInSlot" in your Container class, it should be something like this: @Override /** * Called when a player shift-clicks on a slot. You must override this or you will crash when someone does that. */ public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) { // Here you have to return an ItemStack, depending of what you shift-clicked in your GUI } I think your GUI is very similar to the furnace, so you could use this: @Override /** * Called when a player shift-clicks on a slot. You must override this or you will crash when someone does that. */ public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) { ItemStack itemstack = null; Slot slot = (Slot)this.inventorySlots.get(par2); if (slot != null && slot.getHasStack()) { ItemStack itemstack1 = slot.getStack(); itemstack = itemstack1.copy(); if (par2 == 2) { if (!this.mergeItemStack(itemstack1, 3, 39, true)) { return null; } slot.onSlotChange(itemstack1, itemstack); } else if (par2 != 1 && par2 != 0) { if (FurnaceRecipes.smelting().getSmeltingResult(itemstack1) != null) { if (!this.mergeItemStack(itemstack1, 0, 1, false)) { return null; } } else if (TileEntityFurnace.isItemFuel(itemstack1)) { if (!this.mergeItemStack(itemstack1, 1, 2, false)) { return null; } } else if (par2 >= 3 && par2 < 30) { if (!this.mergeItemStack(itemstack1, 30, 39, false)) { return null; } } else if (par2 >= 30 && par2 < 39 && !this.mergeItemStack(itemstack1, 3, 30, false)) { return null; } } else if (!this.mergeItemStack(itemstack1, 3, 39, false)) { return null; } if (itemstack1.stackSize == 0) { slot.putStack((ItemStack)null); } else { slot.onSlotChanged(); } if (itemstack1.stackSize == itemstack.stackSize) { return null; } slot.onPickupFromSlot(par1EntityPlayer, itemstack1); } return itemstack; }
  4. I've just found a solution. You should remove your ModBlock and ModItems classes and register your blocks directly in the preLoad event. Your new main class would be: package com.jacob814.NanoTech_Engin; import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.FurnaceRecipes; import com.jacob814.NanoTech_Engin.blocks.Blockbauxite; import com.jacob814.NanoTech_Engin.blocks.BlockcopperOre; import com.jacob814.NanoTech_Engin.blocks.BlocktinOre; import com.jacob814.NanoTech_Engin.help.Reference; import com.jacob814.NanoTech_Engin.items.ItemAluminumIngot; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.registry.GameRegistry; @Mod(modid = Reference.MODID, version = Reference.VERSION) public class NanoTech_Main { public static Block bauxite; public static Block tinOre; public static Block copperOre; public static Item aluminumIngot; @EventHandler public void preInit(FMLPreInitializationEvent event) { bauxite = new Blockbauxite().setBlockName("bauxite"); GameRegistry.registerBlock(bauxite, bauxite.getUnlocalizedName().substring(5)); tinOre = new BlocktinOre().setBlockName("tinOre"); GameRegistry.registerBlock(tinOre, tinOre.getUnlocalizedName().substring(5)); copperOre = new BlockcopperOre().setBlockName("copperOre"); GameRegistry.registerBlock(copperOre, copperOre.getUnlocalizedName().substring(5)); aluminumIngot = new ItemAluminumIngot().setUnlocalizedName("aluminumIngot"); GameRegistry.registerItem(aluminumIngot, aluminumIngot.getUnlocalizedName().substring(5)); GameRegistry.addSmelting(bauxite, new ItemStack(aluminumIngot), 0.7F); } } Now both the smelting and the drop of the blocks works fine. I hope I heleped you.
  5. Right, the example provided by DiabolusNeil is pefect in your situation, but if in future you'll need to add other GUI blocks, it would be better to declare in your base mod class the variables representing the IDs, and check them with a switch in your GUI helper class, like this: public class GuiHandler implements IGuiHandler { //Return an instance of your Container @Override public Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) { TileEntity tileEntity = world.getTileEntity(x, y, z); //Get the TileEntity at x,y,z if(tileEntity == null) //If the TileEntity is null return null return null; switch(id) { case 0: //Your case if(tileEntity instanceof TileEntityDNAExtractor) { return new ContainerDNAExtractor(player.inventory, (TileEntityDNAExtractor) tileEntity); } case 1: //Other future cases if(tileEntity instanceof TileEntity....) { return new Container....(player.inventory, (TileEntity....) tileEntity); } case 2: //Other future cases if(tileEntity instanceof TileEntity....) { return new Container....(player.inventory, (TileEntity....) tileEntity); } //....... default: return null; } } //Return an instance of your GUI @Override public Object getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) { TileEntity tileEntity = world.getTileEntity(x, y, z); //Get the TileEntity at x,y,z if(tileEntity == null) //If the TileEntity is null return null return null; switch(id) { case 0: //Foundry Gui if(tileEntity instanceof TileEntityDNAExtractor) { return new GuiDNAExtractor(player.inventory, (TileEntityDNAExtractor) tileEntity); } case 1: //Other future cases if(tileEntity instanceof TileEntity....) { return new Gui....(player.inventory, (TileEntity....) tileEntity); } case 2: //Other future cases if(tileEntity instanceof TileEntity....) { return new Gui....(player.inventory, (TileEntity....) tileEntity); } //....... default: return null; } } } And in your base mod class declare some variables like these: public final static int DNAExtractorID = 0; //This represent your DNA Extractor GUI ID //These will be future GUI IDs public final static int ....ID = 1; public final static int ....ID = 2; And when you open your GUI, in the "onBlockActivated" function: player.openGui(ScienceModMain.instance, ScienceModMain.DNAExtractorID, world, x, y, z);
  6. You need a GUI handler in order to open your GUI.
  7. Do you use a GUI handler to return the instance of the GUI? If yes, I think your GUI is returned in the method "getClientGuiElement", so you could just add in the constructor of your GUI, three int parameters that represents the x, y and z coordinates, and when you have to instantiate your GUI you can simply pass the coords to it.
  8. If your blocks drops themselves it is unnecessary to override the method "getItemDropped", you could delete it because they will always drop themselves. Have you tried to harvest the blocks with the proper tool? It's strange that GameRegistry.addSmelting doesn't works, it seems like it doesn't register the smelting recipe. Try to use this instead: FurnaceRecipes.smelting().func_151394_a(new ItemStack(bauxite), new ItemStack(aluminumIngot), 0.7F);
  9. Thanks brandon for the suggestion, I was just thinking about something similar, but instead of using markBlockForUpdate I used "Minecraft.getMinecraft().renderGlobal.markBlockForRenderUpdate(xCoord, yCoord, zCoord)", that updates the block texture. Thanks to both of you, Abastro you've pointed me in the right direction with that useful tutorial and Brandon you've helped me with your suggestion. Now all works perfectly, on singleplayer and on multiplayer. This is the updated code, if someone else needs to create a Block that changes texture when righ clicked: public class AdditionalOresStairsMulti extends BlockStairs implements ITileEntityProvider { Block[] modelBlocks; int[] modelMetadatas; public AdditionalOresStairsMulti(Block[] _modelBlocks, int[] _modelMetadatas) { super(_modelBlocks[0], _modelMetadatas[0]); modelBlocks = _modelBlocks; modelMetadatas = _modelMetadatas; setCreativeTab(AdditionalOres.tabBlocks); setLightLevel(0.0F); setLightOpacity(255);//Min = 0: Transparent; Max = 255: Opaque useNeighborBrightness = true; } /** * Gets the block's texture. Args: IBlockAccess, posX, posY, posZ, side */ @Override @SideOnly(Side.CLIENT) public IIcon getIcon(IBlockAccess block, int x, int y, int z, int side) { TileEntityStairsMulti teStairs = (TileEntityStairsMulti) block.getTileEntity(x, y, z); if (teStairs != null) { int index = teStairs.getIndex(); return modelBlocks[index].getIcon(side, modelMetadatas[index]); } return this.getIcon(side, block.getBlockMetadata(x, y, z)); } @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9) { if(!world.isRemote) { ItemStack equippedItem = entityPlayer.getCurrentEquippedItem(); if(equippedItem != null && equippedItem.getItem() == AdditionalOres.hammer) { TileEntityStairsMulti teStairs = (TileEntityStairsMulti) world.getTileEntity(x, y, z); teStairs.increaseIndex(modelMetadatas.length); world.markBlockForUpdate(x, y, z); return true; } } return false; } @Override public void breakBlock(World world, int x, int y, int z, Block block, int meta) { TileEntityStairsMulti teStairs = (TileEntityStairsMulti) world.getTileEntity(x, y, z); if (teStairs != null) world.removeTileEntity(x, y, z); } @Override public boolean hasTileEntity(int metadata) { return true; } @Override public TileEntity createNewTileEntity(World world, int var2) { try { return new TileEntityStairsMulti(); } catch (Exception var3) { throw new RuntimeException(var3); } } } And this is the TileEntity: public class TileEntityStairsMulti extends TileEntity{ byte index = 0; public void increaseIndex(int maxTextures) { if(index < (maxTextures - 1)) index++; else index = 0; } public int getIndex() { return index; } public void setIndex(byte newIndex) { index = newIndex; } @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); this.index = nbt.getByte("index"); } @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); nbt.setByte("index", this.index); } @Override public Packet getDescriptionPacket() { NBTTagCompound tagCompound = new NBTTagCompound(); writeToNBT(tagCompound); return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, tagCompound); } @Override //Other Forge release use Packet132TileEntityData instead of S35PacketUpdateTileEntity public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) { //read the packet data from NBT readFromNBT(packet.func_148857_g()); //Update the block render in order to update the client texture Minecraft.getMinecraft().renderGlobal.markBlockForRenderUpdate(xCoord, yCoord, zCoord); } }
  10. Ok, thanks. That tutorial has been very useful, now my block works also on multiplayer mode, but it isn't updated properly. When I right click it, sometimes its texure changes and sometimes not. I think this happens because the method "markBlockForUpdate" is called before the client receives the packet from the server. Is there any method in the Block class (something like "onUpdate" as for Items) that is called very often? I could use it to update the texture after the client receives the packet from the server containing the TileEntity.
  11. I tried to use IBlockAcces to get the TileEntity but it gets only the client side TileEntity, and everytime I shut down Minecraft all its data is reset. MinecraftServer.getServer() doesnt return always null, even on clent side. As I said, it works fine but only in SinglePlayer mode. In Multiplayer mode return null as you said. Any other help would be appreciated.
  12. I'm trying to create a block that saves an array of textures into a TileEntity, and when you right click it with a particular Item, it cycles through its different textures. In the method GetIcon it reads the TileEntity, and based on the data read, it chooses the appropriate texture. The problem is that the method GetIcon is called only on client side. In fact, everything works fine when I play in Singleplayer mode, but if I play in Multiplayer mode, the game crashes. This happens because in order to read the TileEntity, I use the Server instance world, in this way: MinecraftServer.getServer().getEntityWorld().getTileEntity(x, y, z); So given that the method GetIcon is called only on client side, when I'm playing in multiplayer mode, the client side think that the server instance is null and this generates a Null Pointer exception. Is there a way to read in client-side mode a TileEntity from a dedicated server? Do I need to use packets? If I have to use packets I think they should be sent by the server to the client, and then the client should read the TileEntity from its client world: Minecraft.getMinecraft().theWorld.getTileEntity(x, y, z). My Block class is here: public class AdditionalOresStairsMulti extends BlockStairs implements ITileEntityProvider { Block[] modelBlocks; int[] modelMetadatas; public AdditionalOresStairsMulti(Block[] _modelBlocks, int[] _modelMetadatas) { super(_modelBlocks[0], _modelMetadatas[0]); modelBlocks = _modelBlocks; modelMetadatas = _modelMetadatas; setCreativeTab(AdditionalOres.tabBlocks); setLightLevel(0.0F); setLightOpacity(255);//Min = 0: Transparent; Max = 255: Opaque useNeighborBrightness = true; } /** * Gets the block's texture. Args: IBlockAccess, posX, posY, posZ, side */ @Override @SideOnly(Side.CLIENT) public IIcon getIcon(IBlockAccess block, int x, int y, int z, int side) { //Read the TileEntity data from the server instance TileEntityStairsMulti teStairs = (TileEntityStairsMulti) MinecraftServer.getServer().getEntityWorld().getTileEntity(x, y, z); if (teStairs != null) { int index = teStairs.getIndex(); return modelBlocks[index].getIcon(side, modelMetadatas[index]); } return this.getIcon(side, block.getBlockMetadata(x, y, z)); } @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9) { if(!world.isRemote) { ItemStack equippedItem = entityPlayer.getCurrentEquippedItem(); if(equippedItem != null && equippedItem.getItem() == AdditionalOres.hammer) { TileEntityStairsMulti teStairs = (TileEntityStairsMulti) world.getTileEntity(x, y, z); teStairs.increaseIndex(world, this, modelMetadatas.length); //Update the block render in order to update the client texture Minecraft.getMinecraft().renderGlobal.markBlockForRenderUpdate(x, y, z); return true; } } return false; } @Override public void breakBlock(World world, int x, int y, int z, Block block, int meta) { TileEntityStairsMulti teStairs = (TileEntityStairsMulti) MinecraftServer.getServer().getEntityWorld().getTileEntity(x, y, z); if (teStairs != null) world.removeTileEntity(x, y, z); } @Override public boolean hasTileEntity(int metadata) { return true; } @Override public TileEntity createNewTileEntity(World world, int var2) { try { return new TileEntityStairsMulti(); } catch (Exception var3) { throw new RuntimeException(var3); } } } My TileEntity is here: public class TileEntityStairsMulti extends TileEntity{ byte index = 0; public void increaseIndex(World world, Block block, int maxTextures) { if(index < (maxTextures - 1)) index++; else index = 0; world.notifyBlockChange(xCoord, yCoord, zCoord, block); } public int getIndex() { return index; } public void setIndex(byte newIndex) { index = newIndex; } @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); this.index = nbt.getByte("index"); } @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); nbt.setByte("index", this.index); } }
  13. Hi, I know maybe it's too late to reply to your question but I've got the solution. For the glitchy shadow you have to add this line in your constructor of your slab class: useNeighborBrightness = true; And to prevent the 0.5 blocks upper positioning you have to follow what says "MCZaphelon" in this post: http://www.minecraftforum.net/topic/2432754-172forge-modding-slab-problem/ I hope this could help you and anyone else who have the same problem.
×
×
  • Create New...

Important Information

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