Everything posted by V0idWa1k3r
-
Player List
What are you trying to cast to EntityPlayer? You do not yet have a local/field named player. Additionaly you can't have 2 locals with the same name. Moreover if the entity you are casting is not an instanceof EntityPlayer you will crash with a ClassCastException. There is an instanceof check in the language, use it. Comparing a local after casting to a local before casting is redundant. It is the same object, the == check will always be true. Those are java basics. getEntityWorld only returns the overworld. There is a list that holds all players already, it is called something like playerEntitiesList. I have no idea what are you trying to do with that timer but that will not work. If you want to store data related to a player use capabilities. If you want to do something regularly use forge's TickEvent subevents.
-
[1.11.2] Getting Item from LivingEntityUseItemEvent.Finish
If you read the javadocs of the LivingEntityUseItemEvent.Finish you will see the following lines: Fired after an item has fully finished being used. The item has been notified that it was used, and the item/result stacks reflect after that state. Note the item/result stacks reflect after that state. part. If you have used the potion the item is indeed an empty stack - as that is what happens to a potion as you drink it. You can make a workaround by subscribing to either Start or Tick subevents, storing the reference to the stack being used somewhere(presumably in a map, just make sure to not leak memory with your keys), removing that reference on the Stop subevent and using that reference as the item being used originally at your Finish subevent handling. Do not forget to clear that map when needed. That is not a perfect solution and if someone suggests a better one you should use theirs.
-
[1.12] Tileentity not working right
Setting the tileentity like that updates the position of that tileentity. So your next call is already using the new pos - the one you've just set your tile to, the position local to be precise. So it sets the block in front of the original position to air as that is the position it is currenty at. You should not really "move" a tileentity like that. Either carefully invalidate/validate it manualy as you do or simply create a new one and copy all the data over
-
[1.10.2] [SOLVED] Performance measuring
VisualVM is the default jvm profiling tool that is usually shipped with your JDK. It is pretty good and should suffice in most cases. I remember there being mods that did the same, opis and alike. I also remember seing something about alternatives for MC 1.10+. I'll look them up and edit this post with their names if I find any. Also this question is not related to modding directly, so I do not think that this is the right subforum for it? Edit: that alternative is called TickProfiler.
-
[1.10.2] How do I disable the oversized head on the baby version of my mob.
The debuger can't 'not show anything'. Even if your breakpoint isn't triggered it is already showing something, isn't it? It is showing that your code isn't being executed. Then you take if from there and try to see why exactly is it not being executed. If your whole IWorldGenerator is not being triggered(that is a breakpoint at the start of the generate method isn't triggered) then you are not registering your generator correctly. If that breakpoint is triggered something later down the lines isn't correct and the breakpoints allow you to figure out precisely what. If you are using logging to debug - well, you shouldn't. Learn how to do breakpoints, it is literally 1 click of your left mouse button. Logs were ment to give information to the end-user, not to debug. Try again with breakpoints(or if you already are tell exactly what part of your code is not being executed) and post the answer in that other topic of yours.
-
[1.10.2] How do I disable the oversized head on the baby version of my mob.
1. You continuing to post in this topic which is completely unrelated to your current issue. You already have a topic that is related to worldgen with templates. Post there. Posting here just makes it more difficult for others with the same issue to find a solution later as they are likely to skip this topic judging by it's name. if ((int) (Math.random() * RealmOfTheDragonsConfig.testhousechance) == 0) => if (rand.nextInt(RealmOfTheDragonsConfig.testhousechance) == 0) The whole getGroundFromAbove method can be replaced with world::getPrecipitationHeight and a while loop to 'drop down' to the ground in case precipitation height is a tree leaf or something. More efficient than iterating from 255 and all the way down. foundGround = blockAt == Blocks.DIRT || blockAt == Blocks.GRASS || blockAt == Blocks.SAND || blockAt == Blocks.SNOW || blockAt == Blocks.SNOW_LAYER; What if the biome's top block is neither? For example AbyssalCraft's biomes have custom mod-added blocks as top blocks of their biomes. You can also directly return from the while loop. The foundGround local is redundant. // if Y > 20 and all corners pass the test, it's okay to spawn the structure return posAboveGround.getY() > 63 && corner1 && corner2; if Y > 20 return posAboveGround.getY() > 63 One of these two statements is a lie isCornerValid method currently always returns true so there is no reason for it to exist in it's current implementation. Why have you hardcoded 63 everywhere as a minimum height? What if the world is lower than that? Apart from all that I do not see more obvious issues. Is your structure not spawning? What is happening then? Have you tried debuging it? What are the results of the debug?
-
[1.11.2] DrawForeground/Background on GUI Screen
Calling super first makes the button drawn first and then everything is drawn over it. Call super last and it will draw the buttons over the rest of the ui.
-
Forge fluids, help with creative tab, name, and crafting recipe. 1.11.2
Getting a registry object by ID requires a map lookup every time you do so. Getting an effect from a field requires... getting it from a field. The performance is way better if you use the later. It also generates a more readable code. Imagine yourself looking at this code 6 months later. Will you remember what this 19 is there for? What if IDs change? You will have to spend time figuring it out and that is not productive.
-
Container not pulling items from their corresponding spots.
https://github.com/xt9/DeepMobLearner/blob/master/src/main/java/xt9/deepmoblearning/common/items/ItemDeepLearner.java#L24 No, you must open a container on both the server and the client. Opening it on the client only leads to all kinds of bugs including the one you are experiencing. How would a container be opened on client only if the server needs to know about inventory changes? Remove the isRemote check and everything will work fine.
-
Forge fluids, help with creative tab, name, and crafting recipe. 1.11.2
To add a bucket to your fluid you would call FluidRegistry::addBucketForFluid. As you are doing. Is something not working correctly? It will be added to a creative tab that all buckets are at(I believe it is the Miscellaneous tab) if you call that method. Do not name the bucket, name the fuild(Fluid::setUnlocalizedName) and localize that, the bucket will be localized from there. Forge uses capabilities to store fluids in the bucket and so will you. Create an itemstack of a bucket, access it's capabilities and add your fluid into it using the capability. After that just return that stack as a result of your recipe. You can't call client side code from a common class or you will crash the server. You are adding a bucket twice. Granted it should not matter as bucketFluids is a set and set can't usually contain equal elements within but that is still redundant. Potion.getPotionById(19)? What is 19? Where is this magical number coming from? Why are you even using Potion::getPotionById? You have the MobEffects class at net.minecraft.init that contains all potion instances.
-
[1.12] Tileentity not working right
I do not think vanilla has an example of that kind. I can provide you with an example though. It shows you how to make metadata independent properties that are obtained from data in tileentity. Making powered a property should not be much different from that.
-
[1.12] Tileentity not working right
Apart from that I do not see anything that would reset the fuel values. I see that you are changing blockstates in your tileentity without a check if you are on a server and not a client so it could be causing your issue. Why do you have 2 different blocks for your auto miner? Powered and not can be a property that is obtained from say your tileentity in getActualState. You will need to make sure it is synced though.
-
[1.12] Tileentity not working right
Yeah, that can work, sure. There are potential issues with implementations of BlockAutoMiner, if you have multiple of them that is. That is not a typo in game's code. That is a typo in MCP mappings. You can submit a bug report on their repo if you feel like it.
-
Any way to check if the code is running on Client, or server?
That is weird. Last time I checked setUnlocalizedName had no SideOnly annotation so it should work fine on both server and client. In any case if you need to call methods that only exist on client use proxies.
-
[1.12] Tileentity not working right
When you change a blockstate of a block it's tileentity gets recreated unless you explicitly tell it to not do so. You can do so at TileEntity::shouldRefresh. Note that you should not blindly return false as this check will fire even if the block itself is completely different.
-
[1.10.2] How do I disable the oversized head on the baby version of my mob.
I do not see any reason why it shouldn't
-
[1.12.0] Recipe Registration
Read the message of this commit. As Lex said - please be patient.
-
Ticking Block Entity Null Pointer
That is because you need to sync the values between client and server. Either use custom packets, vanilla methods (SPacketUpdateTileEntity, getUpdateTag and such) or sync your data in the GUI directly if you only need it to be visible in the GUI(see GuiFurnace for an example and give me a minute to try and find a thread with a similar issue so I can link it here) Edit: here it is
-
[1.12] Tileentity not working right
You have the hand the player clicks your block with as an argument. That argument is called hand. Do not reinvent the wheel. That method already exists at TileEntityFurnace and it is public and static. Offhand - 40. Mainhand - player.inventory.currentItem. => playerIn.getHeldItem(hand).shrink(1); As for your issue itself try debugging it. Set some breakpoints up, see which method fails the checks, try figuring out why. Edit: Okay, just want to clarify something as my response may seem weird at the point of me talking about the hand argument as you clearly see it existing. To clarify - the issue here is me failing to see any reason as to why are you ignoring the offhand completely and only do things for the main hand. I also tested your code with hand and method references corrected and I do not have the issue.
-
Ticking Block Entity Null Pointer
Wrong subforum. That is a very interesting way of inversing conditions. Are you aware that you can put your condition in parentheses and put a ! before them? This field makes no sense whatsover. TileEntities already have a world field in them(it, conviniently, is also called world). Not only is this redundant it will also crash the server as Minecraft is a client-side only class. You do not need this field. If the tileentity gets ticked(update method is called) it's world can't be null unless explicidly nullified which is not the case for vanilla or any mod that I know of. If tile's world is null and it ticks that is a severe issue on the part of the mod that nullified the world and it is their bug. Even discarding all that this check is pointless as you access tile's world object a few lines above meaning that even if it's world would be null it would crash before getting to this check. RNG => world.rand. No need to create new Random object each tick. Why do you even need this field? You only ever access it to obtain a property instance. Those should be static. And final. You should not need an instance to obtain it. The tiles are updated on both client and server. You might want to adapt your logic to that aswell since you are currently setting blockstates regardless of if it is client or server, which you should not ever do. Blockstates changes should be done on server only.
-
[1.12] Lang file not loaded? {SOLVED}
Use v3 resources. You are currently using v2 which is outdated. Create a pack.mcmeta file in your resources folder and in it define pack_format property as 3. You should also define a description property. Example structure of your pack.mcmeta file can be found in forge's example mod that is shipped with MDK or here. Then rename en_US.lang to en_us.lang(convert it's name to lowercase) and you should be good to go. V3 works just fine in 1.12 for me.
-
[1.11.2] DrawForeground/Background on GUI Screen
Background and foreground are called from this method regardless, background is just called first, then foreground.
-
[1.11.2] DrawForeground/Background on GUI Screen
GuiScreen::drawScreen. Just do not forget to call super.drawScreen() after you are done to render all the buttons and text fields
-
Player Data?? - NBT
Use capabilities.
-
[1.10.2] How do I disable the oversized head on the baby version of my mob.
What do you need a tutorial for? Creating a resourcelocation? Obtaining a template instance from that location? Calling 1 method to generate the structure from a template? You start of by creating your structure in game. Then you save it with structure blocks. Then you grab the resulting nbt file and place it in your structures folder in your assets. Then in your world generator you load that structure into memory by calling TemplateManager::getTemplate. Then you call Template::addBlocksToWorld and you are done. Want an example? Grab one at net.minecraft.world.gen.structure.ComponentScatteredFeaturePieces.Igloo. If you want an example with IWorldGenerator - here is one. It is not perfect but is fine as an example.
IPS spam blocked by CleanTalk.