Minecraft Never got into the Minecraft hype or all these multiplayer MMORPGs games in general.
I despise action games, where you have to associate yourself with any single character.
But I've enjoyed several games similar to Minecraft, like the Dungeon Keeper.
Anyway, since Minecraft is brandished as the pinnacle of programming and game design, lets check its entity code, decompiled for us by the wonderful Chinese people and exposed at github in all its Java glory.
https://github.com/WangTingZheng/mcp940/blob/master/src/minecraft/net/minecraft/entity/Entity.javahttps://github.com/WangTingZheng/mcp940/blob/master/src/minecraft/net/minecraft/tileentity/TileEntity.javaYeah! Thats what peak performance looks like! Each time you see a Java program, you can guess what is behind the multigigabyte jar file with its million of .class files... I read they have specially trained monkeys just to write the getter and setter methods.
public abstract class Entity implements ICommandSender
{
private static final Logger LOGGER = LogManager.getLogger();
private static final List<ItemStack> EMPTY_EQUIPMENT = Collections.<ItemStack>emptyList();
private static final AxisAlignedBB ZERO_AABB = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D);
private static double renderDistanceWeight = 1.0D;
private static int nextEntityID;
private int entityId;
/**
* Blocks entities from spawning when they do their AABB check to make sure the spot is clear of entities that can
* prevent spawning.
*/
public boolean preventEntitySpawning;
private final List<Entity> riddenByEntities;
protected int rideCooldown;
private Entity ridingEntity;
public boolean forceSpawn;
/** Reference to the World object. */
public World world;
public double prevPosX;
public double prevPosY;
public double prevPosZ;
/** Entity position X */
public double posX;
/** Entity position Y */
public double posY;
/** Entity position Z */
public double posZ;
/** Entity motion X */
public double motionX;
/** Entity motion Y */
public double motionY;
/** Entity motion Z */
public double motionZ;
/** Entity rotation Yaw */
public float rotationYaw;
/** Entity rotation Pitch */
public float rotationPitch;
public float prevRotationYaw;
public float prevRotationPitch;
/** Axis aligned bounding box. */
private AxisAlignedBB boundingBox;
public boolean onGround;
/**
* True if after a move this entity has collided with something on X- or Z-axis
*/
public boolean isCollidedHorizontally;
/**
* True if after a move this entity has collided with something on Y-axis
*/
public boolean isCollidedVertically;
/**
* True if after a move this entity has collided with something either vertically or horizontally
*/
public boolean isCollided;
public boolean velocityChanged;
protected boolean isInWeb;
private boolean isOutsideBorder;
/**
* gets set by setEntityDead, so this must be the flag whether an Entity is dead (inactive may be better term)
*/
public boolean isDead;
/** How wide this entity is considered to be */
public float width;
/** How high this entity is considered to be */
public float height;
/** The previous ticks distance walked multiplied by 0.6 */
public float prevDistanceWalkedModified;
/** The distance walked multiplied by 0.6 */
public float distanceWalkedModified;
public float distanceWalkedOnStepModified;
public float fallDistance;
/**
* The distance that has to be exceeded in order to triger a new step sound and an onEntityWalking event on a block
*/
private int nextStepDistance;
private float nextFlap;
/**
* The entity's X coordinate at the previous tick, used to calculate position during rendering routines
*/
public double lastTickPosX;
/**
* The entity's Y coordinate at the previous tick, used to calculate position during rendering routines
*/
public double lastTickPosY;
/**
* The entity's Z coordinate at the previous tick, used to calculate position during rendering routines
*/
public double lastTickPosZ;
/**
* How high this entity can step up when running into a block to try to get over it (currently make note the entity
* will always step up this amount and not just the amount needed)
*/
public float stepHeight;
/**
* Whether this entity won't clip with collision or not (make note it won't disable gravity)
*/
public boolean noClip;
/**
* Reduces the velocity applied by entity collisions by the specified percent.
*/
public float entityCollisionReduction;
protected Random rand;
/** How many ticks has this entity had ran since being alive */
public int ticksExisted;
private int fire;
/**
* Whether this entity is currently inside of water (if it handles water movement that is)
*/
protected boolean inWater;
/**
* Remaining time an entity will be "immune" to further damage after being hurt.
*/
public int hurtResistantTime;
protected boolean firstUpdate;
protected boolean isImmuneToFire;
protected EntityDataManager dataManager;
protected static final DataParameter<Byte> FLAGS = EntityDataManager.<Byte>createKey(Entity.class, DataSerializers.BYTE);
private static final DataParameter<Integer> AIR = EntityDataManager.<Integer>createKey(Entity.class, DataSerializers.VARINT);
private static final DataParameter<String> CUSTOM_NAME = EntityDataManager.<String>createKey(Entity.class, DataSerializers.STRING);
private static final DataParameter<Boolean> CUSTOM_NAME_VISIBLE = EntityDataManager.<Boolean>createKey(Entity.class, DataSerializers.BOOLEAN);
private static final DataParameter<Boolean> SILENT = EntityDataManager.<Boolean>createKey(Entity.class, DataSerializers.BOOLEAN);
private static final DataParameter<Boolean> NO_GRAVITY = EntityDataManager.<Boolean>createKey(Entity.class, DataSerializers.BOOLEAN);
/** Has this entity been added to the chunk its within */
public boolean addedToChunk;
public int chunkCoordX;
public int chunkCoordY;
public int chunkCoordZ;
public long serverPosX;
public long serverPosY;
public long serverPosZ;
/**
* Render entity even if it is outside the camera frustum. Only true in EntityFish for now. Used in RenderGlobal:
* render if ignoreFrustumCheck or in frustum.
*/
public boolean ignoreFrustumCheck;
public boolean isAirBorne;
public int timeUntilPortal;
/** Whether the entity is inside a Portal */
protected boolean inPortal;
protected int portalCounter;
/** Which dimension the player is in (-1 = the Nether, 0 = normal world) */
public int dimension;
/** The position of the last portal the entity was in */
protected BlockPos lastPortalPos;
/**
* A horizontal vector related to the position of the last portal the entity was in
*/
protected Vec3d lastPortalVec;
/**
* A direction related to the position of the last portal the entity was in
*/
protected EnumFacing teleportDirection;
private boolean invulnerable;
protected UUID entityUniqueID;
protected String cachedUniqueIdString;
/** The command result statistics for this Entity. */
private final CommandResultStats cmdResultStats;
protected boolean glowing;
private final Set<String> tags;
private boolean isPositionDirty;
private final double[] pistonDeltas;
private long pistonDeltasGameTime;
public Entity(World worldIn)
{
this.entityId = nextEntityID++;
this.riddenByEntities = Lists.<Entity>newArrayList();
this.boundingBox = ZERO_AABB;
this.width = 0.6F;
this.height = 1.8F;
this.nextStepDistance = 1;
this.nextFlap = 1.0F;
this.rand = new Random();
this.fire = -this.getFireImmuneTicks();
this.firstUpdate = true;
this.entityUniqueID = MathHelper.getRandomUUID(this.rand);
this.cachedUniqueIdString = this.entityUniqueID.toString();
this.cmdResultStats = new CommandResultStats();
this.tags = Sets.<String>newHashSet();
this.pistonDeltas = new double[] {0.0D, 0.0D, 0.0D};
this.world = worldIn;
this.setPosition(0.0D, 0.0D, 0.0D);
if (worldIn != null)
{
this.dimension = worldIn.provider.getDimensionType().getId();
}
this.dataManager = new EntityDataManager(this);
this.dataManager.register(FLAGS, Byte.valueOf((byte)0));
this.dataManager.register(AIR, Integer.valueOf(300));
this.dataManager.register(CUSTOM_NAME_VISIBLE, Boolean.valueOf(false));
this.dataManager.register(CUSTOM_NAME, "");
this.dataManager.register(SILENT, Boolean.valueOf(false));
this.dataManager.register(NO_GRAVITY, Boolean.valueOf(false));
this.entityInit();
}
public int getEntityId()
{
return this.entityId;
}
Current Mood: amusedCurrent Music: https://www.youtube.com/watch?v=l97zTQ9CP40