use of me.steven.carrier.api.CarryingData in project Carrier by GabrielOlvH.
the class CarriableGeneric method tryPickup.
@Override
@NotNull
public ActionResult tryPickup(@NotNull CarrierComponent carrier, @NotNull World world, @NotNull BlockPos blockPos, @Nullable Entity entity) {
if (world.isClient)
return ActionResult.PASS;
BlockEntity blockEntity = world.getBlockEntity(blockPos);
BlockState blockState = world.getBlockState(blockPos);
CarryingData carrying = new CarryingData(type, blockState, blockEntity);
world.removeBlockEntity(blockPos);
world.removeBlock(blockPos, false);
carrier.setCarryingData(carrying);
return ActionResult.SUCCESS;
}
use of me.steven.carrier.api.CarryingData in project Carrier by GabrielOlvH.
the class MixinGameRenderer method carrier_renderCarrying.
@Inject(method = "renderWorld", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/GameRenderer;renderHand(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/Camera;F)V"), cancellable = true)
private void carrier_renderCarrying(float tickDelta, long limitTime, MatrixStack matrix, CallbackInfo ci) {
ClientPlayerEntity player = MinecraftClient.getInstance().player;
CarrierComponent carrier = Carrier.HOLDER.get(player);
CarryingData carrying = carrier.getCarryingData();
if (carrying == null)
return;
Carriable<?> carriable = CarriableRegistry.INSTANCE.get(carrying.getType());
if (carriable != null) {
ci.cancel();
}
}
use of me.steven.carrier.api.CarryingData in project Carrier by GabrielOlvH.
the class MixinPlayerEntity method b.
@Inject(method = "checkFallFlying", at = @At("HEAD"), cancellable = true)
private void b(CallbackInfoReturnable<Boolean> cir) {
CarrierComponent carrier = Carrier.HOLDER.get(this);
CarryingData carrying = carrier.getCarryingData();
if (carrying != null) {
cir.setReturnValue(false);
}
}
Aggregations