net.minecraft.entity.MovementType Java Examples

The following examples show how to use net.minecraft.entity.MovementType. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ClientPlayerEntityMixin.java    From Wurst7 with GNU General Public License v3.0 5 votes vote down vote up
@Inject(at = {@At("HEAD")},
	method = {
		"move(Lnet/minecraft/entity/MovementType;Lnet/minecraft/util/math/Vec3d;)V"})
private void onMove(MovementType type, Vec3d offset, CallbackInfo ci)
{
	PlayerMoveEvent event = new PlayerMoveEvent(this);
	WurstClient.INSTANCE.getEventManager().fire(event);
}
 
Example #2
Source File: HallowedTreasureChestEntity.java    From the-hallow with MIT License 4 votes vote down vote up
@Override
public void tick() {
	if (shouldReplace && !hasReplaced) {
		world.setBlockState(getBlockPos(), Blocks.AIR.getDefaultState(), 3);
		hasReplaced = true;
	}
	
	if (isSpinningUp) {
		spinProgress++;
		
		previousRotation = rotation;
		rotation += ROTATION_PER_TICK;
		this.move(MovementType.SELF, new Vec3d(0, 0.01f, 0));
		
		if (spinProgress >= MAX_SPIN_PROGRESS) {
			isSpinningUp = false;
			isEnding = true;
		}
	}
	
	
	// stationary pause + wiggle after spin
	if (isEnding) {
		endProgress++;
		
		if (endProgress >= MAX_END_PROGRESS) {
			isEnding = false;
			isOpeningHinge = true;
		}
	}
	
	// hinge opening
	if (isOpeningHinge) {
		hingeProgress++;
		
		if (hingeProgress >= MAX_HINGE_PROGRESS * .8) {
			spawnDeathParticles();
		}
		
		if (hingeProgress >= MAX_HINGE_PROGRESS) {
			this.kill();
			
			if (!world.isClient) {
				dropLoot((ServerWorld) world);
			}
		}
	}
	
	// particles to ground
	world.addParticle(ParticleTypes.SMOKE, getX(), getY(), getZ(), 0, -.1, 0);
}