-
Posts
796 -
Joined
-
Last visited
-
Days Won
1
Everything posted by Kokkie
-
Hello, I'm working on a boss but the AI isn't working. I'm using vanilla AI, some of them work but some don't. Here's my code: public class CheeseBossEntity extends EntityMob { private final BossInfoServer bossInfo = (BossInfoServer) new BossInfoServer(getDisplayName(), BossInfo.Color.YELLOW, BossInfo.Overlay.PROGRESS).setCreateFog(true); public CheeseBossEntity(World worldIn) { super(worldIn); setHealth(getMaxHealth()); setSize(1.0F, 2.0F); experienceValue = 100; } @Override protected void initEntityAI() { tasks.addTask(0, new EntityAISwimming(this)); tasks.addTask(1, new EntityAIWanderAvoidWater(this, 0.5D)); tasks.addTask(2, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F)); tasks.addTask(3, new EntityAILookIdle(this)); tasks.addTask(4, new EntityAIAttackMelee(this, 0.6F, true)); targetTasks.addTask(0, new EntityAIHurtByTarget(this, false, new Class[0])); targetTasks.addTask(1, new EntityAINearestAttackableTarget<>(this, EntityPlayer.class, false)); } @Override protected void updateAITasks() { super.updateAITasks(); bossInfo.setPercent(getHealth() / getMaxHealth()); } @Override protected void applyEntityAttributes() { super.applyEntityAttributes(); getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(400.0); getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.5); getEntityAttribute(SharedMonsterAttributes.FOLLOW_RANGE).setBaseValue(0.5); getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).setBaseValue(4.0); } @Override public EnumCreatureAttribute getCreatureAttribute() { return EnumCreatureAttribute.UNDEAD; } @Override protected boolean canBeRidden(Entity entityIn) { return false; } @Override public boolean isNonBoss() { return false; } @Override public void readEntityFromNBT(NBTTagCompound compound) { super.readEntityFromNBT(compound); if (hasCustomName()) { bossInfo.setName(getDisplayName()); } } @Override public void setCustomNameTag(String name) { super.setCustomNameTag(name); bossInfo.setName(getDisplayName()); } @Override public void addTrackingPlayer(EntityPlayerMP player) { super.addTrackingPlayer(player); bossInfo.addPlayer(player); } @Override public void removeTrackingPlayer(EntityPlayerMP player) { super.removeTrackingPlayer(player); bossInfo.removePlayer(player); } @Override public void fall(float distance, float damageMultiplier) {} @Override public void setInWeb() {} }
-
In what event do you suggest doing this?
-
I didn't forget this, I only called this when registering instead of at creation, should've said that though.
-
Okay turns out it didn't matter, what is the correct way to register the renderers?
-
All is fine now, only the methods return a EntityEntryBuilder<Entity> instead of one using my Entity, how can I fix this? Code so far: public static final EntityEntryBuilder<CheeseBossEntity> CHEESE_BOSS = EntityEntryBuilder.create().entity(CheeseBossEntity.class).id(new ResourceLocation(Reference.MOD_ID), ID++).name("cheese_boss").egg(0xFFFFFF, 0xAAAAAA).tracker(64, 20, false); Tell me if something is wrong in this as well. Forgot to add tracker, fixed now
-
But I couldn't find that class.. Let me try updating...
-
Correct me if I'm wrong but I'm creating an EntityRegistration and it takes a ModContainer as parameter, I need to know how I can get the ModContainer of my mod...
-
How can I get the ModContainer?
-
Just tried it, it crashes. The log: [14:33:39] [main/WARN] [FML/]: Registry EntityEntry: Override did not have an associated owner object. Name: dgm:cheese_boss Value: net.minecraftforge.fml.common.registry.EntityEntry@79ed43f8 My code: public class Entities { public static final EntityEntry CHEESE_BOSS = new EntityEntry(CheeseBossEntity.class, Reference.MOD_ID + ":cheese_boss"); public static final EntityEntry[] ENTITIES = new EntityEntry[] { CHEESE_BOSS }; static { CHEESE_BOSS.setRegistryName(Reference.MOD_ID, "cheese_boss"); CHEESE_BOSS.setEgg(new EntityEggInfo(new ResourceLocation(Reference.MOD_ID, "cheese_boss"), 0xFFFFFF, 0xAAAAAA)); } } @Mod.EventBusSubscriber public class CommonHandler { @SubscribeEvent public static void registerBlocks(RegistryEvent.Register<Block> e) { DeGeweldigeMod.LOGGER.info("Registering Blocks."); e.getRegistry().registerAll(Blocks.BLOCKS); } @SubscribeEvent public static void registerItems(RegistryEvent.Register<Item> e) { DeGeweldigeMod.LOGGER.info("Registering Items."); e.getRegistry().registerAll(Items.ITEMS); for (Block block : Blocks.BLOCKS) { e.getRegistry().register(new ItemBlock(block).setRegistryName(block.getRegistryName()).setUnlocalizedName(block.getUnlocalizedName())); } } @SubscribeEvent public static void registerEntities(RegistryEvent.Register<EntityEntry> e) { DeGeweldigeMod.LOGGER.info("Registering Entities."); e.getRegistry().registerAll(Entities.ENTITIES); } } Tell me if you need more code/stuff.
-
Ah, it was EntityEntry instead of raw Entity, thanks!
-
Hello, I was just wondering what the best way to register an entity would be. Thanks.
-
1.7.10 isn't supported
-
Building mods against custom Minecraft Forge version
Kokkie replied to qqxv's topic in Support & Bug Reports
Then don't do it, make your own thread. -
Sorry, I ment the ID of the dimension. (-1 for nether, 0 for overworld etc.)
-
Hi, how can I get the dimension a block is in? I have acces to the world, position and state.
-
Ah yeah, forgot to change #overlay to #ore. Now it works, thanks!
-
What happens when you use GuiButtonExt instead of GuiButton?
-
Now, the purple/black texture appears. My new block model: { "parent": "block/block", "textures": { "block": "blocks/stone", "ore": "dgm:blocks/cheese_ore", "particle": "blocks/stone" }, "elements": [ { "from": [ 0, 0, 0 ], "to": [ 16, 16, 16 ], "faces": { "down": { "texture": "#block", "cullface": "down" }, "up": { "texture": "#block", "cullface": "up" }, "north": { "texture": "#block", "cullface": "north" }, "south": { "texture": "#block", "cullface": "south" }, "west": { "texture": "#block", "cullface": "west" }, "east": { "texture": "#block", "cullface": "east" } } }, { "from": [ 0, 0, 0 ], "to": [ 16, 16, 16 ], "faces": { "down": { "texture": "#overlay", "cullface": "down" }, "up": { "texture": "#overlay", "cullface": "up" }, "north": { "texture": "#overlay", "cullface": "north" }, "south": { "texture": "#overlay", "cullface": "south" }, "west": { "texture": "#overlay", "cullface": "west" }, "east": { "texture": "#overlay", "cullface": "east" } } } ] } The console and client log give no errors.
-
Okay, thanks
-
Oh sorry, didn't know I did, how can I add instead of replace?
-
That's basically what I did, as you can see I 'extended' block/cube_all and specified the stone texture to it.