Everything posted by V0idWa1k3r
-
Machine Block HELP [1.12]
Why did you commit compiled class files to github? You do realize we can't open them and look at your code right? Git is where you upload your sources, not your compiled application. As a side note - that is not how you setup a minecraft mod repository. The root directory must be your workspace directory.
-
[1.12.2] Random damage for sword every time it's crafted
You need to store the additional value to your ItemStack's NBT data or a capability, then override Item#getAttributeModifiers and make the damage attribute add the itemDamage + yourDamage as the modifier. See how ItemSword does that. Edit: Thanks for @Animefan8888 for correcting my mistake, whoops, had ItemStack written as the base class instead of Item.
-
Add splash texts to main menu (without overwriting existing?)
Unfortunately splash texts are a normal resource meaning you can only replace it, not add new entries. The only resource you can add entries to are lang files since they are merged after being collected. Any other resource is just replaced by the one supplied by the last resource pack to be loaded. The best you can do is use the GuiOpenEvent, detect the GuiMainMenu, read the splash text yourself, collect a list of entries, then do a random.nextInt(list.size) == 0 and if it is true change the value of GuiMainMenu.splashText
-
[1.12.2] Access Transformer problem
This is happening because java doesn't allow overrides to lower the access level of the overriden method. If the method in class A is public, then class B that extends A and overrides the method must also have that method as public, not protected or private. In your case you are making This as public but look at public static final CompiledChunk DUMMY = new CompiledChunk() { //LINE 17 - THIS DOESNT APPEAR TO BE BEING MADE PUBLIC protected void setLayerUsed(BlockRenderLayer layer) { throw new UnsupportedOperationException(); } public void setLayerStarted(BlockRenderLayer layer) { throw new UnsupportedOperationException(); } public boolean isVisible(EnumFacing facing, EnumFacing facing2) { return false; } }; In this class. It overrides the method and has it as protected which isn't allowed in java. You need to change this method as well. Try to also add this inner class to the AT as net.minecraft.client.renderer.chunk.CompiledChunk$1. This may or may not work. If it doesn't revert to your field tactic. Or use reflection. It is not that bad. Method lookups and changing the access levels are expensive with reflection. Simply invoking a cached method that already had it's access level set to accessible isn't.
-
Trying to sync server -> client configs, but maybe I'm doing it wrong.
This is a pretty good way to sync the config values. The only problem with this approach is that when the player leaves the server it's config values will still be the server's so I would also keep a backup copy before accepting server configs and revert to it when the player disconnects. You could iterate the properties in the config, write their values to the buffer prefixing everything with the size of the property map, then read them as raw byte arrays as long as there is something to read from the buffer, then recreate the values in the handler from the byte arrays. This approach is however worse than the one you are using since It assumes that all values in the config are 4-byte values(but there are ways around that but that makes the packet way longer and thus adds even more data to be transferred to the client when they log in) It will not work well if the config versions differ from client to server(a new mod version or something) but to be fair your current approach won't work either and again there are ways around that but again that would make the packet even longer.
-
[1.12.2] Properly registering dimension biomes
Yes they do get registered. That is the whole purpose of the registry event. They just don't generate. There is a difference. A registered object doesn't necessairly need to appear in the game at all. Also as @Cadiboo said instantinate your biomes in the event too. BiomeManager.addBiome(biomeType, new BiomeEntry(biome, 10)); BiomeManager.addSpawnBiome(biome); This is why your biomes were spawning in the first place. This adds the biome to the biome entry list that the biomes will get pulled from. The second line allows the player's spawn biome to be yours. To have your biome spawn in your dimension you need to change the BiomeProvider in your WorldProvider and make that BiomeProvider have your biome as a possible biome to spawn. See WorldProviderEnd#init for an example of a single biome per dimension that only generates in that dimension or look at BiomeProvider itself to see how it keeps an array of biomes that can be generated.
-
Minecraft not calling 'drawString' at all
This will fire each time a HUD element is drawn. Once for health, once for hunger, once for experience, etc. You need to check the current element being drawn with RenderGameOverlayEvent#getType. Otherwise you will be drawing your text many times per frame. Also I don't believe RenderGameOverlayEvent itself is ever thrown. It's either Pre, Post or another child of that class. You probably need to handle one of the children events instead. This wouldn't even compile. Minecraft.fontRenderer is not static. Actually speaking of this, fontRendererObj got renamed to fontRenderer a while back. What version are you using exactly?
-
{Solved} Right click action going through twice
You are confusing this method with the right click event. The event will indeed fire for both hands. The Item#onItemRightClick will only fire for the hand holding the item. You can't do this without first checking whether the side the action is happening on is a server. Otherwise it will create a "ghost" entity on the client that will stay there untill relog. As @Daeruin said Same with this, you need to check the side. Otherwise you are sending the message twice.
-
Why is player name and player UUID changing every time I run my mod?
I was just clarifying this point of yours These are independent of which player you are since these are stored in the level.dat file.
-
[1.12.2] Chat Messages
Define "send a message". Send it to a server for everyone to see? Or display it for the player who clicks on the block? If it's the former use PlayerList#sendMessage. If it's the latter use Entity#sendMessage
-
Why is player name and player UUID changing every time I run my mod?
These are in no way related to UUIDs in single player which is where you will spend most of your time modding. Player data is stored within the level.dat file and that includes the capabilities. However when you are modding for multiplayer you also might want the UUID to be random to generate random players to join them all to a server. In general I see little point in keeping the player login data consistent. It doesn't matter in single player and you want different players for multiplayer. There are however cases when you need to store something about the player by the UUID - say their relationship points with villagers - those would be stored in a map<UUID, Integer> in the entity. But these edge cases are far and between.
-
How to modify vanilla ore generation in 1.12.2?
https://mcforge.readthedocs.io/en/latest/events/intro/ Any class/object can be an event handler. There are no restrictions as far as I am aware.
-
How to modify vanilla ore generation in 1.12.2?
Disable their generation and run your generation instead. To disable the generation of a specific ore handle the GenerateMinable event, check if the EventType is the one you want to disable and set the result to DENY. It is absolutely possible but depends on the generation method. You could stop the vanilla's iron ore generation and replace it with your own one that generates the ore and maybe generates the rare ore. If for some reason you can't do that(for example you need to generate your ore in the ore of an another mod that doesn't throw any events) you will have to scan the chunk for the ores to generate your stuff in.
-
Text not being displayed!
# is just a way of writing method reference in the javadocs. When I say ClassName#methodName I mean invoke the method "methodName" using an instance of class "ClassName". If the method was static I would use a dot instead of #(ClassName.methodName)
-
Text not being displayed!
Check that the current element the event had fired for is the one you want to render your stuff after. You can get the current element from RenderGameOverlayEvent#getType
-
Text not being displayed!
Don't remove the original question from your post. If the issue has been resolved but you have a new one just leave a new reply. Now if someone else has the BOM character issue they won't be able to find a solution by searching the forums since you have changed the title and removed the question. Are you sure the event is being handled? As in how did you register the event handler to the bus? Why? This fires multiple times for various HUD elements. You need to check the current element and only draw your text once per frame instead of once per element.
-
Text not being displayed!
As far as I am aware that is a BOM(Byte Order Mark) character issue. Open your file in a text editor that allows you to change the encoding, such as Notepad++ and change the encoding to UTF-8 without BOM(obviously override the file after you've done that).
-
1.12.2 EnumFacing Help!
https://mcforge.readthedocs.io/en/latest/blocks/states/ https://mcforge.readthedocs.io/en/latest/models/blockstates/introduction/
-
1.12.2 EnumFacing Help!
I just listed the things that you need to do. If you need an example start with something simple, like a hay block(BlockHay). I am not going to write code for you, that won't help you.
-
"Kill aura" cheat prevention
It is possible to attack up to the block reach distance in creative mode. Which is 6 blocks. 1.7.10 is no longer supported on these forums.
-
1.12.2 EnumFacing Help!
Well, did you look at what the anvil does to acheive that? You need a direction property registered in your BlockStateContainer, you need it serialized and deserialized from metadata and you need to set that property in your blockstate container to a value when the block is placed. Oh and you also need to define the values of that property in your blockstate file and rotate it accordingly.
-
1.12.2 EnumFacing Help!
IHasModel is stupid. All items need models and there is nothing about a model registration that requires access to protected/private methods of the item. Register your models in the ModelRegistryEvent directly. Cool. What exactly are you trying to do? Define "work on". Because I can't tell your intentions by looking at your code since it does nothing. Block doesn't have a onItemUse method. Item does. Unless you are calling it from somewhere this method does nothing.
-
"Kill aura" cheat prevention
Because the player's reach is 5 blocks and this method allows anything within less than 6 blocks to be attacked. The combat will break completely because the player won't be able to attack anything that isn't extremely close to them. And it won't prevent the "kill aura" anyway. As a side note - what version of the game are you talking about? This method is different in the latest version. In fact since it doesn't check the thread the packet is received on I suspect this is 1.7 or earlier but I might be incorrect.
-
I'm having trouble making a bale of hay.
Don't have empty variants. It isn't supposed to be empty anyway - if the X axis is the default one and the Z is rotated by 90 degrees on the Y axis then the Y variant should be rotated by 90 degrees on either X or Z axis. Here is my example of using a blockstate with rotation. This actually means that your block doesn't have the rotation property at all, since if it had a property that wasn't specified in it's blockstate file it would have a missing model since it's blockstate file is invalid. Either you are not relaying the correct information or you don't have the property in your BlockStateContainer. Show it anyway, you have some conflicting information here.
-
Entity Not Spawning
This task only selects the nearest entity matching the predicate as a target. It doesn't actually make the entity move to the target or even attack it. You need to add those other tasks too.
IPS spam blocked by CleanTalk.