Jump to content

TheMasterGabriel

Forge Modder
  • Posts

    178
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by TheMasterGabriel

  1. No, you do not need to make a custom ThirstHandler. From what I can tell, PlayerEvent.Clone only fires on the server-side. That means that when you set your thirst level, you are only setting it on the server-side. In order for you to see the changes visually, you need to update the client-side as well. You can do that via a packet, which you can send to the client after you update the player's thirst level. You can read about networking here.
  2. Say I wanted to check if a chunk has spawned a specific structure. I know that I can check to see if a chunk has generated a specific terrain feature, like Dungeons or Lakes (etc), with the PopulateChunkEvent.Populate event. However, I can't seem to find something similar for physical structures, like Mineshafts or Ocean Monuments. I was wondering if something like that existed. An example use-case would be to say, alert the player via a message if a Mineshaft or Stronghold has generated in a nearby chunk.
  3. Check out how vanilla classes pull their color data for outlines and manipulate it to your liking. In your Render class, you may be able to set the color by enabling color material via GlStateManager.enableColorMaterial(); and then changing the color with GlStateManager.enableOutlineMode([*color int*]); You can look at RenderBoat for an example. Not sure if this works though, I haven't tried it. Also, to get a color without having to do all the math/googling you can use the MathHelper function that takes in 3 ints from 0-255 (RGB) and returns the single int: public static int rgb(int rIn, int gIn, int bIn)
  4. Wait what exactly is the problem? Is it that the item isn't rendering on your pillar? Please explain.
  5. In your code, you already check if you are on the server side. Because of that, you can cast your world object to a WorldServer object and then use the following method to spawn your particles. It's much easier than the manual packet thing (which I wouldn't have told you about if I'm not oblivious and had read the WorldServer class). Well, knowledge of packets is always good anyways . /** Spawns the desired particle and sends the necessary packets to the relevant connected players. */ public void spawnParticle(EnumParticleTypes particleType, double xCoord, double yCoord, double zCoord, int numberOfParticles, double xOffset, double yOffset, double zOffset, double particleSpeed, int... particleArguments)
  6. Make sure to use the method that passes the IBlockState parameter, not the deprecated one that doesn't. Block#hasTileEntity(IBlockState)
  7. Whoops, I don't know how I missed that. Apologies From past experience, I'm fairly sure that particles only exist on the client, which is why you are not seeing them. Block#randomDisplayTick fires only on the client side, so it makes sense that you could see them there. Try spawning them on the client side. As for your variable problem, that is also due to the client/server side. In order for tile entity to recognize the variable changes on the client-side, you need to update the number of right clicks on the server side and then send the update to the client-side via a packet. You can read about networking and the side stuff on the Forge docs here.
  8. Do not extend BlockContainer. BlockContainer is the vanilla way of doing things and often causes problems like yours because people don't realize some of the things it does. BlockContainer changes the render type of your block to INVISIBLE, and you probably want MODEL (as per your JSON blockstates and models). Override these Forge functions from Block instead of extending BlockContainer: public boolean hasTileEntity(IBlockState state) public TileEntity createTileEntity(World world, IBlockState state)
  9. I was wondering if there was a reliable way of checking if a chunk has generated a specific structure. I noticed that the PopulateChunkEvent provides a flag for when a village has generated in a chunk, but what about the other types of structures? From what I can tell, there isn't. I have some ideas for a PR if there isn't a way currently (as I think this would be a useful addition), but I just wanted to check to see if anybody else knows something that I missed.
  10. What version are you using? If it's the latest, you are not overriding onBlockActivated, as there is an extra ItemStack parameter. You should be overriding public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { return false; } which you can find in the Block class.
  11. I believe that Forge has now implemented an energy capability based off of the CoFH library, so there should be no real need to download the original one (although I'm not sure how used either are in comparison to each other). You can implement it via IEnergyStorage or use Forge's EnergyStorage object. You can read more in-depth about capabilities here
  12. Hi, Because Minecraft doesn't support all possible Unicode characters, I was wondering if there was a way to add glyphs for the ones it's missing? My first thought was that this would be as simple as adding localized names for blocks/items/entities/etc but looking at FontRenderer, that doesn't seem to be the case.
  13. Yea, I thought of that as a possibility. I was wondering if there was an alternative, but I can do that. Thanks
  14. Hi, I'm making a mod that generates stuff relative to the position of spawned structures, specifically Strongholds. I was wondering if there was an event that gets fired whenever a structure is first generated? I've tried looking and it appears that there is a flag that is sent through PopulateChunkEvent that determines if a village has generated in a chunk, but nothing for structures in general. Am I missing something? Thanks - TMG
  15. In the generateNewNoise method: I might be wrong in my assumption, but I think you are meaning to do 2iterations. If so, that's not the Java exponent operator. That's the bitwise xor operator. Use Math.pow(2, iterations) instead.
  16. You can also check out GuiIngameForge#renderSleepFade to see how the sleeping fade works if you want a reference point.
  17. You can also check if an achievement is unlocked like so, which is how the achievements page fetches the info: Minecraft.getMinecraft().thePlayer.getStatFileWriter().hasAchievementUnlocked(achievement)
  18. You can fetch an array of all the player's usernames via the PlayerList like so: FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList().getAllUsernames() .
  19. I would check out the Zombie class and see how they path to village doors.
  20. As Animefan stated, no you cannot use a TileEntity's worldObj or pos variables until they are set (which happens after the tile entity is constructed). However, Forge provides a handy function called onLoad that you can override in your tile entity where you can reference the its world and position.
  21. When Minecraft initializes all the recipes you add, it sorts the list. I suspect that your recipes work because of a quirk in how Java implements list sorting, but that's entirely unplanned. If you want to build a stable mod that is ensured to work for everybody, do it by creating an IRecipe instance. It's not that difficult. Just copy the ShapelessRecipes class and change the line in the matches method that checks for item and metadata equality to check for stack size as well. You can then just add your recipes like: GameRegistry.addRecipe(new MyCopiedShapelessRecipes(output stack, input stack)); However, if you aren't that familiar with Java programming, please take some time to learn at least the basics before jumping in blind. I promise that you will understand a lot more and we will be able to help you a lot more efficiently if you do.
×
×
  • Create New...

Important Information

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