Everything posted by fr0st
-
Crafting make game crash
Nel preInit hai creato una nuova variabile (Item blazeBow = new blazeBow()) invece di inizializzare quella precedente che già avevi (public static Item blazeBow) (Just had to post this in italian, as I saw the comments in his code)
-
Ghost Item slot
Yep, definitely sorted out..
- Ghost Item slot
-
Ghost Item slot
Quick question. I created my own Ghost Slot for my Cointainer. It works, except for one thing... FIrst things first, how is it supposed to work? Whenever the slot is clicked with an itemstack, instead of putting said itemstack in the slot, it creates a copy of the itemstack, with stackSize = 1 and sets it to the slot. All of this without modifying the stackSize of the itemstack that the player clicked the slot with. I tried to be clear on that. Now my problem is the last part, the "not editing the itemstack currently held" part. Do i have to override something in the slot class, with my custom slot? If so, would someone point me to that? Thanks ^^ And i don't think I need to provide any source for this, since it's more of a question than an issue, and there's not much to show actually..
-
[1.7.10] Generating a sphere
I agree a bit, using the code he provided I tried to create a 15 radius sphere, took 2 secs to generate. But yeah, even with the most optimized code snippet ever, that amount of blocks is still going to take a bit to generate.. this is what I think of it, so yeah, you both are right
-
[1.7.10] Generating a sphere
TheGrayGhost, even if this thread isn't mine, and I'm not relevant to the matter here, I have to thank you for that. It worked like a charm
-
[1.7.10] [SOLVED] Every furnace/campfire burns
I was only asking. Glad you solved your issue at least..
-
[1.7.10] [SOLVED] Every furnace/campfire burns
Do I not see a createNewTileEntity() in your block class, or you just didn't post the full code?
-
1.7.10 SimpleNetworkWrapper, Gui open packet crashing
Yes, I will absolutely credit you for any source code you provided! Even if it will be changed, you still helped me a lot. Re: Yeah, I head some of the stuff he's been through.. his father died of cancer 8 months ago, and that's the last time i heard from him.. he's the guy that got me into modding..
-
1.7.10 SimpleNetworkWrapper, Gui open packet crashing
Thanks for clarifying that! I feel so stupid right now, oh god.. Well, thank you coolAlias, I needed to be sure on that because I am trying to use packets as much as it's needed. Also, sorry for having copied your stuff. I'd say time to make it my own way! Thanks again I love seeing such an helpful community here.. PS: Have you had any notice from microjunk, or his job took over his time? I think you might remember me now
-
1.7.10 SimpleNetworkWrapper, Gui open packet crashing
Hello guys, I am back with more issues! But i wanna keep this brief. I am testing out CoolAlias's https://github.com/coolAlias/Tutorial-1.7.10/blob/master/src/main/java/tutorial/network/PacketDispatcher.java PacketDispatcher. [spoiler=PacketDispatcher] package coalpower.common.network.packet; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import coalpower.CoalPower; import coalpower.common.network.packet.handler.CPAbstractClientMessageHandler; import coalpower.common.network.packet.handler.CPAbstractDualSidedMessageHandler; import coalpower.common.network.packet.handler.CPAbstractMessageHandler; import coalpower.common.network.packet.handler.CPAbstractServerMessageHandler; import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper; import cpw.mods.fml.relauncher.Side; public class CPPacketDispatcher { private static byte packetId = 0; private static final SimpleNetworkWrapper dispatcher = NetworkRegistry.INSTANCE.newSimpleChannel(CoalPower.CHANNEL); public static final void registerPackets() { registerMessage(PacketGui.Handler.class, PacketGui.class); registerMessage(PacketSound.Handler.class, PacketSound.class); } /** * Registers a message and message handler on the designated side; * used for standard IMessage + IMessageHandler implementations */ private static final <REQ extends IMessage, REPLY extends IMessage> void registerMessage(Class<? extends IMessageHandler<REQ, REPLY>> handlerClass, Class<REQ> messageClass, Side side) { CPPacketDispatcher.dispatcher.registerMessage(handlerClass, messageClass, packetId++, side); } /** * Registers a message and message handler on both sides; used mainly * for standard IMessage + IMessageHandler implementations and ideal * for messages that are handled identically on either side */ private static final <REQ extends IMessage, REPLY extends IMessage> void registerBiMessage(Class<? extends IMessageHandler<REQ, REPLY>> handlerClass, Class<REQ> messageClass) { CPPacketDispatcher.dispatcher.registerMessage(handlerClass, messageClass, packetId, Side.CLIENT); CPPacketDispatcher.dispatcher.registerMessage(handlerClass, messageClass, packetId++, Side.SERVER); } /** * Registers a message and message handler, automatically determining Side(s) based on the handler class * @param handlerClass Must extend one of {@link AbstractClientMessageHandler}, {@link AbstractServerMessageHandler}, or {@link AbstractBiMessageHandler} */ private static final <REQ extends IMessage> void registerMessage(Class<? extends CPAbstractMessageHandler<REQ>> handlerClass, Class<REQ> messageClass) { if (CPAbstractClientMessageHandler.class.isAssignableFrom(handlerClass)) { registerMessage(handlerClass, messageClass, Side.CLIENT); } else if (CPAbstractServerMessageHandler.class.isAssignableFrom(handlerClass)) { registerMessage(handlerClass, messageClass, Side.SERVER); } else if (CPAbstractDualSidedMessageHandler.class.isAssignableFrom(handlerClass)) { registerBiMessage(handlerClass, messageClass); } else { throw new IllegalArgumentException("Cannot determine on which Side(s) to register " + handlerClass.getName() + " - unrecognized handler class!"); } } /** * Send this message to the specified player. * See {@link SimpleNetworkWrapper#sendTo(IMessage, EntityPlayerMP)} */ public static final void sendTo(IMessage message, EntityPlayerMP player) { CPPacketDispatcher.dispatcher.sendTo(message, player); } /** * Send this message to everyone within a certain range of a point. * See {@link SimpleNetworkWrapper#sendToDimension(IMessage, NetworkRegistry.TargetPoint)} */ public static final void sendToAllAround(IMessage message, NetworkRegistry.TargetPoint point) { CPPacketDispatcher.dispatcher.sendToAllAround(message, point); } /** * Sends a message to everyone within a certain range of the coordinates in the same dimension. */ public static final void sendToAllAround(IMessage message, int dimension, double x, double y, double z, double range) { CPPacketDispatcher.sendToAllAround(message, new NetworkRegistry.TargetPoint(dimension, x, y, z, range)); } /** * Sends a message to everyone within a certain range of the player provided. */ public static final void sendToAllAround(IMessage message, EntityPlayer player, double range) { CPPacketDispatcher.sendToAllAround(message, player.worldObj.provider.dimensionId, player.posX, player.posY, player.posZ, range); } /** * Send this message to everyone within the supplied dimension. * See {@link SimpleNetworkWrapper#sendToDimension(IMessage, int)} */ public static final void sendToDimension(IMessage message, int dimensionId) { CPPacketDispatcher.dispatcher.sendToDimension(message, dimensionId); } /** * Send this message to the server. * See {@link SimpleNetworkWrapper#sendToServer(IMessage)} */ public static final void sendToServer(IMessage message) { CPPacketDispatcher.dispatcher.sendToServer(message); } } [spoiler=Container which is causing the crash] package coalpower.common.inventory.container; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.InventoryCraftResult; import net.minecraft.inventory.InventoryCrafting; import net.minecraft.inventory.Slot; import net.minecraft.inventory.SlotCrafting; import net.minecraft.item.ItemStack; import coalpower.common.recipe.manager.RecipeWorkbenchManager; import coalpower.common.tileentity.CPTileEntityBase; import coalpower.common.tileentity.TileEntityWorkbench; public class ContainerWorkbench extends CPContainerBase { public InventoryCrafting craftMatrix = new InventoryCrafting(this, 3, 3); public IInventory craftResult = new InventoryCraftResult(); public TileEntityWorkbench tile; public ContainerWorkbench(EntityPlayer player, CPTileEntityBase tile) { super(player, tile); this.tile = (TileEntityWorkbench) tile; updateCraftingMatrix(); //0-8 Crafting for (int row = 0; row < 3; row++) { for (int col = 0; col < 3; col++) { addSlotToContainer(new Slot(this.craftMatrix, col + row * 3, 48 + col * 18, 18 + row * 18)); } } //9-35 Inventory for (int row = 0; row < 3; row++) { for (int col = 0; col < 9; col++) { addSlotToContainer(new Slot((TileEntityWorkbench)tile, col + row * 9 + 9, 8 + 18 * col, 90 + row * 18)); } } for (int col = 0; col < 9; col++) { addSlotToContainer(new Slot(player.inventory, col, 8 + 18 * col, 216)); } for (int row = 0; row < 3; row++) { for (int col = 0; col < 9; col++) { addSlotToContainer(new Slot(player.inventory, col + row * 9 + 9, 8 + 18 * col, 158 + row * 18)); } } this.addSlotToContainer(new SlotCrafting(player, this.craftMatrix, this.craftResult, 99, 143, 36)); this.onCraftMatrixChanged(this.craftMatrix); } public void onCraftMatrixChanged(IInventory p_75130_1_) { this.craftResult.setInventorySlotContents(0, RecipeWorkbenchManager.getInstance().findMatchingRecipe(this.craftMatrix, tile.getWorldObj())); } public void onContainerClosed(EntityPlayer par1EntityPlayer) { super.onContainerClosed(par1EntityPlayer); saveCraftingMatrix(); } private void saveCraftingMatrix() { for (int i = 0; i < craftMatrix.getSizeInventory(); i++) { tile.inventory[i] = craftMatrix.getStackInSlot(i); } } private void updateCraftingMatrix() { for (int i = 0; i < craftMatrix.getSizeInventory(); i++) craftMatrix.setInventorySlotContents(i, tile.inventory[i]); } public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int numSlot) { ItemStack itemstack = null; Slot slot = (Slot) this.inventorySlots.get(numSlot); if (slot != null && slot.getHasStack()) { ItemStack itemstack1 = slot.getStack(); itemstack = itemstack1.copy(); if (numSlot == 99) { if (!this.mergeItemStack(itemstack1, 10, 72, true)) { return null; } slot.onSlotChange(itemstack1, itemstack); } else if(numSlot >= 0 && numSlot <= { if(!this.mergeItemStack(itemstack1, 9, 37, false)){ if(!this.mergeItemStack(itemstack1, 37, 72, false)){ return null; } } } else if (numSlot >= 9 && numSlot <= 35) { if (!this.mergeItemStack(itemstack1, 36, 72, false)) { return null; } } else if (numSlot >= 36 && numSlot <= 72) { if (!this.mergeItemStack(itemstack1, 9, 36, 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; } } [spoiler=PacketGui] package coalpower.common.network.packet; import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayer; import coalpower.CoalPower; import coalpower.common.network.packet.handler.CPAbstractServerMessageHandler; import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.MessageContext; public class PacketGui implements IMessage { private int id; public PacketGui() {} public PacketGui(int id) { this.id = id; } @Override public void fromBytes(ByteBuf buffer) { id = buffer.readInt(); } @Override public void toBytes(ByteBuf buffer) { buffer.writeInt(id); } public static class Handler extends CPAbstractServerMessageHandler<PacketGui> { @Override public IMessage handleServerMessage(EntityPlayer player, PacketGui message, MessageContext ctx) { player.openGui(CoalPower.instance, message.id, player.worldObj, (int) player.posX, (int) player.posY, (int) player.posZ); return null; } } } [spoiler=The block class. (The code i commented out was perfectly working, skip to the bottom of onBlockActivated, when it checks if the player is sneaking, not to waste time)] package coalpower.common.block; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; import coalpower.CoalPower; import coalpower.common.item.ItemBaseHammer; import coalpower.common.network.packet.CPPacketDispatcher; import coalpower.common.network.packet.PacketGui; import coalpower.common.tileentity.TileEntityWorkbench; import coalpower.common.util.InventoryUtil; import cpw.mods.fml.common.network.internal.FMLNetworkHandler; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class BlockWorkbench extends CPTileBlockBase{ private Random rand = new Random(); protected BlockWorkbench() { super(Material.wood); setBlockBounds(0, 0, 0, pixel * 16, pixel * 14, pixel * 16); } @Override @SideOnly(Side.CLIENT) public IIcon getIcon(int side, int meta) { return Blocks.stone_slab.getIcon(0, 0); } @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float fx, float fy, float fz) { TileEntityWorkbench tile = (TileEntityWorkbench) world.getTileEntity(x, y, z); if (tile != null && tile.canActivate) { if (!player.isSneaking()){ if(tile.displayedStack != null){ if(player.getHeldItem() == null){ player.setCurrentItemOrArmor(0, tile.displayedStack.copy()); tile.displayedStack = null; world.markBlockForUpdate(x, y, z); return true; } else if(player.getHeldItem() != null){ if (tile.displayedStack.isItemEqual(player.getHeldItem()) && (player.getHeldItem().stackSize + 1 <= player.getHeldItem().getItem().getItemStackLimit(player.getHeldItem()))) { player.getHeldItem().stackSize++; tile.displayedStack = null; world.markBlockForUpdate(x, y, z); return true; } else if(tile.displayedStack != null && player.getHeldItem().getItem() instanceof ItemBaseHammer){ player.getHeldItem().damageItem(1, player); tile.process(); } } } else { if(player.getHeldItem() != null && !(player.getHeldItem().getItem() instanceof ItemBaseHammer)) { ItemStack stack = player.getHeldItem().copy(); stack.stackSize = 1; tile.displayedStack = stack; player.getHeldItem().stackSize--; if (player.getHeldItem().stackSize <= 0) { player.setCurrentItemOrArmor(0, null); } world.markBlockForUpdate(x, y, z); return true; } } } } if(player.isSneaking()){ //FMLNetworkHandler.openGui(player, CoalPower.instance, 0, world, x, y, z); CPPacketDispatcher.sendToServer(new PacketGui(0)); return true; } return false; } @Override public void breakBlock(World world, int x, int y, int z, Block block, int par4) { TileEntityWorkbench tile = (TileEntityWorkbench) world.getTileEntity(x, y, z); if (tile != null && tile.displayedStack != null && !world.isRemote){ InventoryUtil.dropItem(world, x, y, z, ForgeDirection.UP, tile.displayedStack.copy()); } for(int i = 0; i == tile.getSizeInventory(); i++){ if (tile.inventory[i] != null && !world.isRemote){ InventoryUtil.dropItem(world, x, y, z, ForgeDirection.UP, tile.getStackInSlot(i).copy()); } } super.breakBlock(world, x, y, z, block, par4); } @Override public TileEntity createNewTileEntity(World par1, int par2) { return new TileEntityWorkbench(); } @Override public boolean hasCustomRenderer() { return true; } @Override public void registerBlockIcons(IIconRegister iconRegister) { } } The rest of the classes is as shown on CoolAlias's github (Yes. I am damn lazy, but I will change it. It was just a test) So, the game crashes whenever I open my gui. [spoiler=Crash Log] [18:27:41] [server thread/ERROR] [FML]: SimpleChannelHandlerWrapper exception java.lang.NullPointerException at coalpower.common.inventory.container.ContainerWorkbench.updateCraftingMatrix(ContainerWorkbench.java:74) ~[ContainerWorkbench.class:?] at coalpower.common.inventory.container.ContainerWorkbench.<init>(ContainerWorkbench.java:25) ~[ContainerWorkbench.class:?] at coalpower.common.core.CPGuiHandler.getServerGuiElement(CPGuiHandler.java:24) ~[CPGuiHandler.class:?] at cpw.mods.fml.common.network.NetworkRegistry.getRemoteGuiContainer(NetworkRegistry.java:241) ~[NetworkRegistry.class:?] at cpw.mods.fml.common.network.internal.FMLNetworkHandler.openGui(FMLNetworkHandler.java:75) ~[FMLNetworkHandler.class:?] at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2500) ~[EntityPlayer.class:?] at coalpower.common.network.packet.PacketGui$Handler.handleServerMessage(PacketGui.java:31) ~[PacketGui$Handler.class:?] at coalpower.common.network.packet.PacketGui$Handler.handleServerMessage(PacketGui.java:1) ~[PacketGui$Handler.class:?] at coalpower.common.network.packet.handler.CPAbstractMessageHandler.onMessage(CPAbstractMessageHandler.java:23) ~[CPAbstractMessageHandler.class:?] at cpw.mods.fml.common.network.simpleimpl.SimpleChannelHandlerWrapper.channelRead0(SimpleChannelHandlerWrapper.java:37) ~[simpleChannelHandlerWrapper.class:?] at cpw.mods.fml.common.network.simpleimpl.SimpleChannelHandlerWrapper.channelRead0(SimpleChannelHandlerWrapper.java:17) ~[simpleChannelHandlerWrapper.class:?] at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:98) ~[simpleChannelInboundHandler.class:?] at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [DefaultChannelHandlerContext.class:?] at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [DefaultChannelHandlerContext.class:?] at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:101) [simpleChannelInboundHandler.class:?] at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [DefaultChannelHandlerContext.class:?] at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [DefaultChannelHandlerContext.class:?] at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) [MessageToMessageDecoder.class:?] at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) [MessageToMessageCodec.class:?] at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [DefaultChannelHandlerContext.class:?] at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [DefaultChannelHandlerContext.class:?] at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785) [DefaultChannelPipeline.class:?] at io.netty.channel.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:169) [EmbeddedChannel.class:?] at cpw.mods.fml.common.network.internal.FMLProxyPacket.processPacket(FMLProxyPacket.java:86) [FMLProxyPacket.class:?] at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241) [NetworkManager.class:?] at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182) [NetworkSystem.class:?] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:726) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614) [MinecraftServer.class:?] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) [integratedServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752) [MinecraftServer$2.class:?] [18:27:41] [server thread/ERROR] [FML]: There was a critical exception handling a packet on channel coalpower java.lang.NullPointerException at coalpower.common.inventory.container.ContainerWorkbench.updateCraftingMatrix(ContainerWorkbench.java:74) ~[ContainerWorkbench.class:?] at coalpower.common.inventory.container.ContainerWorkbench.<init>(ContainerWorkbench.java:25) ~[ContainerWorkbench.class:?] at coalpower.common.core.CPGuiHandler.getServerGuiElement(CPGuiHandler.java:24) ~[CPGuiHandler.class:?] at cpw.mods.fml.common.network.NetworkRegistry.getRemoteGuiContainer(NetworkRegistry.java:241) ~[NetworkRegistry.class:?] at cpw.mods.fml.common.network.internal.FMLNetworkHandler.openGui(FMLNetworkHandler.java:75) ~[FMLNetworkHandler.class:?] at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2500) ~[EntityPlayer.class:?] at coalpower.common.network.packet.PacketGui$Handler.handleServerMessage(PacketGui.java:31) ~[PacketGui$Handler.class:?] at coalpower.common.network.packet.PacketGui$Handler.handleServerMessage(PacketGui.java:1) ~[PacketGui$Handler.class:?] at coalpower.common.network.packet.handler.CPAbstractMessageHandler.onMessage(CPAbstractMessageHandler.java:23) ~[CPAbstractMessageHandler.class:?] at cpw.mods.fml.common.network.simpleimpl.SimpleChannelHandlerWrapper.channelRead0(SimpleChannelHandlerWrapper.java:37) ~[simpleChannelHandlerWrapper.class:?] at cpw.mods.fml.common.network.simpleimpl.SimpleChannelHandlerWrapper.channelRead0(SimpleChannelHandlerWrapper.java:17) ~[simpleChannelHandlerWrapper.class:?] at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:98) ~[simpleChannelInboundHandler.class:?] at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) ~[DefaultChannelHandlerContext.class:?] at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) ~[DefaultChannelHandlerContext.class:?] at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:101) ~[simpleChannelInboundHandler.class:?] at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) ~[DefaultChannelHandlerContext.class:?] at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) ~[DefaultChannelHandlerContext.class:?] at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) ~[MessageToMessageDecoder.class:?] at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) ~[MessageToMessageCodec.class:?] at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) ~[DefaultChannelHandlerContext.class:?] at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) ~[DefaultChannelHandlerContext.class:?] at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785) ~[DefaultChannelPipeline.class:?] at io.netty.channel.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:169) ~[EmbeddedChannel.class:?] at cpw.mods.fml.common.network.internal.FMLProxyPacket.processPacket(FMLProxyPacket.java:86) [FMLProxyPacket.class:?] at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241) [NetworkManager.class:?] at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182) [NetworkSystem.class:?] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:726) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614) [MinecraftServer.class:?] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) [integratedServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752) [MinecraftServer$2.class:?] Alright so, I am asking help because i've never used this SimpleNetworkWrapper thingy and it seems strange to me, as my code works without sending the packet.. does this have to do with the Side my packet is sent to? Sorry in advance for having bothered you all I will try and solve it by myself too. Oh, and don't look at the rest of my code, I am recoding everything..
-
Problem updating to 1.7
Alright, but some other blocks still work, having those spaces too.
-
Problem updating to 1.7
Alright, i solved every error, but now language files load only for certain items. For example, I have a block which is shown up as tile.block.ash.name in my tab. In my lang file i have tile.block.ash.name = Ash (I also tried with tile.block.ash, block.ash.name, block.ash) but still nothing.
-
Problem updating to 1.7
Man, I just discovered everything as soon as you replied. Also, i forgot to put the resource folder containing my lang files, which I already use in 2 different languages. (I have everything set up already) Let me try moving the lang file to the folder, and I'll see if it works.
-
Problem updating to 1.7
Alrighty. Sorry If i haven't read it carefully enough, It's just stress. Note to self and everyone else: don't code if stressed. Don't do it. Anyways, i'm still tired to code right now, so I'll do the lazy hated guy and throw y'all the code: package coalpower.core; import net.minecraft.block.Block; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import coalpower.CPLoader; import coalpower.lib.block.BlockLoader; import coalpower.lib.lang.LanguageHandler; import coalpower.lib.metadata.DustEnum; import coalpower.lib.metadata.OreEnum; import cpw.mods.fml.common.registry.LanguageRegistry; public class CPTab extends CreativeTabs { public static CreativeTabs resource; public static CreativeTabs tool; public static CreativeTabs world; public static CreativeTabs machine; public Item itemID = Items.apple; public int itemMeta = 0; static { resource = new CPTab(LanguageHandler.getInstance().translate("cptab.resource")).setIcon(Item.getItemFromBlock(CPLoader.ore), OreEnum.COPPER.ordinal()); //world = new CPTab(LanguageHandler.getInstance().translate("cptab.world")).setIcon(Config.blockProjectTableID, 0); machine = new CPTab(LanguageHandler.getInstance().translate("cptab.machine")).setIcon(Item.getItemFromBlock(BlockLoader.MACHINE_SAWMILL), 0); } public CPTab(String label) { super(label.toLowerCase().replace(" ", "_")); LanguageRegistry.instance().addStringLocalization("itemGroup." + label.toLowerCase().replace(" ", "_"), label); } public CPTab setIcon(Item id, int meta) { this.itemID = id; this.itemMeta = meta; return this; } public CPTab setIcon(ItemStack stack) { this.itemID = stack.getItem(); this.itemMeta = stack.getItemDamage(); return this; } @Override public ItemStack getIconItemStack() { return new ItemStack(itemID, 1, itemMeta); } @Override public Item getTabIconItem() { return null; } } I think I'll go to sleep, 2am over here. Tomorrow I'll doublecheck my code The strange thing here is that it suddenly started crashing, whereas it didn't do this 3 weeks ago (Same exact code)
-
Problem updating to 1.7
Alright, I am tired and sick of getting errors, so I'll type just the needed. I am updating my code from 1.6 to 1.7. No errors shown in eclipse, but when I run it, I get an ExceptionInInitializerError at a setCreativeTab() line in my code. This is happening only to my metadata items and blocks. Here's the code of one of them and the crash log: Block package coalpower.block; import java.util.List; import java.util.Random; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; import coalpower.core.CPTab; import coalpower.lib.metadata.OreEnum; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class BlockBaseOre extends BlockBase { public static final float DEFAULT_RESISTANCE = 5F; public static final float DEFAULT_HARDNESS = 3F; public IIcon[] oreOnly; @SideOnly(Side.CLIENT) public long soundDelay; public BlockBaseOre(int i) { super(i, Material.rock, ItemBlockBaseOre.class, OreEnum.class); setHardness(DEFAULT_HARDNESS); setResistance(DEFAULT_RESISTANCE); //setCreativeTab(CPTab.resource); } public boolean isBlockSolidOnSide(World world, int x, int y, int z, ForgeDirection side) { return true; } public boolean renderAsNormalBlock() { return false; } @Override public float getBlockHardness(World world, int x, int y, int z) { return this.DEFAULT_HARDNESS; } @Override @SideOnly(Side.CLIENT) @SuppressWarnings({"unchecked", "rawtypes"}) public void getSubBlocks(Item unknown, CreativeTabs tab, List subItems) { for (OreEnum ore : OreEnum.values()) { subItems.add(ore.toItemStack()); } } @SuppressWarnings("unused") @Override public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) { int meta = world.getBlockMetadata(x, y, z); IIcon[] blockIcons = null; if (blockIcons != null) { if (blockIcons.length == 6) { return blockIcons[side]; } } return getIcon(side, meta); } @Override public IIcon getIcon(int side, int metadata) { return textures[metadata]; } @Override public Item getItemDropped(int par1, Random par2Random, int par3){ return OreEnum.get(par3).toItemStack().getItem(); } @Override public void registerBlockIcons(IIconRegister registry) { super.registerBlockIcons(registry); oreOnly = new IIcon[OreEnum.values().length]; for (int i = 1; i < OreEnum.values().length; i++) { oreOnly[i] = registry.registerIcon(OreEnum.get(i).getTextureFile()); } } } And the log: [00:03:10] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLTweaker [00:03:10] [main/INFO] [LaunchWrapper]: Using primary tweak class name cpw.mods.fml.common.launcher.FMLTweaker [00:03:10] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLTweaker [00:03:10] [main/INFO] [FML]: Forge Mod Loader version 7.2.195.1080 for Minecraft 1.7.2 loading [00:03:10] [main/INFO] [FML]: Java is Java HotSpot(TM) 64-Bit Server VM, version 1.7.0_45, running on Windows 7:amd64:6.1, installed at C:\Program Files\Java\jre7 [00:03:10] [main/INFO] [FML]: Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation [00:03:10] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker [00:03:10] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLDeobfTweaker [00:03:10] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker [00:03:10] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker [00:03:10] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.relauncher.CoreModManager$FMLPluginWrapper [00:03:11] [main/ERROR] [FML]: The binary patch set is missing. Either you are in a development environment, or things are not going to work! [00:03:11] [main/ERROR] [FML]: The minecraft jar file:/C:/Users/pakard/.gradle/caches/minecraft/net/minecraftforge/forge/1.7.2-10.12.1.1080/forgeSrc-1.7.2-10.12.1.1080.jar!/net/minecraft/client/ClientBrandRetriever.class appears to be corrupt! There has been CRITICAL TAMPERING WITH MINECRAFT, it is highly unlikely minecraft will work! STOP NOW, get a clean copy and try again! [00:03:11] [main/ERROR] [FML]: FML has been ordered to ignore the invalid or missing minecraft certificate. This is very likely to cause a problem! [00:03:11] [main/ERROR] [FML]: Technical information: ClientBrandRetriever was at jar:file:/C:/Users/pakard/.gradle/caches/minecraft/net/minecraftforge/forge/1.7.2-10.12.1.1080/forgeSrc-1.7.2-10.12.1.1080.jar!/net/minecraft/client/ClientBrandRetriever.class, there were 0 certificates for it [00:03:11] [main/ERROR] [FML]: FML appears to be missing any signature data. This is not a good thing [00:03:11] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.relauncher.CoreModManager$FMLPluginWrapper [00:03:11] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLDeobfTweaker [00:03:12] [main/INFO] [LaunchWrapper]: Launching wrapped minecraft {net.minecraft.client.main.Main} [00:03:13] [main/INFO]: Setting user: Player949 [00:03:16] [Client thread/INFO]: LWJGL Version: 2.9.0 [00:03:17] [Client thread/INFO] [MinecraftForge]: Attempting early MinecraftForge initialization [00:03:17] [Client thread/INFO] [FML]: MinecraftForge v10.12.1.1080 Initialized [00:03:17] [Client thread/INFO] [FML]: Replaced 141 ore recipies [00:03:17] [Client thread/INFO] [MinecraftForge]: Completed early MinecraftForge initialization [00:03:17] [Client thread/INFO] [FML]: Searching C:\Modding\MechaniCraft\1.7\eclipse\mods for mods [00:03:19] [Client thread/ERROR] [FML]: FML has detected a mod that is using a package name based on 'net.minecraft.src' : net.minecraft.src.FMLRenderAccessLibrary. This is generally a severe programming error. There should be no mod code in the minecraft namespace. MOVE YOUR MOD! If you're in eclipse, select your source code and 'refactor' it into a new package. Go on. DO IT NOW! [00:03:22] [Client thread/INFO] [FML]: Forge Mod Loader has identified 4 mods to load [00:03:23] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:CoalPower-old [00:03:23] [Client thread/INFO] [FML]: Configured a dormant chunk cache size of 0 Starting up SoundSystem... Initializing LWJGL OpenAL (The LWJGL binding of OpenAL. For more information, see http://www.lwjgl.org) OpenAL initialized. [00:03:24] [sound Library Loader/INFO]: Sound engine started [00:03:25] [Client thread/INFO]: Created: 512x256 textures/blocks-atlas [00:03:26] [Client thread/INFO]: Created: 256x256 textures/items-atlas [00:03:26] [Client thread/ERROR] [FML]: Fatal errors were detected during the transition from INITIALIZATION to POSTINITIALIZATION. Loading cannot continue [00:03:26] [Client thread/ERROR] [FML]: mcp{9.03} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized FML{7.2.195.1080} [Forge Mod Loader] (forgeSrc-1.7.2-10.12.1.1080.jar) Unloaded->Constructed->Pre-initialized->Initialized Forge{10.12.1.1080} [Minecraft Forge] (forgeSrc-1.7.2-10.12.1.1080.jar) Unloaded->Constructed->Pre-initialized->Initialized CoalPower-old{0.0.1} [CoalPower-old] (bin) Unloaded->Constructed->Pre-initialized->Errored [00:03:26] [Client thread/ERROR] [FML]: The following problems were captured during this phase [00:03:26] [Client thread/ERROR] [FML]: Caught exception from CoalPower-old java.lang.ExceptionInInitializerError at coalpower.block.BlockBaseOre.<init>(BlockBaseOre.java:33) ~[blockBaseOre.class:?] at coalpower.CPLoader.load(CPLoader.java:50) ~[CPLoader.class:?] at coalpower.CoalPower.load(CoalPower.java:68) ~[CoalPower.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_45] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_45] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_45] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_45] at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:513) ~[FMLModContainer.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_45] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_45] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_45] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_45] at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74) ~[guava-15.0.jar:?] at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:47) ~[guava-15.0.jar:?] at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314) ~[guava-15.0.jar:?] at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296) ~[guava-15.0.jar:?] at com.google.common.eventbus.EventBus.post(EventBus.java:267) ~[guava-15.0.jar:?] at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:208) ~[LoadController.class:?] at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:187) ~[LoadController.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_45] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_45] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_45] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_45] at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74) ~[guava-15.0.jar:?] at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:47) ~[guava-15.0.jar:?] at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314) ~[guava-15.0.jar:?] at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296) ~[guava-15.0.jar:?] at com.google.common.eventbus.EventBus.post(EventBus.java:267) ~[guava-15.0.jar:?] at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:118) [LoadController.class:?] at cpw.mods.fml.common.Loader.initializeMods(Loader.java:687) [Loader.class:?] at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:288) [FMLClientHandler.class:?] at net.minecraft.client.Minecraft.startGame(Minecraft.java:585) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:892) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:112) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_45] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_45] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_45] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_45] at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) [launchwrapper-1.9.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.9.jar:?] Caused by: java.lang.NullPointerException at coalpower.core.CPTab.<init>(CPTab.java:33) ~[CPTab.class:?] at coalpower.core.CPTab.<clinit>(CPTab.java:27) ~[CPTab.class:?] ... 40 more ---- Minecraft Crash Report ---- // You should try our sister game, Minceraft! Time: 31/05/14 0.03 Description: There was a severe problem during mod loading that has caused the game to fail cpw.mods.fml.common.LoaderException: java.lang.ExceptionInInitializerError at cpw.mods.fml.common.LoadController.transition(LoadController.java:162) at cpw.mods.fml.common.Loader.initializeMods(Loader.java:688) at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:288) at net.minecraft.client.Minecraft.startGame(Minecraft.java:585) at net.minecraft.client.Minecraft.run(Minecraft.java:892) at net.minecraft.client.main.Main.main(Main.java:112) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) Caused by: java.lang.ExceptionInInitializerError at coalpower.block.BlockBaseOre.<init>(BlockBaseOre.java:33) at coalpower.CPLoader.load(CPLoader.java:50) at coalpower.CoalPower.load(CoalPower.java:68) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:513) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74) at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296) at com.google.common.eventbus.EventBus.post(EventBus.java:267) at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:208) at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:187) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74) at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296) at com.google.common.eventbus.EventBus.post(EventBus.java:267) at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:118) at cpw.mods.fml.common.Loader.initializeMods(Loader.java:687) ... 10 more Caused by: java.lang.NullPointerException at coalpower.core.CPTab.<init>(CPTab.java:33) at coalpower.core.CPTab.<clinit>(CPTab.java:27) ... 40 more A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- System Details -- Details: Minecraft Version: 1.7.2 Operating System: Windows 7 (amd64) version 6.1 Java Version: 1.7.0_45, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 689243368 bytes (657 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB) JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0 FML: MCP v9.03 FML v7.2.195.1080 Minecraft Forge 10.12.1.1080 4 mods loaded, 4 mods active mcp{9.03} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized FML{7.2.195.1080} [Forge Mod Loader] (forgeSrc-1.7.2-10.12.1.1080.jar) Unloaded->Constructed->Pre-initialized->Initialized Forge{10.12.1.1080} [Minecraft Forge] (forgeSrc-1.7.2-10.12.1.1080.jar) Unloaded->Constructed->Pre-initialized->Initialized CoalPower-old{0.0.1} [CoalPower-old] (bin) Unloaded->Constructed->Pre-initialized->Errored #@!@# Game crashed! Crash report saved to: #@!@# C:\Modding\MechaniCraft\1.7\eclipse\.\crash-reports\crash-2014-05-31_00.03.26-client.txt AL lib: (EE) alc_cleanup: 1 device not closed I AM DESPERATE.
-
RenderBiped renders two heads?
SOLVED BY COMMENTING OUT super.render() IN MY MODEL CLASS.
-
RenderBiped renders two heads?
So actually my actual question is: is there a way to render equipped items without using RenderBiped (Which extends RenderLiving), without copy-pasting renderEquippedItems code (Which I tired, and turned out not to be working)?
-
RenderBiped renders two heads?
Here I am, after months, with new issues So basically I want to render a pickaxe held by my custom villager, so I use RenderBiped. Before, it wasn't rendering the item because i was using RenderLiving, but I also haven't had this issue back then, so the problem is RenderBiped itself. Model (Properly generated with techne and adjusted) Render file
-
IItemRenderer not working
Yes, the config id is correct, since I tried rendering other items, but none of them work. I'm setting breakpoints right now, I'll let you know So, if I set the breakpoint in the renderItem function, It's not even getting called. The class's constructor obviously is, so I don't know what's happening..
-
IItemRenderer not working
Even If this is not required, since other IItemRenderers are registered in this way and work properly, It doesn't hurt me to. Main Class (Commented out everything so yuo can understand what's going on) package coalpower; import net.minecraft.util.DamageSource; import net.minecraftforge.common.MinecraftForge; import coalpower.addon.AddonManager; import coalpower.core.CPKeyBindings; import coalpower.core.Config; import coalpower.enchantment.EnchantmentTimedDamage; import coalpower.info.dev.CapeHandler; import coalpower.lib.core.AchievementLoader; import coalpower.lib.handler.CPEventHandler; import coalpower.lib.handler.GuiHandler; import coalpower.lib.handler.PacketHandler; import coalpower.lib.handler.SoundHandler; import coalpower.lib.world.BiomeLoader; import coalpower.lib.world.CPLoot; import coalpower.lib.world.RadiationDamageSource; import coalpower.network.proxy.ICPProxy; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.Mod.Instance; 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; @Mod(modid = CoalPower.modid, name = CoalPower.modid, version = CoalPower.version) @NetworkMod(clientSideRequired = true, serverSideRequired = false, channels={ CoalPower.channel }, packetHandler = PacketHandler.class) public class CoalPower { @Instance("CoalPower") public static CoalPower instance; public static final String modid = "CoalPower"; public static final String version = "0.0.1"; public static final String channel = "coalPower"; public static AchievementLoader achievements; public static EnchantmentTimedDamage coalTouch = new EnchantmentTimedDamage(100, 1, "Coal Touch"); public static GuiHandler guiHandler = new GuiHandler(); public static DamageSource radiation = new RadiationDamageSource("radiation").setDamageBypassesArmor(); @SidedProxy(clientSide = "coalpower.network.proxy.ClientProxy", serverSide = "coalpower.network.proxy.CommonProxy") public static ICPProxy proxy; @EventHandler public void PreInit(FMLPreInitializationEvent event) { //Config for ids Config.preInit(event); //Capes CapeHandler.registerCapesFromList(CapeHandler.devList, CapeHandler.devCape); //Achievements achievements = new AchievementLoader(); //Events and sounds MinecraftForge.EVENT_BUS.register(new CPEventHandler()); MinecraftForge.EVENT_BUS.register(new SoundHandler()); //KeyBindings if (FMLCommonHandler.instance().getEffectiveSide().isClient()) CPKeyBindings.init(); } @EventHandler public void load(FMLInitializationEvent event) { //Blocks, items, entites, custom dungeon chests and proxy registrations CPLoader.load(); CPLoot.init(); proxy.init(); } @EventHandler public void PostInit(FMLPostInitializationEvent event) { //Addons and biomes AddonManager.loadAddons(); AddonManager.init(); BiomeLoader biomes = new BiomeLoader(); biomes.register(); } } ClientProxy package coalpower.network.proxy; import java.util.Random; import net.minecraft.client.Minecraft; import net.minecraft.client.particle.EntityFX; import net.minecraft.world.World; import net.minecraft.world.WorldType; import net.minecraft.world.biome.BiomeGenBase; import net.minecraftforge.client.MinecraftForgeClient; import net.minecraftforge.common.BiomeManager; import coalpower.client.render.block.RenderAlloyFurnace; import coalpower.client.render.block.RenderGas; import coalpower.client.render.blockitem.RenderItemCrusher; import coalpower.client.render.blockitem.RenderItemGasPipe; import coalpower.client.render.blockitem.RenderItemSawmill; import coalpower.client.render.blockitem.RenderItemSprinkler; import coalpower.client.render.entity.RenderBee; import coalpower.client.render.item.RenderItemBackpack; import coalpower.client.render.machine.RenderCrusher; import coalpower.client.render.machine.RenderSawmill; import coalpower.client.render.machine.RenderSprinkler; import coalpower.client.render.machine.pipe.RenderPipeGas; import coalpower.core.Config; import coalpower.entity.EntityBee; import coalpower.entity.fx.EntitySparkFX; import coalpower.entity.fx.EntityWoodDustFX; import coalpower.lib.core.FXType; import coalpower.tileentity.TileEntityHeatConductant; import coalpower.tileentity.furnace.TileEntityAlloyFurnace; import coalpower.tileentity.machine.TileEntityCrusher; import coalpower.tileentity.machine.TileEntityPoweredFurnace; import coalpower.tileentity.machine.TileEntityProjectTable; import coalpower.tileentity.machine.TileEntitySawmill; import coalpower.tileentity.machine.TileEntitySprinkler; import coalpower.tileentity.machine.conductor.TileEntityGasPipe; import coalpower.world.GenerationManager; import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.client.registry.ClientRegistry; import cpw.mods.fml.client.registry.RenderingRegistry; import cpw.mods.fml.common.registry.GameRegistry; public class ClientProxy extends CommonProxy { @Override public void init(){ super.init(); this.registerEntities(); this.registerGeneric(); this.registerRenderers(); this.registerTileEntities(); this.registerWorldFeatures(); } @Override public void registerRenderers() { super.registerRenderers(); //Entities RenderingRegistry.registerEntityRenderingHandler(EntityBee.class, new RenderBee()); //Blocks / Items RenderingRegistry.registerBlockHandler(renderGasBlock, new RenderGas()); RenderingRegistry.registerBlockHandler(renderAlloyFurnace, RenderAlloyFurnace.INSTANCE); MinecraftForgeClient.registerItemRenderer(Config.machineCrusherID, new RenderItemCrusher()); MinecraftForgeClient.registerItemRenderer(Config.machineSawmillID, new RenderItemSawmill()); MinecraftForgeClient.registerItemRenderer(Config.pipeGasID, new RenderItemGasPipe()); MinecraftForgeClient.registerItemRenderer(Config.machineSprinklerID, new RenderItemSprinkler()); MinecraftForgeClient.registerItemRenderer(Config.itemBackpackID, new RenderItemBackpack()); //TileEntities ClientRegistry.bindTileEntitySpecialRenderer(TileEntityCrusher.class, new RenderCrusher()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntitySawmill.class, new RenderSawmill()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityGasPipe.class, new RenderPipeGas()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntitySprinkler.class, new RenderSprinkler()); } @Override public void registerWorldFeatures(){ super.registerWorldFeatures(); GameRegistry.registerWorldGenerator(GenerationManager.instance); } @Override public void registerTileEntities(){ super.registerTileEntities(); GameRegistry.registerTileEntity(TileEntityAlloyFurnace.class, "FurnaceAlloy"); GameRegistry.registerTileEntity(TileEntityPoweredFurnace.class, "FurnacePowered"); GameRegistry.registerTileEntity(TileEntityProjectTable.class, "BlockProjectTable"); GameRegistry.registerTileEntity(TileEntityCrusher.class, "MachineCrusher"); GameRegistry.registerTileEntity(TileEntitySawmill.class, "MachineSawmill"); GameRegistry.registerTileEntity(TileEntityGasPipe.class, "PipeGas"); GameRegistry.registerTileEntity(TileEntitySprinkler.class, "MachineSprinkler"); } @Override public void spawnParticle(String s, double d, double d1, double d2, double d3, double d4, double d5, World worldObj, int opt) { super.spawnParticle(s, d, d1, d2, d3, d4, d5, worldObj, opt); Minecraft mc = Minecraft.getMinecraft(); if (mc == null || mc.renderViewEntity == null || mc.effectRenderer == null) { return; } int i = mc.gameSettings.particleSetting; if (i == 1 && worldObj.rand.nextInt(3) == 0) { i = 2; } double d6 = mc.renderViewEntity.posX - d; double d7 = mc.renderViewEntity.posY - d1; double d8 = mc.renderViewEntity.posZ - d2; EntityFX obj = null; double d9 = 16D; if (d6 * d6 + d7 * d7 + d8 * d8 > d9 * d9) { return; } if (i > 1) { return; } if (s.equals("wooddust")) obj = new EntityWoodDustFX(worldObj, d, d1, d2, (float)d3, (float)d4, (float)d5); else if(s.equals("spark")) obj = new EntitySparkFX(worldObj, d, d1, d2, false); else if(s.equals("randomspark")) obj = new EntitySparkFX(worldObj, d, d1, d2, true); if (obj != null) { mc.effectRenderer.addEffect((EntityFX)obj); FMLClientHandler.instance().getClient().effectRenderer.addEffect(obj); } } @Override public void addBiome(final BiomeGenBase biome){ final WorldType[] worldTypes = { WorldType.DEFAULT, WorldType.LARGE_BIOMES }; for(final WorldType worldType : worldTypes){ worldType.addNewBiome(biome); } } @Override public void addSpawnBiome(final BiomeGenBase biome){ BiomeManager.addSpawnBiome(biome); } }
-
IItemRenderer not working
What I mean by that is that only blocks with TileEntities get rendered as 3d items with IItemRenderer whereas items (Such as my backpack) don't get renderer at all. All I can see is the item texture in my hand, just like every other item instead of a custom model So for instance I have a Pipe which has got a TileEntity. This pipe gets rendered with IItemRenderer. Backpack won't get rendered at all. Example of what I'm trying to explain: This is not what I want. The backpack should not be a plain texture but a custom model
-
IItemRenderer not working
So what i'm trying to do is rendering a backpack when held. I have multiple working IItemrenderers that work fine. I noticed how those IItemrenderers work only when they render blocks with tileentities, while they don't work on items. RenderItemBackpack: package coalpower.client.render.item; import net.minecraft.client.Minecraft; import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.IItemRenderer; import net.minecraftforge.client.IItemRenderer.ItemRenderType; import net.minecraftforge.client.IItemRenderer.ItemRendererHelper; import org.lwjgl.opengl.GL11; import coalpower.client.model.ModelBackpackHandheld; import coalpower.lib.render.Texture; public class RenderItemBackpack implements IItemRenderer { private ModelBackpackHandheld backpacks; private Texture texture = Texture.BACKPACK; public RenderItemBackpack() { backpacks = new ModelBackpackHandheld(); } @Override public boolean handleRenderType(ItemStack item, ItemRenderType type) { return true; } @Override public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { return true; } @Override public void renderItem(ItemRenderType type, ItemStack item, Object... data) { switch (type) { case ENTITY: { texture.bind(); GL11.glPushMatrix(); GL11.glTranslatef(0F, 1F, 0F); GL11.glRotatef(180, 1, 0, 0); GL11.glRotatef(-90, 0, 1, 0); backpacks.render((Entity)data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F); GL11.glPopMatrix(); break; } case EQUIPPED: { texture.bind(); GL11.glPushMatrix(); GL11.glTranslatef(0.5F, 1.5F, 0.5F); GL11.glRotatef(180, 1, 0, 0); GL11.glRotatef(-90, 0, 1, 0); backpacks.render((Entity)data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F); GL11.glPopMatrix(); break; } case EQUIPPED_FIRST_PERSON: { texture.bind(); GL11.glPushMatrix(); GL11.glTranslatef(1F, 2F, 1F); GL11.glRotatef(180, 1, 0, 0); GL11.glRotatef(-90, 0, 1, 0); backpacks.render((Entity)data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F); GL11.glPopMatrix(); break; } default: break; } } } ClientProxy MinecraftForgeClient.registerItemRenderer(Config.itemBackpackID, new RenderItemBackpack()); This is how I did it for every other block, and it works fine, so I don't know what to do..
-
Advanced Terrain Generation? (Maths, aww )
Some fairly simple math.. well for you COuld you make me an example? I really need that..
-
Advanced Terrain Generation? (Maths, aww )
First of all, before starting I have to say that I'm not very good at maths. I don't want to know how other mods generate their ores, structures and biomes, since there's no math involved. What I'm trying to do is make a volcano. (ouch) I've seen Project Red's Source code and I really couldn't understand anything of how they achieve this. Seriously, should I stop my mod because of this? Because maths are involved in particles and terrain gen, that I really need, and I'm 14, so can't have an huge knowledge. I'm banging my head against a wall right now.
IPS spam blocked by CleanTalk.