Jump to content

BRHSM

Members
  • Posts

    28
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

BRHSM's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. You are trying to use something in your code that can't be null but you are giving it a null to use. The itemstack you are passing is null. Make sure that you initialize it
  2. Hi, I have 5 ores which I want to generate in the world but the problem is that my customGenerator Is not working correctly. public boolean generate(World worldIn, Random p_180709_2_, BlockPos p_180709_3_) { float f = p_180709_2_.nextFloat() * (float)Math.PI; double d0 = (double)((float)(p_180709_3_.getX() + + MathHelper.sin(f) * (float)this.maxVainSize / 8.0F); double d1 = (double)((float)(p_180709_3_.getX() + - MathHelper.sin(f) * (float)this.maxVainSize / 8.0F); double d2 = (double)((float)(p_180709_3_.getZ() + + MathHelper.cos(f) * (float)this.maxVainSize / 8.0F); double d3 = (double)((float)(p_180709_3_.getZ() + - MathHelper.cos(f) * (float)this.maxVainSize / 8.0F); double d4 = (double)(p_180709_3_.getY() + p_180709_2_.nextInt(3) - 2); double d5 = (double)(p_180709_3_.getY() + p_180709_2_.nextInt(3) - 2); for (int i = 0; i < this.maxVainSize; ++i) { float f1 = (float)i / (float)this.maxVainSize; double d6 = d0 + (d1 - d0) * (double)f1; double d7 = d4 + (d5 - d4) * (double)f1; double d8 = d2 + (d3 - d2) * (double)f1; double d9 = p_180709_2_.nextDouble() * (double)this.maxVainSize / 16.0D; double d10 = (double)(MathHelper.sin((float)Math.PI * f1) + 1.0F) * d9 + 1.0D; double d11 = (double)(MathHelper.sin((float)Math.PI * f1) + 1.0F) * d9 + 1.0D; int j = MathHelper.floor_double(d6 - d10 / 2.0D); int k = MathHelper.floor_double(d7 - d11 / 2.0D); int l = MathHelper.floor_double(d8 - d10 / 2.0D); int i1 = MathHelper.floor_double(d6 + d10 / 2.0D); int j1 = MathHelper.floor_double(d7 + d11 / 2.0D); int k1 = MathHelper.floor_double(d8 + d10 / 2.0D); for (int l1 = j; l1 <= i1; ++l1) { double d12 = ((double)l1 + 0.5D - d6) / (d10 / 2.0D); if (d12 * d12 < 1.0D) { for (int i2 = k; i2 <= j1; ++i2) { double d13 = ((double)i2 + 0.5D - d7) / (d11 / 2.0D); if (d12 * d12 + d13 * d13 < 1.0D) { for (int j2 = l; j2 <= k1; ++j2) { double d14 = ((double)j2 + 0.5D - d8) / (d10 / 2.0D); if (d12 * d12 + d13 * d13 + d14 * d14 < 1.0D) { BlockPos blockpos1 = new BlockPos(l1, i2, j2); if (this.isReplacable(worldIn, blockpos1, this.genIn)) { //worldIn.setBlockState(blockpos1, this.block, 2); Ores Don't generate if this isn't there but the coordinates in the log aren't right if (this.genNear == null){ worldIn.setBlockState(blockpos1, this.block, 2); if(ExitedBuilderMod.DEBUG) System.out.println("Generating at: " + blockpos1.getX() +","+ blockpos1.getY() +","+ blockpos1.getZ()); }else{ if(this.isNear(blockpos1, this.genNear, this.genDistance, worldIn)) worldIn.setBlockState(blockpos1, this.block, 2); } } } } } } } } } return true; } This is a modified version of the vanilla ore generator but with the ability to specify the blocks it generates in and the blocks it generates near to. if I uncomment the statement in there the blocks will generate on the right spot (if you move that println directly under it it will tell you the coordinates of the ore when generated ) but If I pass it trought the if (Like the code is now) it will not generate at the spot the println sais it does. Example: [21:50:51] [server thread/INFO] [sTDOUT]: [com.miner11crafter.exitedbuildermod.customs.CustomGenerator:generate:112]: Generating at: 265,24,470 but it generated at 265,52,471. Why does it do that? how can I fix it? How can I corectly make blocks generate with a way to generate them in specific blocks and or near specific blocks? If you need more code let me know!
  3. I don't know if i am registring everything right: package Com.BRHSM.Mod.Registry; import Com.BRHSM.Mod.Handler.GuiHandler; import Com.BRHSM.Mod.TileEntities.TileEntityGemSmelter; import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.common.registry.GameRegistry; public abstract class ClientProxy extends ServerProxy{ public void registerRenderThings() { } public int addArmor(String armor) { return 0; } public void registerNetworkStuff(){ } public void registerTileEntities(){ GameRegistry.registerTileEntity(TileEntityGemSmelter.class, MainRegistry.MODID); } }
  4. here you go: http://pastebin.com/KqcTHs2H
  5. yes they exist, they are set up correctly and spelled correctly I dont know what inherit means though, can you explain?
  6. i have this server and client proxy but i can't load them: @SidedProxy(clientSide = "Com.BRHSM.Mod.Registry.ClientProxy",serverSide = "Com.BRHSM.Mod.Registry.ServerProxy") public static ServerProxy Proxy; the wierd thing is that there is no error in the changelog, just a crach that sais this in the console [17:47:04] [Client thread/ERROR] [FML]: An error occured trying to load a proxy into {serverSide=Com.BRHSM.Mod.Registry.ServerProxy, clientSide=Com.BRHSM.Mod.Registry.ClientProxy}.Com.BRHSM.Mod.Registry.MainRegistry what's going on here?
  7. Yes I did, I have those classes: package Com.BRHSM.Mod.Gui; import org.lwjgl.opengl.GL11; import Com.BRHSM.Mod.Container.ContainerTutFurnace; import Com.BRHSM.Mod.TileEntities.TileEntityGemSmelter; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) public class GuiTutFurnace extends GuiContainer{ private static final ResourceLocation furnaceGuiTextures = new ResourceLocation("textures/gui/container/furnace.png"); private TileEntityGemSmelter tileFurnace; public GuiTutFurnace(InventoryPlayer invPlayer, TileEntityGemSmelter tile) { super(new ContainerTutFurnace(invPlayer, tile)); this.tileFurnace = tile; } protected void drawGuiContainerForegroundLayer(int par1, int par2){ String string = this.tileFurnace.hasCustomInventoryName() ? this.tileFurnace.getInventoryName() : I18n.format(this.tileFurnace.getInventoryName(), new Object[0]); this.fontRendererObj.drawString(string, this.xSize / 2 - this.fontRendererObj.getStringWidth(string), 6, 4210752); this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 94, 4210752); } @Override protected void drawGuiContainerBackgroundLayer(float var1, int var2, int var3) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.mc.getTextureManager().bindTexture(furnaceGuiTextures); int k = (this.width - this.xSize) / 2; int l = (this.height - this.ySize) / 2; this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize); int i1; if (this.tileFurnace.isBurning()) { i1 = this.tileFurnace.getBurnTimeRemainingScaled(12); this.drawTexturedModalRect(k + 56, l + 36 + 12 - i1, 176, 12 - i1, 14, i1 + 2); } i1 = this.tileFurnace.getCookProgressScaled(24); this.drawTexturedModalRect(k + 79, l + 34, 176, 14, i1 + 1, 16); } } Container: package Com.BRHSM.Mod.Container; import Com.BRHSM.Mod.TileEntities.TileEntityGemSmelter; import net.minecraft.block.BlockContainer; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.ICrafting; import net.minecraft.inventory.Slot; import net.minecraft.inventory.SlotFurnace; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.FurnaceRecipes; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class ContainerTutFurnace extends Container{ private TileEntityGemSmelter tileFurnace; private int lastCookTime; private int lastBurnTime; private int lastItemBurnTime; public ContainerTutFurnace(InventoryPlayer player, TileEntityGemSmelter tileEntityFurnace){ this.tileFurnace = tileEntityFurnace; this.addSlotToContainer(new Slot(tileEntityFurnace, 0, 56, 17)); this.addSlotToContainer(new Slot(tileEntityFurnace, 1, 56, 53)); this.addSlotToContainer(new SlotFurnace(player.player, tileEntityFurnace, 2, 116, 35)); int i; for(i = 0; i < 3; ++i){ for(int j = 0; j < 9; ++j){ this.addSlotToContainer(new Slot(player, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); } } for(i = 0; i < 9; ++i){ this.addSlotToContainer(new Slot(player, i , 8 + i * 18 , 142)); } } public void addCraftingToCrafters(ICrafting craft){ super.addCraftingToCrafters(craft); craft.sendProgressBarUpdate(this, 0, this.tileFurnace.GemSmelterCookTime); craft.sendProgressBarUpdate(this, 1, this.tileFurnace.GemSmelterBurnTime); craft.sendProgressBarUpdate(this, 2, this.tileFurnace.GemSmelterCurrentTime); } public void detectAndSendChanges(){ super.detectAndSendChanges(); for(int i = 0; i < this.crafters.size(); ++i){ ICrafting craft = (ICrafting) this.crafters.get(i); if(this.lastCookTime != this.tileFurnace.GemSmelterCookTime){ craft.sendProgressBarUpdate(this, 0, this.tileFurnace.GemSmelterCookTime); } if(this.lastBurnTime != this.tileFurnace.GemSmelterBurnTime){ craft.sendProgressBarUpdate(this, 1, this.tileFurnace.GemSmelterBurnTime); } if(this.lastItemBurnTime != this.tileFurnace.GemSmelterCurrentTime){ craft.sendProgressBarUpdate(this, 2, this.tileFurnace.GemSmelterCurrentTime); } } this.lastBurnTime = this.tileFurnace.GemSmelterBurnTime; this.lastCookTime = this.tileFurnace.GemSmelterCookTime; this.lastItemBurnTime = this.tileFurnace.GemSmelterCurrentTime; } @SideOnly(Side.CLIENT) public void updateProgressBar(int par1, int par2){ if(par1 == 0){ this.tileFurnace.GemSmelterCookTime = par2; } if(par1 == 1){ this.tileFurnace.GemSmelterBurnTime = par2; } if(par1 == 2){ this.tileFurnace.GemSmelterCurrentTime = par2; } } @Override public boolean canInteractWith(EntityPlayer player) { return this.tileFurnace.isUseableByPlayer(player); } public ItemStack transferStackInSlot(EntityPlayer player, 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(TileEntityGemSmelter.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(player, itemstack1); } return itemstack; } }
  8. I did as you said but It still crashes...
  9. Yeah I fugured that was the problem but i had to create the methodes otherwise i had to make serverproxy abstract, i don't think that should be done either. what exactly do you mean with the "Both Side"?
  10. Like this??? public void registerNetworkStuff(){ NetworkRegistry.INSTANCE.registerGuiHandler(MainRegistry.modInstance, new GuiHandler()); } within the server proxy? Here is the full server proxy class: public class ServerProxy implements IGuiHandler { public void registerRenderThings() { } public int addArmor(String armor) { return 0; } public void registerNetworkStuff(){ NetworkRegistry.INSTANCE.registerGuiHandler(MainRegistry.modInstance, new GuiHandler()); } public void registerTileEntities(){ GameRegistry.registerTileEntity(TileEntityGemSmelter.class, MainRegistry.MODID); } @Override public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { // TODO Auto-generated method stub return null; } @Override public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { // TODO Auto-generated method stub return null; } I don't realy know what to do with the last two methots, so i left them blank for now, Is that the problem?
  11. check the question, there is a link to the pastebin site with the crash report!
  12. Here is the part with the modinctance, I beleve this is correct though @Mod(modid = MainRegistry.MODID, version = MainRegistry.VERSION) public class MainRegistry { public static final String MODID = "yarritecraftmod"; public static final String VERSION = "1.0.0 (Alpha)"; @SidedProxy(clientSide = "Com.BRHSM.Mod.Registry.ClientProxy",serverSide = "Com.BRHSM.Mod.Registry.ServerProxy") public static ServerProxy Proxy; @Instance(MODID) public static MainRegistry modInstance; @Metadata public static ModMetadata meta;
  13. I have made a block which must act like a furnace but it doesn't work. When I right click the block the game crashes: http://pastebin.com/w95m2sfR I have this code to open the GUI: public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){ player.openGui(MainRegistry.modInstance, 0, world, x, y, z); return true; } and here are my guihandler and gui code: package Com.BRHSM.Mod.Handler; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; import Com.BRHSM.Mod.Container.ContainerTutFurnace; import Com.BRHSM.Mod.Gui.GuiTutFurnace; import Com.BRHSM.Mod.TileEntities.TileEntityGemSmelter; import cpw.mods.fml.common.network.IGuiHandler; public class GuiHandler implements IGuiHandler { public GuiHandler (){ } @Override public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { if(ID == 0){ TileEntityGemSmelter tileEntityFurnace = (TileEntityGemSmelter) world.getTileEntity(x, y, z); return new ContainerTutFurnace(player.inventory, tileEntityFurnace); } return null; } @Override public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { if(ID == 0){ TileEntityGemSmelter tileEntityTestContainer = (TileEntityGemSmelter) world.getTileEntity(x, y, z); return new GuiTutFurnace(player.inventory, tileEntityTestContainer); } return null; } } package Com.BRHSM.Mod.Gui; import org.lwjgl.opengl.GL11; import Com.BRHSM.Mod.Container.ContainerTutFurnace; import Com.BRHSM.Mod.TileEntities.TileEntityGemSmelter; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) public class GuiTutFurnace extends GuiContainer{ private static final ResourceLocation furnaceGuiTextures = new ResourceLocation("textures/gui/container/furnace.png"); private TileEntityGemSmelter tileFurnace; public GuiTutFurnace(InventoryPlayer invPlayer, TileEntityGemSmelter tile) { super(new ContainerTutFurnace(invPlayer, tile)); this.tileFurnace = tile; } protected void drawGuiContainerForegroundLayer(int par1, int par2){ String string = this.tileFurnace.hasCustomInventoryName() ? this.tileFurnace.getInventoryName() : I18n.format(this.tileFurnace.getInventoryName(), new Object[0]); this.fontRendererObj.drawString(string, this.xSize / 2 - this.fontRendererObj.getStringWidth(string), 6, 4210752); this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 94, 4210752); } @Override protected void drawGuiContainerBackgroundLayer(float var1, int var2, int var3) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.mc.getTextureManager().bindTexture(furnaceGuiTextures); int k = (this.width - this.xSize) / 2; int l = (this.height - this.ySize) / 2; this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize); int i1; if (this.tileFurnace.isBurning()) { i1 = this.tileFurnace.getBurnTimeRemainingScaled(12); this.drawTexturedModalRect(k + 56, l + 36 + 12 - i1, 176, 12 - i1, 14, i1 + 2); } i1 = this.tileFurnace.getCookProgressScaled(24); this.drawTexturedModalRect(k + 79, l + 34, 176, 14, i1 + 1, 16); } } what is causing the crach and how do i keep it from happening?
  14. That's a lot of code to go trough I think It's best i consentrate on my own code
  15. I am fairly new to forge modding. I don't know what you mean here. I sertanly don't know how to fix it, can you give me some raw code on which lines to change?
×
×
  • Create New...

Important Information

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