
colossali
Members-
Posts
19 -
Joined
-
Last visited
Everything posted by colossali
-
[1.8] [SOLVED] Set maximum number of entities
colossali replied to colossali's topic in Modder Support
LivingSpawnEvent.CheckSpawn was exactly what I needed! Thank you! -
[1.8] [SOLVED] Set maximum number of entities
colossali replied to colossali's topic in Modder Support
Thanks for the reply. I've checked in debug mode and the code is firing. It seems this sets a limit to spawn per chunk, while I'm looking for a limit for the entire world, like there being only one persistent EnderDragon -
Hi, I'm trying to set a maximum spawn limit to an entity, here's my code but I can't seem to get it to work. The event handler is registered in the main mod class. @SubscribeEvent public void maxNessieSpawn(LivingPackSizeEvent event){ if(event.entityLiving instanceof EntityNessie){ event.maxPackSize = 1; event.setResult(Result.ALLOW); } }
-
Thanks! By removing the Client only code and implementing IEntityAdditionalSpawnData the problem was fixed! Thank you so much!
-
I've not been able to figure out what's causing my throwable entity to lose the player as the owner. AFAIK I'm doing it all correctly. Here's the code: EntityRegistration EntityRegistry.registerModEntity(EntityWebString.class, "Web String", webStringID, this, 128, 10, true); EntityThrowable public class EntityWebString extends EntityThrowable{ public EntityPlayer spiderMan; public EntityWebString(World world){ super(world); this.spiderMan = (EntityPlayer) this.getThrower(); } public EntityWebString(World world, EntityLivingBase throwingEntity) { super(world, throwingEntity); this.spiderMan = (EntityPlayer) throwingEntity; this.ignoreFrustumCheck = true; this.setSize(0.1F, 0.1F); this.motionX *= 2F; this.motionZ *= 2F; this.motionY *= 2F; SuperHeroLogger.debug("Spawned String with owner:" + spiderMan); } @Override protected float getGravityVelocity() { return 0.03F; } @Override public void onUpdate() { super.onUpdate(); } protected void onImpact(MovingObjectPosition hitPos) { SuperHeroLogger.debug("Object String: " + hitPos.hitInfo); SuperHeroLogger.debug("Owner is: " + this.spiderMan); SuperHeroLogger.debug("Owner is: " + this.getThrower()); if(hitPos.typeOfHit == MovingObjectType.ENTITY){ SuperHeroLogger.debug("Object Hit by String: " + hitPos.entityHit.toString()); hitPos.entityHit.motionX = -0.75F * this.motionX; hitPos.entityHit.motionZ = -0.75F * this.motionZ; hitPos.entityHit.motionY += 0.5F; this.setDead(); } else if(hitPos.typeOfHit == MovingObjectType.BLOCK){ if(!Keyboard.isKeyDown(42)){ try{ SuperHeroLogger.debug("Block Hit by String: " + hitPos.blockX + "x, " + hitPos.blockZ + "z, " + hitPos.blockY + "y"); this.spiderMan.motionX = 2F * this.motionX; this.spiderMan.motionZ = 2F * this.motionZ; this.spiderMan.motionY = (double)(4.0F * -MathHelper.sin(this.spiderMan.rotationPitch / 180.0F * (float)Math.PI)); } catch(NullPointerException e){ SuperHeroLogger.error(e.getMessage()); e.printStackTrace(); } } this.setDead(); } } } Item Right click code @Override public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) { EntityWebString string = new EntityWebString(world, player); switch (shotType){ case 0: if(player.inventory.hasItem(SpiderMan.webString)){ if(!world.isRemote){ world.spawnEntityInWorld(string); } player.inventory.consumeInventoryItem(SpiderMan.webString); } break; case 1: if (player.inventory.hasItem(SpiderMan.webBall)){ if(!world.isRemote){ world.spawnEntityInWorld(new EntityWebBallNew(world, player)); } player.inventory.consumeInventoryItem(SpiderMan.webBall); } break; } return super.onItemRightClick(itemStack, world, player); } Log Output [15:06:30] [Client thread/ERROR] [dg_shc]: Spawned String with owner:EntityClientPlayerMP['rara_avia'/268, l='MpServer', x=-260.85, y=68.62, z=226.77] [15:06:30] [server thread/ERROR] [dg_shc]: Spawned String with owner:EntityPlayerMP['rara_avia'/268, l='New World', x=-260.85, y=67.00, z=226.77] [15:06:30] [Client thread/ERROR] [dg_shc]: Owner is: null [15:06:30] [Client thread/ERROR] [dg_shc]: Owner is: null [15:06:30] [Client thread/ERROR] [dg_shc]: null [15:06:30] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: java.lang.NullPointerException [15:06:30] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.dudgames.spiderman.entities.EntityWebString.onImpact(EntityWebString.java:64) [15:06:30] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.entity.projectile.EntityThrowable.onUpdate(EntityThrowable.java:229) [15:06:30] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.dudgames.spiderman.entities.EntityWebString.onUpdate(EntityWebString.java:45) [15:06:30] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2298) [15:06:30] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.world.World.updateEntity(World.java:2258) [15:06:30] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.world.World.updateEntities(World.java:2108) [15:06:30] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.client.Minecraft.runTick(Minecraft.java:2097) [15:06:30] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1039) [15:06:30] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.client.Minecraft.run(Minecraft.java:962) [15:06:30] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.client.main.Main.main(Main.java:164) [15:06:30] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [15:06:30] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) [15:06:30] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) [15:06:30] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at java.lang.reflect.Method.invoke(Unknown Source) [15:06:30] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [15:06:30] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [15:06:30] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) [15:06:30] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at GradleStart.main(Unknown Source) [15:06:30] [server thread/ERROR] [dg_shc]: Owner is: EntityPlayerMP['rara_avia'/268, l='New World', x=-260.85, y=67.00, z=226.77] [15:06:30] [server thread/ERROR] [dg_shc]: Owner is: EntityPlayerMP['rara_avia'/268, l='New World', x=-260.85, y=67.00, z=226.77]
-
[1.8] Custom Fishing loses player for rendering fishing line
colossali replied to gendeathrow's topic in Modder Support
I'm having a similar problem, have you ever found a solution? -
If you're using 1.6.2 then "rayTraceBlocks" is now "clip" Try that now.
-
Nevermind found it! Just had to call renderplayer.name_tag_range = blah blah
-
[FIXED][1.4.2] [6.0.1] Custom pickaxe refuses to break obsidian
colossali replied to XxArchangelz's topic in Modder Support
I have a 5 on one of my items and it works, so it must be the maxstacksize! -
Hi, I'm working on an SMP mod in which I want to disable the username render tag distance for anyone wearing a certain armour. Now, I was leafing throught the Minecraft Forge github and saw a "Changeable name tag render distance " commit, but didn't understand the code... could anyone explain to me how I could use this?
-
Would that change the colour of both the icon for the Armor and the armor itself or is it just one of them? Also wouldn't the custom renderer then have to override the base one?
-
Oooh that sounds like a good plan! Thanks! I'll try it out next time I get the chance and tell you if it worked!
-
Oh right, that sounds like a plausible plan! I'm crap at that kinda stuff though, any example as to what code/ methods to use?
-
I found the problem, I had certain code in the Entity AI file that used rayTrace to see if the entity was in the field of view of the player. I wanna keep that, does anyone think I could move that method into the client tick handler or some other handler and still get it to work? If yes, then any ideas as to how?...
-
How I can know which block I'm pointing with the mouse?
colossali replied to Fochis's topic in Modder Support
var3.rayTrace(200, 1.0F).blockX var3 is entityplayer 200 is "reach" so if you want you can have the raytrace work for let's say 100 blocks, change that to 100 edit: I'm awful at explaining, so here's my code, it's easy to figure out (I'm telling minecraft to send a packet to the location I'm looking at with the variables positionx positiony positionz and strength) if (var2.currentScreen == null && !Keyboard.isKeyDown(pulseboltKey) && pulseboltKeyDown) { this.sendExplosion((int)var3.rayTrace(200, 1.0F).blockX, (int)var3.rayTrace(200, 1.0F).blockY, (int)var3.rayTrace(200, 1.0F).blockZ, 6); this.explosionTimer = 0; } -
Bump this, I've the same problem D=
-
Hi, I updated the Slender Man mod to 1.3.2 and in ModLoader it's AI started to "lag" What would happen is that the Slender Man would move for half a second, pause for half a seconds, etc. I'm thinking this has something to do with the new server/client merge, but I'm not sure. Is there a code I need to include that sends packets of information about mob AI even for a single player mod? The exact same code was working perfectly for 1.2.5 in both modloader and forge. I decided to move my mod to forge to see if that would help, it didn't. Anyone know what's going on? I'm new to forge, so I dunno what to do... Link "making a github for it now" here's the mod_ class if that helps package colossali.SlenderMan.common; import java.util.Random; import java.util.Map; import java.util.List; import java.util.jar.*; import java.util.*; import java.util.logging.*; import java.util.concurrent.*; import java.awt.datatransfer.*; import java.awt.geom.*; import java.util.zip.*; import java.awt.*; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import net.minecraft.client.Minecraft; import net.minecraft.src.*; import net.minecraftforge.common.Configuration; import net.minecraftforge.common.Property; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; import colossali.SlenderMan.client.ClientProxy; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.FMLLog; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.Init; 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; import cpw.mods.fml.common.event.FMLServerStartedEvent; import cpw.mods.fml.common.network.NetworkMod; import cpw.mods.fml.common.registry.EntityRegistry; import cpw.mods.fml.common.registry.LanguageRegistry; @Mod( modid = "colossali_SlenderMan", name = "SlenderMan", version = "v2.1 [1.3.2]" ) @NetworkMod( clientSideRequired = true, serverSideRequired = false ) public class mod_slenderman { @SidedProxy( clientSide = "colossali.SlenderMan.client.ClientProxy", serverSide = "colossali.SlenderMan.common.CommonProxy" ) public static CommonProxy proxy; public static int ChildSoulID = 4150; public static int SlenderMaskID = 4151; public static int SlenderSuitID = 4152; public static int SlenderPantsID = 4153; public static int SlenderShoesID = 4154; public static int SlenderSwordID = 4155; public static int SlenderNoteID = 4156; public static int SlenderManID = 123; public static int SlenderNoteEntityID = 124; public static final Item ItemChildSoul = new ItemFood(ChildSoulID, 1, 1F, false).setPotionEffect(Potion.blindness.id, 20, 1, 0.9F).setItemName("Child Soul"); public static final Item ItemSlenderMask = (new ItemSlenderArmor(SlenderMaskID, EnumArmorMaterial.DIAMOND, ModLoader.addArmor("slender"), 0)).setItemName("Slender Mask"); public static final Item ItemSlenderSuit = (new ItemSlenderArmor(SlenderSuitID, EnumArmorMaterial.DIAMOND, ModLoader.addArmor("slender"), 1)).setItemName("Slender Suit"); public static final Item ItemSlenderPants = (new ItemSlenderArmor(SlenderPantsID, EnumArmorMaterial.DIAMOND, ModLoader.addArmor("slender"), 2)).setItemName("Slender Pants"); public static final Item ItemSlenderShoes = (new ItemSlenderArmor(SlenderShoesID, EnumArmorMaterial.DIAMOND, ModLoader.addArmor("slender"), 3)).setItemName("Slender Shoes"); public static final Item ItemSlenderSword = (new ItemSlenderSword(SlenderSwordID, EnumToolMaterialSlender.SLENDER)).setIconCoord(3, 4).setItemName("Slender Sword"); public static final Item ItemSlenderNote = (new ItemSlenderNote(SlenderNoteID)).setItemName("Slender Note"); public static String itemsPath = "/colossali/SlenderMan/sprites/items.png"; @Mod.PreInit public void preInit(FMLPreInitializationEvent var1) { proxy.preInit(); Configuration var2 = new Configuration(var1.getSuggestedConfigurationFile()); try { var2.load(); Property var3 = var2.getOrCreateIntProperty("ChildSoul", "item", 4150); ChildSoulID = var3.getInt(4150); var3 = var2.getOrCreateIntProperty("SlenderMask", "item", 4151); SlenderMaskID = var3.getInt(4151); var3 = var2.getOrCreateIntProperty("SlenderSuit", "item", 4152); SlenderSuitID = var3.getInt(4152); var3 = var2.getOrCreateIntProperty("SlenderPants", "item", 4153); SlenderPantsID = var3.getInt(4153); var3 = var2.getOrCreateIntProperty("SlenderShoes", "item", 4154); SlenderShoesID = var3.getInt(4154); var3 = var2.getOrCreateIntProperty("SlenderSword", "item", 4155); SlenderSwordID = var3.getInt(4155); var3 = var2.getOrCreateIntProperty("SlenderNote", "item", 4156); SlenderNoteID = var3.getInt(4156); var3 = var2.getOrCreateIntProperty("SlenderNote", "general", 123); SlenderManID = var3.getInt(123); var3 = var2.getOrCreateIntProperty("SlenderNoteEntity", "general", 124); SlenderNoteEntityID = var3.getInt(124); } catch (Exception var7) { FMLLog.log(Level.SEVERE, var7, "Slender Man Fucked Up", new Object[0]); FMLLog.severe(var7.getMessage(), new Object[0]); } finally { var2.save(); } } @Init public void load(FMLInitializationEvent event) { proxy.registerRenderThings(); ModLoader.addRecipe(new ItemStack(ItemSlenderSword, 1), new Object[] {"090", "090", " 8 ", '0', Block.obsidian, '9', ItemChildSoul, '8', Item.diamond}); ModLoader.addRecipe(new ItemStack(ItemSlenderMask, 1), new Object[] {"797", "969", "797", '7', Item.leather, '9', ItemChildSoul, '6', Item.ghastTear}); ModLoader.addRecipe(new ItemStack(ItemSlenderSuit, 1), new Object[] {"595", "555", "434", '5', Item.diamond, '9', ItemChildSoul, '4', Block.cloth, '3', Item.redstone}); ModLoader.addRecipe(new ItemStack(ItemSlenderPants, 1), new Object[] {"454", "5 5", "9 9", '5', Item.diamond, '9', ItemChildSoul, '4', Block.cloth}); ModLoader.addRecipe(new ItemStack(ItemSlenderShoes, 1), new Object[] {" ", "595", "7 7", '5', Item.diamond, '9', ItemChildSoul, '7', Item.leather}); ModLoader.registerEntityID(EntitySlenderMan.class, "Slenderman", SlenderManID, 16260, 11020932); LanguageRegistry.instance().addStringLocalization("entity.SlenderMan.name", "en_US", "Slender Man"); ModLoader.addSpawn(EntitySlenderMan.class, 1, 1, 2, EnumCreatureType.monster, BiomeGenBase.extremeHills); ModLoader.addSpawn(EntitySlenderMan.class, 4, 1, 2, EnumCreatureType.monster, BiomeGenBase.forest); ModLoader.addSpawn(EntitySlenderMan.class, 4, 1, 2, EnumCreatureType.monster, BiomeGenBase.swampland); ModLoader.addSpawn(EntitySlenderMan.class, 4, 1, 2, EnumCreatureType.monster, BiomeGenBase.hell); ModLoader.addSpawn(EntitySlenderMan.class, 2, 1, 2, EnumCreatureType.monster, BiomeGenBase.forestHills); ModLoader.addSpawn(EntitySlenderMan.class, 2, 1, 2, EnumCreatureType.monster, BiomeGenBase.jungle); ModLoader.addSpawn(EntitySlenderMan.class, 2, 1, 2, EnumCreatureType.monster, BiomeGenBase.jungleHills); ModLoader.addSpawn(EntitySlenderMan.class, 2, 1, 2, EnumCreatureType.monster, BiomeGenBase.taiga); // Register your entities here // Parameters are: entClass, entName, ID, mod, trackingRange, updateFrequency, sendVelocityUpdates // Just like before, just called // Differently EntityRegistry.registerModEntity(EntitySlenderNote.class, "Slender Note", 1, this, 250, 5, false); // This is pretty much the old ModLoader method (in fact, the ModLoader method just calls this) EntityRegistry.registerGlobalEntityID(EntitySlenderNote.class, "Slender Note", SlenderNoteEntityID, 0x00000, 0x000000);//last param is entity ID, must be unique LanguageRegistry.addName(mod_slenderman.ItemChildSoul, "Child Soul"); LanguageRegistry.addName(mod_slenderman.ItemSlenderMask, "Slender Mask"); LanguageRegistry.addName(mod_slenderman.ItemSlenderNote, "Slender Note"); LanguageRegistry.addName(mod_slenderman.ItemSlenderPants, "Slender Trousers"); LanguageRegistry.addName(mod_slenderman.ItemSlenderShoes, "Slender Shoes"); LanguageRegistry.addName(mod_slenderman.ItemSlenderSuit, "Slender Suit"); LanguageRegistry.addName(mod_slenderman.ItemSlenderSword, "Slender Sword"); } @Mod.PostInit public void modsLoaded(FMLPostInitializationEvent var1) {} @Mod.ServerStarted public void serverStarted(FMLServerStartedEvent var1) {} }
-
I also have a problem with damage when landing after flying, now I am very new to forge and I was wondering, I added to my @Init method MinecraftForge.EVENT_BUS.register(new ClientTickHandler()); and I get an error saying "add arguments to match ClientTickHandler(EnumSet) Do I add EnumSet.of(TickType.CLIENT) in there? Never mind! It works =)