use of me.steven.carrier.api.CarrierComponent in project Carrier by GabrielOlvH.
the class MixinPlayerRenderer method carrier_renderCarrying.
@Inject(method = "render", at = @At("TAIL"))
private void carrier_renderCarrying(AbstractClientPlayerEntity player, float yaw, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumerProvider, int light, CallbackInfo ci) {
CarrierComponent carrier = Carrier.HOLDER.get(player);
CarryingData carrying = carrier.getCarryingData();
if (carrying == null)
return;
Carriable<?> carriable = CarriableRegistry.INSTANCE.get(carrying.getType());
if (carriable != null) {
carriable.render(player, carrier, matrices, vertexConsumerProvider, tickDelta, light);
}
}
use of me.steven.carrier.api.CarrierComponent in project Carrier by GabrielOlvH.
the class MixinPlayerEntity method a.
@Inject(method = "updateSwimming", at = @At("HEAD"), cancellable = true)
private void a(CallbackInfo ci) {
CarrierComponent carrier = Carrier.HOLDER.get(this);
CarryingData carrying = carrier.getCarryingData();
if (carrying != null) {
setSwimming(false);
ci.cancel();
}
}
use of me.steven.carrier.api.CarrierComponent in project Carrier by GabrielOlvH.
the class MixinPlayerModel method carrier_setAngles.
@Inject(method = "setAngles", at = @At("RETURN"))
private void carrier_setAngles(LivingEntity livingEntity, float f, float g, float h, float i, float j, CallbackInfo ci) {
if (livingEntity instanceof PlayerEntity) {
PlayerEntity player = (PlayerEntity) livingEntity;
CarrierComponent carrier = Carrier.HOLDER.get(player);
if (carrier.getCarryingData() == null)
return;
float pitch = 0.4f;
if (player.isSneaking())
pitch = 0.8f;
rightArm.pitch = -pitch;
leftArm.pitch = -pitch;
rightSleeve.pitch = -pitch;
leftSleeve.pitch = -pitch;
}
}
use of me.steven.carrier.api.CarrierComponent in project Carrier by GabrielOlvH.
the class ServerWorldTickCallback method onEndTick.
@Override
public void onEndTick(ServerWorld serverWorld) {
for (ServerPlayerEntity player : serverWorld.getPlayers()) {
CarrierComponent carrier = Carrier.HOLDER.get(player);
CarryingData carrying = carrier.getCarryingData();
if (carrying != null) {
Config config = Carrier.CONFIG;
if (config.getSlownessLevel() > 0)
player.addStatusEffect(new StatusEffectInstance(StatusEffects.SLOWNESS, 20, config.getSlownessLevel() - 1));
if (config.getHungerExhaustion() > 0)
player.getHungerManager().addExhaustion(config.getHungerExhaustion());
}
}
}
use of me.steven.carrier.api.CarrierComponent 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();
}
}
Aggregations