Jump to content

navybofus

Members
  • Posts

    53
  • Joined

  • Last visited

Converted

  • Gender
    Male
  • URL
    http://navybofusmods.wordpress.com/
  • Location
    United States
  • Personal Text
    Modder Apprentice

navybofus's Achievements

Stone Miner

Stone Miner (3/8)

2

Reputation

  1. I'll have to find out how to setup my perspective this way because mine is merged.
  2. I knew that it was ticking on both sides but when The tile entity called the item storage method I received a stack overflow. I thought this was caused by my method recycling the extra items from an item stack that was too large. I've got everything working but I still get the error if the items inherent max stack size is 16 (eggs). About the @SideOnly, through tutorials I was taught to use this for graphics. Is this no longer the case? I do understand that I was confusing side only and isRemote checks when I wrote this post.
  3. Wow. I should have thought of that. Been staring at this code too long. Need to take a break lol. Thanks.
  4. Sorry, I meant to say that this works. I was wondering if there is some nifty forge way that does all of this work via IInventory or something.
  5. I've got a few automation blocks that add items to nearby chests. Until I started picking up EntityItems, everything worked fine. Now that I'm getting the ItemStack from the EntityItem and adding them, I'm having troubles. Here's the code that I use to add the items to chests. /*** * Takes an int[] with the x, y, z and slot of a nearby inventory * with either a matching item or empty slot. Also takes the stack to add. */ private void placeItemsInChest(int[] loc, ItemStack stack){ TileEntityChest te = (TileEntityChest) worldObj.getTileEntity(loc[0], loc[1], loc[2]); if(te.getStackInSlot(loc[3]) != null){ ItemStack chestStack = te.getStackInSlot(loc[3]); if(chestStack.getItem() == stack.getItem()){ if(chestStack.getItemDamage() == stack.getItemDamage()){ Item passedItem = stack.getItem(); int size = 0; size = chestStack.stackSize; size += stack.stackSize; if(size <= chestStack.getMaxStackSize()){ te.setInventorySlotContents(loc[3], new ItemStack(passedItem, size)); } else { int sizeRemain = size - chestStack.getMaxStackSize(); te.setInventorySlotContents(loc[3], new ItemStack(passedItem, size-sizeRemain)); ItemStack remainingStack = new ItemStack(passedItem, sizeRemain); if(findChestWithRoom(remainingStack) != null){ //Run this method again with the remaining stack. int[] tmpLoc = findChestWithRoom(remainingStack).clone(); placeItemsInChest(tmpLoc, remainingStack); } else { spawnItems(remainingStack); //Spawns EntityItems into the world if no valid inventory found } } } else { te.setInventorySlotContents(loc[3], stack); } } else { te.setInventorySlotContents(loc[3], stack); } } }
  6. When I get a chance I'll toy around with it. Thanks for all of the advice. I'll let you all know if I get it pinned down or not.
  7. I'm doing everything in test worlds where I ensure only one tile entity is present. I'll do some checks but I'm still confused why my other tile entities are working just fine.
  8. I know how the annotations and the side checks work. What I don't understand is why none of my blocks have problems and a lot of their code is similar. None of my blocks have required side checks so far.
  9. In that case, why do none of my other tile entities require isRemote checks?
  10. I've been writing new code for the LittleHelpers mod for a few weeks, but just recently I've added another new block with a TileEntity (like all the others). BUT, every time I try to run any method, it's running twice. I used System.out.println(); and every message appears twice. I added the delay variable that I've set and it displays two different values (the delay is random) so I believe that each method within my tile entity is running twice. This is really messing with the functionality of my blocks. What am I doing different? Should I be using @SideOnly? I haven't had to use it so far and all other blocks work just fine. Just updated to 1082, but I only did that because the problem was happening in 1060. HALP!
  11. I'm trying to "highlight" (add a wire frame) to some nearby chests when the player looks at a certain block, but I can't seem to get the tessellator to draw the wire frame. I followed the tutorial here on tessellation, but it's mainly for drawing faces of a custom block. I just want to draw a "phantom" wire frame with the faces shaded a color with a low alpha. Currently I just have the code for one face to get started but I stopped there because I was just getting a glitchy black face that was invisible from most angles and glitchy from others. I guess I'm using the wrong methods to draw lines. Sorry, but I just can't find a lot of good info about this. Tessellator t = Tessellator.instance; GL11.glPushMatrix(); GL11.glColor4d(1.0D, 0.0D, 0.0D, 1.0D); GL11.glTranslated(x, y+1, z); GL11.glLineWidth(3.0F); //t.startDrawingQuads(); // EDIT: Was using this. Now using next line. t.startDrawing(GL11.GL_LINE_STRIP); // This is showing the wireframe, but not all the time. t.addVertex(0, 0, 0); t.addVertex(0, 1, 0); t.addVertex(1, 1, 0); t.addVertex(1, 0, 0); t.draw(); GL11.glPopMatrix(); Any help or a point toward a similar tutorial would be greatly appreciated.
  12. Like coolboy, I'm not exactly sure, but I can help you search. You need to add the mod to your workspace somehow so you can reference the item via the mod's code. Also you need to add the original mod to the dependency list or add a default item that the block will drop in case the mod isn't loaded. Coolboy was also right about the method to use to see if the mod is loaded. Add this to your @Mod annotation dependencies = "required-after:halogunmod" And this will be in your PreInit if(Loader.isModLoaded("halogunmod")){ halomodLoaded = true; } Then you can use that boolean in the block's class to determine what the block drops. However, there's always a better way to do things that I normally do, so search the web and I hope you find what you need. **Since i'm unsure of the mod's ID, I just used halogunmod
  13. Currently my LittleHelpers mod does well with vanilla blocks/items, but when it interacts with other mod's items, it goes a bit haywire. I just want to put a check in that will discriminate against other mod items. I was trying to add the mod's jar as a Referenced Library so I can say, "If this is a block from this mod, then skip this block." But I'm crashing on debug. I know there's a way to add other mods to the workspace, but I can't remember or find documentation on how to do so. Any help is greatly appreciated! Thanks!
  14. Hello again Minecraft Forge guru's! I've decided to add a small bit of flare to my newest mod (mostly for practice). I'd like to have an item hover over my block and slowly rotate. I'm going to change this item based on the inventory, but I can do that after I find out how to render any item. So far, I've tried using the tesselator to draw ANYTHING above my block, but I can't even figure out if my Renderer is being registered correctly. I've placed a few log notes and none of them show up. Here's some of my code that I believe is the culprit. EDIT: I've made sure that my renderer is being registered and got something on the screen. I forgot to add proxy.registerRenderers(); to my FMLInitilizationEvent public class CommonProxy { public void registerRenderers(){} } public class ClientProxy extends CommonProxy{ public void registerRenderers(){ ClientRegistry.bindTileEntitySpecialRenderer(TEMetalExtractor.class, new RendererMetalExtractor()); } } public class RendererMetalExtractor extends TileEntitySpecialRenderer{ public RendererMetalExtractor(){} private static final ResourceLocation texture = new ResourceLocation(ModInfo.MODID, "textures/blocks/magnet.png"); @Override @SideOnly(Side.CLIENT) public void renderTileEntityAt(TileEntity te, double x, double y, double z, float f) { bindTexture(texture); Tessellator t = Tessellator.instance; GL11.glPushMatrix(); GL11.glColor3ub((byte)255, (byte)0, (byte)0); GL11.glTranslated(x, y+1, z); GL11.glLineWidth(10.0F); t.startDrawingQuads(); t.addVertexWithUV(0, 0, 0, 0, 0); t.addVertexWithUV(0, 1, 0, 0, 1); t.addVertexWithUV(1, 1, 0, 1, 1); t.addVertexWithUV(1, 0, 0, 1, 0); t.draw(); GL11.glPopMatrix(); } } All of this TESR code is the product of several tutorials that don't do what I wanted, but I thought I could figure it out if I got something to show up. I'm going to continue working towards a solution. If anyone can provide some help I'd really appreciate it.
  15. Yeah I thought a clean install would work too, but the problem persists. I think I'll just leave 1.6.4 alone. I'm not that worried about porting my mods to previous versions. But thanks anyway
×
×
  • Create New...

Important Information

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