Jump to content
Search In
  • More options...
Find results that contain...
Find results in...


  • Posts

  • Joined

  • Last visited

Everything posted by ShetiPhian

  1. I was thinking about setting up a Forge event at the end of GuiInGame.renderGameOverlay This would allow mods to add HUD elements that would behave like the built in one (darken, hide, appear behind everything else, etc.) Due to how fast and often this fires, would it have a negative effect on the event bus?
  2. Atomic's tutorial is the best one I know of. ForgeEvents are very handy. With them I managed to kick PlayerAPI and my few base edits.
  3. Forge has a LivingHurtEvent inside of damageEntity that should work for you. Adding this to your event handler would work simular but it happens before "if (!par1DamageSource.isUnblockable() && this.isBlocking())" instead of after @ForgeSubscribe public void livingHurt(LivingHurtEvent event) { if (!(event.entityLiving instanceof EntityPlayer)) return; EntityPlayer eventPlayer = (EntityPlayer)event.entityLiving; event.ammount = mod_AsgardShield.calcDamage(event.source, event.ammount, eventPlayer); }
  4. Items can use MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, player, true); movingobjectposition should have the info you need. The downfall is, its limited to the players reach. But using it as an example you can easily make one where you set the reach. (and allow its use outside of the Item class)
  5. To do it purely with metadata you only need to make changes in your block's class Store the different directions as different metadata @Override public void onBlockPlacedBy(World world, int x, int y, int z, EntityLiving entityliving) { int metadata = world.getBlockMetadata(x, y, z); int playerDirection = MathHelper.floor_double((double)((entityliving.rotationYaw * 4F) / 360F) + 0.5D) & 3; if(metadata == 0) { switch(playerDirection) { case 0: metadata += 2; break; //South Facing Block = meta 2 case 1: metadata += 3; break; //West Facing Block = meta 3 case 2: metadata += 0; break; //North Facing Block = meta 0 case 3: metadata += 1; break; //East Facing Block = meta 1 } } world.setBlockMetadataWithNotify(x, y, z, metadata); } Now you can texture your block @SideOnly(Side.CLIENT) @Override public int getBlockTextureFromSideAndMetadata(int side, int metadata) { if (side == 0 || side = 1) return 16; //Top and bottom always look the same switch (metadata) { case 0: //North Facing Block if (side == 2) return 16; //North Side of Block if (side == 3) return 17; //South Side of Block if (side == 4) return 19; //West Side of Block if (side == 5) return 18; //East Side of Block case 1: //East Facing Block if (side == 2) return 0; //North Side of Block if (side == 3) return 0; //South Side of Block if (side == 4) return 0; //West Side of Block if (side == 5) return 0; //East Side of Block case 2: //South Facing Block if (side == 2) return 0; //North Side of Block if (side == 3) return 0; //South Side of Block if (side == 4) return 0; //West Side of Block if (side == 5) return 0; //East Side of Block case 3: //West Facing Block if (side == 2) return 0; //North Side of Block if (side == 3) return 0; //South Side of Block if (side == 4) return 0; //West Side of Block if (side == 5) return 0; //East Side of Block } return 16; //Fall back if meta is out of range }
  6. If only, I was back fighting with it again. After I switched over to my textures I noticed I had grabbed the wrong painting from creative mode no wonder it worked Using the correct item mine once again moves up after 15seconds, and vanishes when its at the edge of my screen EDIT: Well I thing I finally got it working. To solve the disappearing at the edges problem, I just sent the bounding box info. Now for moving up after 15sec. The default paintings extend Entity, but if I extend EntityLiving instead my painting stay put. This cause a few problems with simple solutions. Walking into the paintings pushed them off the wall, dropping the item. canBePushed() returning false solved this. If you got too far away the paintings would completely vanish , canDespawn() returning false fixed that. So now my painting are "Alive" but they seem to work.
  7. Well I'm now just getting into entities I've prolonged it as far as possible but to continue development on my mod I need to learn how to use them. The first thing I started with is a new picture entity, I copied EnumArt, ItemPainting, and EntityPainting into my common package, then RenderPainting into my client package. Set up all the imports, and added these two line into my @Init EntityRegistry.registerModEntity(EntityPainting.class, "Picture", EntityRegistry.findGlobalUniqueEntityId(), this, 160, 100, false); Item painting = (new ItemPainting(6500)).setIconCoord(10, 1).setItemName("picture"); and through my proxy this line on the client side RenderingRegistry.registerEntityRenderingHandler(EntityPainting.class, new RenderPainting()); The first problem I had was a null pointer in the renderer, turns out the server wasn't telling the client what the value of art was. That was a simple fix, I first check to make sure art wasn't null to prevent any future crashes, then setup a packet to update the client. At first this looked to work perfectly, then my picture jumped up a block For some reason, in around the 15 second mark, the client decides to change the y value, then it never does it again. The value is still correct on the server side, re-entering the world places the pictures in the correct spot. (for 15sec at least) If I send the x,y,z to the client, every 15seconds it jumps up and gets corrected into the proper spot. I don't know why it is behaving like this, the java files are copies of the originals. The other issue I have is the painting disappear if you turn your camera enough to only have them partly on screen. I'm having so much fun with this entity I cant wait to add mobs, chest, furnace, sign EDIT: Wow you guys are good! I changed nothing in my code between posting here, and pressing the debug button again and everything worked. I'm now more confused and very glad its working.
  8. At the end of Block.class you'll see forge already added things to make beds work. Your new bed block will need to override them. /** * Determines if this block is classified as a Bed, Allowing * players to sleep in it, though the block has to specifically * perform the sleeping functionality in it's activated event. * * @param world The current world * @param x X Position * @param y Y Position * @param z Z Position * @param player The player or camera entity, null in some cases. * @return True to treat this as a bed */ public boolean isBed(World world, int x, int y, int z, EntityLiving player) { return blockID == Block.bed.blockID; } /** * Returns the position that the player is moved to upon * waking up, or respawning at the bed. * * @param world The current world * @param x X Position * @param y Y Position * @param z Z Position * @param player The player or camera entity, null in some cases. * @return The spawn position */ public ChunkCoordinates getBedSpawnPosition(World world, int x, int y, int z, EntityPlayer player) { return BlockBed.getNearestEmptyChunkCoordinates(world, x, y, z, 0); } /** * Called when a user either starts or stops sleeping in the bed. * * @param world The current world * @param x X Position * @param y Y Position * @param z Z Position * @param player The player or camera entity, null in some cases. * @param occupied True if we are occupying the bed, or false if they are stopping use of the bed */ public void setBedOccupied(World world, int x, int y, int z, EntityPlayer player, boolean occupied) { BlockBed.setBedOccupied(world, x, y, z, occupied); } /** * Returns the direction of the block. Same values that * are returned by BlockDirectional * * @param world The current world * @param x X Position * @param y Y Position * @param z Z Position * @return Bed direction */ public int getBedDirection(IBlockAccess world, int x, int y, int z) { return BlockBed.getDirection(world.getBlockMetadata(x, y, z)); } /** * Determines if the current block is the foot half of the bed. * * @param world The current world * @param x X Position * @param y Y Position * @param z Z Position * @return True if the current block is the foot side of a bed. */ public boolean isBedFoot(IBlockAccess world, int x, int y, int z) { return BlockBed.isBlockHeadOfBed(world.getBlockMetadata(x, y, z)); }
  9. I set the fall distance to 0 in my Event Handler You need to do this on both the client and server @ForgeSubscribe public void livingFall(LivingFallEvent event) { if (!(event.entityLiving instanceof EntityPlayer)) return; EntityPlayer eventPlayer = (EntityPlayer)event.entityLiving; //Check if the damage should be removed event.distance = 0F; } I'd imagine you could also use "public void livingHurt(LivingHurtEvent event)" and just check if the damage source is falling, but I've never tested that.
  10. Here is a few commands to help you convert. GameRegistry.addRecipe LanguageRegistry.addName GameRegistry.registerBlock FurnaceRecipes.smelting().addSmelting Now for some problems you will have: First if your not using Eclipse (or something similar) get it, it will make your life easier. Get out of net.minecraft.src use package giganova.uraniac; Never make any imports to client classes on your common classes, always go through your proxy. I have a bit of time to kill, and your code sample is short so here it is converted: Minecraft\src\giganova\uraniac\client\ClientProxy.java http://pastebin.com/duDPTKQ5 Minecraft\common\giganova\uraniac\CommonProxy.java http://pastebin.com/dFmyiXvE Minecraft\common\giganova\uraniac\UraniacArmour.java http://pastebin.com/TDEcnBk5
  11. The names are no longer different, so as long as the mod is coded correctly it can be installed on the client and server.
  12. I've never looked at Rei's code so it might be better then my way, but here is what I did: First you need to set up your tick handler to also trigger on render ticks, http://www.minecraftforge.net/wiki/Tutorials/Upgrading_To_Forge_for_1.3.1#Ticking Don't open a gui screen, instead draw the elements you want during a render tick. (has to be during the render tick or the images flicker)
  13. GL11.glBindTexture(GL11.GL_TEXTURE_2D, mc.renderEngine.getTexture(imgFile)); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); drawTexturedModalRect(screen.xPosition, screen.yPosition, icon.x, icon.y, sizeX, sizeY); //Extra Info for you drawHorizontalLine (x-start, x-stop, y, color); drawVerticalLine(x, y-start, y-stop, color); drawRect(x-start, y-start, x-stop, y-stop, color); drawGradientRect(x-start, y-start, x-stop, y-stop, color-top, color-bottom); drawCenteredString(fontRenderer, text, x, y, color); drawString(fontRenderer, text, x, y, color); color = 0xAARRGGBB
  14. "have you considered putting a test in getCollisionBoundingBoxFromPool for cloudWalk?" Yep with funny results too, the block became pass through for everyone when one who couldn't walk on them touched it. Another thing I tried in 1.2.3 was setting the box to null on the server but a full cube on the client. I don't remember what problems I had with that but it was scrapped. Got through this one though, I submitted a hook that allows server mods to use noClip to stop NetServerHandler from freaking out. It was put in Build #237 so all is good there. (server side noClip seems to have solved issue #3 as well) As long as a block exists, is solid, and is not a leaf block, Minecraft calls it a valid spawn block. I located where this was happening and submitted a new hook, others may find it helpful also. But it if doesn't make it in I'll just continue pushing my blocks away from the map spawn point. (and hope no server admins move it)
  15. yes, and imho it is the best file archiver. http://www.7-zip.org/
  16. import net.minecraft.src.*; should work, its working for me. I'd also suggest moving your files again, you should not be using someone else's folder at all. use zcelo.floracraft
  17. Others have had this problem. All so far have found redownloading Rei's Minimap fixes it. Might work for you too.
  18. Here is what I'm using, it places a modname.cfg into the config folder. with a bit of string manipulation you can add "/EUIndustry/" and change the file name if you wish. @PreInit public void preInit(FMLPreInitializationEvent event) { configFile = event.getSuggestedConfigurationFile();
  19. I'm looking for a better way to do my semi-solid cloud blocks. Effect I'm after: Entities fall through the block unless the cloudWalk flag return true, then it is just like any other solid block. The cloudWalk flag is true when the player can fly or has equipped special armor. How it is Currently working. The block is solid. in "onEntityWalking" and "onFallenUpon" the flag gets checked, if false the entity gets nudged into the block. in "onEntityCollidedWithBlock" the flag gets checked, if false "entity.setInWeb()" & "entity.setVelocity(0.0D, -2.0D, 0.0D)" In 1.2.5 this method worked well in SSP, but on the server it worked poorly on players. Issue #1 --Solved with new server side noClip hook added in #237 Even though the server was pushing the player it was seen as an invalid move and NetServerHandler would push the player back. The only way I found to get around this was to edit the base class and override the check while falling through the cloud block Issue #2 Minecraft seen the block as a valid spawn spot, many times you'd fall to your death. To hack around this I edited my generator so clouds wouldn't be placed withing the spawn zone (this looked dumb) Issue #3 --Solved with new hook added in #237or at least it appears to be If the clouds where thicker then one block (almost always) sometimes you'd get stuck while falling through because "onEntityWalking" and "onFallenUpon" didn't trigger on the block bellow. By wiggling you could get unstuck. My thoughts for reworking: I think the best thing to do is set the getCollisionBoundingBox to null. That should solve the getting stuck problem, remove the base edit, and maybe solve the spawn problem. But then I have to find a way to collide with a block that has no collision box For the y value I could check if there is a cloud bellow and change it to counter the fall, if done at LivingUpdateEvent there shouldn't be any noticeable jitter, but I've got no ideas for x and z.
  20. Always check Jenkins, it has every build ever made. http://jenkins.minecraftforge.net:7070/job/forge/
  21. You can't have any client imports in your common or server files. It doesn't matter if they are used or not, just trying to load them will kill the server. Go through all of your common and server files and remove all client imports. The errors you get is code you need to pass through your proxy.
  22. Update Forge, Current build is #228 That has been fixed back in build #207 Build #207 Changes Fixed bug in EntityMinecart that would cause them to fall through the ground at the bottom of slopes.
  23. 1.3.0 hasn't even been out for a month, 1.3.2 was last week. Anyhow. When 1.3.0 dropped Forge was in the middle of a 1.2.5 build, Instead of scrapping the code the final 1.2.5 build was finished. Forge had a modders version up, for testing and bug hunting. not builds suited for full blown modding. It has since left that phase and modders have been updating, most haven't taken time to post that they are because that takes time away from updating and breaks the grove you get into and its hard to get back on track. A lot has changed it will take time for all mods to update, the bigger the mod the longer the wait. "animal bikes ditched forge" Maybe they didn't need the features forge provided and jumped on the already finished api (understandable but personally I think its a poor decision) or Maybe they didn't want to take the time to learn the new system (piss poor excuse there, 1.4 will be hell for them) Either way they left for their own reasons, and you will see the mods you love again.
  24. Not your EnumArmorMaterial, its within range private static final int[] maxDamageArray = new int[] {11, 16, 15, 13}; Your armor is calling an invalid id, until you register one the array stops at 4 and they are used by the default armors. bedrockHead is using the dimond id ( 3 ) bedrockBody is using an invalid id ( 8 ) bedrockLegs is using an invalid id ( 6 ) bedrockBoots is using dimond id ( 3 ) you've also got two issues with your item Id's #1 - they are hard coded, use a config file so users can change the id if they need to #2 - they are too low, you need to be above 4096 to get into item id's Here I'll give you a little push. Put this where your current code is: public static Item bedrockHead; public static Item bedrockBody; public static Item bedrockLegs; public static Item bedrockBoots; Put this in your @Init //Read from Config File Here bedrockHeadId = /*GetValue From Config, Default:*/ 7578; //I added 7000 to your old ids bedrockBodyId = /*GetValue From Config, Default:*/ 7571; bedrockLegsId = /*GetValue From Config, Default:*/ 7579; bedrockBootsId = /*GetValue From Config, Default:*/ 7580; EnumArmorMaterial bedrockarmor = EnumHelper.addArmorMaterial("Bedrock", 33, new int[]{3, 8, 6, 6}, 10); int bedRockArmorId = proxy.addArmor("BedRock"); //There is more info about this in the link I gave you bedrockHead = new ItemBedrockArmor(bedrockHeadId, bedrockarmor, bedRockArmorId, 0).setIconIndex(6).setItemName("bedrockhead"); bedrockBody = new ItemBedrockArmor(bedrockBodyId, bedrockarmor, bedRockArmorId, 1).setIconIndex(.setItemName("bedrockbody"); bedrockLegs = new ItemBedrockArmor(bedrockLegsId, bedrockarmor, bedRockArmorId, 2).setIconIndex(9).setItemName("bedrocklegs"); bedrockBoots = new ItemBedrockArmor(bedrockBootsId, bedrockarmor, bedRockArmorId, 3).setIconIndex(7).setItemName("bedrockboots");
  25. I've never seen anything funny either, but forge outputs a warning to the console so I oblige
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.