From f91e44e8465be20dc3b03a0b7085089172ad7c71 Mon Sep 17 00:00:00 2001 From: Jenny Date: Sat, 14 Jun 2025 14:08:01 +0200 Subject: [PATCH] change map color & entity size of TNTs for vanilla parity --- gradle.properties | 2 +- .../enhancedexplosives/blocks/blocks.java | 32 ++++++++++--------- .../enhancedexplosives/entities/entities.java | 17 +++++----- .../entities/tnt/basePrimedTNT.java | 16 +++++----- 4 files changed, 34 insertions(+), 33 deletions(-) diff --git a/gradle.properties b/gradle.properties index 3639828..bed4c3b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -11,7 +11,7 @@ mapping_version=2023.12.31-1.20.3 mod_id=enhancedexplosives mod_name=Enhanced Explosives mod_license=All Rights Reserved -mod_version=0.13.2 +mod_version=0.14.0 mod_group_id=com.jenny mod_authors=Jenny mod_description=strong & throwable explosives diff --git a/src/main/java/com/jenny/enhancedexplosives/blocks/blocks.java b/src/main/java/com/jenny/enhancedexplosives/blocks/blocks.java index 925699c..9757268 100644 --- a/src/main/java/com/jenny/enhancedexplosives/blocks/blocks.java +++ b/src/main/java/com/jenny/enhancedexplosives/blocks/blocks.java @@ -1,9 +1,9 @@ package com.jenny.enhancedexplosives.blocks; import com.jenny.enhancedexplosives.items.BlockItemTooltip; - import net.minecraft.world.item.Item; import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.SoundType; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.material.MapColor; import net.minecraftforge.eventbus.api.IEventBus; @@ -14,49 +14,51 @@ import net.minecraftforge.registries.RegistryObject; import static com.jenny.enhancedexplosives.EnhancedExplosives.MODID; public class blocks { + private static final BlockBehaviour.Properties DEFAULT_PROPS = BlockBehaviour.Properties.of().mapColor(MapColor.FIRE).instabreak().sound(SoundType.GRASS).ignitedByLava(); + public static final DeferredRegister BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, MODID); public static final DeferredRegister ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, MODID); - public static final RegistryObject TNT_8 = BLOCKS.register("tnt_8", () -> new strongerTNTBlock(BlockBehaviour.Properties.of().mapColor(MapColor.STONE), 8.0f, 80)); + public static final RegistryObject TNT_8 = BLOCKS.register("tnt_8", () -> new strongerTNTBlock(DEFAULT_PROPS, 8.0f, 80)); public static final RegistryObject TNT_8_ITEM = ITEMS.register("tnt_8", () -> new BlockItemTooltip(TNT_8.get(), new Item.Properties())); - public static final RegistryObject TNT_16 = BLOCKS.register("tnt_16", () -> new strongerTNTBlock(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_RED), 16.0f, 80)); + public static final RegistryObject TNT_16 = BLOCKS.register("tnt_16", () -> new strongerTNTBlock(DEFAULT_PROPS, 16.0f, 80)); public static final RegistryObject TNT_16_ITEM = ITEMS.register("tnt_16", () -> new BlockItemTooltip(TNT_16.get(), new Item.Properties())); - public static final RegistryObject TNT_32 = BLOCKS.register("tnt_32", () -> new strongerTNTBlock(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_RED), 32.0f, 80)); + public static final RegistryObject TNT_32 = BLOCKS.register("tnt_32", () -> new strongerTNTBlock(DEFAULT_PROPS, 32.0f, 80)); public static final RegistryObject TNT_32_ITEM = ITEMS.register("tnt_32", () -> new BlockItemTooltip(TNT_32.get(), new Item.Properties())); - public static final RegistryObject TNT_64 = BLOCKS.register("tnt_64", () -> new strongerTNTBlock(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_RED), 64.0f, 80)); + public static final RegistryObject TNT_64 = BLOCKS.register("tnt_64", () -> new strongerTNTBlock(DEFAULT_PROPS, 64.0f, 80)); public static final RegistryObject TNT_64_ITEM = ITEMS.register("tnt_64", () -> new BlockItemTooltip(TNT_64.get(), new Item.Properties())); - public static final RegistryObject TNT_128 = BLOCKS.register("tnt_128", () -> new strongerTNTBlock(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_RED), 128.0f, 80)); + public static final RegistryObject TNT_128 = BLOCKS.register("tnt_128", () -> new strongerTNTBlock(DEFAULT_PROPS, 128.0f, 80)); public static final RegistryObject TNT_128_ITEM = ITEMS.register("tnt_128", () -> new BlockItemTooltip(TNT_128.get(), new Item.Properties())); - public static final RegistryObject TNT_CLUSTER_2 = BLOCKS.register("tnt_cluster_2", () -> new ClusterTNTBlock(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_RED), 4.0f, 80, 2, 10)); + public static final RegistryObject TNT_CLUSTER_2 = BLOCKS.register("tnt_cluster_2", () -> new ClusterTNTBlock(DEFAULT_PROPS, 4.0f, 80, 2, 10)); public static final RegistryObject TNT_CLUSTER_2_ITEM = ITEMS.register("tnt_cluster_2", () -> new BlockItemTooltip(TNT_CLUSTER_2.get(), new Item.Properties())); - public static final RegistryObject TNT_CLUSTER_4 = BLOCKS.register("tnt_cluster_4", () -> new ClusterTNTBlock(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_RED), 4.0f, 80, 4, 10)); + public static final RegistryObject TNT_CLUSTER_4 = BLOCKS.register("tnt_cluster_4", () -> new ClusterTNTBlock(DEFAULT_PROPS, 4.0f, 80, 4, 10)); public static final RegistryObject TNT_CLUSTER_4_ITEM = ITEMS.register("tnt_cluster_4", () -> new BlockItemTooltip(TNT_CLUSTER_4.get(), new Item.Properties())); - public static final RegistryObject TNT_CLUSTER_8 = BLOCKS.register("tnt_cluster_8", () -> new ClusterTNTBlock(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_RED), 4.0f, 80, 8, 10)); + public static final RegistryObject TNT_CLUSTER_8 = BLOCKS.register("tnt_cluster_8", () -> new ClusterTNTBlock(DEFAULT_PROPS, 4.0f, 80, 8, 10)); public static final RegistryObject TNT_CLUSTER_8_ITEM = ITEMS.register("tnt_cluster_8", () -> new BlockItemTooltip(TNT_CLUSTER_8.get(), new Item.Properties())); - public static final RegistryObject TNT_HOMING = BLOCKS.register("tnt_homing", () -> new homingTNTBlock(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_RED), 4.0f, 80, 1)); + public static final RegistryObject TNT_HOMING = BLOCKS.register("tnt_homing", () -> new homingTNTBlock(DEFAULT_PROPS, 4.0f, 80, 1)); public static final RegistryObject TNT_HOMING_ITEM = ITEMS.register("tnt_homing", () -> new BlockItemTooltip(TNT_HOMING.get(), new Item.Properties())); - public static final RegistryObject TNT_BLACK_HOLE = BLOCKS.register("tnt_black_hole", () -> new blackHoleTNTBlock(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_RED), 4.0f, 80, 1)); + public static final RegistryObject TNT_BLACK_HOLE = BLOCKS.register("tnt_black_hole", () -> new blackHoleTNTBlock(DEFAULT_PROPS, 4.0f, 80, 1)); public static final RegistryObject TNT_BLACK_HOLE_ITEM = ITEMS.register("tnt_black_hole", () -> new BlockItemTooltip(TNT_BLACK_HOLE.get(), new Item.Properties())); - public static final RegistryObject TNT_CLAYMORE = BLOCKS.register("tnt_claymore", () -> new claymoreTNTBlock(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_RED), 2.0f, 20, 256)); + public static final RegistryObject TNT_CLAYMORE = BLOCKS.register("tnt_claymore", () -> new claymoreTNTBlock(DEFAULT_PROPS, 2.0f, 20, 256)); public static final RegistryObject TNT_CLAYMORE_ITEM = ITEMS.register("tnt_claymore", () -> new BlockItemTooltip(TNT_CLAYMORE.get(), new Item.Properties())); - public static final RegistryObject TNT_SELECTIVE = BLOCKS.register("tnt_selective", () -> new selectiveTNTBlock(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_RED), 32.0f, 80)); + public static final RegistryObject TNT_SELECTIVE = BLOCKS.register("tnt_selective", () -> new selectiveTNTBlock(DEFAULT_PROPS, 32.0f, 80)); public static final RegistryObject TNT_SELECTIVE_ITEM = ITEMS.register("tnt_selective", () -> new BlockItemTooltip(TNT_SELECTIVE.get(), new Item.Properties())); - public static final RegistryObject TNT_ENDER = BLOCKS.register("tnt_ender", () -> new enderTNTBlock(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_RED), 4.0f, 80)); + public static final RegistryObject TNT_ENDER = BLOCKS.register("tnt_ender", () -> new enderTNTBlock(DEFAULT_PROPS, 4.0f, 80)); public static final RegistryObject TNT_ENDER_ITEM = ITEMS.register("tnt_ender", () -> new BlockItemTooltip(TNT_ENDER.get(), new Item.Properties())); - public static final RegistryObject TNT_REPULSIVE = BLOCKS.register("tnt_repulsive", () -> new repulsiveTNTBlock(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_RED), 4.0f, 80, 1)); + public static final RegistryObject TNT_REPULSIVE = BLOCKS.register("tnt_repulsive", () -> new repulsiveTNTBlock(DEFAULT_PROPS, 4.0f, 80, 1)); public static final RegistryObject TNT_REPULSIVE_ITEM = ITEMS.register("tnt_repulsive", () -> new BlockItemTooltip(TNT_REPULSIVE.get(), new Item.Properties())); diff --git a/src/main/java/com/jenny/enhancedexplosives/entities/entities.java b/src/main/java/com/jenny/enhancedexplosives/entities/entities.java index efe9d62..a4a10f6 100644 --- a/src/main/java/com/jenny/enhancedexplosives/entities/entities.java +++ b/src/main/java/com/jenny/enhancedexplosives/entities/entities.java @@ -4,7 +4,6 @@ import com.jenny.enhancedexplosives.entities.arrows.*; import com.jenny.enhancedexplosives.entities.client.*; import com.jenny.enhancedexplosives.entities.throwable.dynamite; import com.jenny.enhancedexplosives.entities.tnt.*; - import net.minecraft.client.renderer.entity.EntityRenderers; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.MobCategory; @@ -21,35 +20,35 @@ public class entities { public static final RegistryObject> TNT_HOMING = ENTITY_TYPES.register("tnt_homing", () -> EntityType.Builder.of(homingPrimedTNT::new, MobCategory.MISC) - .sized(0.98F, 0.7F).fireImmune().clientTrackingRange(8).build("tnt_homing")); + .fireImmune().sized(0.98F, 0.98F).clientTrackingRange(10).updateInterval(10).build("tnt_homing")); public static final RegistryObject> TNT_STRONGER = ENTITY_TYPES.register("tnt_stronger", () -> EntityType.Builder.of(StrongerPrimedTNT::new, MobCategory.MISC) - .sized(0.98F, 0.7F).fireImmune().clientTrackingRange(8).build("tnt_stronger")); + .fireImmune().sized(0.98F, 0.98F).clientTrackingRange(10).updateInterval(10).build("tnt_stronger")); public static final RegistryObject> TNT_CLUSTER = ENTITY_TYPES.register("tnt_cluster", () -> EntityType.Builder.of(ClusterPrimedTNT::new, MobCategory.MISC) - .sized(0.48F, 0.48F).fireImmune().clientTrackingRange(8).build("tnt_cluster")); + .sized(0.48F, 0.48F).fireImmune().clientTrackingRange(10).updateInterval(10).build("tnt_cluster")); public static final RegistryObject> TNT_BLACK_HOLE = ENTITY_TYPES.register("tnt_blackhole", () -> EntityType.Builder.of(blackHolePrimedTNT::new, MobCategory.MISC) - .sized(0.98F, 0.7F).fireImmune().clientTrackingRange(8).build("tnt_blackhole")); + .fireImmune().sized(0.98F, 0.98F).clientTrackingRange(10).updateInterval(10).build("tnt_blackhole")); public static final RegistryObject> TNT_SELECTIVE = ENTITY_TYPES.register("tnt_selective", () -> EntityType.Builder.of(selectivePrimedTNT::new, MobCategory.MISC) - .sized(0.98F, 0.7F).fireImmune().clientTrackingRange(8).build("tnt_selective")); + .fireImmune().sized(0.98F, 0.98F).clientTrackingRange(10).updateInterval(10).build("tnt_selective")); public static final RegistryObject> TNT_CLAYMORE = ENTITY_TYPES.register("tnt_claymore", () -> EntityType.Builder.of(claymorePrimedTNT::new, MobCategory.MISC) - .sized(0.98F, 0.7F).fireImmune().clientTrackingRange(8).build("tnt_claymore")); + .fireImmune().sized(0.98F, 0.98F).clientTrackingRange(10).updateInterval(10).build("tnt_claymore")); public static final RegistryObject> TNT_ENDER = ENTITY_TYPES.register("tnt_ender", () -> EntityType.Builder.of(enderPrimedTNT::new, MobCategory.MISC) - .sized(0.98F, 0.7F).fireImmune().clientTrackingRange(8).build("tnt_ender")); + .fireImmune().sized(0.98F, 0.98F).clientTrackingRange(10).updateInterval(10).build("tnt_ender")); public static final RegistryObject> TNT_REPULSIVE = ENTITY_TYPES.register("tnt_repulsive", () -> EntityType.Builder.of(repulsivePrimedTNT::new, MobCategory.MISC) - .sized(0.98F, 0.7F).fireImmune().clientTrackingRange(8).build("tnt_repulsive")); + .fireImmune().sized(0.98F, 0.98F).clientTrackingRange(10).updateInterval(10).build("tnt_repulsive")); public static final RegistryObject> ARROW_TNT = ENTITY_TYPES.register("arrow_tnt", () -> EntityType.Builder.of(tntArrow::new, MobCategory.MISC) diff --git a/src/main/java/com/jenny/enhancedexplosives/entities/tnt/basePrimedTNT.java b/src/main/java/com/jenny/enhancedexplosives/entities/tnt/basePrimedTNT.java index 8821faa..6870fab 100644 --- a/src/main/java/com/jenny/enhancedexplosives/entities/tnt/basePrimedTNT.java +++ b/src/main/java/com/jenny/enhancedexplosives/entities/tnt/basePrimedTNT.java @@ -25,20 +25,20 @@ public abstract class basePrimedTNT extends Entity implements TraceableEntity { public basePrimedTNT(EntityType pEntityType, @NotNull Level pLevel, @Nullable LivingEntity owner) { super(pEntityType, pLevel); - commonInit(pLevel, owner); - this.fuse = getFuse(); - } - - private void commonInit(@NotNull Level pLevel, @Nullable LivingEntity owner) { - double d0 = pLevel.random.nextDouble() * (double)((float)Math.PI * 2F); - this.setDeltaMovement(-Math.sin(d0) * 0.02D, (double)0.2F, -Math.cos(d0) * 0.02D); this.blocksBuilding = true; this.setOwner(owner); + this.fuse = getFuse(); } public basePrimedTNT(EntityType pEntityType, @NotNull Level pLevel, @Nullable LivingEntity owner, Vec3 pos, int fuse, float power) { super(pEntityType, pLevel); - commonInit(pLevel, owner); + this.blocksBuilding = true; + this.setOwner(owner); + double d0 = pLevel.random.nextDouble() * (double) ((float) Math.PI * 2F); + this.setDeltaMovement(-Math.sin(d0) * 0.02D, (double) 0.2F, -Math.cos(d0) * 0.02D); + xo = pos.x; + yo = pos.y; + zo = pos.z; setPos(pos); setFuse(fuse); setPower(power);