Jump to content

MisterGamer _

Members
  • Posts

    27
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

MisterGamer _'s Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Ok, my error, i registered it in a different way than the other Tile Entities. I fixed it. Thank you anyway.
  2. I created a directional block. I attached a Tile Entity to it and when I run the game, the message appears in the console: "(TileEntity name) is missing a mapping!", But I registered the Tile Entity correctly. Also when I break the block with this Tile Entity, the Collision Box remains and I get stuck in an invisible block. When I place a block instead of the one just broken, the just broken block reappears, and if I break it again, it disappears forever. I have another block that uses TileEntity and I have done all the steps I did when I created that block, but this gives problems. How can I solve it? P.S. This problem occurs only if my block is directional, even if the message "(TileEntity name) is missing a mapping!" still appears. A brief video of the problem: (password is: minecraftisgood)
  3. Ok, I removed "static", but now the block isn't in the game.
  4. ModBlocks line 41 is this: public static final Block REVERSING_FURNACE = new ReversingFurnaceBlock("reversing_furnace", Material.IRON);
  5. Hi I was creating a Directional Block (a Furnace) and i received an exception. Console Error: Even if the Error says: "Caused by: at com.mistergamer.mysticalmod.world.biome.BiomeMystical.<init>(BiomeMystical.java:14), at com.mistergamer.mysticalmod.init.BiomeInit.<clinit>(BiomeInit.java:15), at com.mistergamer.mysticalmod.Main.PreInit(Main.java:58)", there are no errors here, so it's a createBlockState() method error. Here it is the code: public final PropertyDirection FACING = PropertyDirection.create("facing"); public ReversingFurnaceBlock(String name, Material material) { super(name, material); setSoundType(SoundType.METAL); setHardness(12.0F); setResistance(52.0F); setHarvestLevel("pickaxe", 2); setCreativeTab(Main.tabMystical); this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH)); } @Override protected BlockStateContainer createBlockState() { return new BlockStateContainer(this, new IProperty[] {FACING}); } @Override public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) { worldIn.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing())); } public int getMetaFromState(IBlockState state) { return ((EnumFacing)state.getValue(FACING)).getIndex(); } public IBlockState getStateFromMeta(int meta) { EnumFacing enumfacing = EnumFacing.getFront(meta); if (enumfacing.getAxis() == EnumFacing.Axis.Y) { enumfacing = EnumFacing.NORTH; } return this.getDefaultState().withProperty(FACING, enumfacing); } @Override public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { ReversingFurnaceTileEntity te = (ReversingFurnaceTileEntity)world.getTileEntity(pos); if(te != null && te.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.NORTH)) { player.openGui(Main.instance, GuiHandler.REVERSING_FURNACE_GUI, world, pos.getX(), pos.getY(), pos.getZ()); return true; } return super.onBlockActivated(world, pos, state, player, hand, facing, hitX, hitY, hitZ); } @Override public TileEntity createNewTileEntity(World worldIn, int meta) { return new ReversingFurnaceTileEntity(); } Thank you very much.
  6. I have a Container with 2 slots; one for input and one for output. The Output Slot is a custom-made Slot and here is it's code: import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.SlotItemHandler; public class CompactorOutputSlot extends SlotItemHandler{ private int removeCount; public CompactorOutputSlot(IItemHandler itemHandler, int index, int xPosition, int yPosition) { super(itemHandler, index, xPosition, yPosition); } @Override public ItemStack onTake(EntityPlayer thePlayer, ItemStack stack) { this.onCrafting(stack); super.onTake(thePlayer, stack); return stack; } @Override public boolean isItemValid(ItemStack stack) { return false; } @Override public ItemStack decrStackSize(int amount) { if(this.getHasStack()) this.removeCount += Math.min(amount, this.getStack().getCount()); return super.decrStackSize(amount); } } How can I specify which of the two slots the hopper can take?
  7. Hello, i created a Tile Entity with capabilities and i searched for the update() method, but there isn't even if i implemented ITickable interface. I found tick() and i think it does the same of update(). Then i tried to create a "machine style" Tile Entity, to process items, but i failed. How can I create a Machine Block with a Tile Entity based on Capabilities? Thank you.
  8. I had a look at the Beacon GUI and it works now! Thank you so much!
  9. Here it is: package com.mistergamer.mysticalmod.gui; public class CompactorGui extends GuiContainer{ public static final int WIDTH = 176; public static final int HEIGHT = 166; public GuiButton button1; public String crafting; BlockPos pos = Minecraft.getMinecraft().player.getPosition(); World world = Minecraft.getMinecraft().world; EntityPlayer player = Minecraft.getMinecraft().player; Entity entity; public static final ResourceLocation background = new ResourceLocation(Reference.MOD_ID, "textures/gui/container/compactor_gui.png"); public static final int GUI_ID = 2; public CompactorGui(CompactorTileEntity tileEntity, CompactorContainer container) { super(container); xSize = WIDTH; ySize = HEIGHT; } @Override protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) { GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); GL11.glDisable(GL11.GL_LIGHTING); mc.getTextureManager().bindTexture(background); drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize); this.renderHoveredToolTip (mouseX, mouseY); } protected void drawGuiContainerForegroundLayer(float partialTicks, int mouseX, int mouseY) { this.renderHoveredToolTip(mouseX, mouseY); } @Override public boolean doesGuiPauseGame() { return false; } @Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { this.drawDefaultBackground(); super.drawScreen(mouseX, mouseY, partialTicks); this.renderHoveredToolTip(mouseX, mouseY); fontRenderer.drawString("Inventory", this.getGuiLeft() + 8, this.getGuiTop() + 72, 4210752); //Draw the Help button this.buttonList.add(new GuiButton(1, this.getGuiLeft() + 128, this.getGuiTop() + 62, 20, 20, "?")); //Draw the Mystical Ingot button and icon this.buttonList.add(new GuiButton(2, this.getGuiLeft() + 8, this.getGuiTop() + 8, 20, 20, "")); mc.getRenderItem().renderItemAndEffectIntoGUI(new ItemStack(ModItems.MYSTICAL_INGOT), this.getGuiLeft() + 10, this.getGuiTop() + 10); //Draw the Mystical Fuel button and icon this.buttonList.add(new GuiButton(3, this.getGuiLeft() + 29, this.getGuiTop() + 8, 20, 20, "")); mc.getRenderItem().renderItemAndEffectIntoGUI(new ItemStack(ModItems.MYSTICAL_FUEL), this.getGuiLeft() + 31, this.getGuiTop() + 10); } @Override protected void actionPerformed(GuiButton button) throws IOException { if(button.id == 1) { if(world.isRemote) { Minecraft.getMinecraft().displayGuiScreen(new CompactorHelpGui()); Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.UI_BUTTON_CLICK, 1.0F)); } }else if(button.id == 2) { if(world.isRemote) { Minecraft.getMinecraft().player.sendChatMessage("/give @p " + Reference.MOD_ID + ":mystical_ingot 1"); } Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.UI_BUTTON_CLICK, 1.0F)); }else if(button.id == 3) { if(world.isRemote) { Minecraft.getMinecraft().player.sendChatMessage("/give @p " + Reference.MOD_ID + ":mystical_fuel 1"); } Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.UI_BUTTON_CLICK, 1.0F)); } } }
  10. button.id.isPressed() doesn't exists. A little info I didn't remember: this if statement is in the actionPerformed method of a GUI.
  11. Hi, I have a problem with GuiButton. First the code: if(button.id == 2) { if(world.isRemote) { Minecraft.getMinecraft().player.sendChatMessage("/give @p " + Reference.MOD_ID + ":mystical_ingot 1"); } Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.UI_BUTTON_CLICK, 1.0F)); } The code works very well, but instead of one ingot, i receive many ingots. So I tried to send a chat message without a command but it appears many times instead of one. Some fixes?
  12. Ok I tried this, but same result... Minecraft.getMinecraft().displayGuiScreen(new CompactorHelpGui());
×
×
  • Create New...

Important Information

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