
dude22072
Members-
Posts
185 -
Joined
-
Last visited
Everything posted by dude22072
-
Currently using the following code: @Override public void drawForeground(int mouseX, int mouseY) { long rupees = Minecraft.getMinecraft().thePlayer.getEntityData().getLong("rupeeCount"); System.out.println(rupees); Minecraft.getMinecraft().fontRendererObj.drawString(Long.toString(rupees), 45, 92, 4210752); } It always displays as 0. I know I am using the correct key for the long because I have added a chat command that checks it and it is returning the proper value.
-
I can't seem to find any tutorials on how to create RetroGen. What classes do i need to extend/implement?
-
Yes, it's registered. Didn't know that, will fix. Finally, generateBacteria is an exact copy of Minecraft's vine generation with the function name changed. So go yell at Jeb_ or whoever makes Minecraft nowadays.
-
I'm attempting to make world gen for a custom block that works the same as vines. The following is my IWorldGenerator code: package dudesmods.fancycheeses.world.gen.feature; import java.util.Random; import cpw.mods.fml.common.IWorldGenerator; import dudesmods.fancycheeses.FancyCheeses; import net.minecraft.util.Direction; import net.minecraft.util.Facing; import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; public class WorldGenBacteraLactococcus implements IWorldGenerator { @Override public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) { if(world.provider.dimensionId == 0) { int firstBlockXCoord = chunkX + random.nextInt(16); int firstBlockYCoord = 64; int firstBlockZCoord = chunkZ + random.nextInt(16); generateBacteria(world, random, firstBlockXCoord, firstBlockYCoord, firstBlockZCoord); } } public boolean generateBacteria(World world, Random rand, int x, int y, int z) { int l = x; for (int i1 = z; y < 128; ++y) { if (world.isAirBlock(x, y, z)) { for (int j1 = 2; j1 <= 5; ++j1) { if (FancyCheeses.bacteria_lactococcus.canPlaceBlockOnSide(world, x, y, z, j1)) { world.setBlock(x, y, z, FancyCheeses.bacteria_lactococcus, 1 << Direction.facingToDirection[Facing.oppositeSide[j1]], 2); break; } } } else { x = l + rand.nextInt(4) - rand.nextInt(4); z = i1 + rand.nextInt(4) - rand.nextInt(4); } } return true; } } but nothing is generating.
-
ItemStacks have the method getItem(), but they don't seem to have getBlock(). Is it one of the func_s or does it simply not exist?
-
[1.7.10] Consume item in hand instead of just any item?
dude22072 replied to dude22072's topic in Modder Support
And then how would I consume the item? ConsumeItem doesn't take a slot. -
In the code below i'm making it so a milk bucket acts as a normal bucket. But when "event.entityPlayer.inventory.consumeInventoryItem(Items.milk_bucket);" is called it will consume any milk bucket on the hotbar (in order from left to right) instead of the one in hand. @SubscribeEvent public void onPlayerInteraction(PlayerInteractEvent event) { if(event.action == PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) { if(event.entityPlayer.getHeldItem().getItem() != null && event.entityPlayer.getHeldItem().getItem() == Items.milk_bucket) { if(!event.entityPlayer.capabilities.isCreativeMode) { event.entityPlayer.inventory.consumeInventoryItem(Items.milk_bucket); event.entityPlayer.inventory.addItemStackToInventory(new ItemStack(Items.bucket, 1)); } switch (event.face) { case 0: event.world.setBlock(event.x, event.y-1, event.z, FancyCheeses.block_cow_milk); //y-1 case 1: event.world.setBlock(event.x, event.y+1, event.z, FancyCheeses.block_cow_milk); //y+1 case 2: event.world.setBlock(event.x, event.y, event.z-1, FancyCheeses.block_cow_milk); //z-1 case 3: event.world.setBlock(event.x, event.y, event.z+1, FancyCheeses.block_cow_milk); //z+1 case 4: event.world.setBlock(event.x-1, event.y, event.z, FancyCheeses.block_cow_milk); //x-1 case 5: event.world.setBlock(event.x+1, event.y, event.z, FancyCheeses.block_cow_milk); //x+1 } } } }
-
I was wondering how to make my TileEntity compatible with fluid pipes such as BuildCraft's Waterproof pipes or Thermal Expansion's Liquiducts.
-
I was wondering how to overwrite the vanilla milk bucket so I can make milk a fluid, as MFR does. Also, If it's possible, have my mod detect if MFR is installed and use it's fluid instead of adding my own.
-
[1.7.10]Display liquid and mB when hovered over in gui?
dude22072 replied to dude22072's topic in Modder Support
where do i get fontRenderer from? Edit: Found it, It's ment to be fontRendererObj -
In mods such as Tinker's Construct and Thermal Expansion when you hover over a liquid in a gui it tells you the name of the liquid and the amount in mB. How is this accomplished?
-
This man is correct. buttonList is deprecated. use controlList instead.
-
I was wondering how to make something happen in onItemUse when the player Shift+Right Clicks, but not if the player is holding right-click and then hits shift.
-
So, something like this? protected void guiDrawIcon(Item item, int x, int y) { Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.locationBlocksTexture); IIcon icon = item.getIconFromDamage(0); GL11.glEnable(GL11.GL_BLEND); this.drawTexturedModelRectFromIcon(x, y, icon, 16, 16); GL11.glDisable(GL11.GL_BLEND); }
-
I was wondering how I could get an item's icon to display in a GUI. (Or a fake slot would work too, but I don't know how to do that either.)
-
[1.7.10]TileEntity - NBT not working & GUI not updating.
dude22072 replied to dude22072's topic in Modder Support
OK, using these has solved some most of my problems. Sorry for being vague earlier. At the moment, the issue is that when I click a button on my gui, it doesn't seem to do anything. My System.out.println()s are telling me the IMessage class is receiving the message, but then the functions in the TileEntity class that they call don't seem to do anything. -
Whenever I close Minecraft and re-launch it the TileEntity is missing some data, but not all? Also it seems the GUI is not updating on certain things. Block: Container Custom Slot: GUI: GUI Handler: TileEntity: IMessage Class: stuff from main class:
-
I know i'd do: this.slots[1].damageItem(amount, /*?*/); but I need the "/*?*/" bit. It needs an EntityLivingBase and I don't thinka TileEntity counts and I don't know how to get a player server-side.
-
[1.7.10]Item disappears when removing it from slot. (SlotFurnace)
dude22072 replied to dude22072's topic in Modder Support
The function is being called when a button on the GUI is pressed. -
[1.7.10]Item disappears when removing it from slot. (SlotFurnace)
dude22072 replied to dude22072's topic in Modder Support
What methods do I need to change it server-side? -
When I use setInventorySlotContents to set a slot to an item the item disappears when removing it from the slot. @Override public void setInventorySlotContents(int var1, ItemStack var2) { this.slots[var1] = var2; if(var2 != null && var2.stackSize > this.getInventoryStackLimit()) { var2.stackSize = this.getInventoryStackLimit(); } }
-
EDIT:Solved by calling "super.initGui();" in my initGUi(); Before adding my buttons, my GUI appears as such: After adding buttons, it appears as this: (also there's that weird brown thing on the gui aswell. Plus it seems to break NEI.) My GUI class (with the buttons added): package dudesmods.fancycheeses.gui; import org.lwjgl.opengl.GL11; import dudesmods.fancycheeses.container.ContainerCheeseMaker; import dudesmods.fancycheeses.tileentity.TileEntityCheeseMaker; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.IIcon; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; public class GuiCheeseMaker extends GuiContainer { public static final ResourceLocation bground = new ResourceLocation("fancycheeses", "textures/gui/GuiCheeseMaker.png"); public TileEntityCheeseMaker cheeseMaker; public GuiCheeseMaker(InventoryPlayer inventoryPlayer, TileEntityCheeseMaker entity) { super(new ContainerCheeseMaker(inventoryPlayer, entity)); this.cheeseMaker = entity; this.xSize = 176; this.ySize = 166; } @Override public void initGui() { this.buttonList.add(new GuiButton(0, 70, 20, 10, 14, "<")); this.buttonList.add(new GuiButton(1, 98, 20, 10, 14, ">")); } @Override public void actionPerformed(GuiButton button) { switch(button.id) { case 0: if(cheeseMaker.cheeseToMake > 0) { cheeseMaker.cheeseToMake--; } break; case 1: if(cheeseMaker.cheeseToMake < 4) { cheeseMaker.cheeseToMake++; } break; default: break; } } public void drawGuiContainerForegroundLayer(int par1, int par2) { String name = this.cheeseMaker.hasCustomInventoryName() ? this.cheeseMaker.getInventoryName() : I18n.format(this.cheeseMaker.getInventoryName(), new Object[0]); this.fontRendererObj.drawString(name, (this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2) + 40, 4, 4210752); this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752); } @Override protected void drawGuiContainerBackgroundLayer(float var1, int var2, int var3) { guiDraw(bground); guiDrawLiquid("sheep_milk", guiLeft + 29, guiTop + 33, 20, 50); guiDrawLiquid("goat_milk", guiLeft + 50, guiTop + 33, 20, 50); //TODO : Might re-use this stuff? /* //Flames if(this.cheeseMaker.isBurning()) { int k = this.cheeseMaker.getBurnTimeRemainingScaled(12); int j = 40 - k; this.drawTexturedModalRect(guiLeft + 26, guiTop + 50 + 12 - k, 176, 12 - k, 14, k + 2); } //Progress Arrow int k = this.cheeseMaker.getCookProgressScaled(24); this.drawTexturedModalRect(guiLeft + 95, guiTop + 18, 176, 14, k + 1, 16); */ } protected void guiDraw(ResourceLocation var1) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); Minecraft.getMinecraft().getTextureManager().bindTexture(var1); this.drawTexturedModalRect(guiLeft, guiTop, 0, 0, this.xSize, this.ySize); } protected void guiDrawLiquid(String fluidName, int x, int y, int fluidAmount, int fluidCapacity) { if(fluidAmount > 50) { fluidAmount = 50; System.out.println("ERROR: Cheese Maker conatins more " + fluidName + " than it possibly should!"); } Fluid fluid = FluidRegistry.getFluid(fluidName); Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.locationBlocksTexture); //RenderUtil.setIntColor3(fluid.getColor()); IIcon icon = fluid.getStillIcon(); double height = 1; height = fluidAmount; height = height / fluidCapacity; height = height * 100; height = height / 2.33; GL11.glEnable(GL11.GL_BLEND); this.drawTexturedModelRectFromIcon(x, (int) ((y - (20 * 65 / 50))), icon != null ? icon : fluid.getBlock().getIcon(0, 0), 16, (int) Math.round(height)); GL11.glDisable(GL11.GL_BLEND); } }
-
[1.7.10]Fill Bucket from right-clicking on a mob
dude22072 replied to dude22072's topic in Modder Support
What about a vanilla mob? -
How would I make it so that a bucket gets filled with a fluid by right-clicking on a mob?