
YellowMilk
Members-
Posts
16 -
Joined
-
Last visited
Converted
-
Gender
Undisclosed
-
Personal Text
I am new!
YellowMilk's Achievements

Tree Puncher (2/8)
0
Reputation
-
hmm okay tyvm
-
but doesn't registerModEntity requires the entity ID in the third field?
-
package com.pandaism.NLO.handlers; import java.util.Random; import com.pandaism.NLO.NeverLogOff; import com.pandaism.NLO.RefString; import net.minecraft.entity.EntityList; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.common.registry.EntityRegistry; public class EntityHandler { public static void RegisterMobs(Class entityClass, String name) { int entityID = EntityRegistry.findGlobalUniqueEntityId(); long x = name.hashCode(); Random ran = new Random(x); int mainColor = ran.nextInt() * 16777215; int subColor = ran.nextInt() * 16777215; EntityRegistry.registerGlobalEntityID(entityClass, name, entityID); EntityRegistry.registerModEntity(entityClass, name, entityID, NeverLogOff.instance, 64, 1, false); EntityList.entityEggs.put(Integer.valueOf(entityID), new EntityList.EntityEggInfo(entityID, mainColor, subColor)); } } This is the entity on SMP http://prntscr.com/7ru9v7 which spawns properly
-
Renderer: package com.pandaism.NLO.mobs.graphics; import net.minecraft.client.Minecraft; import net.minecraft.client.model.ModelBiped; import net.minecraft.client.renderer.entity.RenderBiped; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) public class RenderOfflinePlayer extends RenderBiped { private ResourceLocation texture; public RenderOfflinePlayer(ModelBiped model, float shadowSize, String string) { super(Minecraft.getMinecraft().getRenderManager(), model, shadowSize); this.texture = new ResourceLocation("nlo", string); } protected ResourceLocation getEntityTexture(EntityLiving entity) { return this.texture; } } register: package com.pandaism.NLO; import com.pandaism.NLO.mobs.entity.EntityOfflinePlayer; import com.pandaism.NLO.mobs.graphics.RenderOfflinePlayer; import net.minecraft.client.Minecraft; import net.minecraft.client.model.ModelBiped; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraftforge.fml.client.registry.RenderingRegistry; import net.minecraftforge.fml.common.registry.EntityRegistry; public class ClientProxy extends ServerProxy { public void registerRenders() { RenderingRegistry.registerEntityRenderingHandler(EntityOfflinePlayer.class, new RenderOfflinePlayer(new ModelBiped(), 0.5F, "textures/entity/offlineplayer.png")); } } main: package com.pandaism.NLO; import java.io.File; import java.io.IOException; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.SidedProxy; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import com.pandaism.NLO.events.OfflinePlayerDropsHandler; import com.pandaism.NLO.events.PlayerLoggingHandler; import com.pandaism.NLO.handlers.EntityHandler; import com.pandaism.NLO.mobs.entity.EntityOfflinePlayer; @Mod(modid = RefString.MODID, name = RefString.NAME, version = RefString.VERSION) public class NeverLogOff { PlayerLoggingHandler logging; @Mod.Instance public static NeverLogOff instance; @SidedProxy(clientSide = RefString.CLIENT, serverSide = RefString.SERVER) public static ServerProxy proxy; @EventHandler public void preLoad(FMLPreInitializationEvent e) { } @EventHandler public void Load(FMLInitializationEvent e) { FMLCommonHandler.instance().bus().register(new PlayerLoggingHandler()); MinecraftForge.EVENT_BUS.register(new OfflinePlayerDropsHandler()); EntityHandler.RegisterMobs(EntityOfflinePlayer.class, "Offline Player"); proxy.registerRenders(); } }
-
Yep it renders the entity on smp but on ssp it doesn't but I guess that's good cause the mod is suppose to be for smp
-
When I check with if(world.loadedEntityList.contains(offline)) { System.out.println("Success"); } else { System.out.println("Failed"); } sysout will always print "Success" but the entity is nowhere to be found
-
I ran into a weird problem while testing my mod, the code to spawn the entity have always stayed the same while I added on a yaml check for the entity. To clarify every the mod is to keep the player infomation online when they log off so I spawn an entity into the location of the player as they log off and everything worked fine until today. This is my code to spawn the entity (it have remain unchanged since I add the yaml checking code): @SubscribeEvent public void playerLogOff(PlayerLoggedOutEvent e) { EntityPlayer player = e.player; World world = player.getEntityWorld(); EntityOfflinePlayer offline = new EntityOfflinePlayer(player.getEntityWorld(), player.posX, player.posY, player.posZ);// <-- set the position and world // // //change player to config offline.setCustomNameTag(player.getDisplayNameString()); offline.setHealth(player.getHealth()); offline.setCurrentItemOrArmor(0, player.getHeldItem()); world.spawnEntityInWorld(offline);// <--- should spawn the entity System.out.println(player + ", " + player.posX + ", " + player.posY + ", " + player.posZ); System.out.println(offline + ", " + offline.posX + ", " + offline.posY + ", " + offline.posZ ); try { data.createFile(player.getUniqueID()); data.savePlayerInfo(player); System.out.println("Loaded"); } catch (IOException e1) { e1.printStackTrace(); } } Result of sysout: [23:36:19] [server thread/INFO] [sTDOUT]: [com.pandaism.NLO.events.PlayerLoggingHandler:playerLogOff:77]: EntityPlayerMP['Player890'/7111, l='New World', x=-243.50, y=72.00, z=6.50], -243.5, 72.0, 6.5 [23:36:19] [server thread/INFO] [sTDOUT]: [com.pandaism.NLO.events.PlayerLoggingHandler:playerLogOff:78]: EntityOfflinePlayer['Player890'/9920, l='New World', x=-243.50, y=72.00, z=6.50], -243.5, 72.0, 6.5
-
Thank you, the entity I'm looking for is actually a custom mob that is spawned into the world every time a player logs off and the Entity is called OfflinePlayerEntity ^^
-
I want to get an entity with a custom name, I manage to get a list of the entity on world but when i try to single out the entity i want i cant do it. I try setting .contain to get the entity displayname but it always go to the else statement screenshot of entity on the world: http://prntscr.com/7ppth1 System.out.println(world.loadedEntityList) outputs: [EntitySlime['Slime'/0, l='New World', x=405.27, y=1.00, z=-433.02], EntityOfflinePlayer['Player109'/1, l='New World', x=420.62, y=1.00, z=-436.08], EntityPlayerMP['Player13'/2, l='New World', x=423.97, y=1.00, z=-432.51]] result: Sysout shows "Not Detected" as stated in the else statement EntityPlayer player = e.player; World world = player.getEntityWorld(); EntityOfflinePlayer offline = new EntityOfflinePlayer(player.getEntityWorld(), player.posX, player.posY, player.posZ); PlayerData data = new PlayerData(); System.out.println(world.loadedEntityList); if(world.loadedEntityList.contains("Player109")) { System.out.println("Have character"); } else { System.out.println("Not Detected"); }
-
I got http://prntscr.com/7pal2c but in the folder i don't see the GradleStartServer
-
How would i be able to test my mod on a server through eclipse? Is there a way to launch a localhost server through eclipse so i can connect and test the mod im coding?
-
i fixed it
-
I'm trying to get the texture to render but keep getting this creepy messed up steve skin: http://prntscr.com/7p3h0j I checked my modid and the path name it seems to all be correct so im not sure what im doing wrong package explorer: http://prntscr.com/7p3kar Render Class: package com.pandaism.NLO.mobs.graphics; import net.minecraft.client.Minecraft; import net.minecraft.client.model.ModelBiped; import net.minecraft.client.renderer.entity.RenderBiped; import net.minecraft.entity.Entity; import net.minecraft.util.ResourceLocation; public class RenderOfflinePlayer extends RenderBiped { private ResourceLocation texture; public RenderOfflinePlayer(ModelBiped model, float shadowSize, String string) { super(Minecraft.getMinecraft().getRenderManager(), model, shadowSize); this.texture = new ResourceLocation("nlo", string); } protected ResourceLocation func_110775_a(Entity entity) { return this.texture; } } proxy: package com.pandaism.NLO; import com.pandaism.NLO.mobs.entity.EntityOfflinePlayer; import com.pandaism.NLO.mobs.graphics.RenderOfflinePlayer; import net.minecraft.client.Minecraft; import net.minecraft.client.model.ModelBiped; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraftforge.fml.client.registry.RenderingRegistry; import net.minecraftforge.fml.common.registry.EntityRegistry; public class ClientProxy extends ServerProxy { public void registerRenders() { RenderingRegistry.registerEntityRenderingHandler(EntityOfflinePlayer.class, new RenderOfflinePlayer(new ModelBiped(), 0.5F, "textures/entity/offlineplayer.png")); } } main with refstrings: package com.pandaism.NLO; import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.SidedProxy; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import com.pandaism.NLO.events.PlayerLogOffHandler; import com.pandaism.NLO.handlers.EntityHandler; import com.pandaism.NLO.mobs.entity.EntityOfflinePlayer; @Mod(modid = RefString.MODID, name = RefString.NAME, version = RefString.VERSION) public class NeverLogOff { @Mod.Instance public static NeverLogOff instance; @SidedProxy(clientSide = RefString.CLIENT, serverSide = RefString.SERVER) public static ServerProxy proxy; @EventHandler public void preLoad(FMLPreInitializationEvent e) { } @EventHandler public void Load(FMLInitializationEvent e) { FMLCommonHandler.instance().bus().register(new PlayerLogOffHandler()); EntityHandler.RegisterMobs(EntityOfflinePlayer.class, "Offline Player"); proxy.registerRenders(); } } -------- package com.pandaism.NLO; public class RefString { public static final String MODID = "nlo"; public static final String NAME = "Never Log Off"; public static final String VERSION = "1.0.0"; public static final String CLIENT = "com.pandaism.NLO.ClientProxy"; public static final String SERVER = "com.pandaism.NLO.ServerProxy"; }
-
Error when trying to connect to localhost
YellowMilk replied to YellowMilk's topic in Modder Support
Main: package com.pandaism.main; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.SidedProxy; import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import com.pandaism.events.EventHandle; import com.pandaism.lib.RefStrings; @Mod(modid = RefStrings.MODID, name = RefStrings.NAME, version = RefStrings.VERSION) public class MainRegistry { static EventHandle handler = new EventHandle(); @SidedProxy(clientSide = RefStrings.CLIENT, serverSide = RefStrings.SERVER) public static ServerProxy proxy; @EventHandler public static void PreLoad(FMLPreInitializationEvent pre) { FMLCommonHandler.instance().bus().register(handler); MinecraftForge.EVENT_BUS.register(handler); proxy.registerRenderInfo(); } @EventHandler public static void PreLoad(FMLInitializationEvent init) { } @EventHandler public static void PreLoad(FMLPostInitializationEvent post) { } } RefString: package com.pandaism.lib; public class RefStrings { public static final String MODID = "neverlogoff"; public static final String NAME = "Never Log Off"; public static final String VERSION = "0.1"; public static final String CLIENT = "com.pandaism.main.ClientProxy"; public static final String SERVER = "com.pandaism.main.ServerProxy"; } event: package com.pandaism.events; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.PlayerEvent; public class EventHandle { @SubscribeEvent public void Join(PlayerEvent.PlayerLoggedOutEvent e) { System.out.print("logged out"); } } this is my first run -
I get this error when i try to connect to localhost via the minecraft in ellipses so i can't test my mod [19:53:33] [Client thread/INFO]: Setting user: Player472 [19:53:38] [Client thread/INFO]: LWJGL Version: 2.9.1 [19:53:44] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Never Log Off [19:53:45] [sound Library Loader/INFO]: Starting up SoundSystem... [19:53:45] [Thread-9/INFO]: Initializing LWJGL OpenAL [19:53:45] [Thread-9/INFO]: (The LWJGL binding of OpenAL. For more information, see http://www.lwjgl.org) [19:53:46] [Thread-9/INFO]: OpenAL initialized. [19:53:46] [sound Library Loader/INFO]: Sound engine started [19:53:56] [Client thread/INFO]: Created: 512x512 textures-atlas [19:53:58] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Never Log Off [19:53:58] [Client thread/INFO]: SoundSystem shutting down... [19:53:58] [Client thread/WARN]: Author: Paul Lamb, www.paulscode.com [19:53:58] [sound Library Loader/INFO]: Starting up SoundSystem... [19:53:59] [Thread-11/INFO]: Initializing LWJGL OpenAL [19:53:59] [Thread-11/INFO]: (The LWJGL binding of OpenAL. For more information, see http://www.lwjgl.org) [19:53:59] [Thread-11/INFO]: OpenAL initialized. [19:53:59] [sound Library Loader/INFO]: Sound engine started [19:54:06] [Client thread/INFO]: Created: 512x512 textures-atlas [19:54:12] [Client thread/INFO]: Connecting to localhost, 25565 [19:54:13] [server Connector #1/ERROR]: Couldn't connect to server java.net.ConnectException: Connection refused: no further information: localhost/127.0.0.1:25565 at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method) ~[?:1.7.0_07] at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:692) ~[?:1.7.0_07] at io.netty.channel.socket.nio.NioSocketChannel.doFinishConnect(NioSocketChannel.java:191) ~[NioSocketChannel.class:4.0.15.Final] at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:255) ~[AbstractNioChannel$AbstractNioUnsafe.class:4.0.15.Final] at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:502) ~[NioEventLoop.class:4.0.15.Final] at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:452) ~[NioEventLoop.class:4.0.15.Final] at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:346) ~[NioEventLoop.class:4.0.15.Final] at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:101) ~[singleThreadEventExecutor$2.class:4.0.15.Final] at java.lang.Thread.run(Thread.java:722) ~[?:1.7.0_07] [19:54:42] [Client thread/INFO]: Stopping! [19:54:42] [Client thread/INFO]: SoundSystem shutting down... [19:54:42] [Client thread/WARN]: Author: Paul Lamb, www.paulscode.com im still new to forge modding so please be gentle