
DrD
Members-
Posts
30 -
Joined
-
Last visited
Everything posted by DrD
-
Okay, I solved it. After changing @SubscribeEvent(priority=EventPriority.HIGHEST) to @SubscribeEvent(priority=EventPriority.LOWEST) everything works now. I don't know exactly why.
-
Ehm, but it works, because this is in the logs: [21:58:52] [server thread/INFO] [MyMod]: Stopped generation of village
-
Hi, me again. I do the following in my mod: @EventHandler public void postInit(FMLPostInitializationEvent event) { MinecraftForge.TERRAIN_GEN_BUS.register(new GenStructure()); logger.info("Registered WorldGen Events!"); } That works. Then I call in GenStructures(): public class GenStructure { @SubscribeEvent(priority=EventPriority.HIGHEST) public void onInitMapGenEvent(InitMapGenEvent event) { if(event.type.toString() == "VILLAGE") { event.newGen = new NoVillage(); MyClass.logger.info("Stopped generation of village"); } } } That works too so far, but now in NoVillage: public class NoVillage extends MapGenVillage { @Override public boolean canSpawnStructureAtCoords(int var1, int var2) { MyClass.logger.info("test"); return false; } } And that does not work. The line "test" never appears in the log and the village is generated even though I don't want it. Where is my error?
-
That was, what I was looking for! Thank you!
-
The item is registered under a name in the system. When this item exists can I pull it from there?
-
Thank you! But for that I need to include the modded class. I want to find a way around this.
-
Hi, got a problem. I need to change the drops of a modded item. I know, I can access the HarvestDropsEvent event, so I can do something like this: public void onHarvestDropsEvent(HarvestDropsEvent event) { if(event.block.toString().contains("net.minecraft.block.BlockOldLog")) { event.drops.clear(); event.drops.add(new ItemStack(Items.stick, random.nextInt(3)+1)); } } When I break wood, I get a few sticks instead of the wood logs. That works! But now I want to drop a modded item. How can I spawn it when I only got the name of it and not the actual class? Thank you!
-
Thank you for your answers. I don't try to access my own button (that would be easier), I want to access the regular Minecraft GUI. The ID of the buttons are not unique so I cannot use "button.id". Nevermind, I just did it wrong! It works now, thank you!
-
Updated the question because I could solve my first problem. :-)
-
Hi, I have some noob questions. Problem #1 solved itself somehow!? To identify the buttons in the GUI I can do something like this: if(button.displayString.contains("Difficulty")) { button.enabled = false; } But this fails when the user has changed his language. How can I identify the buttons more reliably? Forge version is 1517 so I'm still in 1.7.10.
-
I looked into the documentation but did not find an event for successful or unsuccessful villager trading. I have another mod that implements trading with its own entities with the regular merchant mechanics. My idea is to find out when a player has interact with one of the entities to trigger events that are important for the later game. It is a bit difficult to explain. I just wondered there are so many events for all sorts of interaction but none for trading. Maybe I just miss something.
-
Nevermind, I understand it. Thank you!
-
Just to understand the problem. Shouldn't setCurrentItemOrArmor() fail as well? BTW: It works like this ((EntitySkeleton)event.entity).setSkeletonType(1);
-
Hm, then tell me please what's wrong with this? import net.minecraft.entity.monster.EntitySkeleton; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraftforge.event.entity.EntityJoinWorldEvent; import cpw.mods.fml.common.eventhandler.SubscribeEvent; public class WitherSkeleton { @SubscribeEvent public void onMobSpawn(EntityJoinWorldEvent event) { if (event.entity instanceof EntitySkeleton) { event.entity.setCurrentItemOrArmor(0, null); // works event.entity.setCurrentItemOrArmor(0, new ItemStack(Items.stone_sword)); // works event.entity.setSkeletonType(1); // does not work! } } } Forge 1.7.10-10.13.0.1208
-
Depending on the latest javadocs there should be a function public void setSkeletonType(int p_82201_1_) in net.minecraft.entity.monster.EntitySkeleton. However when I try to call it it tells me cannot find symbol. Eclipse does not find it either. All necessary libs are included and the object is called correctly. Other functions work flawless. Am I missing something or did someone forget to implement it?
-
[1.7.10] Prevent pausing the game in the options screen
DrD replied to DrD's topic in Modder Support
Yeah derp, I tried to modify it when I could have just replace everything. -
How about? @SubscribeEvent public void onTickEvent(WorldTickEvent event) { // Overworld only if(event.world.provider.dimensionId != 0) { return; } // What time is it? long worldTime = event.world.getWorldTime(); // 24000 ticks is one minecraft day if(worldTime%24000 != 0) { return; } // Do something } The event is https://docs.larry1123.net/forge/1060/cpw/mods/fml/common/gameevent/TickEvent.WorldTickEvent.html You need to register FMLCommonHandler.instance().bus().register(new yourClass());
-
Hi, I want the options menu to keep the game running even in single player. I can check if the game is paused with doesGuiPauseGame() but I cannot overwrite it. The events I found are fired after the gui has been initialized so I think it is too late to override the default behaviour. How can I prevent the game from pausing in single player?
-
I did not expect you to write the whole code for this. O_O You! Are! Awesome! <3
-
I don't want to make the block harder. I want it to be unharvestable by hand. This does exactly, what I want: @SubscribeEvent public void onHarvestDropsEvent(HarvestDropsEvent event) { // Oak Wood logs if(event.block.toString().contains("net.minecraft.block.BlockOldLog") && event.blockMetadata == 0) { // Mined by a player if(event.harvester != null) { // Get the current tool of the player if(event.harvester.getCurrentEquippedItem() != null) { String tool = event.harvester.getCurrentEquippedItem().toString(); // No TiCo Tools => no oak if(!tool.contains("item.InfiTool.Axe") && !tool.contains("item.InfiTool.LumberAxe") && !tool.contains("item.InfiTool.Battleaxe") && !tool.contains("item.InfiTool.Mattock")) { // Delete all drops event.drops.clear(); } } else { // Delete all drops event.drops.clear(); } } } }
-
Thank you! I already found it but could not update my post as the forum was somehow unavailable. :-)
-
After searching around I think HarvestDropsEvent might be a better choice as it gives me all needed information. The only question is how do I find out what tool was used?
-
Thank you, I will look at it. There will be some custom trees (Natura/BoP) so the risk is not that bigger than in vanilla minecraft where you can also spawn in a desert with no trees around. But the general idea is to make minecraft a lot harder to play so I do not care about the risk. :-D