
Ddogclaw
Forge Modder-
Posts
7 -
Joined
-
Last visited
Converted
-
Gender
Male
-
Personal Text
I make things.
Ddogclaw's Achievements

Tree Puncher (2/8)
0
Reputation
-
[1.7.10] Can I use Thermal Expansion Pulverizer recipes?
Ddogclaw replied to Ddogclaw's topic in Modder Support
I could have sworn that I tried doing that in the past, but I tried it again and it starting working right away.. huh.. Well thanks so much, I appreciate it, it's nice to know I don't have to go through some frustrating Reflection crap like I thought I might. -
[1.7.10] Can I use Thermal Expansion Pulverizer recipes?
Ddogclaw replied to Ddogclaw's topic in Modder Support
I think you misunderstand my purpose, I'm not trying to add more pulverizer recipes to the TE pulverizer, I'm trying to make a machine that ACCESSES the list of pulverizer recipes, there is no getPulverizerRecipe() in that class. -
[1.7.10] Can I use Thermal Expansion Pulverizer recipes?
Ddogclaw replied to Ddogclaw's topic in Modder Support
I hate to reply to this again, but I've been running into a few issues trying to get this to work. I can't for the life of me seem to figure out how to use Reflection to do this. Thermal Expansion has a class called PulverizerManager and I have no issue getting at that and running its methods, my issue is that there's a subclass of PulverizerManager called RecipePulverizer and I have to use that as the type of a variable during my pulverization function. I just can't seem to figure out how to do that! -
[1.7.10] Can I use Thermal Expansion Pulverizer recipes?
Ddogclaw replied to Ddogclaw's topic in Modder Support
Alright thanks. I was hoping I wasn't going to need to decompile, but oh well, thanks for your help. -
Hi, I want to make use of TE's existing recipe handler for items that can be pulverized but I can't find any reference to it in the api except for the functions to send recipes to TE through intermodcomms. Does anybody know if I can get these recipes? Thanks!
-
[Solved] [1.7.10] Block Container issue with Slot shfiting
Ddogclaw replied to Ddogclaw's topic in Modder Support
Awesome! Thank you so much, I figured I was doing something stupid wrong. I appreciate it! -
[Solved] [1.7.10] Block Container issue with Slot shfiting
Ddogclaw posted a topic in Modder Support
Hey guys, I've ran into a bit of an issue here. I'm trying to make a mod with a block that has an inventory, but I've done something wrong somewhere in my code (my guess is in the container class) that makes it so that all of the slots in the inventory are shifted to the left side of the screen. Here's a picture of the problem (I have all the slots in my inventory filled): Here are my classes: [spoiler=ContainerCuilGenerator.java] package com.ddogclaw.container; import com.ddogclaw.godeeper.tileentity.TileEntityCuilGeneratorEntity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.inventory.SlotFurnace; import net.minecraft.item.ItemStack; public class ContainerCuilGenerator extends Container { protected TileEntityCuilGeneratorEntity tileEntity; public ContainerCuilGenerator(InventoryPlayer inventoryPlayer, TileEntityCuilGeneratorEntity te) { tileEntity = te; int i = 0; int j = 0; for(i = 0; i < 3; i++) { for(j = 0; j < 3; j++) { addSlotToContainer(new Slot(tileEntity, j + i * 3, 62 + j * 18, 17 + i * 18)); } } for (i = 0; i < 3; ++i) { for (j = 0; j < 9; ++j) { this.addSlotToContainer(new Slot(inventoryPlayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); } } for (i = 0; i < 9; ++i) { this.addSlotToContainer(new Slot(inventoryPlayer, i, 8 + i * 18, 142)); } } protected void bindPlayerInventory(InventoryPlayer inventoryPlayer) { } @Override public boolean canInteractWith(EntityPlayer player) { // TODO Auto-generated method stub return tileEntity.isUseableByPlayer(player); } // For shift-clicking, without this, it would cause massive errors @Override public ItemStack transferStackInSlot(EntityPlayer player, int slot) { ItemStack stack = null; Slot slotObject = (Slot) inventorySlots.get(slot); // null checks and checks if the item can be stacked (maxStackSize > 1) if (slotObject != null && slotObject.getHasStack()) { ItemStack stackInSlot = slotObject.getStack(); stack = stackInSlot.copy(); // Merges the item into player inventory since its in the tileEntity if (slot < 9) { if (!this.mergeItemStack(stackInSlot, 0, 35, true)) { return null; } // places it into the tileEntity is possible since its in the // player inventory } else if (!this.mergeItemStack(stackInSlot, 0, 9, false)) { return null; } if (stackInSlot.stackSize == 0) { slotObject.putStack(null); } else { slotObject.onSlotChanged(); } if (stackInSlot.stackSize == stack.stackSize) { return null; } slotObject.onPickupFromSlot(player, stackInSlot); } return stack; } } [spoiler=BlockCuilGenerator.java] package com.ddogclaw.godeeper.block; import com.ddogclaw.godeeper.GoDeeper; import com.ddogclaw.godeeper.gui.GuiCuilGenerator; import com.ddogclaw.godeeper.tileentity.TileEntityCuilGeneratorEntity; import cofh.api.energy.IEnergyHandler; import cpw.mods.fml.common.registry.GameRegistry; import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; public class BlockCuilGenerator extends BlockContainer { private String name = "cuilGenerator"; public BlockCuilGenerator() { super(Material.rock); setCreativeTab(CreativeTabs.tabBlock); setBlockBounds(0, 0, 0, 1, 1, 1); System.out.println("REGISTERING CUIL GENERATOR. JUST THOUGHT YOU SHOULD KNOW"); GameRegistry.registerBlock(this, name); setBlockName(GoDeeper.MODID + "." + name); setBlockTextureName(GoDeeper.MODID + ":" + name); } @Override public boolean hasTileEntity() { return true; } @Override public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) { // TODO Auto-generated method stub return new TileEntityCuilGeneratorEntity(); } @Override public int getRenderType() { return -1; } @Override public boolean isOpaqueCube() { return false; } @Override public boolean renderAsNormalBlock() { return false; } @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) { TileEntity tileEntity = world.getTileEntity(x,y,z); if (tileEntity == null) { return false; } if (world.isRemote) { System.out.println("Opening GUI"); player.openGui(GoDeeper.instance, 1, world, x, y, z); return true; } return false; } } [spoiler=TileEntityCuilGeneratorEntity.java] package com.ddogclaw.godeeper.tileentity; import com.ddogclaw.godeeper.GoDeeper; import cpw.mods.fml.common.registry.GameRegistry; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; public class TileEntityCuilGeneratorEntity extends TileEntity implements IInventory { private String name = "cuilGeneratorTile"; public int customField; private ItemStack[] inv = new ItemStack[9]; @Override public void writeToNBT(NBTTagCompound tagCompound) { super.writeToNBT(tagCompound); NBTTagList itemList = new NBTTagList(); for(int i = 0; i < inv.length; i++) { ItemStack stack = inv[i]; if (stack != null) { NBTTagCompound tag = new NBTTagCompound(); tag.setByte("Slot", (byte) i); stack.writeToNBT(tag); itemList.appendTag(tag); } } tagCompound.setTag("Inventory", itemList); } @Override public void readFromNBT(NBTTagCompound tagCompound) { super.readFromNBT(tagCompound); NBTTagList tagList = tagCompound.getTagList("Inventory", 0); for (int i = 0; i < tagList.tagCount(); i++) { NBTTagCompound tag = tagList.getCompoundTagAt(i); byte slot = tag.getByte("Slot"); if (slot >= 0 && slot < inv.length) { inv[slot] = ItemStack.loadItemStackFromNBT(tag); } } } @Override public int getSizeInventory() { // TODO Auto-generated method stub return inv.length; } @Override public ItemStack getStackInSlot(int slot) { // TODO Auto-generated method stub return inv[slot]; } @Override public ItemStack decrStackSize(int slot, int amt) { ItemStack stack = getStackInSlot(slot); if (stack != null) { if (stack.stackSize <= amt) { setInventorySlotContents(slot, null); } else { stack = stack.splitStack(amt); if (stack.stackSize == 0) { setInventorySlotContents(slot, null); } } } return stack; } @Override public ItemStack getStackInSlotOnClosing(int slot) { ItemStack stack = getStackInSlot(slot); if (stack != null) { setInventorySlotContents(slot, null); } return stack; } @Override public void setInventorySlotContents(int slot, ItemStack stack) { inv[slot] = stack; if (stack != null && stack.stackSize > getInventoryStackLimit()) { stack.stackSize = getInventoryStackLimit(); } } @Override public String getInventoryName() { return GoDeeper.MODID + "." + name; } @Override public boolean hasCustomInventoryName() { // TODO Auto-generated method stub return false; } @Override public int getInventoryStackLimit() { // TODO Auto-generated method stub return 64; } @Override public boolean isUseableByPlayer(EntityPlayer player) { return worldObj.getTileEntity(xCoord, yCoord, zCoord) == this && player.getDistanceSq(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5) < 64; } @Override public void openInventory() { } @Override public void closeInventory() { } @Override public boolean isItemValidForSlot(int p_94041_1_, ItemStack p_94041_2_) { // TODO Auto-generated method stub return false; } } [spoiler=GuiCuilGenerator.java] package com.ddogclaw.godeeper.gui; import org.lwjgl.opengl.GL11; import com.ddogclaw.container.ContainerCuilGenerator; import com.ddogclaw.godeeper.GoDeeper; import com.ddogclaw.godeeper.tileentity.TileEntityCuilGeneratorEntity; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; public class GuiCuilGenerator extends GuiContainer { public static final int guiID = 1; public GuiCuilGenerator(InventoryPlayer inventoryPlayer, TileEntityCuilGeneratorEntity tileEntity) { super(new ContainerCuilGenerator(inventoryPlayer, tileEntity)); } protected int xSize = 247; protected int ySize = 165; @Override public void initGui() { buttonList.clear(); } @Override public boolean doesGuiPauseGame() { return false; } protected void drawGuiContainerForegroundLayer(int param1, int param2) { //Text and stuff fontRendererObj.drawString("Current Cuil Level:", (width - xSize) / 2, (height - ySize) / 2, 4210752); } @Override protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); this.mc.renderEngine.bindTexture(new ResourceLocation(GoDeeper.MODID + ":textures/gui/cuilGeneratorGuiBG.png")); int x = (width - xSize) / 2; int y = (height - ySize) / 2; this.drawTexturedModalRect(x, y, 0, 0, 247, ySize); } } [spoiler=GuiHandler.java] package com.ddogclaw.godeeper; import com.ddogclaw.container.ContainerCuilGenerator; import com.ddogclaw.godeeper.gui.GuiCuilGenerator; import com.ddogclaw.godeeper.tileentity.TileEntityCuilGeneratorEntity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import cpw.mods.fml.common.network.IGuiHandler; public class GuiHandler implements IGuiHandler { @Override public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { TileEntity tileEntity = world.getTileEntity(x,y,z); if(tileEntity instanceof TileEntityCuilGeneratorEntity) { return new ContainerCuilGenerator(player.inventory, (TileEntityCuilGeneratorEntity) tileEntity); } return null; } @Override public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { TileEntity tileEntity = world.getTileEntity(x, y, z); if (tileEntity instanceof TileEntityCuilGeneratorEntity) { return new GuiCuilGenerator(player.inventory, (TileEntityCuilGeneratorEntity) tileEntity); } return null; } } I appreciate any help and criticism that you guys can give me. Thanks!