diff --git a/src/main/java/com/minelittlepony/unicopia/client/render/CuccoonEntityRenderer.java b/src/main/java/com/minelittlepony/unicopia/client/render/CuccoonEntityRenderer.java index cebab328..2803de1a 100644 --- a/src/main/java/com/minelittlepony/unicopia/client/render/CuccoonEntityRenderer.java +++ b/src/main/java/com/minelittlepony/unicopia/client/render/CuccoonEntityRenderer.java @@ -1,17 +1,10 @@ package com.minelittlepony.unicopia.client.render; -import com.minelittlepony.unicopia.InteractionManager; import com.minelittlepony.unicopia.client.render.model.CuccoonEntityModel; import com.minelittlepony.unicopia.entity.CuccoonEntity; -import com.mojang.blaze3d.systems.RenderSystem; - import net.fabricmc.fabric.api.client.rendereregistry.v1.EntityRendererRegistry; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.entity.EntityRenderDispatcher; import net.minecraft.client.render.entity.LivingEntityRenderer; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.entity.Entity; import net.minecraft.util.Identifier; public class CuccoonEntityRenderer extends LivingEntityRenderer { @@ -33,21 +26,7 @@ public class CuccoonEntityRenderer extends LivingEntityRenderer { private float breatheAmount; public CuccoonEntityModel() { + super(RenderLayer::getEntityTranslucentCull); body = new ModelPart(this, 0, 0); body.setTextureSize(250, 250); @@ -35,12 +33,6 @@ public class CuccoonEntityModel extends EntityModel { public void render(MatrixStack matrices, VertexConsumer vertexConsumer, int light, int overlay, float red, float green, float blue, float alpha) { matrices.push(); - RenderSystem.enableBlend(); - RenderSystem.enableAlphaTest(); - RenderSystem.enableRescaleNormal(); - - RenderSystem.blendFunc(SrcFactor.SRC_ALPHA, DstFactor.ONE_MINUS_SRC_ALPHA); - matrices.scale(1 - breatheAmount, 1 + breatheAmount, 1 - breatheAmount); matrices.translate(0, -breatheAmount * 1.3F, 0); @@ -51,10 +43,6 @@ public class CuccoonEntityModel extends EntityModel { body.render(matrices, vertexConsumer, light, overlay, red, green, blue, alpha); - RenderSystem.disableRescaleNormal(); - RenderSystem.disableAlphaTest(); - RenderSystem.disableBlend(); - matrices.pop(); } diff --git a/src/main/java/com/minelittlepony/unicopia/entity/CuccoonEntity.java b/src/main/java/com/minelittlepony/unicopia/entity/CuccoonEntity.java index c0bf9bb0..ec41595f 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/CuccoonEntity.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/CuccoonEntity.java @@ -1,10 +1,9 @@ package com.minelittlepony.unicopia.entity; -import java.util.List; +import java.util.Collections; import javax.annotation.Nullable; -import com.google.common.collect.Lists; import com.minelittlepony.unicopia.EquinePredicates; import com.minelittlepony.unicopia.Race; import com.minelittlepony.unicopia.USounds; @@ -12,6 +11,7 @@ import com.minelittlepony.unicopia.entity.player.Pony; import com.minelittlepony.unicopia.particles.UParticles; import com.minelittlepony.unicopia.util.MagicalDamageSource; +import net.fabricmc.fabric.api.tools.FabricToolTags; import net.minecraft.block.Blocks; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityDimensions; @@ -44,8 +44,6 @@ public class CuccoonEntity extends LivingEntity implements IMagicals, InAnimate private static final TrackedData STRUGGLE_COUNT = DataTracker.registerData(CuccoonEntity.class, TrackedDataHandlerRegistry.INTEGER); - private final List armour = Lists.newArrayList(); - private boolean captiveLastSneakState; public CuccoonEntity(EntityType type, World world) { @@ -81,7 +79,11 @@ public class CuccoonEntity extends LivingEntity implements IMagicals, InAnimate public boolean damage(DamageSource source, float amount) { if (EquinePredicates.PLAYER_CHANGELING.test(source.getSource())) { - amount = 0; + + PlayerEntity player = (PlayerEntity)source.getSource(); + if (!FabricToolTags.SHOVELS.contains(player.getMainHandStack().getItem())) { + amount = 0; + } } return super.damage(source, amount); @@ -93,6 +95,7 @@ public class CuccoonEntity extends LivingEntity implements IMagicals, InAnimate && !entity.isSneaking() && !hasPassengers() && entity instanceof LivingEntity + && !(entity instanceof CuccoonEntity) && !EquinePredicates.PLAYER_CHANGELING.test(entity); } @@ -106,6 +109,12 @@ public class CuccoonEntity extends LivingEntity implements IMagicals, InAnimate return 0; } + @Override + @Nullable + public Entity getPrimaryPassenger() { + return getPassengerList().isEmpty() ? null : getPassengerList().get(0); + } + @Override public void tick() { super.tick(); @@ -150,39 +159,36 @@ public class CuccoonEntity extends LivingEntity implements IMagicals, InAnimate public ActionResult interactAt(PlayerEntity player, Vec3d vec, Hand hand) { if (hand == Hand.MAIN_HAND && EquinePredicates.PLAYER_CHANGELING.test(player)) { + Entity passenger = getPrimaryPassenger(); - if (hasPassengers()) { - Entity passenger = getPrimaryPassenger(); + if (passenger != null && (player.canConsume(false) || player.getHealth() < player.getMaximumHealth())) { + DamageSource d = MagicalDamageSource.causePlayerDamage("feed", player); - if (player.canConsume(false) || player.getHealth() < player.getMaximumHealth()) { - DamageSource d = MagicalDamageSource.causePlayerDamage("feed", player); + Pony.of(player).spawnParticles(UParticles.CHANGELING_MAGIC, 7); - Pony.of(player).spawnParticles(UParticles.CHANGELING_MAGIC, 7); - - if (passenger instanceof LivingEntity) { - if (player.hasStatusEffect(StatusEffects.NAUSEA)) { - ((LivingEntity)passenger).addStatusEffect(player.removeStatusEffectInternal(StatusEffects.NAUSEA)); - } else if (random.nextInt(2300) == 0) { - ((LivingEntity)passenger).addStatusEffect(new StatusEffectInstance(StatusEffects.WITHER, 20, 1)); - } + if (passenger instanceof LivingEntity) { + if (player.hasStatusEffect(StatusEffects.NAUSEA)) { + ((LivingEntity)passenger).addStatusEffect(player.removeStatusEffectInternal(StatusEffects.NAUSEA)); + } else if (random.nextInt(2300) == 0) { + ((LivingEntity)passenger).addStatusEffect(new StatusEffectInstance(StatusEffects.WITHER, 20, 1)); } - - if (passenger instanceof PlayerEntity) { - if (!player.hasStatusEffect(StatusEffects.HEALTH_BOOST)) { - player.addStatusEffect(new StatusEffectInstance(StatusEffects.HEALTH_BOOST, 13000, 1)); - } - } - - passenger.damage(d, 5); - - if (player.canConsume(false)) { - player.getHungerManager().add(5, 0); - } else { - player.heal(5); - } - - return ActionResult.SUCCESS; } + + if (passenger instanceof PlayerEntity) { + if (!player.hasStatusEffect(StatusEffects.HEALTH_BOOST)) { + player.addStatusEffect(new StatusEffectInstance(StatusEffects.HEALTH_BOOST, 13000, 1)); + } + } + + passenger.damage(d, 5); + + if (player.canConsume(false)) { + player.getHungerManager().add(5, 0); + } else { + player.heal(5); + } + + return ActionResult.SUCCESS; } } @@ -196,7 +202,7 @@ public class CuccoonEntity extends LivingEntity implements IMagicals, InAnimate @Override public boolean isAttackable() { - return false; + return true; } public boolean attemptDismount(Entity captive) { @@ -284,7 +290,7 @@ public class CuccoonEntity extends LivingEntity implements IMagicals, InAnimate @Override public Iterable getArmorItems() { - return armour; + return Collections.emptyList(); } @Override diff --git a/src/main/resources/assets/unicopia/lang/en_us.json b/src/main/resources/assets/unicopia/lang/en_us.json index b45899ff..19cd7e48 100644 --- a/src/main/resources/assets/unicopia/lang/en_us.json +++ b/src/main/resources/assets/unicopia/lang/en_us.json @@ -165,13 +165,14 @@ "curse.siphon": "Siphoning", "curse.siphon.tagline": "Energy III", - "entity.racing_cloud.name": "Bucking Bronco", - "entity.construction_cloud.name": "Construction Cloud", - "entity.cloud.name": "Cloud", - "entity.spell.name": "Magic", - "entity.spellbook.name": "Spellbook", - "entity.butterfly.name": "Butterfly", - "entity.spear.name": "Spear", + "entity.unicopia.racing_cloud": "Bucking Bronco", + "entity.unicopia.construction_cloud": "Construction Cloud", + "entity.unicopia.cloud": "Cloud", + "entity.unicopia.spell": "Magic", + "entity.unicopia.spellbook": "Spellbook", + "entity.unicopia.butterfly": "Butterfly", + "entity.unicopia.spear": "Spear", + "entity.unicopia.cuccoon": "Cuccoon", "toxicity.safe.name": "Safe", "toxicity.mild.name": "Mildly Toxic",