Jump to content

Skelyvelocirap

Members
  • Posts

    51
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Skelyvelocirap

  1. My item gives me a random item whenever you right click. I tried to utilize the use() method. My issue is that I want to have the user press down the right click button for some time(5 seconds maybe??) and only once that is done should it give the item and repeat if its still held. I tried to use the getUseDuration() method but that doesn't work. I tried to take a look at how its done on some other items(like food items) but i can't figure it out. Can someone help be with this?
  2. That works, thank you! I tried to do that yesterday which didn't work, i just noticed its because i forgot to get the registry name before doing #equals. Well thank you very much for your help!
  3. Alright so, I had to mess with it. I don't know if its exactly what you were saying but thats the only way it seems to work. entityBiome.getRegistryName().toString().matches(Biomes.SWAMP.location().toString() This is the condition which seems to work now. Thanks for your help!
  4. I tried to do that but it doesn't work because Biomes#SWAMP is a registry key while World#GetBiome() returns a biome. In other words its the same as using the Registry#BIOMES_REGISTRY.
  5. Registry#BIOMES? It doesn't show up for some reason. I get Registry#BIOME_REGISTRY and two other similar ones but not Registry#BIOMES. I tried the three other things and none of them are right.
  6. Ohhhhh, alright. I thought it included both. Hmmm, then is there another way i can do this?
  7. I'm trying to check if the player is in a swamp biome. For some reason, it doesn't want to work though. This is what an old post used to make it work(it was recommended to them) but for some reason it doesn't seam to work even being in the same versions. Can someone tell me what I'm doing wrong? @Override public boolean onEntitySwing(ItemStack stack, LivingEntity entity) { World world = entity.level; Biome entityBiome = world.getBiome(entity.blockPosition()); if(entityBiome == ForgeRegistries.BIOMES.getValue(Biomes.SWAMP.getRegistryName())) { //REST OF THE CODE } }
  8. Hmmm... Ok so i ran into another issue. How exactly would i check for the fluid? I know of one way, looping through all the classes and checking what type of fluid they hold but that would be fairly inefficient. I also thought of making a new instance of that class with the correct fuel and using "contains()" with "equals()" but that would require me to know all of the other values in advance. Not so sure how else i can do it. Is there maybe a function i could use to check for only the fuel in those classes?
  9. Hmmmm, ok. I think i get it. So, i simply make one of those classes and make an array of this class. I simply call the array and when adding a new type of fuel, i simply change the values a bit from where i'm calling it and feed that to the array. Seems simple enough, ill see what i can do!
  10. Ok, sorry, i had to go yesterday. Anyways, what exactly do you mean by that? What are data classes? I don't think i have heard of this term yet? Do I simply create a class for my fuel? And how would i use that for an array?
  11. Oh, whoops. Never realized that! Hmmm, then how can i do this? Id prefer having everything in one array. I tried using objects but i don't quite understand how to make them in java.
  12. Hello. I was working on a teleporter for my mod but ran into an issue. This teleporter is going to be consuming different fluids(the fluid logic and fluid tank isn't implemented yet, ill work on it after this issue is resolved) and each of those fluids will have different values which dictates the max distance you can travel with them. The issue i am having is that i am trying to save those values in a multi-dimensional ArrayList. It is an issue because i cannot seem to be able to get the length of the array, or so from what i can tell. Here is how i am making that work: private static ArrayList<String>[][] fuelTypes; public static void addFuelType(Fluid fuel, int fuelEfficiency, boolean isPrecise) { int arrayIndex = 0; int length = TileEntityTeleporter.fuelTypes[0].length; if(length > 0) { arrayIndex = length; } TileEntityTeleporter.fuelTypes[arrayIndex][2].add(Boolean.toString(isPrecise));// = isPrecise; TileEntityTeleporter.fuelTypes[arrayIndex][1].add(Integer.toString(fuelEfficiency)); TileEntityTeleporter.fuelTypes[arrayIndex][0].add(fuel.getFluid().toString());// = fuel.getFluid(); } addFuelType is being used somewhere else but i don't think that matters. Anyways, i pass in the arguments to make it load and when i attempt to load the fueltypes it give me the error of: java.lang.NullPointerException: null at skelyvelocirap.alieninvasion.tile_entities.TileEntityTeleporter.addFuelType(TileEntityTeleporter.java:129) ~[?:?] {re:classloading} This points to this line: int length = TileEntityTeleporter.fuelTypes[0].length; Please help me! I am not sure why its not working, i have tried multiple different things and none of which are working. I feel like im doing a very basic java error but i can't tell what it is! Any help would be appreciated, thanks!
  13. Sorry for answering so late but i did not manage to make this work! I'd show what i tried but i must have deleted it instead of commenting out when testing out a different part of the mod.
  14. Ok, sorry for the late response. I cannot test this out quite yet but i will make sure to do so and say if it worked!
  15. What do you mean? Aren't the tooltips the text that appears below the name?
  16. I want to make a special piece of Armour which will allow the player to see the actual names of some items, without this amour, it should be different. For example, it might turn "My Custom Apple" into lh cmodym noihyo". The second name is just random characters and the first isn't an actual item but anyways, my issue is that i have no clue where to start. Checking what the player is wearing should be "easy" but im not sure how to change the display name. If it changes anything, i have my item names inside a JSON file. Anyways, thanks for the help! Kind regards
  17. Oops, it was on private. It should be fixed now!
  18. Success! It works! I am not sure if it is exactly(i think someone might have told me that actually) but what i did was use drain from the i fluid handler but simulated it and checked if it wasn't null. If it isn't null then i just return the second tank. I will post the code just so anyone who needs help can use it and so that if its not very efficiently done than you can tell me. https://github.com/Skelyvelocirap/Thebalance/blob/master/java/skely/mod/objects/block/TBFluidTank.java https://github.com/Skelyvelocirap/Thebalance/blob/master/java/skely/mod/objects/block/tileentity/TileEntityTank.java
  19. I thought that those two were used to actually drain/fill or check it is possible to do so. How should i use those to solve my issue?
  20. How exactly would i do that? Creating the class would be simple but i mean how would i make them discern whether its filling or draining?
  21. Why do i need to create a new Fluid handler? Can i not do this with the normal one? And so i can simply choose what tank using getCapability? Ohhhh, thats what that means... return CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY.cast(tank); The tank is the tank that is actually being used. I thought that that line simply meant that the tank has the fluid handler capability. Ok, Thank you for your help! I will try this immediately! Hmmm.. although, how do i check if the person is filling or draining?
  22. Hello, I have a block called the fluid tank. This block is... as the name suggests... a fluid tank. The issue though is that i want it to have two FluidTank inside. One of those tanks being like normal but the other tank can only be filled using a machine but can be drained like normal(but has priority). Is that possible? And if so, how can i do that? Thank you!
  23. Hmmm, well i think that would work but each "Fluid Block" would have to have a heat source nearby. I was originally thinking that it would have a "network" in a way which would have the amount of blocks in it and store the total amount of heat and the liquid slime calculates it itself based on that. The issue is that im not sure how i would do that. I think that this would be the most lag_friendly way and what would be the closest to what im imagining how it would work.
  24. Hello, I am currently trying to make a fluid but i want it to be quite a bit different then other fluids but i have no clue how to approach doing so. I have a fluid which i want it to solidify if a property called "heat" is too low. The issue i have is that i essentially want the "heat" to be connected to other blocks. Essentially, you have a 2x2 square of my fluid(liquid slime) and one heat source close by. The "heat" property is going to be shared between only fluid blocks connected to one another. The "heat" property would also depend on all of those. For example, if there is a heat source generating 1000 heat, and there are four liquid slimes, the heat of each liquid slime blocks is going to be 250. Is that even possible to do? Thank you!
×
×
  • Create New...

Important Information

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