本文整理了Java中net.minecraft.entity.Entity.onUpdate()
方法的一些代码示例,展示了Entity.onUpdate()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Entity.onUpdate()
方法的具体详情如下:
包路径:net.minecraft.entity.Entity
类名称:Entity
方法名:onUpdate
暂无
代码示例来源:origin: Vazkii/Botania
@Override
public void onUpdate() {
super.onUpdate();
liveTime++;
int diffTime = Math.max(1, 30 - (int) (liveTime / 45f));
if(burstsFired < TOTAL_BURSTS && liveTime % diffTime == 0) {
if(!world.isRemote)
spawnBurst();
burstsFired++;
}
if(burstsFired >= TOTAL_BURSTS) {
deathTime++;
if(deathTime >= DEATH_TIME) {
setDead();
world.newExplosion(this, posX, posY, posZ, 8F, true, true);
}
}
}
代码示例来源:origin: Vazkii/Botania
motionY = 0;
motionZ = 0;
super.onUpdate();
代码示例来源:origin: Vazkii/Botania
@Override
public void onUpdate() {
super.onUpdate();
代码示例来源:origin: Alex-the-666/Ice_and_Fire
public void onUpdateParts() {
for (Entity entity : segments) {
if (entity != null) {
entity.onUpdate();
}
}
}
代码示例来源:origin: Vazkii/Botania
@Override
public void onUpdate() {
super.onUpdate();
代码示例来源:origin: Vazkii/Botania
@Override
public void onUpdate() {
super.onUpdate();
if(world.isRemote)
return;
InvWithLocation inv = getSparkInventory();
if(inv == null) {
dropAndKill();
return;
}
if(isMaster())
master = this;
if(firstTick) {
if(isMaster())
restartNetwork();
else findNetwork();
firstTick = false;
}
if(master != null && (((Entity) master).isDead || master.getNetwork() != getNetwork()))
master = null;
int displayTicks = getItemDisplayTicks();
if(displayTicks > 0)
setItemDisplayTicks(displayTicks - 1);
else if(displayTicks < 0)
setItemDisplayTicks(displayTicks + 1);
}
代码示例来源:origin: iLexiconn/LLibrary
default void onUpdateParts() {
for (Entity entity : this.getParts()) {
entity.onUpdate();
}
}
代码示例来源:origin: Vazkii/Botania
this.lastTickPosY = this.posY;
this.lastTickPosZ = this.posZ;
super.onUpdate();
代码示例来源:origin: ValkyrienWarfare/Valkyrien-Warfare-Revamped
@Override
public void onUpdate() {
super.onUpdate();
tickLerp();
// if(!worldObj.isRemote){
processMovementForTick();
// }
}
代码示例来源:origin: ValkyrienWarfare/Valkyrien-Warfare-Revamped
@Override
public void onUpdate() {
super.onUpdate();
// System.out.println("test");
Entity rider = getRider();
if (rider != null) {
rotationYaw = rider.getRotationYawHead();
rotationPitch = rider.rotationPitch;
}
}
代码示例来源:origin: iLexiconn/LLibrary
@Override
public void onUpdate() {
this.setPositionAndUpdate(this.parent.posX + this.radius * Math.cos(this.parent.renderYawOffset * (Math.PI / 180.0F) + this.angleYaw), this.parent.posY + this.offsetY, this.parent.posZ + this.radius * Math.sin(this.parent.renderYawOffset * (Math.PI / 180.0F) + this.angleYaw));
if (!this.world.isRemote) {
this.collideWithNearbyEntities();
}
if (this.parent.isDead) {
this.world.removeEntityDangerously(this);
}
super.onUpdate();
}
代码示例来源:origin: Direwolf20-MC/BuildingGadgets
@Override
public void onUpdate() {
super.onUpdate();
if (ticksExisted > maxLife) {
setDespawning();
}
if (!isDespawning()) {
} else {
despawnTick();
}
}
代码示例来源:origin: JurassiCraftTeam/JurassiCraft2
@Override
public void onUpdate() {
super.onUpdate();
if(dinosaur == null) {
Optional<Entity> parentEntity = world.loadedEntityList.stream().filter(entity -> entity.getUniqueID().equals(this.parent)).findFirst();
if(parentEntity.isPresent() && parentEntity.get() instanceof DinosaurEntity) {
this.dinosaur = ((DinosaurEntity)parentEntity.get()).getDinosaur();
}
}
if (!this.world.isRemote) {
if (this.entity == null) {
this.setDead();
}
this.hatchTime--;
if (this.hatchTime <= 0) {
this.hatch();
}
if (!this.onGround) {
this.motionY -= 0.035D;
}
this.motionX *= 0.85;
this.motionY *= 0.85;
this.motionZ *= 0.85;
this.move(MoverType.SELF, this.motionX, this.motionY, this.motionZ);
}
}
代码示例来源:origin: Vazkii/Quark
@Override
public void onUpdate() {
super.onUpdate();
if(isDead)
return;
if(!isRiding()) {
if(!world.isRemote)
setDead();
return;
}
Entity riding = getRidingEntity();
rotationYaw = riding.prevRotationYaw;
rotationPitch = 0F;
}
代码示例来源:origin: DimensionalDevelopment/VanillaFix
/**
* @reason Adds subsections to the "root.tick.level.entities.regular.tick"
* profiler, using the entity ID, or the class name if the ID is null.
*/
@Redirect(method = "updateEntities", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;onUpdate()V"))
private void entityOnUpdate(Entity entity) {
profiler.func_194340_a(() -> { // func_194340_a = startSection(Supplier<String>)
final ResourceLocation entityID = EntityList.getKey(entity);
return entityID == null ? entity.getClass().getSimpleName() : entityID.toString();
});
entity.onUpdate();
profiler.endSection();
}
代码示例来源:origin: P3pp3rF1y/AncientWarfare2
@Override
public void onUpdate() {
this.ticksExisted++;
super.onUpdate();
this.onMovementTick();
if (!this.world.isRemote) {
if (this.ticksExisted > 6000)//5 min timer max for missiles...
{
this.setDead();
} else if (this.ammoType.isTorpedo() && this.ticksExisted > 400)//and much shorter for torpedoes, 10 second lifetime
{
this.setDead();
}
}
}
代码示例来源:origin: ldtteam/minecolonies
/**
* Called to update the entity's position/logic.
*/
@Override
public void onUpdate()
{
super.onUpdate();
if (fishHookIsOverTimeToLive())
{
this.setDead();
}
bounceFromGround();
if (this.inGround)
{
return;
}
moveSomeStuff();
}
代码示例来源:origin: Vazkii/Quark
@Override
public void onUpdate() {
super.onUpdate();
BlockPos pos = getPosition();
if(pos != null && !(getEntityWorld().getBlockState(pos).getBlock() instanceof BlockStairs) || !canBeAbove(getEntityWorld(), pos)) {
setDead();
return;
}
List<Entity> passangers = getPassengers();
if(passangers.isEmpty())
setDead();
for(Entity e : passangers)
if(e.isSneaking())
setDead();
}
代码示例来源:origin: Direwolf20-MC/BuildingGadgets
@Override
public void onUpdate() {
super.onUpdate();
if (ticksExisted > maxLife) {
setDespawning();
}
if (setPos != null) {
if (!(world.getBlockState(setPos).getBlock() instanceof ConstructionBlock) && !(world.getBlockState(setPos).getBlock() instanceof ConstructionBlockPowder)) {
setDespawning();
}
}
if (!isDespawning()) {
} else {
despawnTick();
}
}
代码示例来源:origin: ValkyrienWarfare/Valkyrien-Warfare-Revamped
@Override
public void updatePassenger(Entity passenger) {
Vector inLocal = wrapping.getLocalPositionForEntity(passenger);
if (inLocal != null) {
Vector newEntityPosition = new Vector(inLocal);
float f = passenger.width / 2.0F;
float f1 = passenger.height;
AxisAlignedBB inLocalAABB = new AxisAlignedBB(newEntityPosition.X - f, newEntityPosition.Y,
newEntityPosition.Z - f, newEntityPosition.X + f, newEntityPosition.Y + f1,
newEntityPosition.Z + f);
wrapping.coordTransform.fromLocalToGlobal(newEntityPosition);
passenger.setPosition(newEntityPosition.X, newEntityPosition.Y, newEntityPosition.Z);
Polygon entityBBPoly = new Polygon(inLocalAABB, wrapping.coordTransform.lToWTransform);
AxisAlignedBB newEntityBB = entityBBPoly.getEnclosedAABB();
passenger.setEntityBoundingBox(newEntityBB);
if (passenger instanceof EntityMountingWeaponBase) {
passenger.onUpdate();
for (Entity e : passenger.riddenByEntities) {
if (wrapping.isEntityFixed(e)) {
Vector inLocalAgain = wrapping.getLocalPositionForEntity(e);
if (inLocalAgain != null) {
Vector newEntityPositionAgain = new Vector(inLocalAgain);
wrapping.coordTransform.fromLocalToGlobal(newEntityPositionAgain);
e.setPosition(newEntityPositionAgain.X, newEntityPositionAgain.Y, newEntityPositionAgain.Z);
}
}
}
}
}
}
内容来源于网络,如有侵权,请联系作者删除!