Jump to content

TLHPoE

Members
  • Posts

    638
  • Joined

  • Last visited

Everything posted by TLHPoE

  1. I think you need to set the meta data of the block too.
  2. Did you mess with anything?
  3. Thanks, I scanned through it the first time and didn't see that.
  4. Hello, I get the following when I try building: I can run the mod perfectly in my workspace, and I'm using FML 10.12.1.1065.
  5. You're extending ItemSword, and ItemSword sets the EnumAction to .block. You have to override that and set it to .none.
  6. I get an error when I try using the /help command. I believe what I return for the command usage affects this. Command: package easycoins.command; import java.util.List; import net.minecraft.command.ICommand; import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.server.MinecraftServer; import net.minecraft.util.ChatComponentText; import net.minecraft.util.EnumChatFormatting; import easycoins.api.EasyCoinsAPI; public class CommandCoinsEC implements ICommand { private List aliases; @Override public String getCommandName() { return "coins"; } @Override public String getCommandUsage(ICommandSender sender) { return "commands.coins.usage"; } @Override public void processCommand(ICommandSender sender, String[] args) { EntityPlayerMP player = MinecraftServer.getServer().getConfigurationManager().getPlayerForUsername(sender.getCommandSenderName()); player.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.WHITE + "You currently have " + EnumChatFormatting.YELLOW + EasyCoinsAPI.getCoins(player) + EnumChatFormatting.WHITE + " coins.")); } @Override public int compareTo(Object o) { return 0; } @Override public List getCommandAliases() { return aliases; } @Override public boolean canCommandSenderUseCommand(ICommandSender var1) { return true; } @Override public List addTabCompletionOptions(ICommandSender var1, String[] var2) { return null; } @Override public boolean isUsernameIndex(String[] var1, int var2) { return false; } } Language File: commands.coins.usage=/coins If I try returning "coins" then it works fine, but it looks weird if I use the /help command. Am I doing something wrong?
  7. I'm not sure if this would work, but you could cancel the menu from opening since it's a gui. From there, you can open your own gui.
  8. I'll do that for now I guess, someone in the past told me to always do extra rendering in the post event and canceling in the pre event.
  9. In my mod, I'm trying to cancel the default player rendering and rendering my own model. The problem I'm having, is that in the pre event, I cancel it. Because of that, it cancels the post event too, which my rendering code is in. package net.rpg.handler; import net.minecraftforge.client.event.RenderPlayerEvent; import net.rpg.Util; import cpw.mods.fml.common.eventhandler.SubscribeEvent; public class PlayerRenderHandler { @SubscribeEvent public void renderPrePlayer(RenderPlayerEvent.Pre event) { if(!Util.isNewPlayer(event.entityPlayer)) { event.setCanceled(true); } } @SubscribeEvent public void renderPostPlayer(RenderPlayerEvent.Post event) { if(!Util.isNewPlayer(event.entityPlayer)) { //Render player } } }
  10. You need to add your mod id and a colon behind the sound. It's currently looking in the Minecraft sounds for that sound.
  11. Ok, I have a method that I ONLY want to use when I'm working on the server. I'm checking to see if it's server side by doing the normal isRemote check. For some reason, it thinks I am on client-side. Code that calls the method: @SubscribeEvent public void EntityJoinWorldEvent(EntityJoinWorldEvent event) { if(event.entity instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) event.entity; if(!player.worldObj.isRemote) { if(Util.isNewPlayer(player) && !player.inventory.hasItem(ItemHelper.getItem("raceStone"))) { int es = player.inventory.getFirstEmptyStack(); player.inventory.setInventorySlotContents(es, new ItemStack(ItemHelper.getItem("raceStone"), 1)); } else { Util.applyStats(player); } } } } And here's the method: @SideOnly(Side.SERVER) public static void applyStats(EntityPlayer player) { final AttributeModifier health = new AttributeModifier(player.getPersistentID(), "rpg_health", (((double) Util.getIntegerStat(player, Reference.MHP)) / 10) - 1, 1); float current = player.getHealth(); IAttributeInstance iaiHealth = player.getEntityAttribute(SharedMonsterAttributes.maxHealth); if(iaiHealth.getModifier(health.getID()) == null) { iaiHealth.applyModifier(health); } else { iaiHealth.removeModifier(health); iaiHealth.applyModifier(health); } player.setHealth(current); /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// final AttributeModifier speed = new AttributeModifier(player.getPersistentID(), "rpg_speed", (((double) Util.getIntegerStat(player, Reference.SPEED)) / 10), 1); IAttributeInstance iaiSpeed = player.getEntityAttribute(SharedMonsterAttributes.movementSpeed); if(iaiSpeed.getModifier(speed.getID()) == null) { iaiSpeed.applyModifier(speed); } else { iaiSpeed.removeModifier(speed); iaiSpeed.applyModifier(speed); } }
  12. Is there anyway to cancel the rendering of a player? I would register the player with a new render, but that seems really hacky. Also, there's a RenderTickEvent, but I can't cancel the player rendering there. Edit: Found it, RenderPlayerEvent.
  13. I have that there to make sure it can't spawn without a type. I'll try running it without that line. Edit: Ok, I'm an idiot. That was the problem the entire time. Thank you for pointing that out.
  14. Now I'm 100% sure something is wrong with my entity class and not my render class. This works: public void addRenders() { RenderingRegistry.registerEntityRenderingHandler(EntityZombie.class, new RenderHumanL()); }
  15. The error should be self explanatory. But if you can't comprehend it, it means that you did a bad job of copying and pasting, and didn't replace some parts of the code.
  16. Yes, I added a print inside of its onUpdate method and it prints. Also, if I try registering the entity with any other render, like RenderXPOrb, no errors are thrown at me.
  17. Ok, everything is being called right. I tried using another method of registering the render, but nothing. public void addRenders() { RenderHumanL render = new RenderHumanL(); render.setRenderManager(RenderManager.instance); RenderManager.instance.entityRenderMap.put(EntityInfantryL.class, render); RenderManager.instance.entityRenderMap.put(EntityArcherL.class, render); RenderManager.instance.entityRenderMap.put(EntityTroopLeaderL.class, render); } I'm gonna try registering the renders in different intialization events. Edit: Nope
  18. Same outcome. Also if I released my mod like that, it wouldn't run on servers.
  19. I'm pretty sure I'm not suppose to cram everything into my client proxy. I did that with the same outcome. Here's my main class: package legions; import static legions.ReferenceL.ID; import static legions.ReferenceL.NAME; import static legions.ReferenceL.VERSION; import legions.handler.PacketHandlerL; import legions.network.PacketCommandL; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.Mod.Instance; import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; @Mod(modid = ID, name = NAME, version = VERSION) public class Legions { @Instance(ID) public static Legions instance; @SidedProxy(clientSide = ID + ".ClientProxyL", serverSide = ID + ".ServerProxyL") public static ServerProxyL proxy; public static PacketHandlerL packetHandler; @EventHandler public void preInit(FMLPreInitializationEvent event) { proxy.initServer(); proxy.initClient(); } @EventHandler public void init(FMLInitializationEvent event) { packetHandler = new PacketHandlerL(); packetHandler.initialise(); } @EventHandler public void postInit(FMLPostInitializationEvent event) { packetHandler.registerPacket(PacketCommandL.class); packetHandler.postInitialise(); } }
  20. I know how configurations work, but I don't know why I saved after loading everything else... I changed it, but nothing has changed. ServerProxy: package legions; import java.io.File; import legions.entity.EntityArcherL; import legions.entity.EntityInfantryL; import legions.entity.EntityTroopLeaderL; import legions.handler.ServerForgeEventHandlerL; import net.minecraft.entity.Entity; import net.minecraftforge.common.config.Configuration; import cpw.mods.fml.common.registry.EntityRegistry; public class ServerProxyL { public static Configuration config; public static ServerForgeEventHandlerL forgeEvents; public void initServer() { loadConfigurations(); addEvents(); addEntities(); } public void loadConfigurations() { config = new Configuration(new File("./config/Legions/Server.cfg"), true); config.load(); config.save(); } public void addEvents() { forgeEvents = new ServerForgeEventHandlerL(); } public void addEntities() { addEntity(EntityInfantryL.class, "infantry"); addEntity(EntityArcherL.class, "archer"); addEntity(EntityTroopLeaderL.class, "leader"); } public void initClient() { } private static void addEntity(Class<? extends Entity> clazz, String name) { EntityRegistry.registerModEntity(clazz, name, EntityRegistry.findGlobalUniqueEntityId(), Legions.instance, 64, 20, true); } } ClientProxy: package legions; import java.io.File; import legions.entity.EntityArcherL; import legions.entity.EntityInfantryL; import legions.entity.EntityTroopLeaderL; import legions.handler.ClientFMLEventHandlerL; import legions.handler.ClientForgeEventHandlerL; import legions.handler.KeyHandlerL; import legions.network.PacketCommandL; import legions.render.RenderHumanL; import net.minecraftforge.common.config.Configuration; import cpw.mods.fml.client.registry.RenderingRegistry; public class ClientProxyL extends ServerProxyL { public static Configuration config; public static ClientFMLEventHandlerL fmlEvents; public static ClientForgeEventHandlerL forgeEvents; public static KeyHandlerL keyHandler; @Override public void initClient() { loadConfigurations(); addKeys(); addEvents(); addRenders(); } public void loadConfigurations() { config = new Configuration(new File("./config/Legions/Client.cfg"), true); config.load(); shouldSlide = config.get("Gui", "Enable Sliding Menu", true).getBoolean(true); config.save(); } public void addKeys() { keyHandler = new KeyHandlerL(); } public void addEvents() { fmlEvents = new ClientFMLEventHandlerL(); forgeEvents = new ClientForgeEventHandlerL(); } public void addRenders() { RenderingRegistry.registerEntityRenderingHandler(EntityInfantryL.class, new RenderHumanL()); RenderingRegistry.registerEntityRenderingHandler(EntityArcherL.class, new RenderHumanL()); RenderingRegistry.registerEntityRenderingHandler(EntityTroopLeaderL.class, new RenderHumanL()); } public static boolean shouldSlide; public static int currentMenu = 0; public static int guiY = -64; public static PacketCommandL commandPacket; }
  21. This may not be the smartest way, but I would write my own code for rendering the item in your model's hand. Look at how vanilla Minecraft renders the item, and then apply that t your code with some translations if needed.
  22. I don't have any source code to look in since my external hard drive is gone right now, but I think there's a method in ResourceLocation to get the file directory of the current resource.
  23. I've had this problem before, but I cannot find the old post in my history. Yesterday my entities were rendering perfectly, but now they don't render at all. None of the methods in the render class are called except for the constructor, which leads me to believe that the renders are not being registered properly. ClientProxy: package legions; import java.io.File; import legions.entity.EntityArcherL; import legions.entity.EntityInfantryL; import legions.entity.EntityTroopLeaderL; import legions.handler.ClientFMLEventHandlerL; import legions.handler.ClientForgeEventHandlerL; import legions.handler.KeyHandlerL; import legions.network.PacketCommandL; import legions.render.RenderHumanL; import net.minecraftforge.common.config.Configuration; import cpw.mods.fml.client.registry.RenderingRegistry; public class ClientProxyL extends ServerProxyL { public static Configuration config; public static ClientFMLEventHandlerL fmlEvents; public static ClientForgeEventHandlerL forgeEvents; public static KeyHandlerL keyHandler; @Override public void initClient() { config = new Configuration(new File("./config/Legions/Client.cfg"), true); config.load(); addKeys(); loadConfigurations(); addEvents(); addRenders(); config.save(); } public void loadConfigurations() { shouldSlide = config.get("Gui", "Enable Sliding Menu", true).getBoolean(true); } public void addKeys() { keyHandler = new KeyHandlerL(); } public void addEvents() { fmlEvents = new ClientFMLEventHandlerL(); forgeEvents = new ClientForgeEventHandlerL(); } public void addRenders() { for(int i = 0; i < 1000; i++) { System.err.println("ADDING RENDERS"); } RenderingRegistry.registerEntityRenderingHandler(EntityInfantryL.class, new RenderHumanL()); RenderingRegistry.registerEntityRenderingHandler(EntityArcherL.class, new RenderHumanL()); RenderingRegistry.registerEntityRenderingHandler(EntityTroopLeaderL.class, new RenderHumanL()); } public static boolean shouldSlide; public static int currentMenu = 0; public static int guiY = -64; public static PacketCommandL commandPacket; } Entity (I have 3 more entities that are virtually the same): package legions.entity; import legions.TroopL; import legions.UtilL; import net.minecraft.entity.EntityLiving; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.MathHelper; import net.minecraft.world.World; public class EntityInfantryL extends EntityLiving { public int type; public boolean hired = false; public EntityInfantryL(World world) { super(world); this.setDead(); } public EntityInfantryL(World world, int type) { super(world); this.type = type; this.setSize(0.6F, 1.8F); } @Override public void writeEntityToNBT(NBTTagCompound nbt) { super.writeEntityToNBT(nbt); nbt.setInteger("Type", type); } @Override protected boolean canDespawn() { return false; } @Override public void readEntityFromNBT(NBTTagCompound nbt) { super.readEntityFromNBT(nbt); type = nbt.getInteger("Type"); } public void giveEquipment() { switch(type) { case (TroopL.BASIC_INFANTRY_1): this.setCurrentItemOrArmor(0, new ItemStack(Items.wooden_sword)); break; case (TroopL.BASIC_INFANTRY_2): this.setCurrentItemOrArmor(0, new ItemStack(Items.stone_sword)); this.setCurrentItemOrArmor(4, new ItemStack(Items.golden_helmet)); this.setCurrentItemOrArmor(3, new ItemStack(Items.golden_chestplate)); this.setCurrentItemOrArmor(2, new ItemStack(Items.golden_leggings)); this.setCurrentItemOrArmor(1, new ItemStack(Items.golden_boots)); break; case (TroopL.BASIC_INFANTRY_3): this.setCurrentItemOrArmor(0, new ItemStack(Items.iron_sword)); this.setCurrentItemOrArmor(4, new ItemStack(Items.iron_helmet)); this.setCurrentItemOrArmor(3, new ItemStack(Items.iron_chestplate)); this.setCurrentItemOrArmor(2, new ItemStack(Items.iron_leggings)); this.setCurrentItemOrArmor(1, new ItemStack(Items.iron_boots)); break; case (TroopL.BASIC_INFANTRY_4): this.setCurrentItemOrArmor(0, new ItemStack(Items.diamond_sword)); this.setCurrentItemOrArmor(4, new ItemStack(Items.diamond_helmet)); this.setCurrentItemOrArmor(3, new ItemStack(Items.diamond_chestplate)); this.setCurrentItemOrArmor(2, new ItemStack(Items.diamond_leggings)); this.setCurrentItemOrArmor(1, new ItemStack(Items.diamond_boots)); break; } } public static EntityInfantryL spawnInfantry(World world, int type, double x, double y, double z) { EntityInfantryL e = new EntityInfantryL(world, type); e.setLocationAndAngles(x, y, z, MathHelper.wrapAngleTo180_float(world.rand.nextFloat() * 360.0F), 0.0F); e.rotationYawHead = e.rotationYaw; e.renderYawOffset = e.rotationYaw; world.spawnEntityInWorld(e); e.giveEquipment(); return e; } public static EntityInfantryL spawnRandomInfantry(World world, double x, double y, double z) { EntityInfantryL e = new EntityInfantryL(world, UtilL.getRandomIntegerBetween(0, 3)); System.err.println("SPAWNED INFANTRY WITH TYPE " + e.type); e.setLocationAndAngles(x, y, z, MathHelper.wrapAngleTo180_float(world.rand.nextFloat() * 360.0F), 0.0F); e.rotationYawHead = e.rotationYaw; e.renderYawOffset = e.rotationYaw; world.spawnEntityInWorld(e); e.giveEquipment(); return e; } } Render: package legions.render; import legions.UtilL; 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.entity.EntityLivingBase; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; public class RenderHumanL extends RenderBiped { private static final float SCALE = 0.9375F; private static final ResourceLocation TEXTURE = UtilL.newResource("textures/entity/human.png"); public RenderHumanL() { super(new ModelBiped(), 0.5F); } @Override public void doRender(EntityLiving par1EntityLiving, double par2, double par4, double par6, float par8, float par9) { System.err.println("RENDER"); super.doRender(par1EntityLiving, par2, par4, par6, par8, par9); } @Override protected void preRenderCallback(EntityLivingBase par1EntityLivingBase, float par2) { System.err.println("SCALE"); GL11.glScalef(SCALE, SCALE, SCALE); } @Override protected ResourceLocation getEntityTexture(Entity par1Entity) { System.err.println("TEXTURE"); return TEXTURE; } } ServerProxy: package legions; import java.io.File; import legions.entity.EntityArcherL; import legions.entity.EntityInfantryL; import legions.entity.EntityTroopLeaderL; import legions.handler.ServerForgeEventHandlerL; import net.minecraft.entity.Entity; import net.minecraft.entity.EnumCreatureType; import net.minecraft.world.biome.BiomeGenBase; import net.minecraftforge.common.config.Configuration; import cpw.mods.fml.common.registry.EntityRegistry; public class ServerProxyL { public static Configuration config; public static ServerForgeEventHandlerL forgeEvents; public void initServer() { config = new Configuration(new File("./config/Legions/Server.cfg"), true); config.load(); addEvents(); addEntities(); config.save(); } public void addEvents() { forgeEvents = new ServerForgeEventHandlerL(); } public void addEntities() { addEntity(EntityInfantryL.class, "infantry"); addEntity(EntityArcherL.class, "archer"); addEntity(EntityTroopLeaderL.class, "leader"); } public void initClient() { } private static void addEntity(Class<? extends Entity> clazz, String name) { EntityRegistry.registerModEntity(clazz, name, EntityRegistry.findGlobalUniqueEntityId(), Legions.instance, 64, 20, true); } } I have prints in the render class (not the constructor) and before I register the renders. The only prints that fire are the ones before I register the renders.
  24. I don't think that's the model, because he has a couple of shapes in his model class. I had the same problem earlier and I left it alone, and after I touched some of my gui code my entity completely stopped rendering. Sorry.
  25. Nope Resetting the color did the job for me: GL11.glColor3f(1, 1, 1);
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.