net.minecraft.entity.ExperienceOrbEntity Java Examples

The following examples show how to use net.minecraft.entity.ExperienceOrbEntity. 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: ExperienceOrbEntityMixin.java    From fabric-carpet with MIT License 6 votes vote down vote up
@Inject(method = "tick",
        at = @At(
                value = "INVOKE",
                target = "Lnet/minecraft/entity/ExperienceOrbEntity;move(Lnet/minecraft/entity/MovementType;Lnet/minecraft/util/math/Vec3d;)V",
                shift = At.Shift.AFTER
        ))
void checkCombineAtTick(CallbackInfo ci)
{
    if (CarpetSettings.combineXPOrbs)
    {
        if (getCombineDelay() > 0)
        {
            setCombineDelay(getCombineDelay()-1);
        }

        if (getCombineDelay() == 0)
        {
            XPcombine.searchForOtherXPNearby((ExperienceOrbEntity) (Object) this);
        }
    }
}
 
Example #2
Source File: ExperienceOrbEntityMixin_RealTime.java    From Galaxy with GNU Affero General Public License v3.0 6 votes vote down vote up
@Redirect(
    method = "tick",
    at = @At(value = "FIELD",
        target = "Lnet/minecraft/entity/ExperienceOrbEntity;orbAge:I",
        opcode = Opcodes.PUTFIELD
    ),
    slice = @Slice(
        from = @At(
            value = "FIELD",
            target = "Lnet/minecraft/entity/ExperienceOrbEntity;renderTicks:I",
            opcode = Opcodes.PUTFIELD
        ),
        to = @At(
            value = "CONSTANT",
            args = "intValue=6000"
        )
    )
)
private void realTimeImpl$adjustForRealTimeAge(final ExperienceOrbEntity self, final int modifier) {
    final int ticks = (int) ((RealTimeTrackingBridge) self.getEntityWorld()).realTimeBridge$getRealTimeTicks();
    this.orbAge += ticks;
}
 
Example #3
Source File: MixinExperienceOrbEntity.java    From patchwork-api with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Inject(method = "onPlayerCollision", cancellable = true, at = @At(value = "FIELD", opcode = Opcodes.H_PUTFIELD, ordinal = 0,
		target = "net/minecraft/entity/player/PlayerEntity.experiencePickUpDelay:I"))
private void hookOnPlayerCollisionForPickup(PlayerEntity player, CallbackInfo ci) {
	@SuppressWarnings("ConstantConditions")
	ExperienceOrbEntity entity = (ExperienceOrbEntity) (Object) this;

	if (MinecraftForge.EVENT_BUS.post(new PlayerPickupXpEvent(player, entity))) {
		ci.cancel();
	}
}
 
Example #4
Source File: XPcombine.java    From fabric-carpet with MIT License 5 votes vote down vote up
public static void searchForOtherXPNearby(ExperienceOrbEntity first)
{
    for (ExperienceOrbEntity entityxp : first.world.getNonSpectatingEntities(ExperienceOrbEntity.class, first.getBoundingBox().expand(0.5D, 0.0D, 0.5D)))
    {
        combineItems(first, entityxp);
    }
}
 
Example #5
Source File: ExperienceOrbEntityMixin_RealTime.java    From Galaxy with GNU Affero General Public License v3.0 5 votes vote down vote up
@Redirect(
    method = "tick",
    at = @At(
        value = "FIELD",
        target = "Lnet/minecraft/entity/ExperienceOrbEntity;pickupDelay:I",
        opcode = Opcodes.PUTFIELD
    )
)
private void realTimeImpl$adjustForRealTimePickupDelay(final ExperienceOrbEntity self, final int modifier) {
    final int ticks = (int) ((RealTimeTrackingBridge) this.world).realTimeBridge$getRealTimeTicks();
    this.pickupDelay = Math.max(0, this.pickupDelay - ticks);
}
 
Example #6
Source File: PlayerPickupXpEvent.java    From patchwork-api with GNU Lesser General Public License v2.1 4 votes vote down vote up
public PlayerPickupXpEvent(PlayerEntity player, ExperienceOrbEntity orb) {
	super(player, orb);
}
 
Example #7
Source File: PlayerXpEvent.java    From patchwork-api with GNU Lesser General Public License v2.1 4 votes vote down vote up
public PickupXp(PlayerEntity player, ExperienceOrbEntity orb) {
	super(player);
	this.orb = orb;
}
 
Example #8
Source File: PlayerXpEvent.java    From patchwork-api with GNU Lesser General Public License v2.1 4 votes vote down vote up
public ExperienceOrbEntity getOrb() {
	return orb;
}