homing tnt texture & homing tnt particle change & moved tnt/arrow particle spawning into tick() logic

This commit is contained in:
Jenny 2025-01-27 19:05:37 +01:00
parent 66c79bf74e
commit cc21d6b935
Signed by: Jenny
GPG Key ID: 2072A14E40940632
10 changed files with 27 additions and 20 deletions

View File

@ -17,7 +17,7 @@ public class blocks {
public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, MODID);
public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, MODID);
public static final RegistryObject<strongerTNTBlock> TNT_8 = BLOCKS.register("tnt_8", () -> new strongerTNTBlock(BlockBehaviour.Properties.of().mapColor(MapColor.STONE), 8.0f, 80));
public static final RegistryObject<Block> TNT_8 = BLOCKS.register("tnt_8", () -> new strongerTNTBlock(BlockBehaviour.Properties.of().mapColor(MapColor.STONE), 8.0f, 80));
public static final RegistryObject<Item> TNT_8_ITEM = ITEMS.register("tnt_8", () -> new BlockItemTooltip(TNT_8.get(), new Item.Properties()));
public static final RegistryObject<Block> TNT_16 = BLOCKS.register("tnt_16", () -> new strongerTNTBlock(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_RED), 16.0f, 80));

View File

@ -21,13 +21,14 @@ public class ModBlockStateProvider extends BlockStateProvider {
@Override
protected void registerStatesAndModels() {
sideTopBottom(blocks.TNT_8.get());
sideTopBottom(blocks.TNT_16.get());
sideTopBottom(blocks.TNT_32.get());
sideTopBottom(blocks.TNT_64.get());
sideTopBottom(blocks.TNT_128.get());
sideTopBottom(blocks.TNT_ENDER.get());
sideTopBottom(blocks.TNT_CLAYMORE.get());
sideTopBottom(blocks.TNT_8);
sideTopBottom(blocks.TNT_16);
sideTopBottom(blocks.TNT_32);
sideTopBottom(blocks.TNT_64);
sideTopBottom(blocks.TNT_128);
sideTopBottom(blocks.TNT_ENDER);
sideTopBottom(blocks.TNT_CLAYMORE);
sideTopBottom(blocks.TNT_HOMING);
blockWithItem(blocks.TNT_BLACK_HOLE);
}
@ -60,7 +61,8 @@ public class ModBlockStateProvider extends BlockStateProvider {
return new ResourceLocation(rl.getNamespace(), rl.getPath() + suffix);
}
public void sideTopBottom(Block block) {
public void sideTopBottom(RegistryObject<Block> blockRegistryObject) {
Block block = blockRegistryObject.get();
ModelFile model = models().cubeBottomTop(name(block), extend(blockTexture(block), "_side"), extend(blockTexture(block), "_bottom"), extend(blockTexture(block), "_top"));
this.getVariantBuilder(block).forAllStates(blockState -> ConfiguredModel.builder().modelFile(model).build());
simpleBlockItem(block, model);

View File

@ -104,7 +104,7 @@ public class baseArrow extends AbstractArrow {
this.makeParticle(1);
}
} else {
this.makeParticle(2);
spawnParticles(0);
}
this.tick++;
} else if (this.inGround && this.inGroundTime != 0 && !this.effects.isEmpty() && this.inGroundTime >= 600) {

View File

@ -35,10 +35,6 @@ public class BaseTNTRenderer<T extends basePrimedTNT> extends EntityRenderer<T>
float f1 = 1.0F + f * 0.3F;
pPoseStack.scale(f1, f1, f1);
}
if (ConfigClient.tntParticles) {
pEntity.spawnParticles(pPartialTicks);
}
pEntity.spawnParticles(pPartialTicks);
pPoseStack.mulPose(Axis.YP.rotationDegrees(-90.0F));
pPoseStack.translate(-0.5F, -0.5F, 0.5F);
pPoseStack.mulPose(Axis.YP.rotationDegrees(90.0F));

View File

@ -17,7 +17,6 @@ import net.minecraft.world.level.block.Blocks;
import org.jetbrains.annotations.NotNull;
public class TNTArrowRenderer extends EntityRenderer<baseArrow> {
private final boolean renderParticles = ConfigClient.arrowParticles;
private final BlockRenderDispatcher blockRenderer;
public TNTArrowRenderer(EntityRendererProvider.Context pContext) {
@ -27,6 +26,7 @@ public class TNTArrowRenderer extends EntityRenderer<baseArrow> {
}
public void render(@NotNull baseArrow pEntity, float pEntityYaw, float pPartialTicks, PoseStack pPoseStack, @NotNull MultiBufferSource pBuffer, int pPackedLight) {
pPoseStack.pushPose();
pPoseStack.translate(0.0F, 0.5F, 0.0F);
pPoseStack.scale(0.5f, 0.5f, 0.5f);
@ -34,9 +34,6 @@ public class TNTArrowRenderer extends EntityRenderer<baseArrow> {
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(pPartialTicks);
}
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

@ -65,6 +65,9 @@ public abstract class basePrimedTNT extends Entity implements TraceableEntity {
}
public void tick() {
if (level().isClientSide) {
spawnParticles(0);
}
if (!this.isNoGravity()) {
this.setDeltaMovement(this.getDeltaMovement().add(0.0D, -0.04D, 0.0D));
}

View File

@ -1,8 +1,10 @@
package com.jenny.enhancedexplosives.entities.tnt;
import com.jenny.enhancedexplosives.blocks.blocks;
import com.jenny.enhancedexplosives.entities.entities;
import com.jenny.enhancedexplosives.config.ConfigClient;
import net.minecraft.core.BlockPos;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.syncher.EntityDataAccessor;
@ -11,6 +13,7 @@ import net.minecraft.network.syncher.SynchedEntityData;
import net.minecraft.world.entity.*;
import net.minecraft.world.entity.ai.targeting.TargetingConditions;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.Vec3;
@ -94,8 +97,14 @@ public class homingPrimedTNT extends basePrimedTNT {
@Override
public void spawnParticles(float partialTicks) {
for (int i = 1; i <= ConfigClient.calcPCount(30); i++) {
level().addParticle(ParticleTypes.FALLING_OBSIDIAN_TEAR, getX(), getY(), getZ(), this.getDeltaMovement().x, this.getDeltaMovement().y, this.getDeltaMovement().z);
Vec3 pos = getPosition(partialTicks);
for (int i = 1; i <= ConfigClient.calcPCount(1); i++) {
level().addParticle(ParticleTypes.FLAME, pos.x, pos.y, pos.z, 0, 0, 0);
}
}
@Override
public Block renderBlock() {
return blocks.TNT_HOMING.get();
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 250 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 248 B