Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.12.2]Multipart entity problem maybe about setDead


_HungTeen_
 Share

Recommended Posts

public class EntityConeHead extends MultiPartEntityPart{

	private EntityNormalZombie zombie;
	
	public EntityConeHead(EntityNormalZombie zombie, String partName, float width, float height) {
		super(zombie, partName, width, height);
		this.zombie=zombie;
		this.setExist();
	}

	@Override
	public boolean attackEntityFrom(DamageSource source, float amount) {
		//System.out.println(this.world.isRemote+" "+source.damageType+" "+amount);
		return super.attackEntityFrom(source, amount);
	}
	
	public void setExist()
	{
		if(this.parent instanceof EntityZombieBase) {
			if(((EntityZombieBase) this.parent).getIsInivs()) this.setInvisible(true);
			else this.setInvisible(false);
		}
		else {
			System.out.println("error parent!");
			return ;
		}
	}
	
	public EntityZombieBase getZombie()
	{
		return this.zombie;
	}
	
	public void setBreak()
	{
		this.setSize(0f, 0f);
		this.setInvisible(true);
	}
}
public class EntityConeHeadZombie extends EntityNormalZombie implements IEntityMultiPart{

	private final EntityConeHead cone;
	
	public EntityConeHeadZombie(World worldIn) {
		super(worldIn);
		cone=new EntityConeHead(this, "cone_head", 0.5f, 1f);
	}

	@Override
	protected void applyEntityAttributes()
    {
        super.applyEntityAttributes();
        this.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(56.0D);
    }
	
	@Override
	public void onUpdate() {
		super.onUpdate();
		if(this.getHealth()<=20) {
			this.cone.setBreak();
		}
		else{
			this.cone.setLocationAndAngles(this.posX, this.posY+1.5, this.posZ, this.rotationYawHead, -this.rotationPitch);
		}
		this.world.updateEntityWithOptionalForce(this.cone, true);
	}
	
	@Override
	protected boolean canDespawn() {
		return false;
	}
	
	@Override
	public void setDead() {
		super.setDead();
		this.cone.setDead();
	}
	
	@Override
	public Entity[] getParts() {
		return new Entity[] {this.cone};
	}
	
	@Override
	public World getWorld() {
		return this.world;
	}

	@Override
	public boolean attackEntityFromPart(MultiPartEntityPart part, DamageSource source, float damage) {
		return this.attackEntityFrom(source, damage);
	}
	
	@Override
	public boolean isNonBoss() {
		return false;
	}
}

 

It's my first time to ask question at here.The problem is I am making a ConeHead Zombie by using multipartEntity ,When my peaShooter kill some ConeHead Zombie,there will exist some invisble object blocking my peaShooter's bullet.I know it may be the uncleared Cone,but I don't know how to deal with it.Pls help me ,thx !

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • Hi So Im trying to set up a Server for 1.16.4 now but when I go to launch it doesn't work, Im using the Life in the Village 2 server pack thats already pre-made but it still wont launch no matter what I try. If I can get some help that would be great thanks. D:\Modded Mc\LITV2-Serverpack-1.28a\LITV2-Serverpack-1.28a>java -Xmx4G -jar forge-1.16.5-36.2.4.jar nogui 2021-11-29 13:43:08,050 main WARN Advanced terminal features are not available in this environment [13:43:08] [main/INFO] [cp.mo.mo.Launcher/MODLAUNCHER]: ModLauncher running: args [--gameDir, ., --launchTarget, fmlserver, --fml.forgeVersion, 36.2.4, --fml.mcpVersion, 20210115.111550, --fml.mcVersion, 1.16.5, --fml.forgeGroup, net.minecraftforge, nogui] [13:43:08] [main/INFO] [cp.mo.mo.Launcher/MODLAUNCHER]: ModLauncher 8.0.9+86+master.3cf110c starting: java version 16.0.2 by Oracle Corporation Exception in thread "main" java.lang.IllegalAccessError: class cpw.mods.modlauncher.SecureJarHandler (in unnamed module @0x4de5031f) cannot access class sun.security.util.ManifestEntryVerifier (in module java.base) because module java.base does not export sun.security.util to unnamed module @0x4de5031f at cpw.mods.modlauncher.SecureJarHandler.lambda$static$1(SecureJarHandler.java:41) at cpw.mods.modlauncher.api.LamdbaExceptionUtils.uncheck(LamdbaExceptionUtils.java:95) at cpw.mods.modlauncher.SecureJarHandler.<clinit>(SecureJarHandler.java:41) at cpw.mods.modlauncher.Launcher.lambda$new$6(Launcher.java:55) at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1708) at cpw.mods.modlauncher.api.TypesafeMap.computeIfAbsent(TypesafeMap.java:52) at cpw.mods.modlauncher.api.TypesafeMap.computeIfAbsent(TypesafeMap.java:47) at cpw.mods.modlauncher.Environment.computePropertyIfAbsent(Environment.java:62) at cpw.mods.modlauncher.Launcher.<init>(Launcher.java:55) at cpw.mods.modlauncher.Launcher.main(Launcher.java:66) at net.minecraftforge.server.ServerMain$Runner.runLauncher(ServerMain.java:63) at net.minecraftforge.server.ServerMain$Runner.access$100(ServerMain.java:60) at net.minecraftforge.server.ServerMain.main(ServerMain.java:57) D:\Modded Mc\LITV2-Serverpack-1.28a\LITV2-Serverpack-1.28a>pause Press any key to continue . . .  
    • Still waiting on the issue.
    • Registering in static fields isn't ideal. You have a method that registers your deferred register to the event bus, right? leave your RegistryObject fields as non-final and empty, and set their reference in that method, right after registering the deferred register on the bus.
    • This is my event: p.s i tried the subclasses.   Above this line, I am also registering my GUI event listener with RenderGameOverlay, which works fine.  
    • Thanks. But I thought they would help me decide on the code. (((    As a result, I figured it out myself.   private static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, MODID); public static final RegistryObject<BlockItem> MyBlockItem = ITEMS.register("mysuperblockreg", () -> new BlockItem(testBlock, new Item.Properties().tab(CreativeModeTab.TAB_BUILDING_BLOCKS)));  
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.