added dynamite (missing textures)

This commit is contained in:
Jenny committed 2025-01-24 23:14:27 +01:00
1 parent 8ed0394fdd
commit 0e4fa52f88
7 files changed
+132 -6

No files matched your search

@@ -1,6 +1,6 @@
package com.jenny.compressedtnt.entities.client;
import com.jenny.compressedtnt.entities.tnt.ClusterPrimedTNT;
import com.jenny.compressedtnt.entities.tnt.basePrimedTNT;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Axis;
import net.minecraft.client.renderer.MultiBufferSource;
@@ -14,7 +14,7 @@ import net.minecraft.util.Mth;
import net.minecraft.world.level.block.Blocks;
import org.jetbrains.annotations.NotNull;
public class clusterTNTRenderer extends EntityRenderer<ClusterPrimedTNT> {
public class clusterTNTRenderer extends EntityRenderer<basePrimedTNT> {
private final BlockRenderDispatcher blockRenderer;
public clusterTNTRenderer(EntityRendererProvider.Context pContext) {
@@ -23,7 +23,7 @@ public class clusterTNTRenderer extends EntityRenderer<ClusterPrimedTNT> {
this.blockRenderer = pContext.getBlockRenderDispatcher();
}
public void render(ClusterPrimedTNT pEntity, float pEntityYaw, float pPartialTicks, PoseStack pPoseStack, @NotNull MultiBufferSource pBuffer, int pPackedLight) {
public void render(basePrimedTNT pEntity, float pEntityYaw, float pPartialTicks, PoseStack pPoseStack, @NotNull MultiBufferSource pBuffer, int pPackedLight) {
pPoseStack.pushPose();
pPoseStack.translate(0.0F, 0.5F, 0.0F);
int i = pEntity.getFuse();
@@ -47,7 +47,7 @@ public class clusterTNTRenderer extends EntityRenderer<ClusterPrimedTNT> {
super.render(pEntity, pEntityYaw, pPartialTicks, pPoseStack, pBuffer, pPackedLight);
}
public @NotNull ResourceLocation getTextureLocation(@NotNull ClusterPrimedTNT pEntity) {
public @NotNull ResourceLocation getTextureLocation(@NotNull basePrimedTNT pEntity) {
return TextureAtlas.LOCATION_BLOCKS;
}
}
@@ -4,6 +4,7 @@ import com.jenny.compressedtnt.entities.arrows.*;
import com.jenny.compressedtnt.entities.client.BaseTNTRenderer;
import com.jenny.compressedtnt.entities.client.TNTArrowRenderer;
import com.jenny.compressedtnt.entities.client.clusterTNTRenderer;
import com.jenny.compressedtnt.entities.throwable.dynamite;
import com.jenny.compressedtnt.entities.tnt.*;
import net.minecraft.client.renderer.entity.EntityRenderers;
@@ -52,6 +53,10 @@ public class entities {
ENTITY_TYPES.register("arrow_carpet", () -> EntityType.Builder.<carpetArrow>of(carpetArrow::new, MobCategory.MISC)
.sized(0.48F, 0.48F).clientTrackingRange(64).build("arrow_carpet"));
public static final RegistryObject<EntityType<dynamite>> DYNAMITE =
ENTITY_TYPES.register("dynamite", () -> EntityType.Builder.<dynamite>of(dynamite::new, MobCategory.MISC)
.sized(0.48F, 0.48F).clientTrackingRange(64).build("dynamite"));
public static void register(IEventBus eventBus) {
ENTITY_TYPES.register(eventBus);
}
@@ -66,5 +71,7 @@ public class entities {
EntityRenderers.register(ARROW_TNT.get(), TNTArrowRenderer::new);
EntityRenderers.register(ARROW_CONCUSSIVE.get(), TNTArrowRenderer::new);
EntityRenderers.register(ARROW_CARPET.get(), TNTArrowRenderer::new);
EntityRenderers.register(DYNAMITE.get(), clusterTNTRenderer::new);
}
}
@@ -0,0 +1,62 @@
package com.jenny.compressedtnt.entities.throwable;
import com.jenny.compressedtnt.entities.entities;
import com.jenny.compressedtnt.entities.tnt.basePrimedTNT;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.util.Mth;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.MoverType;
import net.minecraft.world.level.Level;
import net.minecraft.world.phys.Vec3;
import javax.annotation.Nullable;
public class dynamite extends basePrimedTNT {
public dynamite (Level pLevel, double pX, double pY, double pZ, @Nullable LivingEntity pOwner, float power, int fuse) {
super(entities.DYNAMITE.get(), pLevel, pOwner, new Vec3(pX, pY, pZ), fuse, power, "dynamite");
}
public dynamite(EntityType<dynamite> entityType, Level level) {
super(entityType, level, null);
this.setRenderID("dynamite");
}
@Override
public void tick() {
if (!this.isNoGravity()) {
this.setDeltaMovement(this.getDeltaMovement().add(0.0D, -0.04D, 0.0D));
}
Vec3 beforeMove = getDeltaMovement();
this.move(MoverType.SELF, this.getDeltaMovement());
this.setDeltaMovement(this.getDeltaMovement().scale(0.98D));
if (this.onGround()) {
this.setDeltaMovement(this.getDeltaMovement().multiply(0.7D, 0, 0.7D).add(0, (-beforeMove.y) * 0.5, 0));
}
int i = this.getFuse() - 1;
this.setFuse(i);
if (i <= 0) {
this.discard();
if (!this.level().isClientSide) {
this.explode();
}
} else {
this.updateInWaterStateAndDoFluidPushing();
if (this.level().isClientSide) {
this.level().addParticle(ParticleTypes.SMOKE, this.getX(), this.getY() + 0.5D, this.getZ(), 0.0D, 0.0D, 0.0D);
}
}
}
public void shootFromRotation(Entity pShooter, float pX, float pY, float pZ, float pVelocity) {
float f = -Mth.sin(pY * ((float)Math.PI / 180F)) * Mth.cos(pX * ((float)Math.PI / 180F));
float f1 = -Mth.sin((pX + pZ) * ((float)Math.PI / 180F));
float f2 = Mth.cos(pY * ((float)Math.PI / 180F)) * Mth.cos(pX * ((float)Math.PI / 180F));
Vec3 vec = new Vec3(f, f1, f2).multiply(pVelocity, pVelocity, pVelocity);
this.setDeltaMovement(vec);
Vec3 vec3 = pShooter.getDeltaMovement();
this.setDeltaMovement(this.getDeltaMovement().add(vec3.x, pShooter.onGround() ? 0.0D : vec3.y, vec3.z));
}
}