
Everything posted by Kokkie
-
[1.12] Entity AI not working
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() {} }
-
[1.12] Registering entities
- [1.12] Registering entities
In what event do you suggest doing this?- [1.12] Registering entities
I didn't forget this, I only called this when registering instead of at creation, should've said that though.- [1.12] Registering entities
Okay turns out it didn't matter, what is the correct way to register the renderers?- [1.12] Registering entities
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- [1.12] Registering entities
But I couldn't find that class.. Let me try updating...- [1.12] Registering entities
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...- [1.12] Registering entities
How can I get the ModContainer?- [1.12.1] placing a fluid block in the world which places flow blocks itself
Maybe have a try looking at how normal water does it?- [1.12.1] placing a fluid block in the world which places flow blocks itself
Have you tried updating the neighbors?- [1.12] Registering entities
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.- [1.12] Registering entities
Ah, it was EntityEntry instead of raw Entity, thanks!- [1.12] Registering entities
Hello, I was just wondering what the best way to register an entity would be. Thanks.- Hello help pls!
1.7.10 isn't supported- Building mods against custom Minecraft Forge version
Then don't do it, make your own thread.- [1.12] Get dimension [Solved]
- [1.12] Get dimension [Solved]
Sorry, I ment the ID of the dimension. (-1 for nether, 0 for overworld etc.)- [1.12] Get dimension [Solved]
Hi, how can I get the dimension a block is in? I have acces to the world, position and state.- [1.12] Multilayer block model [Solved]
Ah yeah, forgot to change #overlay to #ore. Now it works, thanks!- [1.12.1] Button will not show in Pause Menu
What happens when you use GuiButtonExt instead of GuiButton?- [1.12] Multilayer block model [Solved]
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.- [1.12] Multilayer block model [Solved]
Okay, thanks- [1.12] Multilayer block model [Solved]
Oh sorry, didn't know I did, how can I add instead of replace?- [1.12] Multilayer block model [Solved]
That's basically what I did, as you can see I 'extended' block/cube_all and specified the stone texture to it. - [1.12] Registering entities
IPS spam blocked by CleanTalk.
Important Information
By using this site, you agree to our Terms of Use.