Everything posted by DrD
-
[Solved] Prevent all villages from generating
Okay, I solved it. After changing @SubscribeEvent(priority=EventPriority.HIGHEST) to @SubscribeEvent(priority=EventPriority.LOWEST) everything works now. I don't know exactly why.
-
[Solved] Prevent all villages from generating
Ehm, but it works, because this is in the logs: [21:58:52] [server thread/INFO] [MyMod]: Stopped generation of village
-
[Solved] Prevent all villages from generating
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?
-
[1.7.10] Drop items from another mod
That was, what I was looking for! Thank you!
-
[1.7.10] Drop items from another mod
The item is registered under a name in the system. When this item exists can I pull it from there?
-
[1.7.10] Drop items from another mod
Thank you! But for that I need to include the modded class. I want to find a way around this.
-
[1.7.10] Drop items from another mod
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!
-
[Solved] Accessing GUI elements more reliably
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!
-
[Solved] Accessing GUI elements more reliably
Updated the question because I could solve my first problem. :-)
-
[Solved] Accessing GUI elements more reliably
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.
-
[1.7.10] Villager Trading?
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.
-
[1.7.10] Change skeleton subtype
Nevermind, I understand it. Thank you!
-
[1.7.10] Change skeleton subtype
Just to understand the problem. Shouldn't setCurrentItemOrArmor() fail as well? BTW: It works like this ((EntitySkeleton)event.entity).setSkeletonType(1);
-
[1.7.10] Change skeleton subtype
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
-
[1.7.10] Change skeleton subtype
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
Yeah derp, I tried to modify it when I could have just replace everything.
-
Counting the days passing by :P
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());
-
[1.7.10] Prevent pausing the game in the options screen
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?
-
Spawner control
I did not expect you to write the whole code for this. O_O You! Are! Awesome! <3
- Spawner control
- Spawner control
-
[1.7.10] Changing the harvest level of oak wood
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(); } } } }
-
[1.7.10] Changing the harvest level of oak wood
Thank you! I already found it but could not update my post as the forum was somehow unavailable. :-)
-
[1.7.10] Changing the harvest level of oak wood
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?
-
[1.7.10] Changing the harvest level of oak wood
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
IPS spam blocked by CleanTalk.