Skip to content

Instantly share code, notes, and snippets.

@AEnterprise
Created October 10, 2015 12:52
Show Gist options
  • Save AEnterprise/77f7077ccd6199effccd to your computer and use it in GitHub Desktop.
Save AEnterprise/77f7077ccd6199effccd to your computer and use it in GitHub Desktop.
package kineticrevolution.entities;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
/**
* Created by AEnterprise
*/
public class EntityDuster extends Entity {
public EntityDuster(World world) {
super(world);
setSize(1, 1);
noClip = true;
}
@Override
protected void entityInit() {
System.out.println("Entity init");
}
@Override
public void onEntityUpdate() {
if (worldObj.isRemote)
return;
worldObj.theProfiler.startSection("KRDuster");
worldObj.theProfiler.endSection();
}
@Override
protected void readEntityFromNBT(NBTTagCompound tag) {
}
@Override
protected void writeEntityToNBT(NBTTagCompound tag) {
}
@Override
public boolean canBeCollidedWith() {
return true;
}
@Override
public void onCollideWithPlayer(EntityPlayer player) {
if (player.fallDistance > 0.9f && !player.worldObj.isRemote) {
moveEntity(0, -0.5, 0);
}
}
@Override
public void applyEntityCollision(Entity entity) {
//super.applyEntityCollision(entity);
}
@Override
public boolean hitByEntity(Entity entity) {
return true;
}
@Override
public boolean attackEntityFrom(DamageSource source, float damage) {
if (source == DamageSource.anvil) {
System.out.println("ANVIL");
}
return false;
}
@Override
public AxisAlignedBB getBoundingBox() {
return AxisAlignedBB.getBoundingBox(posX - 0.5F, posY - 0.5F, posZ - 0.25F, posX + 0.5F, posY + 0.5F, posZ + 0.5F);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment