-
Posts
42 -
Joined
-
Last visited
Everything posted by Geometrically
-
Getting EntityPlayer in a TickEvent to call another method.
Geometrically replied to Geometrically's topic in Modder Support
I'm trying to use all of them. The method called prints out messages to the whole world -
Getting EntityPlayer in a TickEvent to call another method.
Geometrically replied to Geometrically's topic in Modder Support
printMessages(null); } public void printMessages(EntityPlayer player){ That little snippit of code. Look at the first post. -
Getting EntityPlayer in a TickEvent to call another method.
Geometrically replied to Geometrically's topic in Modder Support
So what do I put to get the player? -
I want to call a method that has a parameter, EntityPlayer player to a TickEvent. I did this with null, and I get a NullPointerExeption. How do I get the entity player there and put it there? My code is attached. The line is printMessages(null); package com.geometrically.SolarApoc.util; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.text.TextComponentString; import net.minecraft.util.text.TextFormatting; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent.WorldTickEvent; public class WorldTickHandler { public static int ticker; @SubscribeEvent public void onWorldTick(WorldTickEvent handler){ ticker++; //Tick Checkers if (ticker > SAConfiguration.dayoneStart){ SAMethods.beginDayOne(); System.out.println("Day One has started"); } if (ticker > SAConfiguration.daytwoStart){ SAMethods.beginDayTwo(); } if (ticker > SAConfiguration.daythreeStart){ SAMethods.beginDayThree(); } if (ticker > SAConfiguration.dayfourStart){ SAMethods.beginDayFour(); } if (ticker > SAConfiguration.dayfiveStart){ SAMethods.beginDayFive(); } printMessages(null); } public void printMessages(EntityPlayer player){ //Message Printers if (ticker == SAConfiguration.dayoneStart){ SAMethods.beginDayOne(); player.addChatComponentMessage(new TextComponentString(TextFormatting.RED + "The Solar Apocalypse has started. Day One will now upbring its wrath.")); System.out.println("!!!!!!!!!!!!!!!!!!!!Day One has started"); } if (ticker == SAConfiguration.daytwoStart){ SAMethods.beginDayTwo(); player.addChatComponentMessage(new TextComponentString(TextFormatting.RED + "The Solar Apocalypse's second wave has arrived. Day Two will now upbring its wrath.")); } if (ticker == SAConfiguration.daythreeStart){ SAMethods.beginDayThree(); player.addChatComponentMessage(new TextComponentString(TextFormatting.RED + "The Solar Apocalypse's third wave has arrived. Day Three will now upbring its wrath.")); } if (ticker == SAConfiguration.dayfourStart){ SAMethods.beginDayFour(); player.addChatComponentMessage(new TextComponentString(TextFormatting.RED + "The Solar Apocalypse's fourth wave has arrived. Day Four will now upbring its wrath.")); } if (ticker == SAConfiguration.dayfiveStart){ SAMethods.beginDayFive(); player.addChatComponentMessage(new TextComponentString(TextFormatting.RED + "The Solar Apocalypse's fifth and final wave has arrived. Let's see how long you can survive. ")); player.addChatComponentMessage(new TextComponentString(TextFormatting.GOLD + "Escape if you can.")); } } }
-
I want to call a method that has a parameter, EntityPlayer player to a TickEvent. I did this with null, and I get a NullPointerExeption. How do I get the entity player there and put it there? My code is attached. package com.geometrically.SolarApoc.util; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.text.TextComponentString; import net.minecraft.util.text.TextFormatting; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent.WorldTickEvent; public class WorldTickHandler { public static int ticker; @SubscribeEvent public void onWorldTick(WorldTickEvent handler){ ticker++; //Tick Checkers if (ticker > SAConfiguration.dayoneStart){ SAMethods.beginDayOne(); System.out.println("Day One has started"); } if (ticker > SAConfiguration.daytwoStart){ SAMethods.beginDayTwo(); } if (ticker > SAConfiguration.daythreeStart){ SAMethods.beginDayThree(); } if (ticker > SAConfiguration.dayfourStart){ SAMethods.beginDayFour(); } if (ticker > SAConfiguration.dayfiveStart){ SAMethods.beginDayFive(); } printMessages(null); } public void printMessages(EntityPlayer player){ //Message Printers if (ticker == SAConfiguration.dayoneStart){ SAMethods.beginDayOne(); player.addChatComponentMessage(new TextComponentString(TextFormatting.RED + "The Solar Apocalypse has started. Day One will now upbring its wrath.")); System.out.println("!!!!!!!!!!!!!!!!!!!!Day One has started"); } if (ticker == SAConfiguration.daytwoStart){ SAMethods.beginDayTwo(); player.addChatComponentMessage(new TextComponentString(TextFormatting.RED + "The Solar Apocalypse's second wave has arrived. Day Two will now upbring its wrath.")); } if (ticker == SAConfiguration.daythreeStart){ SAMethods.beginDayThree(); player.addChatComponentMessage(new TextComponentString(TextFormatting.RED + "The Solar Apocalypse's third wave has arrived. Day Three will now upbring its wrath.")); } if (ticker == SAConfiguration.dayfourStart){ SAMethods.beginDayFour(); player.addChatComponentMessage(new TextComponentString(TextFormatting.RED + "The Solar Apocalypse's fourth wave has arrived. Day Four will now upbring its wrath.")); } if (ticker == SAConfiguration.dayfiveStart){ SAMethods.beginDayFive(); player.addChatComponentMessage(new TextComponentString(TextFormatting.RED + "The Solar Apocalypse's fifth and final wave has arrived. Let's see how long you can survive. ")); player.addChatComponentMessage(new TextComponentString(TextFormatting.GOLD + "Escape if you can.")); } } }
-
Creating a timer until a certain event
Geometrically replied to Geometrically's topic in Modder Support
I did that and it doesn't print out anything. Here is my code: @SubscribeEvent public void onWorldTick(WorldTickEvent handler){ if (this.ticker < 100){ ticker++; System.out.println("Ticks executed:" + ticker); } else { //do the method System.out.println("Executed and Done!"); } } -
Hello Everyone. i want to create a timer/tick clock that will countdown, until it ends. When it ends, a planned event will happen (I have the code for this). the problem is I don'tknow how to do this.Can anyone help me?
-
Overriding the Worldgen Function witha default world
Geometrically replied to Geometrically's topic in Modder Support
I mean like the function minecraft uses when a new world is created to generate the terrain. What I want to do is override the function when a world is being generated and make the world a skyblock world. Sort of like SkyFactory -
I am creating a mod someone, for a lets play series, and they want something like skyfactory. I want to create a default world that when an SP or a MP world is created, it will just override the world gen functions and replace it with this world. I have been searching for a couple hours now through MC's source code and haven't found a thing. Can anyone help me?
-
I honestly think it's worth it. Although, I have seen with several poplular mods is that people want to play with all thier favorite mods together. A lot of popular mods are not to 1.9, and most are still on 1.7.10-1.8. It's honestly up to you. Although, it may take some time to sort out the .json files.
-
Mod works in eclipse but not in Minecraft
Geometrically replied to Geometrically's topic in Modder Support
It still won't work. It doesn't seem to find my mcmod.info file. -
Mod works in eclipse but not in Minecraft
Geometrically replied to Geometrically's topic in Modder Support
Okay. In eclipse, I put my mcmod.info file in the resources folder. Is that the wrong place? The text in my mcmod.info file is this. -
Mod works in eclipse but not in Minecraft
Geometrically replied to Geometrically's topic in Modder Support
My main mod class's code is this: -
Mod works in eclipse but not in Minecraft
Geometrically replied to Geometrically's topic in Modder Support
I used gradlew build to get my mod's jar file which I used to put in the mods folder. -
I have coded my mod in eclipse and when I run it it is perfectly fine. When I put it into the mods folder and run Minecraft Forge, it comes up with this: