fixed entity being rendered too high for cluster tnt / dynamite & implemented method to get tnt's fuse that was given at init time

This commit is contained in:
Jenny 2025-01-25 21:42:15 +01:00
parent 94133e167a
commit 3587ccbc8a
Signed by: Jenny
GPG Key ID: 4A98012FB1C39311
5 changed files with 17 additions and 6 deletions

View File

@ -38,7 +38,7 @@ mod_name=Enhanced Explosives
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
mod_license=All Rights Reserved
# The mod version. See https://semver.org/
mod_version=0.8.1
mod_version=0.8.2
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
# This should match the base package used for the mod sources.
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html

View File

@ -33,6 +33,7 @@ public class baseArrow extends AbstractArrow {
private Potion potion = Potions.EMPTY;
private final Set<MobEffectInstance> effects = Sets.newHashSet();
private boolean fixedColor;
private int tick = 0;
public baseArrow(EntityType<? extends baseArrow> pEntityType, Level pLevel) {
super(pEntityType, pLevel);
@ -105,13 +106,13 @@ public class baseArrow extends AbstractArrow {
} else {
this.makeParticle(2);
}
this.tick++;
} else if (this.inGround && this.inGroundTime != 0 && !this.effects.isEmpty() && this.inGroundTime >= 600) {
this.level().broadcastEntityEvent(this, (byte)0);
this.potion = Potions.EMPTY;
this.effects.clear();
this.entityData.set(ID_EFFECT_COLOR, -1);
}
}
private void makeParticle(int pParticleAmount) {
@ -232,4 +233,8 @@ public class baseArrow extends AbstractArrow {
public void spawnParticles() {
}
public int getTick() {
return this.tick;
}
}

View File

@ -19,7 +19,6 @@ import org.jetbrains.annotations.NotNull;
public class TNTArrowRenderer extends EntityRenderer<baseArrow> {
private final boolean renderParticles = ConfigClient.ARROW_PARTICLES;
private final BlockRenderDispatcher blockRenderer;
private float i = 0;
public TNTArrowRenderer(EntityRendererProvider.Context pContext) {
super(pContext);
@ -31,14 +30,14 @@ public class TNTArrowRenderer extends EntityRenderer<baseArrow> {
pPoseStack.pushPose();
pPoseStack.translate(0.0F, 0.5F, 0.0F);
pPoseStack.scale(0.5f, 0.5f, 0.5f);
i += 0.1f;
int i = pEntity.getTick();
pPoseStack.mulPose(Axis.YP.rotationDegrees(-90.0F));
pPoseStack.translate(-0.5F, -0.5F, 0.5F);
pPoseStack.mulPose(Axis.YP.rotationDegrees(90.0F));
if (renderParticles) {
pEntity.spawnParticles();
}
TntMinecartRenderer.renderWhiteSolidBlock(this.blockRenderer, Blocks.TNT.defaultBlockState(), pPoseStack, pBuffer, pPackedLight, Math.round(Math.sin(i)) == 0);
TntMinecartRenderer.renderWhiteSolidBlock(this.blockRenderer, Blocks.TNT.defaultBlockState(), pPoseStack, pBuffer, pPackedLight, i / 5 % 2 == 0);
pPoseStack.popPose();
super.render(pEntity, pEntityYaw, pPartialTicks, pPoseStack, pBuffer, pPackedLight);
}

View File

@ -39,7 +39,7 @@ public class clusterTNTRenderer extends EntityRenderer<basePrimedTNT> {
}
pPoseStack.mulPose(Axis.YP.rotationDegrees(-90.0F));
pPoseStack.translate(-0.5F, -0.5F, 0.5F);
pPoseStack.translate(-0.5F, -1.0F, 0.5F);
pPoseStack.mulPose(Axis.YP.rotationDegrees(90.0F));
TntMinecartRenderer.renderWhiteSolidBlock(this.blockRenderer, pEntity.renderBlock().defaultBlockState(), pPoseStack, pBuffer, pPackedLight, i / 5 % 2 == 0);
pPoseStack.popPose();

View File

@ -20,10 +20,12 @@ public abstract class basePrimedTNT extends Entity implements TraceableEntity {
@Nullable
private LivingEntity owner;
private int fuse = 0;
public basePrimedTNT(EntityType<? extends basePrimedTNT> pEntityType, Level pLevel, @Nullable LivingEntity owner) {
super(pEntityType, pLevel);
commonInit(pLevel, owner);
this.fuse = getFuse();
}
private void commonInit(Level pLevel, @Nullable LivingEntity owner) {
@ -39,6 +41,7 @@ public abstract class basePrimedTNT extends Entity implements TraceableEntity {
setPos(pos);
setFuse(fuse);
setPower(power);
this.fuse = getFuse();
}
protected void explode() {
@ -127,4 +130,8 @@ public abstract class basePrimedTNT extends Entity implements TraceableEntity {
public Block renderBlock() {
return Blocks.GLASS;
}
public int defaultFuse() {
return this.fuse;
}
}