Jump to content

ArmamentHaki

Members
  • Posts

    114
  • Joined

  • Last visited

Everything posted by ArmamentHaki

  1. Well I created some spells and the easiest thing would be creating a custom entity that flies in a certain distance and applies damage on collision. I cant show you my code right now however. You will need to learn this stuff if you want to mod so take a look at how Minecraft handles projectiles.
  2. You need multiple things: 1. A Gui Handler that allows you to open Guis on Clientside and Containers server side 2. A TileEntity for your bookshelf (depends on how similar it should be to a chest maybe you can simply extend BlockChest) 3. A capability attached to your itemstack that stores the inventory for your itemstack 4. A class that extends some Gui class 5. A class that extends some Container class This is a whole lot but should give you a basic overview of what you need to do.
  3. Hello, I want a change in the world to happen after some time e. G. Changing a block position tick by tick. My idea was to use the server tick event and "queue" different changes. For instance there could be something happening 3 ticks after clicking an item. Are there any easier ways to do this implemented by forge? Edit: I will try using entities for this purpose first
  4. My fault, I forget we were talking about an item. In that case, I have some points: if(entity instanceof EntityPlayer) will always be true use onItemUse(), not onItemUseFirst /** * Called when a Block is right-clicked with this Item */ public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { return EnumActionResult.PASS; } The casts are unnessecary Try using entity.inventory.deleteStack(entity.inventory.getCurrentItem()); entity.inventory.add(entity.inventory.currentItem, new ItemStack(Items.WATER_BUCKET)); You need to change the bucket back, otherwise, this will only work in one direction
  5. You need two states. One if the bucket is full and one if not. I'd suggest using PropertyBool to create a BlockProperty. Then you override the methods that are provided by the Item class your Item is extended from. I don't know the exact name, but I think it is onItemUse(Use the one were a blockstate is given that is Right-Clicked on). Then perform checks. Like, if the bucket is full, empty it. If not, check if the player clicked water and in that case, fill the bucket. That is all there is to it.
  6. First of all, yes, there would probably be a ton of if statements, as its probably one of the most used statements in Java. I don't think it will have a lot of "then" statements though. If(hehe if statement) you are making a PvP-Mod (what is totally fine to want to make) you should already know that their are tons of fancy PvP-Mods out there. And it sounds to me as if you are only trying to implement things that aren't new, like Toggle Sprint. The reason why you need to understand java is because otherwise you won't understand Minecraft(and Forge) nor be able to modify it to your liking. Finally, when modding, I would suggest not simply asking how to do everything before trying it out yourself. But as for ToggleSprint, there is a field in EntityPlayer called "isSprinting", so everything you would need to do would be use reflect... Wait actually no, that wouldn't work on a Server! What I am trying to say here is that you should remember always only modifying code that doesn't affect Client-Server-Side relations if you are making a pvp-mod.
  7. I created a different-from-vanilla system now. I looked up some source code from other mods and saw that they raise terrain additionally to world generation. I have a custom ChunkGenerator that uses completely different height generation than Vanilla, so my conditions are a bit different. Basically, what I planned/already did until now was: -Create ModStructure, quite similar to the Vanillas' structure start. -Create ModStructureType, determining how to generate in specific ModStructure instances. -Have a List in my ChunkGenerator that holds all ModStructure instances. Planned: - Call generate() for all structures in the list -Precalculating which chunks will be needed for the structure, so that I can raise the terrain. I think this will be the hardest part. Another idea: Raise terrain for each structure piece. -Generating the structure itself on the terrain! These are some screenshots of my dimension. As you can see, single fortresses spawn quite well, but I don't think this will be the case for other structures. https://imgur.com/a/MWPHS (Somehow Uploading won't work)
  8. I think I will somehow manage to prevent weird looks on my Gens, by checking corners and altering terrain. The only issue I really have problems with is lag prevention. Look at for example how my Fortress Generator works(I hope it is on Github). Thanks for all the replies
  9. I did some research on how to prevent chunks from loading that shouldn't be loaded yet(caused by world generators generating across the edge of a chunk). So far what I have found is that usually, the generation is offset into the middle of the chunk. But I need to generate structures bigger than a chunk. How do I do that? I considered using isChunkGeneratedAt(). However, for big structures, I would then need to offset generation far into chunks that were already loaded a long time ago, giving the impression that the structure simply "popped up". There has to be a solution to this. Of course I already checked Minecraft Village generation, but they all seem to have chunk-sized structure components. The only thing that is close to what I want to do is the Mansion, but it is a pain to understand it because of the insane amount of pieces it uses.
  10. As i said I was doing that before, please believe it. Debugging stuff is what I need do most of the time anyways. It was as expected, the World Provider was causing problems, I just needed help to know what these errors were, and it was because the Provider was pointing to the Overworld Dimension Type. That was because the DimensionType can't be accessed directly but only by a method.
  11. Simply look up some instructions online. Automatic upscaling will always give you mixed colors to make it look more smooth, but with very small textures, it won't look quite as before. That is why I suggest upscaling manually. Every one Pixel needs to be 2x2 now so copy whatever pattern you have and then add more detail. Its really just about getting the hang of it. For Minecraft, I find Gimp easier to use.
  12. That is the exact problem, I was already only using the Overworld chunk generator(copy), as stated above, and it is laggy. It only works(still laggy) when I stop the Overworld generator from creating structures like the usual villages or mineshafts. That means that the problem is not the world generation taking place in my class itself, but something which isn't in the chunk generator. This is why I posted it, it is even laggy with the usual Generator, and I have no hints where to start looking after the problem.
  13. I looked into it again and found out that structure generation was taking the most runtime of all. However, even without the structure creation, I get heavy lags, which makes me think that the behaviour is related to overall generation(I believe that structures generally take long to generate compared to normal blocks). This means that I am still stuck on the problem. I researches it and a lot of posts said that it depended on whether you are in an environment or not, and it wouldn't be laggy after building the mod. However, wouldn't that mean that Overworld should be as laggy too? The problem is that every single step in world generation takes too long, compared to Overworld, leaving me with guessing that there is something wrong in the World Provider. But how can I find out what is wrong if it isn't happening in the actual generation that I do?
  14. Actually there are many functions that can be used for that. I think faithful had a rather easy way of doing it, picking the Minecraft colors and reusing them in the same pattern but in a higher resolution. If you have 16x textures that you created yourself, just upscale them manually, with a bit of practise everything below 128 should be not that hard to upscale as you can modify each Pixel.
  15. Well, there aren't tutorials for anything you would want to do. You need to figure it out yourself. First, look at how the Minecraft Rail works by looking into the Source Code. Then decide whether there is an easy way to do what you want to do(e.g Extending and Overriding) or not. Then, try it out. If you are new to modding I would suggest you search for tutorials by the grey ghost or jabelar to understand the basics of Minecraft. Otherwise, have a look at other mods' open source code to learn from them. Choonsters TestMod3 is what I find helpful, as it gives you an overview of how most basic possible uses of Forge work.
  16. When modding, I often run into problems, and I use the debugger for e.g. methods that I created. But since I had this problem before and never knew what could be causing it, I thought I was doing something fundamental wrong whilst creating a dimension. Of course it is easier for more experienced people to know what cause these problems, so I thought I would post this. Before posting I usually invest hours of looking for the error and trying things out, and I am able to solve most things, but I still run into loads of things I don't know about.
  17. Debugger logs nothing special. I didn't inspect any fields as I didn't see anything wrong except for the lag. I printed out how many times a chunk event takes place and it looks like it is only happening once every 5-30 seconds. But I have no idea what causes this lag, only thing I remember is that I had this same issue with another dimension in another project.
  18. The things in the ground are probably clouds. There is a method in WorldProvider to change the height. Other than that, I think you should check how the biomes behave, as this could be the cause for the weird grass colors.
  19. I check whether the player is in overworld now. However,my problem stoll persists. Is this normal for a testing environment? At least I know from other mods that it is possible to have many dimensions without that kind of lag. Edit: I realized that there are only few chunk updates taking place, mostly 0-10 and sometimes up to 30. In overworld, this amount is way higher.
  20. I thought I was performing a check whether I was in overworld. However if that is true, wouldn't I be stuck in loading screen forever?
  21. I checked this again and it seems to work just fine for Nether or end, but not the new dimension. I teleport to this dimension by using World.Load event so I start there instantly after joining the world.
  22. A block object gets created once for every block, while starting up Minecraft. That means, you have exactly one isOn variable for all the blocks that might be in your world. In Minecraft, a block is represented with a Blockstate at a location in the world, meaning that you need the variable isOn(if you really want to use it) available in your blockstate.
  23. Whenever I join another custom Dimension, the world loading takes a huge amount of time. Memory use is always low, but allocated takes full 100%. The ChunkGenerator works the same way as the Overworld one, so that shouldn't be the problem. Also, nothing is logged in the console, only that the server is running huge amounts of ticks behind. https://github.com/Oeku/RPG-Mod/blob/master/src/main/java/net/zeldadungeons/world/medieval/CGMedieval.java
  24. I noticed that but I was asking for a general overview because there are so many different classes that Minecraft uses and it is hard to keep track of what is where. In my case, I want to generate Villages aswell, but I think Minecraft Villages dont use NBT but hard coded files.
  25. I think there should be something in Forge that makes this easier or a helpful post in Common issues, as loads of people have the problem that their GUI resizes on changing the the scale.
×
×
  • Create New...

Important Information

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