Author SHA1 Message Date
Jenny 86e640ab32 0.15.0 2025-08-17 11:39:19 +02:00
Jenny 958364907d change map color & entity size of TNTs for vanilla parity 2025-06-14 14:11:28 +02:00
Jenny 45937ee33d 1.20.6 port 2025-02-12 16:47:18 +01:00
Jenny dc81f5e8da 1.20.3 port 2025-02-12 14:07:21 +01:00
76 changed files with 377 additions and 693 deletions

No files matched your search

+9 -9
View File
@@ -14,7 +14,7 @@ base {
} }
java { java {
toolchain.languageVersion = JavaLanguageVersion.of(17) toolchain.languageVersion = JavaLanguageVersion.of(21)
} }
minecraft { minecraft {
@@ -77,12 +77,6 @@ minecraft {
// You can set various levels here. // You can set various levels here.
// Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
property 'forge.logging.console.level', 'debug' property 'forge.logging.console.level', 'debug'
mods {
"${mod_id}" {
source sourceSets.main
}
}
} }
client { client {
@@ -136,8 +130,8 @@ repositories {
dependencies { dependencies {
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}" minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
implementation fg.deobf("curse.maven:guidebook-253874:3904597")
implementation fg.deobf("curse.maven:patchouli-306770:3936481") implementation('net.sf.jopt-simple:jopt-simple:5.0.4') { version { strictly '5.0.4' } }
} }
// This block of code expands all declared replace properties in the specified resource targets. // This block of code expands all declared replace properties in the specified resource targets.
@@ -177,3 +171,9 @@ tasks.named('jar', Jar).configure {
tasks.withType(JavaCompile).configureEach { tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
} }
sourceSets.each {
def dir = layout.buildDirectory.dir("sourcesSets/$it.name")
it.output.resourcesDir = dir
it.java.destinationDirectory = dir
}
+6 -6
View File
@@ -1,13 +1,13 @@
# CreateCoredumpOnCrash only works on jdk9+ # CreateCoredumpOnCrash only works on jdk9+
org.gradle.jvmargs=-Xmx3G -XX:-CreateCoredumpOnCrash org.gradle.jvmargs=-Xmx3G -XX:-CreateCoredumpOnCrash
org.gradle.daemon=false org.gradle.daemon=false
minecraft_version=1.19.2 minecraft_version=1.20.6
minecraft_version_range=[1.19.2] minecraft_version_range=[1.20.6]
forge_version=43.5.0 forge_version=50.1.0
forge_version_range=[43,) forge_version_range=[50,)
loader_version_range=[43,) loader_version_range=[50,)
mapping_channel=parchment mapping_channel=parchment
mapping_version=2022.11.27-1.19.2 mapping_version=2024.06.16-1.20.6
mod_id=enhancedexplosives mod_id=enhancedexplosives
mod_name=Enhanced Explosives mod_name=Enhanced Explosives
@@ -34,6 +34,7 @@ public class EnhancedExplosives {
particles.register(modEventBus); particles.register(modEventBus);
blocks.register(modEventBus); blocks.register(modEventBus);
items.register(modEventBus); items.register(modEventBus);
creativeTab.register(modEventBus);
entities.register(modEventBus); entities.register(modEventBus);
// Register ourselves for server and other game events we are interested in // Register ourselves for server and other game events we are interested in
@@ -67,7 +67,7 @@ public class ClusterTNTBlock extends TntBlock {
if (!level.isClientSide) { if (!level.isClientSide) {
for (int i = 0; i < childCount; i++) { for (int i = 0; i < childCount; i++) {
int ft = (short) (level.random.nextInt(fuseTime / 4) + fuseTime / 8); int ft = (short) (level.random.nextInt(fuseTime / 4) + fuseTime / 8);
ClusterPrimedTNT primedtnt = new ClusterPrimedTNT(level, (double) blockPos.getX() + (double) 0.5F, (double) blockPos.getY(), (double) blockPos.getZ() + (double) 0.5F, pExplosion.getSourceMob(), pRadius, ft, getMove(level, childRange)); ClusterPrimedTNT primedtnt = new ClusterPrimedTNT(level, (double) blockPos.getX() + (double) 0.5F, (double) blockPos.getY(), (double) blockPos.getZ() + (double) 0.5F, pExplosion.getIndirectSourceEntity(), pRadius, ft, getMove(level, childRange));
level.addFreshEntity(primedtnt); level.addFreshEntity(primedtnt);
} }
} }
@@ -52,7 +52,7 @@ public class bedrockTNTBlock extends TntBlock {
public void wasExploded(Level level, @NotNull BlockPos blockPos, @NotNull Explosion pExplosion) { public void wasExploded(Level level, @NotNull BlockPos blockPos, @NotNull Explosion pExplosion) {
if (!level.isClientSide) { if (!level.isClientSide) {
int ft = (short) (level.random.nextInt(fuseTime / 4) + fuseTime / 8); int ft = (short) (level.random.nextInt(fuseTime / 4) + fuseTime / 8);
bedrockPrimedTNT primedtnt = new bedrockPrimedTNT(level, (double) blockPos.getX() + (double) 0.5F, (double) blockPos.getY(), (double) blockPos.getZ() + (double) 0.5F, pExplosion.getSourceMob(), pRadius, ft); bedrockPrimedTNT primedtnt = new bedrockPrimedTNT(level, (double) blockPos.getX() + (double) 0.5F, (double) blockPos.getY(), (double) blockPos.getZ() + (double) 0.5F, pExplosion.getIndirectSourceEntity(), pRadius, ft);
level.addFreshEntity(primedtnt); level.addFreshEntity(primedtnt);
} }
} }
@@ -50,7 +50,7 @@ public class blackHoleTNTBlock extends TntBlock {
@Override @Override
public void wasExploded(Level level, @NotNull BlockPos blockPos, @NotNull Explosion pExplosion) { public void wasExploded(Level level, @NotNull BlockPos blockPos, @NotNull Explosion pExplosion) {
if (!level.isClientSide) { if (!level.isClientSide) {
blackHolePrimedTNT primedtnt = new blackHolePrimedTNT(level, (double) blockPos.getX() + (double) 0.5F, (double) blockPos.getY(), (double) blockPos.getZ() + (double) 0.5F, pExplosion.getSourceMob(), pRadius, fuseTime, speed); blackHolePrimedTNT primedtnt = new blackHolePrimedTNT(level, (double) blockPos.getX() + (double) 0.5F, (double) blockPos.getY(), (double) blockPos.getZ() + (double) 0.5F, pExplosion.getIndirectSourceEntity(), pRadius, fuseTime, speed);
int i = primedtnt.getFuse(); int i = primedtnt.getFuse();
primedtnt.setFuse((short) (level.random.nextInt(i / 4) + i / 8)); primedtnt.setFuse((short) (level.random.nextInt(i / 4) + i / 8));
level.addFreshEntity(primedtnt); level.addFreshEntity(primedtnt);
@@ -5,68 +5,67 @@ import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.SoundType; import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.material.Material; import net.minecraft.world.level.material.MapColor;
import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegistryObject; import net.minecraftforge.registries.RegistryObject;
import static com.jenny.enhancedexplosives.EnhancedExplosives.MODID; import static com.jenny.enhancedexplosives.EnhancedExplosives.MODID;
import static com.jenny.enhancedexplosives.creativeTab.CREATIVE_MODE_TAB;
public class blocks { public class blocks {
private static final BlockBehaviour.Properties DEFAULT_PROPS = BlockBehaviour.Properties.of(Material.EXPLOSIVE).instabreak().sound(SoundType.GRASS); private static final BlockBehaviour.Properties DEFAULT_PROPS = BlockBehaviour.Properties.of().mapColor(MapColor.FIRE).instabreak().sound(SoundType.GRASS).ignitedByLava();
public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, MODID); 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 DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, MODID);
public static final RegistryObject<Block> TNT_8 = BLOCKS.register("tnt_8", () -> new strongerTNTBlock(DEFAULT_PROPS, 8.0f, 80)); public static final RegistryObject<Block> TNT_8 = BLOCKS.register("tnt_8", () -> new strongerTNTBlock(DEFAULT_PROPS, 8.0f, 80));
public static final RegistryObject<Item> TNT_8_ITEM = ITEMS.register("tnt_8", () -> new BlockItemTooltip(TNT_8.get(), new Item.Properties().tab(CREATIVE_MODE_TAB))); 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(DEFAULT_PROPS, 16.0f, 80)); public static final RegistryObject<Block> TNT_16 = BLOCKS.register("tnt_16", () -> new strongerTNTBlock(DEFAULT_PROPS, 16.0f, 80));
public static final RegistryObject<Item> TNT_16_ITEM = ITEMS.register("tnt_16", () -> new BlockItemTooltip(TNT_16.get(), new Item.Properties().tab(CREATIVE_MODE_TAB))); public static final RegistryObject<Item> TNT_16_ITEM = ITEMS.register("tnt_16", () -> new BlockItemTooltip(TNT_16.get(), new Item.Properties()));
public static final RegistryObject<Block> TNT_32 = BLOCKS.register("tnt_32", () -> new strongerTNTBlock(DEFAULT_PROPS, 32.0f, 80)); public static final RegistryObject<Block> TNT_32 = BLOCKS.register("tnt_32", () -> new strongerTNTBlock(DEFAULT_PROPS, 32.0f, 80));
public static final RegistryObject<Item> TNT_32_ITEM = ITEMS.register("tnt_32", () -> new BlockItemTooltip(TNT_32.get(), new Item.Properties().tab(CREATIVE_MODE_TAB))); public static final RegistryObject<Item> TNT_32_ITEM = ITEMS.register("tnt_32", () -> new BlockItemTooltip(TNT_32.get(), new Item.Properties()));
public static final RegistryObject<Block> TNT_64 = BLOCKS.register("tnt_64", () -> new strongerTNTBlock(DEFAULT_PROPS, 64.0f, 80)); public static final RegistryObject<Block> TNT_64 = BLOCKS.register("tnt_64", () -> new strongerTNTBlock(DEFAULT_PROPS, 64.0f, 80));
public static final RegistryObject<Item> TNT_64_ITEM = ITEMS.register("tnt_64", () -> new BlockItemTooltip(TNT_64.get(), new Item.Properties().tab(CREATIVE_MODE_TAB))); public static final RegistryObject<Item> TNT_64_ITEM = ITEMS.register("tnt_64", () -> new BlockItemTooltip(TNT_64.get(), new Item.Properties()));
public static final RegistryObject<Block> TNT_128 = BLOCKS.register("tnt_128", () -> new strongerTNTBlock(DEFAULT_PROPS, 128.0f, 80)); public static final RegistryObject<Block> TNT_128 = BLOCKS.register("tnt_128", () -> new strongerTNTBlock(DEFAULT_PROPS, 128.0f, 80));
public static final RegistryObject<Item> TNT_128_ITEM = ITEMS.register("tnt_128", () -> new BlockItemTooltip(TNT_128.get(), new Item.Properties().tab(CREATIVE_MODE_TAB))); public static final RegistryObject<Item> TNT_128_ITEM = ITEMS.register("tnt_128", () -> new BlockItemTooltip(TNT_128.get(), new Item.Properties()));
public static final RegistryObject<Block> TNT_CLUSTER_2 = BLOCKS.register("tnt_cluster_2", () -> new ClusterTNTBlock(DEFAULT_PROPS, 4.0f, 80, 2, 10)); public static final RegistryObject<Block> TNT_CLUSTER_2 = BLOCKS.register("tnt_cluster_2", () -> new ClusterTNTBlock(DEFAULT_PROPS, 4.0f, 80, 2, 10));
public static final RegistryObject<Item> TNT_CLUSTER_2_ITEM = ITEMS.register("tnt_cluster_2", () -> new BlockItemTooltip(TNT_CLUSTER_2.get(), new Item.Properties().tab(CREATIVE_MODE_TAB))); public static final RegistryObject<Item> TNT_CLUSTER_2_ITEM = ITEMS.register("tnt_cluster_2", () -> new BlockItemTooltip(TNT_CLUSTER_2.get(), new Item.Properties()));
public static final RegistryObject<Block> TNT_CLUSTER_4 = BLOCKS.register("tnt_cluster_4", () -> new ClusterTNTBlock(DEFAULT_PROPS, 4.0f, 80, 4, 10)); public static final RegistryObject<Block> TNT_CLUSTER_4 = BLOCKS.register("tnt_cluster_4", () -> new ClusterTNTBlock(DEFAULT_PROPS, 4.0f, 80, 4, 10));
public static final RegistryObject<Item> TNT_CLUSTER_4_ITEM = ITEMS.register("tnt_cluster_4", () -> new BlockItemTooltip(TNT_CLUSTER_4.get(), new Item.Properties().tab(CREATIVE_MODE_TAB))); public static final RegistryObject<Item> TNT_CLUSTER_4_ITEM = ITEMS.register("tnt_cluster_4", () -> new BlockItemTooltip(TNT_CLUSTER_4.get(), new Item.Properties()));
public static final RegistryObject<Block> TNT_CLUSTER_8 = BLOCKS.register("tnt_cluster_8", () -> new ClusterTNTBlock(DEFAULT_PROPS, 4.0f, 80, 8, 10)); public static final RegistryObject<Block> TNT_CLUSTER_8 = BLOCKS.register("tnt_cluster_8", () -> new ClusterTNTBlock(DEFAULT_PROPS, 4.0f, 80, 8, 10));
public static final RegistryObject<Item> TNT_CLUSTER_8_ITEM = ITEMS.register("tnt_cluster_8", () -> new BlockItemTooltip(TNT_CLUSTER_8.get(), new Item.Properties().tab(CREATIVE_MODE_TAB))); public static final RegistryObject<Item> TNT_CLUSTER_8_ITEM = ITEMS.register("tnt_cluster_8", () -> new BlockItemTooltip(TNT_CLUSTER_8.get(), new Item.Properties()));
public static final RegistryObject<Block> TNT_HOMING = BLOCKS.register("tnt_homing", () -> new homingTNTBlock(DEFAULT_PROPS, 4.0f, 80, 1)); public static final RegistryObject<Block> TNT_HOMING = BLOCKS.register("tnt_homing", () -> new homingTNTBlock(DEFAULT_PROPS, 4.0f, 80, 1));
public static final RegistryObject<Item> TNT_HOMING_ITEM = ITEMS.register("tnt_homing", () -> new BlockItemTooltip(TNT_HOMING.get(), new Item.Properties().tab(CREATIVE_MODE_TAB))); public static final RegistryObject<Item> TNT_HOMING_ITEM = ITEMS.register("tnt_homing", () -> new BlockItemTooltip(TNT_HOMING.get(), new Item.Properties()));
public static final RegistryObject<Block> TNT_BLACK_HOLE = BLOCKS.register("tnt_black_hole", () -> new blackHoleTNTBlock(DEFAULT_PROPS, 4.0f, 80, 1)); public static final RegistryObject<Block> TNT_BLACK_HOLE = BLOCKS.register("tnt_black_hole", () -> new blackHoleTNTBlock(DEFAULT_PROPS, 4.0f, 80, 1));
public static final RegistryObject<Item> TNT_BLACK_HOLE_ITEM = ITEMS.register("tnt_black_hole", () -> new BlockItemTooltip(TNT_BLACK_HOLE.get(), new Item.Properties().tab(CREATIVE_MODE_TAB))); public static final RegistryObject<Item> TNT_BLACK_HOLE_ITEM = ITEMS.register("tnt_black_hole", () -> new BlockItemTooltip(TNT_BLACK_HOLE.get(), new Item.Properties()));
public static final RegistryObject<Block> TNT_CLAYMORE = BLOCKS.register("tnt_claymore", () -> new claymoreTNTBlock(DEFAULT_PROPS, 2.0f, 20, 256)); public static final RegistryObject<Block> TNT_CLAYMORE = BLOCKS.register("tnt_claymore", () -> new claymoreTNTBlock(DEFAULT_PROPS, 2.0f, 20, 256));
public static final RegistryObject<Item> TNT_CLAYMORE_ITEM = ITEMS.register("tnt_claymore", () -> new BlockItemTooltip(TNT_CLAYMORE.get(), new Item.Properties().tab(CREATIVE_MODE_TAB))); public static final RegistryObject<Item> TNT_CLAYMORE_ITEM = ITEMS.register("tnt_claymore", () -> new BlockItemTooltip(TNT_CLAYMORE.get(), new Item.Properties()));
public static final RegistryObject<Block> TNT_SELECTIVE = BLOCKS.register("tnt_selective", () -> new selectiveTNTBlock(DEFAULT_PROPS, 32.0f, 80)); public static final RegistryObject<Block> TNT_SELECTIVE = BLOCKS.register("tnt_selective", () -> new selectiveTNTBlock(DEFAULT_PROPS, 32.0f, 80));
public static final RegistryObject<Item> TNT_SELECTIVE_ITEM = ITEMS.register("tnt_selective", () -> new BlockItemTooltip(TNT_SELECTIVE.get(), new Item.Properties().tab(CREATIVE_MODE_TAB))); public static final RegistryObject<Item> TNT_SELECTIVE_ITEM = ITEMS.register("tnt_selective", () -> new BlockItemTooltip(TNT_SELECTIVE.get(), new Item.Properties()));
public static final RegistryObject<Block> TNT_ENDER = BLOCKS.register("tnt_ender", () -> new enderTNTBlock(DEFAULT_PROPS, 4.0f, 80)); public static final RegistryObject<Block> TNT_ENDER = BLOCKS.register("tnt_ender", () -> new enderTNTBlock(DEFAULT_PROPS, 4.0f, 80));
public static final RegistryObject<Item> TNT_ENDER_ITEM = ITEMS.register("tnt_ender", () -> new BlockItemTooltip(TNT_ENDER.get(), new Item.Properties().tab(CREATIVE_MODE_TAB))); public static final RegistryObject<Item> TNT_ENDER_ITEM = ITEMS.register("tnt_ender", () -> new BlockItemTooltip(TNT_ENDER.get(), new Item.Properties()));
public static final RegistryObject<Block> TNT_REPULSIVE = BLOCKS.register("tnt_repulsive", () -> new repulsiveTNTBlock(DEFAULT_PROPS, 4.0f, 80, 1)); public static final RegistryObject<Block> TNT_REPULSIVE = BLOCKS.register("tnt_repulsive", () -> new repulsiveTNTBlock(DEFAULT_PROPS, 4.0f, 80, 1));
public static final RegistryObject<Item> TNT_REPULSIVE_ITEM = ITEMS.register("tnt_repulsive", () -> new BlockItemTooltip(TNT_REPULSIVE.get(), new Item.Properties().tab(CREATIVE_MODE_TAB))); public static final RegistryObject<Item> TNT_REPULSIVE_ITEM = ITEMS.register("tnt_repulsive", () -> new BlockItemTooltip(TNT_REPULSIVE.get(), new Item.Properties()));
public static final RegistryObject<Block> TNT_BEDROCK = BLOCKS.register("tnt_bedrock", () -> new bedrockTNTBlock(DEFAULT_PROPS, 4.0f, 80)); public static final RegistryObject<Block> TNT_BEDROCK = BLOCKS.register("tnt_bedrock", () -> new bedrockTNTBlock(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_RED), 4.0f, 80));
public static final RegistryObject<Item> TNT_BEDROCK_ITEM = ITEMS.register("tnt_bedrock", () -> new BlockItemTooltip(TNT_BEDROCK.get(), new Item.Properties().tab(CREATIVE_MODE_TAB))); public static final RegistryObject<Item> TNT_BEDROCK_ITEM = ITEMS.register("tnt_bedrock", () -> new BlockItemTooltip(TNT_BEDROCK.get(), new Item.Properties()));
public static final RegistryObject<Block> TNT_ENTITY = BLOCKS.register("tnt_entity", () -> new entityTNTBlock(DEFAULT_PROPS, 4.0f, 80)); public static final RegistryObject<Block> TNT_ENTITY = BLOCKS.register("tnt_entity", () -> new entityTNTBlock(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_RED), 4.0f, 80));
public static final RegistryObject<Item> TNT_ENTITY_ITEM = ITEMS.register("tnt_entity", () -> new BlockItemTooltip(TNT_ENTITY.get(), new Item.Properties().tab(CREATIVE_MODE_TAB))); public static final RegistryObject<Item> TNT_ENTITY_ITEM = ITEMS.register("tnt_entity", () -> new BlockItemTooltip(TNT_ENTITY.get(), new Item.Properties()));
public static void register(IEventBus bus) { public static void register(IEventBus bus) {
@@ -52,7 +52,7 @@ public class claymoreTNTBlock extends TntBlock {
public void wasExploded(Level level, @NotNull BlockPos blockPos, @NotNull Explosion pExplosion) { public void wasExploded(Level level, @NotNull BlockPos blockPos, @NotNull Explosion pExplosion) {
if (!level.isClientSide) { if (!level.isClientSide) {
int ft = (short) (level.random.nextInt(fuseTime / 4) + fuseTime / 8); int ft = (short) (level.random.nextInt(fuseTime / 4) + fuseTime / 8);
claymorePrimedTNT primedtnt = new claymorePrimedTNT(level, (double) blockPos.getX() + (double) 0.5F, (double) blockPos.getY(), (double) blockPos.getZ() + (double) 0.5F, pExplosion.getSourceMob(), pRadius, ft, projectileCount); claymorePrimedTNT primedtnt = new claymorePrimedTNT(level, (double) blockPos.getX() + (double) 0.5F, (double) blockPos.getY(), (double) blockPos.getZ() + (double) 0.5F, pExplosion.getIndirectSourceEntity(), pRadius, ft, projectileCount);
level.addFreshEntity(primedtnt); level.addFreshEntity(primedtnt);
} }
} }
@@ -81,7 +81,7 @@ public class enderTNTBlock extends TntBlock {
if (!level.isClientSide) { if (!level.isClientSide) {
BlockPos pos = getSpawnPos(level, blockPos); BlockPos pos = getSpawnPos(level, blockPos);
if (pos != null) { if (pos != null) {
enderPrimedTNT primedtnt = new enderPrimedTNT(level, pos.getX() + 0.5F, pos.getY(), pos.getZ() + 0.5F, pExplosion.getSourceMob(), pRadius, fuseTime); enderPrimedTNT primedtnt = new enderPrimedTNT(level, pos.getX() + 0.5F, pos.getY(), pos.getZ() + 0.5F, pExplosion.getIndirectSourceEntity(), pRadius, fuseTime);
int i = primedtnt.getFuse(); int i = primedtnt.getFuse();
primedtnt.setFuse((short) (level.random.nextInt(i / 4) + i / 8)); primedtnt.setFuse((short) (level.random.nextInt(i / 4) + i / 8));
level.addFreshEntity(primedtnt); level.addFreshEntity(primedtnt);
@@ -52,7 +52,7 @@ public class entityTNTBlock extends TntBlock {
public void wasExploded(Level level, @NotNull BlockPos blockPos, @NotNull Explosion pExplosion) { public void wasExploded(Level level, @NotNull BlockPos blockPos, @NotNull Explosion pExplosion) {
if (!level.isClientSide) { if (!level.isClientSide) {
int ft = (short) (level.random.nextInt(fuseTime / 4) + fuseTime / 8); int ft = (short) (level.random.nextInt(fuseTime / 4) + fuseTime / 8);
EntityPrimedTNT primedtnt = new EntityPrimedTNT(level, (double) blockPos.getX() + (double) 0.5F, (double) blockPos.getY(), (double) blockPos.getZ() + (double) 0.5F, pExplosion.getSourceMob(), pRadius, ft); EntityPrimedTNT primedtnt = new EntityPrimedTNT(level, (double) blockPos.getX() + (double) 0.5F, (double) blockPos.getY(), (double) blockPos.getZ() + (double) 0.5F, pExplosion.getIndirectSourceEntity(), pRadius, ft);
level.addFreshEntity(primedtnt); level.addFreshEntity(primedtnt);
} }
} }
@@ -51,7 +51,7 @@ public class homingTNTBlock extends TntBlock {
@Override @Override
public void wasExploded(Level level, @NotNull BlockPos blockPos, @NotNull Explosion pExplosion) { public void wasExploded(Level level, @NotNull BlockPos blockPos, @NotNull Explosion pExplosion) {
if (!level.isClientSide) { if (!level.isClientSide) {
homingPrimedTNT primedtnt = new homingPrimedTNT(level, (double) blockPos.getX() + (double) 0.5F, (double) blockPos.getY(), (double) blockPos.getZ() + (double) 0.5F, pExplosion.getSourceMob(), pRadius, fuseTime, speed); homingPrimedTNT primedtnt = new homingPrimedTNT(level, (double) blockPos.getX() + (double) 0.5F, (double) blockPos.getY(), (double) blockPos.getZ() + (double) 0.5F, pExplosion.getIndirectSourceEntity(), pRadius, fuseTime, speed);
int i = primedtnt.getFuse(); int i = primedtnt.getFuse();
primedtnt.setFuse((short) (level.random.nextInt(i / 4) + i / 8)); primedtnt.setFuse((short) (level.random.nextInt(i / 4) + i / 8));
level.addFreshEntity(primedtnt); level.addFreshEntity(primedtnt);
@@ -50,7 +50,7 @@ public class repulsiveTNTBlock extends TntBlock {
@Override @Override
public void wasExploded(Level level, @NotNull BlockPos blockPos, @NotNull Explosion pExplosion) { public void wasExploded(Level level, @NotNull BlockPos blockPos, @NotNull Explosion pExplosion) {
if (!level.isClientSide) { if (!level.isClientSide) {
repulsivePrimedTNT primedtnt = new repulsivePrimedTNT(level, (double) blockPos.getX() + (double) 0.5F, (double) blockPos.getY(), (double) blockPos.getZ() + (double) 0.5F, pExplosion.getSourceMob(), pRadius, fuseTime, speed); repulsivePrimedTNT primedtnt = new repulsivePrimedTNT(level, (double) blockPos.getX() + (double) 0.5F, (double) blockPos.getY(), (double) blockPos.getZ() + (double) 0.5F, pExplosion.getIndirectSourceEntity(), pRadius, fuseTime, speed);
int i = primedtnt.getFuse(); int i = primedtnt.getFuse();
primedtnt.setFuse((short) (level.random.nextInt(i / 4) + i / 8)); primedtnt.setFuse((short) (level.random.nextInt(i / 4) + i / 8));
level.addFreshEntity(primedtnt); level.addFreshEntity(primedtnt);
@@ -51,7 +51,7 @@ public class selectiveTNTBlock extends TntBlock {
public void wasExploded(Level level, @NotNull BlockPos blockPos, @NotNull Explosion pExplosion) { public void wasExploded(Level level, @NotNull BlockPos blockPos, @NotNull Explosion pExplosion) {
if (!level.isClientSide) { if (!level.isClientSide) {
int ft = (short) (level.random.nextInt(fuseTime / 4) + fuseTime / 8); int ft = (short) (level.random.nextInt(fuseTime / 4) + fuseTime / 8);
selectivePrimedTNT primedtnt = new selectivePrimedTNT(level, (double) blockPos.getX() + (double) 0.5F, (double) blockPos.getY(), (double) blockPos.getZ() + (double) 0.5F, pExplosion.getSourceMob(), pRadius, ft); selectivePrimedTNT primedtnt = new selectivePrimedTNT(level, (double) blockPos.getX() + (double) 0.5F, (double) blockPos.getY(), (double) blockPos.getZ() + (double) 0.5F, pExplosion.getIndirectSourceEntity(), pRadius, ft);
level.addFreshEntity(primedtnt); level.addFreshEntity(primedtnt);
} }
} }
@@ -52,7 +52,7 @@ public class strongerTNTBlock extends TntBlock {
public void wasExploded(Level level, @NotNull BlockPos blockPos, @NotNull Explosion pExplosion) { public void wasExploded(Level level, @NotNull BlockPos blockPos, @NotNull Explosion pExplosion) {
if (!level.isClientSide) { if (!level.isClientSide) {
int ft = (short) (level.random.nextInt(fuseTime / 4) + fuseTime / 8); int ft = (short) (level.random.nextInt(fuseTime / 4) + fuseTime / 8);
StrongerPrimedTNT primedtnt = new StrongerPrimedTNT(level, (double) blockPos.getX() + (double) 0.5F, (double) blockPos.getY(), (double) blockPos.getZ() + (double) 0.5F, pExplosion.getSourceMob(), pRadius, ft); StrongerPrimedTNT primedtnt = new StrongerPrimedTNT(level, (double) blockPos.getX() + (double) 0.5F, (double) blockPos.getY(), (double) blockPos.getZ() + (double) 0.5F, pExplosion.getIndirectSourceEntity(), pRadius, ft);
level.addFreshEntity(primedtnt); level.addFreshEntity(primedtnt);
} }
} }
@@ -1,14 +1,50 @@
package com.jenny.enhancedexplosives; package com.jenny.enhancedexplosives;
import com.jenny.enhancedexplosives.blocks.blocks; import com.jenny.enhancedexplosives.blocks.blocks;
import com.jenny.enhancedexplosives.items.items;
import net.minecraft.core.registries.Registries;
import net.minecraft.network.chat.Component;
import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.CreativeModeTabs;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.RegistryObject;
import java.util.Arrays;
import static com.jenny.enhancedexplosives.EnhancedExplosives.MODID;
public class creativeTab { public class creativeTab {
public static final CreativeModeTab CREATIVE_MODE_TAB = new CreativeModeTab("enhancedexplosives") { public static final DeferredRegister<CreativeModeTab> CREATIVE_MODE_TABS = DeferredRegister.create(Registries.CREATIVE_MODE_TAB, MODID);
@Override public static final RegistryObject<CreativeModeTab> CREATIVE_TAB = CREATIVE_MODE_TABS.register("enhancedexplosives", () -> CreativeModeTab.builder().withTabsBefore(CreativeModeTabs.SPAWN_EGGS).icon(() -> blocks.TNT_8_ITEM.get().getDefaultInstance()).displayItems((parameters, output) -> {
public ItemStack makeIcon() { output.acceptAll(Arrays.stream(getBlocks()).toList());
return new ItemStack(blocks.TNT_8_ITEM.get()); output.acceptAll(Arrays.stream(getItems()).toList());
}).title(Component.literal("Enhanced Explosives")).build());
public static void register(IEventBus bus) {
CREATIVE_MODE_TABS.register(bus);
}
public static ItemStack[] getBlocks() {
ItemStack[] ret = new ItemStack[blocks.ITEMS.getEntries().size()];
int i = 0;
for (RegistryObject<Item> item : blocks.ITEMS.getEntries()) {
ret[i] = item.get().getDefaultInstance();
i++;
}
return ret;
}
public static ItemStack[] getItems() {
ItemStack[] ret = new ItemStack[items.ITEMS.getEntries().size()];
int i = 0;
for (RegistryObject<Item> item : items.ITEMS.getEntries()) {
ret[i] = item.get().getDefaultInstance();
i++;
}
return ret;
} }
};
} }
@@ -0,0 +1,27 @@
package com.jenny.enhancedexplosives.datagen;
import net.minecraft.core.HolderLookup;
import net.minecraft.data.DataGenerator;
import net.minecraft.data.PackOutput;
import net.minecraftforge.common.data.ExistingFileHelper;
import net.minecraftforge.data.event.GatherDataEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import org.jetbrains.annotations.NotNull;
import java.util.concurrent.CompletableFuture;
import static com.jenny.enhancedexplosives.EnhancedExplosives.MODID;
@Mod.EventBusSubscriber(modid = MODID, bus = Mod.EventBusSubscriber.Bus.MOD)
public class DataGenerators {
@SubscribeEvent
public static void gatherData(@NotNull GatherDataEvent event) {
DataGenerator generator = event.getGenerator();
PackOutput packOutput = generator.getPackOutput();
ExistingFileHelper existingFileHelper = event.getExistingFileHelper();
CompletableFuture<HolderLookup.Provider> lookupProvider = event.getLookupProvider();
generator.addProvider(event.includeClient(), new ModBlockStateProvider(packOutput, existingFileHelper));
generator.addProvider(event.includeClient(), new ModItemModelProvider(packOutput, existingFileHelper));
}
}
@@ -0,0 +1,99 @@
package com.jenny.enhancedexplosives.datagen;
import com.jenny.enhancedexplosives.blocks.blocks;
import net.minecraft.data.PackOutput;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraftforge.client.model.generators.BlockStateProvider;
import net.minecraftforge.client.model.generators.ConfiguredModel;
import net.minecraftforge.client.model.generators.ModelFile;
import net.minecraftforge.common.data.ExistingFileHelper;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegistryObject;
import org.jetbrains.annotations.NotNull;
import java.util.Objects;
import static com.jenny.enhancedexplosives.EnhancedExplosives.MODID;
public class ModBlockStateProvider extends BlockStateProvider {
public ModBlockStateProvider(PackOutput output, ExistingFileHelper exFileHelper) {
super(output, MODID, exFileHelper);
}
@Override
protected void registerStatesAndModels() {
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_BEDROCK);
sideTopBottom(blocks.TNT_ENTITY);
SideTop(blocks.TNT_BLACK_HOLE);
SideTop(blocks.TNT_REPULSIVE);
SideOnlyTNT(blocks.TNT_CLUSTER_2);
SideOnlyTNT(blocks.TNT_CLUSTER_4);
SideOnlyTNT(blocks.TNT_CLUSTER_8);
SideOnlyTNT(blocks.TNT_SELECTIVE);
SideOnlyTNT(blocks.TNT_HOMING);
}
private void blockWithItem(@NotNull RegistryObject<Block> blockRegistryObject) {
simpleBlockWithItem(blockRegistryObject.get(), cubeAll(blockRegistryObject.get()));
}
private void SideTop(@NotNull RegistryObject<Block> blockRegistryObject) {
simpleBlockWithItem(blockRegistryObject.get(), topSide(blockRegistryObject.get()));
}
private void blockItem(@NotNull RegistryObject<Block> blockRegistryObject) {
simpleBlockItem(blockRegistryObject.get(), new ModelFile.UncheckedModelFile(MODID +
":block/" + Objects.requireNonNull(ForgeRegistries.BLOCKS.getKey(blockRegistryObject.get())).getPath()));
}
private void topBottom2Sides(@NotNull RegistryObject<Block> blockRegistryObject) {
simpleBlockWithItem(blockRegistryObject.get(), northEastTopBottom(blockRegistryObject.get()));
}
private ResourceLocation key(Block block) {
return ForgeRegistries.BLOCKS.getKey(block);
}
private @NotNull String name(Block block) {
return key(block).getPath();
}
private ResourceLocation extend(@NotNull ResourceLocation rl, String suffix) {
return new ResourceLocation(rl.getNamespace(), rl.getPath() + suffix);
}
public void sideTopBottom(@NotNull 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);
}
public void SideOnlyTNT(@NotNull RegistryObject<Block> blockRegistryObject) {
Block block = blockRegistryObject.get();
ModelFile model = models().cubeBottomTop(name(block), extend(blockTexture(block), "_side"), extend(blockTexture(Blocks.TNT), "_bottom"), extend(blockTexture(Blocks.TNT), "_top"));
this.getVariantBuilder(block).forAllStates(blockState -> ConfiguredModel.builder().modelFile(model).build());
simpleBlockItem(block, model);
}
public ModelFile northEastTopBottom(Block block) {
return models().cube(name(block), extend(blockTexture(block), "_bottom"), extend(blockTexture(block), "_top"), extend(blockTexture(block), "_nw"), extend(blockTexture(block), "_se"), extend(blockTexture(block), "_se"), extend(blockTexture(block), "_nw")).texture("particle", extend(blockTexture(block), "_se"));
}
public ModelFile cube(Block block) {
return models().cube(name(block), extend(blockTexture(block), "_bottom"), extend(blockTexture(block), "_top"), extend(blockTexture(block), "_north"), extend(blockTexture(block), "_south"), extend(blockTexture(block), "_east"), extend(blockTexture(block), "_west")).texture("particle", extend(blockTexture(block), "_north"));
}
public ModelFile topSide(Block block) {
return models().cubeColumn(name(block), extend(blockTexture(block), "_side"), extend(blockTexture(block), "_top"));
}
}
@@ -0,0 +1,31 @@
package com.jenny.enhancedexplosives.datagen;
import com.jenny.enhancedexplosives.items.items;
import net.minecraft.data.PackOutput;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.Item;
import net.minecraftforge.client.model.generators.ItemModelProvider;
import net.minecraftforge.common.data.ExistingFileHelper;
import net.minecraftforge.registries.RegistryObject;
import static com.jenny.enhancedexplosives.EnhancedExplosives.MODID;
public class ModItemModelProvider extends ItemModelProvider {
public ModItemModelProvider(PackOutput output, ExistingFileHelper existingFileHelper) {
super(output, MODID, existingFileHelper);
}
@Override
protected void registerModels() {
simpleItem(items.TNT_ARROW);
simpleItem(items.CONCUSSIVE_ARROW);
simpleItem(items.CARPET_ARROW);
simpleItem(items.TUNNEL_ARROW);
}
private void simpleItem(RegistryObject<Item> item) {
withExistingParent(item.getId().getPath(),
new ResourceLocation("item/generated")).texture("layer0",
new ResourceLocation(MODID,"item/" + item.getId().getPath()));
}
}
@@ -5,7 +5,6 @@ import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.projectile.AbstractArrow; import net.minecraft.world.entity.projectile.AbstractArrow;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@@ -14,15 +13,15 @@ public class baseArrow extends AbstractArrow {
private int tick = 0; private int tick = 0;
public baseArrow(EntityType<? extends baseArrow> pEntityType, Level pLevel) { public baseArrow(EntityType<? extends baseArrow> pEntityType, Level pLevel) {
super(pEntityType, pLevel); super(pEntityType, pLevel, ItemStack.EMPTY);
} }
public baseArrow(Level pLevel, LivingEntity pShooter, EntityType<? extends baseArrow> pEntityType) { public baseArrow(Level pLevel, LivingEntity pShooter, EntityType<? extends baseArrow> pEntityType) {
super(pEntityType, pShooter, pLevel); super(pEntityType, pShooter, pLevel, ItemStack.EMPTY);
} }
public baseArrow(Level pLevel, EntityType<? extends baseArrow> pEntityType) { public baseArrow(Level pLevel, EntityType<? extends baseArrow> pEntityType) {
super(pEntityType, pLevel); super(pEntityType, pLevel, ItemStack.EMPTY);
} }
public void tick() { public void tick() {
@@ -37,7 +36,12 @@ public class baseArrow extends AbstractArrow {
@NotNull @NotNull
protected ItemStack getPickupItem() { protected ItemStack getPickupItem() {
return new ItemStack(Items.ARROW); return ItemStack.EMPTY;
}
@Override
protected ItemStack getDefaultPickupItem() {
return ItemStack.EMPTY;
} }
protected Vec3 particlePos(double dist) { protected Vec3 particlePos(double dist) {
@@ -55,8 +59,4 @@ public class baseArrow extends AbstractArrow {
public int getTick() { public int getTick() {
return this.tick; return this.tick;
} }
public Level level() {
return level;
}
} }
@@ -2,15 +2,12 @@ package com.jenny.enhancedexplosives.entities.arrows;
import com.jenny.enhancedexplosives.config.ConfigClient; import com.jenny.enhancedexplosives.config.ConfigClient;
import com.jenny.enhancedexplosives.entities.entities; import com.jenny.enhancedexplosives.entities.entities;
import com.jenny.enhancedexplosives.items.items;
import com.jenny.enhancedexplosives.particles.particles; import com.jenny.enhancedexplosives.particles.particles;
import net.minecraft.util.RandomSource; import net.minecraft.util.RandomSource;
import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
import org.jetbrains.annotations.NotNull;
public class carpetArrow extends baseArrow { public class carpetArrow extends baseArrow {
public final int childCount = 32; public final int childCount = 32;
@@ -47,11 +44,6 @@ public class carpetArrow extends baseArrow {
} }
} }
@NotNull
protected ItemStack getPickupItem() {
return new ItemStack(items.CARPET_ARROW.get());
}
@Override @Override
public void spawnParticles(float partialTicks) { public void spawnParticles(float partialTicks) {
for (int i = 1; i <= ConfigClient.calcPCount(5); i++) { for (int i = 1; i <= ConfigClient.calcPCount(5); i++) {
@@ -3,12 +3,11 @@ package com.jenny.enhancedexplosives.entities.arrows;
import com.jenny.enhancedexplosives.config.ConfigClient; import com.jenny.enhancedexplosives.config.ConfigClient;
import com.jenny.enhancedexplosives.config.ConfigServer; import com.jenny.enhancedexplosives.config.ConfigServer;
import com.jenny.enhancedexplosives.entities.entities; import com.jenny.enhancedexplosives.entities.entities;
import com.jenny.enhancedexplosives.items.items;
import com.jenny.enhancedexplosives.particles.particles; import com.jenny.enhancedexplosives.particles.particles;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.damagesource.DamageTypes;
import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Explosion;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@@ -37,14 +36,14 @@ public class carpetArrowPart extends baseArrow {
public void explode() { public void explode() {
if (!level().isClientSide) { if (!level().isClientSide) {
level().explode(this, getX(), getY(), getZ(), 8.0f, Explosion.BlockInteraction.BREAK); level().explode(this, getX(), getY(), getZ(), 8.0f, Level.ExplosionInteraction.NONE);
} }
discard(); discard();
} }
@NotNull @Override
protected ItemStack getPickupItem() { public boolean hurt(@NotNull DamageSource pSource, float pAmount) {
return new ItemStack(items.CONCUSSIVE_ARROW.get()); return super.hurt(pSource, pAmount) || pSource.is(DamageTypes.EXPLOSION);
} }
@Override @Override
@@ -2,11 +2,8 @@ package com.jenny.enhancedexplosives.entities.arrows;
import com.jenny.enhancedexplosives.config.ConfigServer; import com.jenny.enhancedexplosives.config.ConfigServer;
import com.jenny.enhancedexplosives.entities.entities; import com.jenny.enhancedexplosives.entities.entities;
import com.jenny.enhancedexplosives.items.items;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@@ -18,17 +15,13 @@ public class claymoreArrow extends baseArrow{
} }
public claymoreArrow(@NotNull Level pLevel) {
super(entities.ARROW_CLAYMORE.get(), pLevel);
}
public claymoreArrow(@NotNull Level pLevel, @NotNull LivingEntity pShooter) { public claymoreArrow(@NotNull Level pLevel, @NotNull LivingEntity pShooter) {
super(pLevel, pShooter, entities.ARROW_CLAYMORE.get()); super(pLevel, pShooter, entities.ARROW_CLAYMORE.get());
} }
@Override @Override
protected void doPostHurtEffects(@NotNull LivingEntity pTarget) { protected void doPostHurtEffects(@NotNull LivingEntity pTarget) {
pTarget.hurt(DamageSource.arrow(this, getOwner()), 15); pTarget.hurt(damageSources().mobProjectile(this, (LivingEntity) getOwner()), 15);
} }
@Override @Override
@@ -38,10 +31,4 @@ public class claymoreArrow extends baseArrow{
discard(); discard();
} }
} }
@Override
@NotNull
protected ItemStack getPickupItem() {
return new ItemStack(items.CONCUSSIVE_ARROW.get(), 0);
}
} }
@@ -2,12 +2,9 @@ package com.jenny.enhancedexplosives.entities.arrows;
import com.jenny.enhancedexplosives.config.ConfigClient; import com.jenny.enhancedexplosives.config.ConfigClient;
import com.jenny.enhancedexplosives.entities.entities; import com.jenny.enhancedexplosives.entities.entities;
import com.jenny.enhancedexplosives.items.items;
import com.jenny.enhancedexplosives.particles.particles; import com.jenny.enhancedexplosives.particles.particles;
import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Explosion;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@@ -25,22 +22,17 @@ public class concussiveArrow extends baseArrow{
public void tick() { public void tick() {
super.tick(); super.tick();
if (this.inGround) { if (this.inGround) {
this.level().explode(this, getX(), getY(), getZ(), 8.0f, Explosion.BlockInteraction.NONE); this.level().explode(this, getX(), getY(), getZ(), 8.0f, Level.ExplosionInteraction.NONE);
this.discard(); this.discard();
} }
} }
@Override @Override
protected void doPostHurtEffects(@NotNull LivingEntity pTarget) { protected void doPostHurtEffects(@NotNull LivingEntity pTarget) {
this.level().explode(this, getX(), getY(), getZ(), 8.0f, Explosion.BlockInteraction.NONE); this.level().explode(this, getX(), getY(), getZ(), 8.0f, Level.ExplosionInteraction.NONE);
this.discard(); this.discard();
} }
@NotNull
protected ItemStack getPickupItem() {
return new ItemStack(items.CONCUSSIVE_ARROW.get());
}
@Override @Override
public void spawnParticles(float partialTicks) { public void spawnParticles(float partialTicks) {
for (int i = 1; i <= ConfigClient.calcPCount(5); i++) { for (int i = 1; i <= ConfigClient.calcPCount(5); i++) {
@@ -2,12 +2,9 @@ package com.jenny.enhancedexplosives.entities.arrows;
import com.jenny.enhancedexplosives.config.ConfigClient; import com.jenny.enhancedexplosives.config.ConfigClient;
import com.jenny.enhancedexplosives.entities.entities; import com.jenny.enhancedexplosives.entities.entities;
import com.jenny.enhancedexplosives.items.items;
import com.jenny.enhancedexplosives.particles.particles; import com.jenny.enhancedexplosives.particles.particles;
import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Explosion;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@@ -25,22 +22,17 @@ public class tntArrow extends baseArrow {
public void tick() { public void tick() {
super.tick(); super.tick();
if (this.inGround) { if (this.inGround) {
this.level().explode(this, this.getX(), this.getY(), this.getZ(), 2, Explosion.BlockInteraction.BREAK); this.level().explode(this, this.getX(), this.getY(), this.getZ(), 2, Level.ExplosionInteraction.TNT);
this.discard(); this.discard();
} }
} }
@Override @Override
protected void doPostHurtEffects(@NotNull LivingEntity pTarget) { protected void doPostHurtEffects(@NotNull LivingEntity pTarget) {
this.level().explode(this, this.getX(), this.getY(), this.getZ(), 2, Explosion.BlockInteraction.BREAK); this.level().explode(this, this.getX(), this.getY(), this.getZ(), 2, Level.ExplosionInteraction.TNT);
this.discard(); this.discard();
} }
@NotNull
protected ItemStack getPickupItem() {
return new ItemStack(items.TNT_ARROW.get());
}
@Override @Override
public void spawnParticles(float partialTicks) { public void spawnParticles(float partialTicks) {
for (int i = 1; i <= ConfigClient.calcPCount(5); i++) { for (int i = 1; i <= ConfigClient.calcPCount(5); i++) {
@@ -6,7 +6,6 @@ import com.jenny.enhancedexplosives.particles.particles;
import net.minecraft.util.Mth; import net.minecraft.util.Mth;
import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.level.Explosion;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@@ -48,7 +47,7 @@ public class tunnelArrow extends baseArrow{
for (int i = 0; i < explosionCount; i++) { for (int i = 0; i < explosionCount; i++) {
Vec3 pos = position().add(rot.multiply(i * spacing, i * spacing, i * spacing)); Vec3 pos = position().add(rot.multiply(i * spacing, i * spacing, i * spacing));
level().explode(this, pos.x, pos.y, pos.z, level().explode(this, pos.x, pos.y, pos.z,
power, Explosion.BlockInteraction.BREAK); power, Level.ExplosionInteraction.TNT);
} }
} }
@@ -2,7 +2,7 @@ package com.jenny.enhancedexplosives.entities.client;
import com.jenny.enhancedexplosives.entities.tnt.basePrimedTNT; import com.jenny.enhancedexplosives.entities.tnt.basePrimedTNT;
import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Vector3f; import com.mojang.math.Axis;
import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.block.BlockRenderDispatcher; import net.minecraft.client.renderer.block.BlockRenderDispatcher;
import net.minecraft.client.renderer.entity.EntityRenderer; import net.minecraft.client.renderer.entity.EntityRenderer;
@@ -34,9 +34,9 @@ public class BaseTNTRenderer<T extends basePrimedTNT> extends EntityRenderer<T>
float f1 = 1.0F + f * 0.3F; float f1 = 1.0F + f * 0.3F;
pPoseStack.scale(f1, f1, f1); pPoseStack.scale(f1, f1, f1);
} }
pPoseStack.mulPose(Vector3f.YP.rotationDegrees(-90.0F)); pPoseStack.mulPose(Axis.YP.rotationDegrees(-90.0F));
pPoseStack.translate(-0.5F, -0.5F, 0.5F); pPoseStack.translate(-0.5F, -0.5F, 0.5F);
pPoseStack.mulPose(Vector3f.YP.rotationDegrees(90.0F)); pPoseStack.mulPose(Axis.YP.rotationDegrees(90.0F));
TntMinecartRenderer.renderWhiteSolidBlock(this.blockRenderer, pEntity.renderBlock().defaultBlockState(), pPoseStack, pBuffer, pPackedLight, i / 5 % 2 == 0); TntMinecartRenderer.renderWhiteSolidBlock(this.blockRenderer, pEntity.renderBlock().defaultBlockState(), pPoseStack, pBuffer, pPackedLight, i / 5 % 2 == 0);
pPoseStack.popPose(); pPoseStack.popPose();
super.render(pEntity, pEntityYaw, pPartialTicks, pPoseStack, pBuffer, pPackedLight); super.render(pEntity, pEntityYaw, pPartialTicks, pPoseStack, pBuffer, pPackedLight);
@@ -2,7 +2,7 @@ package com.jenny.enhancedexplosives.entities.client;
import com.jenny.enhancedexplosives.entities.tnt.selectivePrimedTNT; import com.jenny.enhancedexplosives.entities.tnt.selectivePrimedTNT;
import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Vector3f; import com.mojang.math.Axis;
import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.block.BlockRenderDispatcher; import net.minecraft.client.renderer.block.BlockRenderDispatcher;
import net.minecraft.client.renderer.entity.EntityRenderer; import net.minecraft.client.renderer.entity.EntityRenderer;
@@ -35,9 +35,9 @@ public class SelectiveTNTRenderer<T extends selectivePrimedTNT> extends EntityRe
float f1 = 1.0F + f * 0.3F; float f1 = 1.0F + f * 0.3F;
pPoseStack.scale(f1, f1, f1); pPoseStack.scale(f1, f1, f1);
} }
pPoseStack.mulPose(Vector3f.YP.rotationDegrees(-90.0F)); pPoseStack.mulPose(Axis.YP.rotationDegrees(-90.0F));
pPoseStack.translate(-0.5F, -0.5F, 0.5F); pPoseStack.translate(-0.5F, -0.5F, 0.5F);
pPoseStack.mulPose(Vector3f.YP.rotationDegrees(90.0F)); pPoseStack.mulPose(Axis.YP.rotationDegrees(90.0F));
Block block = (i / 5 % 2 == 0) ? pEntity.renderBlockBeneath(): pEntity.renderBlock(); Block block = (i / 5 % 2 == 0) ? pEntity.renderBlockBeneath(): pEntity.renderBlock();
TntMinecartRenderer.renderWhiteSolidBlock(this.blockRenderer, block.defaultBlockState(), pPoseStack, pBuffer, pPackedLight, false); TntMinecartRenderer.renderWhiteSolidBlock(this.blockRenderer, block.defaultBlockState(), pPoseStack, pBuffer, pPackedLight, false);
pPoseStack.popPose(); pPoseStack.popPose();
@@ -2,7 +2,7 @@ package com.jenny.enhancedexplosives.entities.client;
import com.jenny.enhancedexplosives.entities.arrows.baseArrow; import com.jenny.enhancedexplosives.entities.arrows.baseArrow;
import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Vector3f; import com.mojang.math.Axis;
import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.block.BlockRenderDispatcher; import net.minecraft.client.renderer.block.BlockRenderDispatcher;
import net.minecraft.client.renderer.entity.EntityRenderer; import net.minecraft.client.renderer.entity.EntityRenderer;
@@ -28,9 +28,9 @@ public class TNTArrowRenderer extends EntityRenderer<baseArrow> {
pPoseStack.translate(0.0F, 0.5F, 0.0F); pPoseStack.translate(0.0F, 0.5F, 0.0F);
pPoseStack.scale(0.5f, 0.5f, 0.5f); pPoseStack.scale(0.5f, 0.5f, 0.5f);
int i = pEntity.getTick(); int i = pEntity.getTick();
pPoseStack.mulPose(Vector3f.YP.rotationDegrees(-90.0F)); pPoseStack.mulPose(Axis.YP.rotationDegrees(-90.0F));
pPoseStack.translate(-0.5F, -0.5F, 0.5F); pPoseStack.translate(-0.5F, -0.5F, 0.5F);
pPoseStack.mulPose(Vector3f.YP.rotationDegrees(90.0F)); pPoseStack.mulPose(Axis.YP.rotationDegrees(90.0F));
TntMinecartRenderer.renderWhiteSolidBlock(this.blockRenderer, Blocks.TNT.defaultBlockState(), pPoseStack, pBuffer, pPackedLight, i / 5 % 2 == 0); TntMinecartRenderer.renderWhiteSolidBlock(this.blockRenderer, Blocks.TNT.defaultBlockState(), pPoseStack, pBuffer, pPackedLight, i / 5 % 2 == 0);
pPoseStack.popPose(); pPoseStack.popPose();
super.render(pEntity, pEntityYaw, pPartialTicks, pPoseStack, pBuffer, pPackedLight); super.render(pEntity, pEntityYaw, pPartialTicks, pPoseStack, pBuffer, pPackedLight);
@@ -4,6 +4,7 @@ import net.minecraft.client.renderer.entity.ArrowRenderer;
import net.minecraft.client.renderer.entity.EntityRendererProvider; import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.projectile.AbstractArrow; import net.minecraft.world.entity.projectile.AbstractArrow;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import static net.minecraft.client.renderer.entity.TippableArrowRenderer.NORMAL_ARROW_LOCATION; import static net.minecraft.client.renderer.entity.TippableArrowRenderer.NORMAL_ARROW_LOCATION;
@@ -2,7 +2,7 @@ package com.jenny.enhancedexplosives.entities.client;
import com.jenny.enhancedexplosives.entities.tnt.basePrimedTNT; import com.jenny.enhancedexplosives.entities.tnt.basePrimedTNT;
import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Vector3f; import com.mojang.math.Axis;
import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.block.BlockRenderDispatcher; import net.minecraft.client.renderer.block.BlockRenderDispatcher;
import net.minecraft.client.renderer.entity.EntityRenderer; import net.minecraft.client.renderer.entity.EntityRenderer;
@@ -38,9 +38,9 @@ public class clusterTNTRenderer extends EntityRenderer<basePrimedTNT> {
pPoseStack.scale(0.5f, 0.5f, 0.5f); pPoseStack.scale(0.5f, 0.5f, 0.5f);
} }
pPoseStack.mulPose(Vector3f.YP.rotationDegrees(-90.0F)); pPoseStack.mulPose(Axis.YP.rotationDegrees(-90.0F));
pPoseStack.translate(-0.5F, -1.0F, 0.5F); pPoseStack.translate(-0.5F, -1.0F, 0.5F);
pPoseStack.mulPose(Vector3f.YP.rotationDegrees(90.0F)); pPoseStack.mulPose(Axis.YP.rotationDegrees(90.0F));
TntMinecartRenderer.renderWhiteSolidBlock(this.blockRenderer, pEntity.renderBlock().defaultBlockState(), pPoseStack, pBuffer, pPackedLight, i / 5 % 2 == 0); TntMinecartRenderer.renderWhiteSolidBlock(this.blockRenderer, pEntity.renderBlock().defaultBlockState(), pPoseStack, pBuffer, pPackedLight, i / 5 % 2 == 0);
pPoseStack.popPose(); pPoseStack.popPose();
super.render(pEntity, pEntityYaw, pPartialTicks, pPoseStack, pBuffer, pPackedLight); super.render(pEntity, pEntityYaw, pPartialTicks, pPoseStack, pBuffer, pPackedLight);
@@ -28,7 +28,7 @@ public class entities {
public static final RegistryObject<EntityType<ClusterPrimedTNT>> TNT_CLUSTER = public static final RegistryObject<EntityType<ClusterPrimedTNT>> TNT_CLUSTER =
ENTITY_TYPES.register("tnt_cluster", () -> EntityType.Builder.<ClusterPrimedTNT>of(ClusterPrimedTNT::new, MobCategory.MISC) ENTITY_TYPES.register("tnt_cluster", () -> EntityType.Builder.<ClusterPrimedTNT>of(ClusterPrimedTNT::new, MobCategory.MISC)
.fireImmune().sized(0.48F, 0.48F).clientTrackingRange(10).updateInterval(10).build("tnt_cluster")); .sized(0.48F, 0.48F).fireImmune().clientTrackingRange(10).updateInterval(10).build("tnt_cluster"));
public static final RegistryObject<EntityType<blackHolePrimedTNT>> TNT_BLACK_HOLE = public static final RegistryObject<EntityType<blackHolePrimedTNT>> TNT_BLACK_HOLE =
ENTITY_TYPES.register("tnt_blackhole", () -> EntityType.Builder.<blackHolePrimedTNT>of(blackHolePrimedTNT::new, MobCategory.MISC) ENTITY_TYPES.register("tnt_blackhole", () -> EntityType.Builder.<blackHolePrimedTNT>of(blackHolePrimedTNT::new, MobCategory.MISC)
@@ -20,7 +20,7 @@ public class dynamite extends basePrimedTNT {
} }
public dynamite(EntityType<dynamite> entityType, Level level) { public dynamite(EntityType<dynamite> entityType, Level level) {
super(entityType, level); super(entityType, level, null);
} }
@Override @Override
@@ -31,7 +31,7 @@ public class dynamite extends basePrimedTNT {
Vec3 beforeMove = getDeltaMovement(); Vec3 beforeMove = getDeltaMovement();
this.move(MoverType.SELF, this.getDeltaMovement()); this.move(MoverType.SELF, this.getDeltaMovement());
this.setDeltaMovement(this.getDeltaMovement().scale(0.98D)); this.setDeltaMovement(this.getDeltaMovement().scale(0.98D));
if (this.onGround) { if (this.onGround()) {
this.setDeltaMovement(this.getDeltaMovement().multiply(0.7D, 0, 0.7D).add(0, (-beforeMove.y) * 0.5, 0)); this.setDeltaMovement(this.getDeltaMovement().multiply(0.7D, 0, 0.7D).add(0, (-beforeMove.y) * 0.5, 0));
} }
@@ -57,7 +57,7 @@ public class dynamite extends basePrimedTNT {
Vec3 vec = new Vec3(f, f1, f2).multiply(pVelocity, pVelocity, pVelocity); Vec3 vec = new Vec3(f, f1, f2).multiply(pVelocity, pVelocity, pVelocity);
this.setDeltaMovement(vec); this.setDeltaMovement(vec);
Vec3 vec3 = pShooter.getDeltaMovement(); Vec3 vec3 = pShooter.getDeltaMovement();
this.setDeltaMovement(this.getDeltaMovement().add(vec3.x, pShooter.isOnGround() ? 0.0D : vec3.y, vec3.z)); this.setDeltaMovement(this.getDeltaMovement().add(vec3.x, pShooter.onGround() ? 0.0D : vec3.y, vec3.z));
} }
public Block renderBlock() { public Block renderBlock() {
@@ -1,7 +1,6 @@
package com.jenny.enhancedexplosives.entities.tnt; package com.jenny.enhancedexplosives.entities.tnt;
import com.jenny.enhancedexplosives.entities.entities; import com.jenny.enhancedexplosives.entities.entities;
import com.jenny.enhancedexplosives.util;
import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
@@ -15,11 +14,11 @@ public class ClusterPrimedTNT extends basePrimedTNT {
public ClusterPrimedTNT (Level pLevel, double pX, double pY, double pZ, @Nullable LivingEntity pOwner, float power, int fuse, Vec3 move) { public ClusterPrimedTNT (Level pLevel, double pX, double pY, double pZ, @Nullable LivingEntity pOwner, float power, int fuse, Vec3 move) {
super(entities.TNT_CLUSTER.get(), pLevel, pOwner, new Vec3(pX, pY, pZ), fuse, power); super(entities.TNT_CLUSTER.get(), pLevel, pOwner, new Vec3(pX, pY, pZ), fuse, power);
util.addDeltaMovement(this, move); this.addDeltaMovement(move);
} }
public ClusterPrimedTNT(EntityType<ClusterPrimedTNT> entityType, Level level) { public ClusterPrimedTNT(EntityType<ClusterPrimedTNT> entityType, Level level) {
super(entityType, level); super(entityType, level, null);
} }
@Override @Override
@@ -3,7 +3,6 @@ package com.jenny.enhancedexplosives.entities.tnt;
import com.jenny.enhancedexplosives.blocks.blocks; import com.jenny.enhancedexplosives.blocks.blocks;
import com.jenny.enhancedexplosives.entities.entities; import com.jenny.enhancedexplosives.entities.entities;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.BlockGetter;
@@ -31,12 +30,12 @@ public class EntityPrimedTNT extends basePrimedTNT {
} }
public EntityPrimedTNT(EntityType<EntityPrimedTNT> entityType, Level level) { public EntityPrimedTNT(EntityType<EntityPrimedTNT> entityType, Level level) {
super(entityType, level); super(entityType, level, null);
} }
@Override @Override
protected void explode() { protected void explode() {
noEntityExplosionCalculator dmgCalc = new noEntityExplosionCalculator(); noEntityExplosionCalculator dmgCalc = new noEntityExplosionCalculator();
this.level().explode(this, DamageSource.explosion(getOwner()), dmgCalc, getX(), getY(), getZ(), getPower(), false, Explosion.BlockInteraction.BREAK); this.level().explode(this, null, dmgCalc, position(), getPower(), false, Level.ExplosionInteraction.TNT);
} }
public BlockPos getBlockBelow() { public BlockPos getBlockBelow() {
@@ -17,7 +17,7 @@ public class StrongerPrimedTNT extends basePrimedTNT {
} }
public StrongerPrimedTNT(EntityType<StrongerPrimedTNT> entityType, Level level) { public StrongerPrimedTNT(EntityType<StrongerPrimedTNT> entityType, Level level) {
super(entityType, level); super(entityType, level, null);
} }
@Override @Override
@@ -3,13 +3,10 @@ package com.jenny.enhancedexplosives.entities.tnt;
import com.jenny.enhancedexplosives.config.ConfigClient; import com.jenny.enhancedexplosives.config.ConfigClient;
import net.minecraft.core.particles.ParticleTypes; import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.protocol.Packet;
import net.minecraft.network.protocol.game.ClientboundAddEntityPacket;
import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.EntityDataSerializers;
import net.minecraft.network.syncher.SynchedEntityData; import net.minecraft.network.syncher.SynchedEntityData;
import net.minecraft.world.entity.*; import net.minecraft.world.entity.*;
import net.minecraft.world.level.Explosion;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.Blocks;
@@ -18,7 +15,7 @@ import org.jetbrains.annotations.NotNull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
public abstract class basePrimedTNT extends Entity { public abstract class basePrimedTNT extends Entity implements TraceableEntity {
private static final EntityDataAccessor<Integer> DATA_FUSE_ID = SynchedEntityData.defineId(basePrimedTNT.class, EntityDataSerializers.INT); private static final EntityDataAccessor<Integer> DATA_FUSE_ID = SynchedEntityData.defineId(basePrimedTNT.class, EntityDataSerializers.INT);
private static final EntityDataAccessor<Float> DATA_POWER_ID = SynchedEntityData.defineId(basePrimedTNT.class, EntityDataSerializers.FLOAT); private static final EntityDataAccessor<Float> DATA_POWER_ID = SynchedEntityData.defineId(basePrimedTNT.class, EntityDataSerializers.FLOAT);
@@ -26,26 +23,30 @@ public abstract class basePrimedTNT extends Entity {
private LivingEntity owner; private LivingEntity owner;
private int fuse = 0; private int fuse = 0;
public basePrimedTNT(EntityType<? extends basePrimedTNT> pEntityType, @NotNull Level pLevel) { public basePrimedTNT(EntityType<? extends basePrimedTNT> pEntityType, @NotNull Level pLevel, @Nullable LivingEntity owner) {
super(pEntityType, pLevel); super(pEntityType, pLevel);
this.blocksBuilding = true; this.blocksBuilding = true;
this.setOwner(owner);
this.fuse = getFuse();
} }
public basePrimedTNT(EntityType<? extends basePrimedTNT> pEntityType, @NotNull Level pLevel, @Nullable LivingEntity owner, Vec3 pos, int fuse, float power) { public basePrimedTNT(EntityType<? extends basePrimedTNT> pEntityType, @NotNull Level pLevel, @Nullable LivingEntity owner, Vec3 pos, int fuse, float power) {
this(pEntityType, pLevel); super(pEntityType, pLevel);
setPos(pos); this.blocksBuilding = true;
this.setOwner(owner);
double d0 = pLevel.random.nextDouble() * (double) ((float) Math.PI * 2F); 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.setDeltaMovement(-Math.sin(d0) * 0.02D, (double) 0.2F, -Math.cos(d0) * 0.02D);
this.setOwner(owner); xo = pos.x;
this.xo = pos.x; yo = pos.y;
this.yo = pos.y; zo = pos.z;
this.zo = pos.z; setPos(pos);
setFuse(fuse); setFuse(fuse);
setPower(power); setPower(power);
this.fuse = getFuse();
} }
protected void explode() { protected void explode() {
this.level().explode(this, this.getX(), this.getY(0.0625D), this.getZ(), this.getPower(), Explosion.BlockInteraction.BREAK); this.level().explode(this, this.getX(), this.getY(0.0625D), this.getZ(), this.getPower(), Level.ExplosionInteraction.TNT);
} }
public int getFuse() { public int getFuse() {
@@ -65,13 +66,6 @@ public abstract class basePrimedTNT extends Entity {
} }
public void tick() { public void tick() {
if (!level().isClientSide) {
System.out.println("Server: " + tickCount + "|x=" + (getX() - 0.5F) + "|y=" + getY() + "|z=" + (getZ() - 0.5F));
} else {
System.out.println("Client: " + tickCount + "|x=" + (getX() - 0.5F) + "|y=" + getY() + "|z=" + (getZ() - 0.5F));
}
if (level().isClientSide) { if (level().isClientSide) {
if (ConfigClient.tntParticles.get()) { if (ConfigClient.tntParticles.get()) {
spawnParticles(); spawnParticles();
@@ -83,7 +77,7 @@ public abstract class basePrimedTNT extends Entity {
this.move(MoverType.SELF, this.getDeltaMovement()); this.move(MoverType.SELF, this.getDeltaMovement());
this.setDeltaMovement(this.getDeltaMovement().scale(0.98D)); this.setDeltaMovement(this.getDeltaMovement().scale(0.98D));
if (this.onGround) { if (this.onGround()) {
this.setDeltaMovement(this.getDeltaMovement().multiply(0.7D, -0.5D, 0.7D)); this.setDeltaMovement(this.getDeltaMovement().multiply(0.7D, -0.5D, 0.7D));
} }
@@ -108,9 +102,10 @@ public abstract class basePrimedTNT extends Entity {
return MovementEmission.NONE; return MovementEmission.NONE;
} }
protected void defineSynchedData() { @Override
this.entityData.define(DATA_FUSE_ID, 80); protected void defineSynchedData(SynchedEntityData.@NotNull Builder builder) {
this.entityData.define(DATA_POWER_ID, 4.0f); builder.define(DATA_FUSE_ID, 80);
builder.define(DATA_POWER_ID, 4.0f);
} }
protected void addAdditionalSaveData(CompoundTag pCompound) { protected void addAdditionalSaveData(CompoundTag pCompound) {
@@ -147,12 +142,4 @@ public abstract class basePrimedTNT extends Entity {
public void spawnParticles() { public void spawnParticles() {
level().addParticle(ParticleTypes.SMOKE, getX(), getY(), getZ(), 0, 0, 0); level().addParticle(ParticleTypes.SMOKE, getX(), getY(), getZ(), 0, 0, 0);
} }
public Level level() {
return level;
}
public Packet<?> getAddEntityPacket() {
return new ClientboundAddEntityPacket(this);
}
} }
@@ -3,7 +3,6 @@ package com.jenny.enhancedexplosives.entities.tnt;
import com.jenny.enhancedexplosives.blocks.blocks; import com.jenny.enhancedexplosives.blocks.blocks;
import com.jenny.enhancedexplosives.entities.entities; import com.jenny.enhancedexplosives.entities.entities;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.BlockGetter;
@@ -31,12 +30,12 @@ public class bedrockPrimedTNT extends basePrimedTNT {
} }
public bedrockPrimedTNT(EntityType<bedrockPrimedTNT> entityType, Level level) { public bedrockPrimedTNT(EntityType<bedrockPrimedTNT> entityType, Level level) {
super(entityType, level); super(entityType, level, null);
} }
@Override @Override
protected void explode() { protected void explode() {
noExplosionCalculator dmgCalc = new noExplosionCalculator(); noExplosionCalculator dmgCalc = new noExplosionCalculator();
this.level().explode(this, DamageSource.explosion(getOwner()), dmgCalc, getX(), getY(), getZ(), getPower(), false, Explosion.BlockInteraction.BREAK); this.level().explode(this, null, dmgCalc, position(), getPower(), false, Level.ExplosionInteraction.TNT);
explodeBelow(); explodeBelow();
} }
@@ -2,7 +2,6 @@ package com.jenny.enhancedexplosives.entities.tnt;
import com.jenny.enhancedexplosives.blocks.blocks; import com.jenny.enhancedexplosives.blocks.blocks;
import com.jenny.enhancedexplosives.entities.entities; import com.jenny.enhancedexplosives.entities.entities;
import com.jenny.enhancedexplosives.util;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.EntityDataSerializers;
@@ -14,6 +13,7 @@ import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.List; import java.util.List;
@@ -27,7 +27,7 @@ public class blackHolePrimedTNT extends basePrimedTNT {
} }
public blackHolePrimedTNT(EntityType<blackHolePrimedTNT> entityType, Level level) { public blackHolePrimedTNT(EntityType<blackHolePrimedTNT> entityType, Level level) {
super(entityType, level); super(entityType, level, null);
this.setSpeed(this.getSpeed()); this.setSpeed(this.getSpeed());
} }
@@ -60,7 +60,7 @@ public class blackHolePrimedTNT extends basePrimedTNT {
@Override @Override
public void tick() { public void tick() {
for (Entity e : findTargets()) { for (Entity e : findTargets()) {
util.addDeltaMovement(e, targetVector(e)); e.addDeltaMovement(targetVector(e));
} }
super.tick(); super.tick();
} }
@@ -86,9 +86,9 @@ public class blackHolePrimedTNT extends basePrimedTNT {
} }
@Override @Override
protected void defineSynchedData() { protected void defineSynchedData(SynchedEntityData.@NotNull Builder builder) {
this.entityData.define(DATA_SPEED_ID, 4.0f); builder.define(DATA_SPEED_ID, 4.0f);
super.defineSynchedData(); super.defineSynchedData(builder);
} }
@Override @Override
@@ -14,6 +14,7 @@ import net.minecraft.world.entity.projectile.Projectile;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
@@ -26,7 +27,7 @@ public class claymorePrimedTNT extends basePrimedTNT {
} }
public claymorePrimedTNT(EntityType<claymorePrimedTNT> entityType, Level level) { public claymorePrimedTNT(EntityType<claymorePrimedTNT> entityType, Level level) {
super(entityType, level); super(entityType, level, null);
} }
public Vec3 targetVector(RandomSource rng) { public Vec3 targetVector(RandomSource rng) {
@@ -42,12 +43,10 @@ public class claymorePrimedTNT extends basePrimedTNT {
RandomSource rng = level().getRandom(); RandomSource rng = level().getRandom();
for (int i = 0; i < getPCount(); i++) { for (int i = 0; i < getPCount(); i++) {
Vec3 target = targetVector(rng); Vec3 target = targetVector(rng);
Projectile e = new claymoreArrow(level()); assert this.getOwner() != null;
Projectile e = new claymoreArrow(level(), this.getOwner());
e.setPos(position().add(0, 0.5, 0)); e.setPos(position().add(0, 0.5, 0));
e.setDeltaMovement(target); e.setDeltaMovement(target);
if (getOwner() != null) {
e.setOwner(getOwner());
}
level().addFreshEntity(e); level().addFreshEntity(e);
} }
@@ -74,9 +73,9 @@ public class claymorePrimedTNT extends basePrimedTNT {
} }
@Override @Override
protected void defineSynchedData() { protected void defineSynchedData(SynchedEntityData.@NotNull Builder builder) {
this.entityData.define(DATA_PCOUNT_ID, 16); builder.define(DATA_PCOUNT_ID, 16);
super.defineSynchedData(); super.defineSynchedData(builder);
} }
@Override @Override
@@ -17,7 +17,7 @@ public class enderPrimedTNT extends basePrimedTNT {
} }
public enderPrimedTNT(EntityType<enderPrimedTNT> entityType, Level level) { public enderPrimedTNT(EntityType<enderPrimedTNT> entityType, Level level) {
super(entityType, level); super(entityType, level, null);
} }
public Block renderBlock() { public Block renderBlock() {
@@ -4,7 +4,6 @@ import com.jenny.enhancedexplosives.blocks.blocks;
import com.jenny.enhancedexplosives.config.ConfigClient; import com.jenny.enhancedexplosives.config.ConfigClient;
import com.jenny.enhancedexplosives.config.ConfigServer; import com.jenny.enhancedexplosives.config.ConfigServer;
import com.jenny.enhancedexplosives.entities.entities; import com.jenny.enhancedexplosives.entities.entities;
import com.jenny.enhancedexplosives.util;
import net.minecraft.core.particles.ParticleTypes; import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataAccessor;
@@ -17,6 +16,7 @@ import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.ArrayList; import java.util.ArrayList;
@@ -33,7 +33,7 @@ public class homingPrimedTNT extends basePrimedTNT {
} }
public homingPrimedTNT(EntityType<homingPrimedTNT> entityType, Level level) { public homingPrimedTNT(EntityType<homingPrimedTNT> entityType, Level level) {
super(entityType, level); super(entityType, level, null);
} }
private Vec3 targetVector() { private Vec3 targetVector() {
@@ -90,11 +90,7 @@ public class homingPrimedTNT extends basePrimedTNT {
findTarget(); findTarget();
} }
else { else {
if (getTargetDist() > 15) { if (getTargetDist() > 15) {target = null;} else {addDeltaMovement(targetVector());}
target = null;
} else {
util.addDeltaMovement(this, targetVector());
}
} }
super.tick(); super.tick();
@@ -121,9 +117,9 @@ public class homingPrimedTNT extends basePrimedTNT {
} }
@Override @Override
protected void defineSynchedData() { protected void defineSynchedData(SynchedEntityData.@NotNull Builder builder) {
this.entityData.define(DATA_SPEED_ID, 4.0f); builder.define(DATA_SPEED_ID, 4.0f);
super.defineSynchedData(); super.defineSynchedData(builder);
} }
@Override @Override
@@ -2,7 +2,6 @@ package com.jenny.enhancedexplosives.entities.tnt;
import com.jenny.enhancedexplosives.blocks.blocks; import com.jenny.enhancedexplosives.blocks.blocks;
import com.jenny.enhancedexplosives.entities.entities; import com.jenny.enhancedexplosives.entities.entities;
import com.jenny.enhancedexplosives.util;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.EntityDataSerializers;
@@ -14,6 +13,7 @@ import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.List; import java.util.List;
@@ -27,7 +27,7 @@ public class repulsivePrimedTNT extends basePrimedTNT {
} }
public repulsivePrimedTNT(EntityType<repulsivePrimedTNT> entityType, Level level) { public repulsivePrimedTNT(EntityType<repulsivePrimedTNT> entityType, Level level) {
super(entityType, level); super(entityType, level, null);
this.setSpeed(this.getSpeed()); this.setSpeed(this.getSpeed());
} }
@@ -53,7 +53,7 @@ public class repulsivePrimedTNT extends basePrimedTNT {
@Override @Override
public void tick() { public void tick() {
for (Entity e : findTargets()) { for (Entity e : findTargets()) {
util.addDeltaMovement(e, targetVector(e)); e.addDeltaMovement(targetVector(e));
} }
super.tick(); super.tick();
} }
@@ -61,7 +61,7 @@ public class repulsivePrimedTNT extends basePrimedTNT {
@Override @Override
public void explode() { public void explode() {
for (Entity e : findTargets()) { for (Entity e : findTargets()) {
util.addDeltaMovement(e, targetVector(e).scale(3)); e.addDeltaMovement(targetVector(e).scale(3));
} }
super.explode(); super.explode();
} }
@@ -87,9 +87,9 @@ public class repulsivePrimedTNT extends basePrimedTNT {
} }
@Override @Override
protected void defineSynchedData() { protected void defineSynchedData(SynchedEntityData.@NotNull Builder builder) {
this.entityData.define(DATA_SPEED_ID, 4.0f); builder.define(DATA_SPEED_ID, 4.0f);
super.defineSynchedData(); super.defineSynchedData(builder);
} }
@Override @Override
@@ -3,7 +3,6 @@ package com.jenny.enhancedexplosives.entities.tnt;
import com.jenny.enhancedexplosives.blocks.blocks; import com.jenny.enhancedexplosives.blocks.blocks;
import com.jenny.enhancedexplosives.entities.entities; import com.jenny.enhancedexplosives.entities.entities;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.BlockGetter;
@@ -35,12 +34,12 @@ public class selectivePrimedTNT extends basePrimedTNT {
} }
public selectivePrimedTNT(EntityType<selectivePrimedTNT> entityType, Level level) { public selectivePrimedTNT(EntityType<selectivePrimedTNT> entityType, Level level) {
super(entityType, level); super(entityType, level, null);
} }
@Override @Override
protected void explode() { protected void explode() {
SelectiveExplosionCalculator dmgCalc = new SelectiveExplosionCalculator(getBlock()); SelectiveExplosionCalculator dmgCalc = new SelectiveExplosionCalculator(getBlock());
this.level().explode(this, DamageSource.explosion(getOwner()), dmgCalc, getX(), getY(), getZ(), getPower(), false, Explosion.BlockInteraction.BREAK); this.level().explode(this, null, dmgCalc, position(), getPower(), false, Level.ExplosionInteraction.TNT);
} }
public String getBlock() { public String getBlock() {
@@ -11,7 +11,6 @@ import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.List; import java.util.List;
@@ -23,12 +22,12 @@ public abstract class ArrowAbstract extends ArrowItem {
} }
@Override @Override
public void appendHoverText(@NotNull ItemStack pStack, @Nullable Level pLevel, @NotNull List<Component> pTooltipComponents, @NotNull TooltipFlag pIsAdvanced) { public void appendHoverText(@NotNull ItemStack pStack, @NotNull TooltipContext pContext, @NotNull List<Component> pTooltipComponents, @NotNull TooltipFlag pTooltipFlag) {
String key = String.format("tooltip.%s.%s", MODID, this); String key = String.format("tooltip.%s.%s", MODID, this);
MutableComponent toolTip = Component.translatable(key); MutableComponent toolTip = Component.translatable(key);
if (!toolTip.getString().equals(key)) { if (!toolTip.getString().equals(key)) {
pTooltipComponents.add(toolTip.withStyle(ChatFormatting.DARK_BLUE)); pTooltipComponents.add(toolTip.withStyle(ChatFormatting.DARK_BLUE));
super.appendHoverText(pStack, pLevel, pTooltipComponents, pIsAdvanced); super.appendHoverText(pStack, pContext, pTooltipComponents, pTooltipFlag);
} }
} }
@@ -7,10 +7,8 @@ import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.Item; import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.List; import java.util.List;
@@ -22,12 +20,12 @@ public class BlockItemTooltip extends BlockItem {
} }
@Override @Override
public void appendHoverText(@NotNull ItemStack pStack, @Nullable Level pLevel, @NotNull List<Component> pTooltipComponents, @NotNull TooltipFlag pIsAdvanced) { public void appendHoverText(@NotNull ItemStack pStack, @NotNull TooltipContext pContext, @NotNull List<Component> pTooltipComponents, @NotNull TooltipFlag pTooltipFlag) {
String key = String.format("tooltip.%s.%s", MODID, this); String key = String.format("tooltip.%s.%s", MODID, this);
MutableComponent toolTip = Component.translatable(key); MutableComponent toolTip = Component.translatable(key);
if (!toolTip.getString().equals(key)) { if (!toolTip.getString().equals(key)) {
pTooltipComponents.add(toolTip.withStyle(ChatFormatting.DARK_BLUE)); pTooltipComponents.add(toolTip.withStyle(ChatFormatting.DARK_BLUE));
super.appendHoverText(pStack, pLevel, pTooltipComponents, pIsAdvanced); super.appendHoverText(pStack, pContext, pTooltipComponents, pTooltipFlag);
} }
} }
} }
@@ -13,7 +13,6 @@ import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.List; import java.util.List;
@@ -43,12 +42,12 @@ public class Dynamite extends Item {
} }
@Override @Override
public void appendHoverText(@NotNull ItemStack pStack, @Nullable Level pLevel, @NotNull List<Component> pTooltipComponents, @NotNull TooltipFlag pIsAdvanced) { public void appendHoverText(@NotNull ItemStack pStack, @NotNull TooltipContext pContext, @NotNull List<Component> pTooltipComponents, @NotNull TooltipFlag pTooltipFlag) {
String key = String.format("tooltip.%s.%s", MODID, this); String key = String.format("tooltip.%s.%s", MODID, this);
MutableComponent toolTip = Component.translatable(key); MutableComponent toolTip = Component.translatable(key);
if (!toolTip.getString().equals(key)) { if (!toolTip.getString().equals(key)) {
pTooltipComponents.add(toolTip.withStyle(ChatFormatting.DARK_BLUE)); pTooltipComponents.add(toolTip.withStyle(ChatFormatting.DARK_BLUE));
super.appendHoverText(pStack, pLevel, pTooltipComponents, pIsAdvanced); super.appendHoverText(pStack, pContext, pTooltipComponents, pTooltipFlag);
} }
} }
} }
@@ -1,16 +1,18 @@
package com.jenny.enhancedexplosives.items; package com.jenny.enhancedexplosives.items;
import com.jenny.enhancedexplosives.entities.arrows.baseArrow;
import com.jenny.enhancedexplosives.entities.entities; import com.jenny.enhancedexplosives.entities.entities;
import net.minecraft.core.Direction;
import net.minecraft.core.Position; import net.minecraft.core.Position;
import net.minecraft.core.dispenser.AbstractProjectileDispenseBehavior; import net.minecraft.core.dispenser.BlockSource;
import net.minecraft.core.dispenser.DefaultDispenseItemBehavior;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.projectile.AbstractArrow;
import net.minecraft.world.entity.projectile.Projectile;
import net.minecraft.world.item.Item; import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.ProjectileItem;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.DispenserBlock; import net.minecraft.world.level.block.DispenserBlock;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.ForgeRegistries;
@@ -18,42 +20,53 @@ import net.minecraftforge.registries.RegistryObject;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import static com.jenny.enhancedexplosives.EnhancedExplosives.MODID; import static com.jenny.enhancedexplosives.EnhancedExplosives.MODID;
import static com.jenny.enhancedexplosives.creativeTab.CREATIVE_MODE_TAB;
public class items { public class items {
public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, MODID); public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, MODID);
public static final RegistryObject<Item> TNT_ARROW = ITEMS.register("arrow_tnt", () -> new ArrowTNT(new Item.Properties())); public static final RegistryObject<Item> TNT_ARROW = ITEMS.register("arrow_tnt", () -> new ArrowTNT(new Item.Properties()));
public static final RegistryObject<Item> CONCUSSIVE_ARROW = ITEMS.register("arrow_concussive", () -> new ArrowConcussive(new Item.Properties().tab(CREATIVE_MODE_TAB))); public static final RegistryObject<Item> CONCUSSIVE_ARROW = ITEMS.register("arrow_concussive", () -> new ArrowConcussive(new Item.Properties()));
public static final RegistryObject<Item> CARPET_ARROW = ITEMS.register("arrow_carpet", () -> new ArrowCarpet(new Item.Properties().tab(CREATIVE_MODE_TAB))); public static final RegistryObject<Item> CARPET_ARROW = ITEMS.register("arrow_carpet", () -> new ArrowCarpet(new Item.Properties()));
public static final RegistryObject<Item> TUNNEL_ARROW = ITEMS.register("arrow_tunnel", () -> new ArrowTunnel(new Item.Properties().tab(CREATIVE_MODE_TAB))); public static final RegistryObject<Item> TUNNEL_ARROW = ITEMS.register("arrow_tunnel", () -> new ArrowTunnel(new Item.Properties()));
public static final RegistryObject<Item> DYNAMITE = ITEMS.register("dynamite", () -> new Dynamite(new Item.Properties().tab(CREATIVE_MODE_TAB))); public static final RegistryObject<Item> DYNAMITE = ITEMS.register("dynamite", () -> new Dynamite(new Item.Properties()));
public static void register(IEventBus bus) { public static void register(IEventBus bus) {
ITEMS.register(bus); ITEMS.register(bus);
} }
public static void registerDispenser() { public static void registerDispenser() {
class ArrowDispenseBehaviour extends AbstractProjectileDispenseBehavior { class ArrowDispenseBehaviour extends DefaultDispenseItemBehavior {
private final EntityType<? extends baseArrow> arrowType; private final ArrowAbstract.DispenseConfig dispenseConfig;
private final EntityType<? extends Entity> arrowType;
public ArrowDispenseBehaviour(EntityType<? extends baseArrow> arrow) { public ArrowDispenseBehaviour(@NotNull ProjectileItem arrowItem, EntityType<? extends Entity> arrow) {
this.dispenseConfig = arrowItem.createDispenseConfig();
this.arrowType = arrow; this.arrowType = arrow;
} }
@Override @Override
protected @NotNull Projectile getProjectile(@NotNull Level pLevel, @NotNull Position pPosition, @NotNull ItemStack pStack) { public @NotNull ItemStack execute(@NotNull BlockSource pBlockSource, @NotNull ItemStack pItem) {
baseArrow arrow = arrowType.create(pLevel); Level level = pBlockSource.level();
assert arrow != null; Direction dir = pBlockSource.state().getValue(DispenserBlock.FACING);
arrow.setPos(pPosition.x(), pPosition.y(), pPosition.z()); Position pos = this.dispenseConfig.positionFunction().getDispensePosition(pBlockSource, dir);
arrow.pickup = AbstractArrow.Pickup.ALLOWED;
return arrow; Entity arrowEntity = arrowType.create(level);
assert arrowEntity != null;
arrowEntity.setPos(new Vec3(pos.x(), pos.y(), pos.z()));
arrowEntity.setDeltaMovement(dir.getStepX(), dir.getStepY(), dir.getStepZ());
level.addFreshEntity(arrowEntity);
pItem.shrink(1);
return pItem;
} }
} }
DispenserBlock.registerBehavior(TNT_ARROW.get(), new ArrowDispenseBehaviour(entities.ARROW_TNT.get())); DispenserBlock.registerBehavior(TNT_ARROW.get(), new ArrowDispenseBehaviour(
DispenserBlock.registerBehavior(CONCUSSIVE_ARROW.get(), new ArrowDispenseBehaviour(entities.ARROW_CONCUSSIVE.get())); (ArrowAbstract) TNT_ARROW.get(), entities.ARROW_TNT.get()));
DispenserBlock.registerBehavior(CARPET_ARROW.get(), new ArrowDispenseBehaviour(entities.ARROW_CARPET.get())); DispenserBlock.registerBehavior(CONCUSSIVE_ARROW.get(), new ArrowDispenseBehaviour(
DispenserBlock.registerBehavior(TUNNEL_ARROW.get(), new ArrowDispenseBehaviour(entities.ARROW_TUNNEL.get())); (ArrowAbstract) TNT_ARROW.get(), entities.ARROW_CONCUSSIVE.get()));
DispenserBlock.registerBehavior(CARPET_ARROW.get(), new ArrowDispenseBehaviour(
(ArrowAbstract) CARPET_ARROW.get(), entities.ARROW_CARPET.get()));
DispenserBlock.registerBehavior(TUNNEL_ARROW.get(), new ArrowDispenseBehaviour(
(ArrowAbstract) TUNNEL_ARROW.get(), entities.ARROW_TUNNEL.get()));
} }
} }
@@ -1,10 +0,0 @@
package com.jenny.enhancedexplosives;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.phys.Vec3;
public class util {
public static void addDeltaMovement(Entity entity, Vec3 movement) {
entity.setDeltaMovement(movement.add(entity.getDeltaMovement()));
}
}
-12
View File
@@ -22,15 +22,3 @@ mandatory = true
versionRange = "${minecraft_version_range}" versionRange = "${minecraft_version_range}"
ordering = "NONE" ordering = "NONE"
side = "BOTH" side = "BOTH"
[[dependencies."${mod_id}"]]
modId = "gbook"
mandatory = false
versionRange = "[1.7.3,)"
ordering = "BEFORE"
side = "BOTH"
[[dependencies."${mod_id}"]]
modId = "patchouli"
mandatory = false
versionRange = "[1.0.6,)"
ordering = "BEFORE"
side = "BOTH"
@@ -1,160 +0,0 @@
<book title="Enhanced Explosives">
<!--> Template files are bugged till gbook 3.7.2 <-->
<template id="page_title" height="43" mode="flow">
<p align="center"><image src="gbook:gui/book" w="120" h="7" tx="50" ty="10"/></p>
<space height="4"/>
<element index="0" align="center" scale="1.5"/> <!-- Intended use with one-line paragraph -->
<p align="center"><image src="gbook:gui/book" w="120" h="7" tx="50" ty="10"/></p>
</template>
<chapter id="ch_landing">
<section id="se_landing">
<page_title>
<title>Content</title>
</page_title>
<title>TNTs</title>
<link ref=":se_compressed_tnt">Compressed TNT</link>
<link ref=":se_cluster_tnt">Cluster TNT</link>
<link ref=":se_homing_tnt">Homing TNT</link>
<link ref=":se_black_hole_tnt">Black Hole TNT</link>
<link ref=":se_claymore_tnt">Claymore TNT</link>
<link ref=":se_selective_tnt">Selective</link>
<link ref=":se_ender_tnt">Ender TNT</link>
<link ref=":se_repulsive_tnt">Repulsive TNT</link>
<link ref=":se_bedrock_tnt">Bedrock TNT</link>
<link ref=":se_entity_tnt">Entity TNT</link>
<title>Arrows</title>
<link ref=":ch_tnt_arrow">TNT Arrow</link>
<link ref=":se_concussive_arrow">Concussive Arrow</link>
<link ref=":se_carpet_arrow">Carpet Bombing Arrow</link>
<link ref=":se_tunnel_arrow">Tunnel Arrow</link>
<title>Other</title>
<link ref=":se_dynamite">Dynamite</link>
</section>
</chapter>
<chapter id="ch_compressed_tnt">
<section id="se_compressed_tnt">
<page_title>
<title>Compressed TNT</title>
</page_title>
<p>These TNTs are stronger than vanilla TNT. They are crafted from 4 TNTs of the previous stage and offer
double the explosion strength.
</p>
</section>
</chapter>
<chapter id="ch_cluster_tnt">
<section id="se_cluster_tnt">
<page_title>
<title>Cluster TNT</title>
</page_title>
<p>These TNTs spawn multiple smaller TNTs when primed. Each spawned TNT is as strong as vanilla TNT.</p>
</section>
</chapter>
<chapter id="ch_homing_tnt">
<section id="se_homing_tnt">
<page_title>
<title>Homing TNT</title>
</page_title>
<p>This TNT targets the closest mob and moves towards it.</p>
</section>
</chapter>
<chapter id="ch_black_hole_tnt">
<section id="se_black_hole_tnt">
<page_title>
<title>Black Hole TNT</title>
</page_title>
<p>This TNT attracts close entities towards itself before exploding.</p>
</section>
</chapter>
<chapter id="ch_claymore_tnt">
<section id="se_claymore_tnt">
<page_title>
<title>Claymore TNT</title>
</page_title>
<p>This TNT shoots many arrows in a circle around the TNT, instead of exploding.</p>
</section>
</chapter>
<chapter id="ch_selective_tnt">
<section id="se_selective_tnt">
<page_title>
<title>Selective TNT</title>
</page_title>
<p>This TNT will only destroy the type of block it is sitting upon when exploding. It will still honour the
blocks blast resistance, e.g. it won't destroy bedrock.
</p>
</section>
</chapter>
<chapter id="ch_ender_tnt">
<section id="se_ender_tnt">
<page_title>
<title>Ender TNT</title>
</page_title>
<p>This TNT will teleport randomly teleport when primed.</p>
</section>
</chapter>
<chapter id="ch_repulsive_tnt">
<section id="se_repulsive_tnt">
<page_title>
<title>Repulsive TNT</title>
</page_title>
<p>This TNT will push entities away when primed.</p>
</section>
</chapter>
<chapter id="ch_bedrock_tnt">
<section id="se_bedrock_tnt">
<page_title>
<title>Bedrock TNT</title>
</page_title>
<p>This TNT will destroy the one bedrock block below it.</p>
</section>
</chapter>
<chapter id="ch_entity_tnt">
<section id="se_entity_tnt">
<page_title>
<title>Entity TNT</title>
</page_title>
<p>This TNT won't destroy blocks but hurt entities.</p>
</section>
</chapter>
<chapter id="ch_tnt_arrow">
<section id="se_tnt_arrow">
<page_title>
<title>TNT Arrow</title>
</page_title>
<p>This arrow explodes on impact with half the strength of TNT.</p>
</section>
</chapter>
<chapter id="ch_concussive_arrow">
<section id="se_concussive_arrow">
<page_title>
<title>TNT Arrow</title>
</page_title>
<p>This arrow explodes on impact without damaging blocks.</p>
</section>
</chapter>
<chapter id="ch_carpet_arrow">
<section id="se_carpet_arrow">
<page_title>
<title>Carpet Bombing Arrow</title>
</page_title>
<p>This arrow splits into many Concussive Arrows as soon as it starts falling.</p>
</section>
</chapter>
<chapter id="ch_tunnel_arrow">
<section id="se_tunnel_arrow">
<page_title>
<title>Tunnel Arrow</title>
</page_title>
<p>This arrow spawns multiple explosions in a line equivalent to its direction on hit.</p>
</section>
</chapter>
<chapter id="ch_dynamite">
<section id="se_dynamite">
<page_title>
<title>Dynamite</title>
</page_title>
<p>Dynamite can be thrown like a potion and explodes with the strength of vanilla TNT.</p>
</section>
</chapter>
</book>
@@ -1,6 +1,4 @@
{ {
"itemGroup.enhancedexplosives": "Enhanced Explosives",
"block.enhancedexplosives.tnt_8": "Compressed TNT", "block.enhancedexplosives.tnt_8": "Compressed TNT",
"block.enhancedexplosives.tnt_16": "Double Compressed TNT", "block.enhancedexplosives.tnt_16": "Double Compressed TNT",
"block.enhancedexplosives.tnt_32": "Triple Compressed TNT", "block.enhancedexplosives.tnt_32": "Triple Compressed TNT",
@@ -1,5 +0,0 @@
{
"name": "Arrows",
"description": "These are all new arrows",
"icon": "minecraft:arrow"
}
@@ -1,5 +0,0 @@
{
"name": "Others",
"description": "Some other new stuff",
"icon": "minecraft:bedrock"
}
@@ -1,5 +0,0 @@
{
"name": "TNTs",
"description": "These are all new TNTs",
"icon": "minecraft:tnt"
}
@@ -1,12 +0,0 @@
{
"name": "Carpet Bombing Arrow",
"icon": "enhancedexplosives:arrow_carpet",
"category": "enhancedexplosives:arrows",
"pages": [
{
"type": "patchouli:crafting",
"text": "This arrow splits into many explosive arrows as soon as it starts falling. Whether the arrows are concussive or TNT Arrows depends on the config.",
"recipe": "enhancedexplosives:arrow_carpet"
}
]
}
@@ -1,12 +0,0 @@
{
"name": "Concussive Arrow",
"icon": "enhancedexplosives:arrow_concussive",
"category": "enhancedexplosives:arrows",
"pages": [
{
"type": "patchouli:crafting",
"text": "This arrow explodes like TNT on impact, but without damaging blocks.",
"recipe": "enhancedexplosives:arrow_concussive"
}
]
}
@@ -1,12 +0,0 @@
{
"name": "TNT Arrow",
"icon": "enhancedexplosives:arrow_tnt",
"category": "enhancedexplosives:arrows",
"pages": [
{
"type": "patchouli:crafting",
"text": "This arrow explodes like TNT on impact.",
"recipe": "enhancedexplosives:arrow_tnt"
}
]
}
@@ -1,12 +0,0 @@
{
"name": "Tunnel Arrow",
"icon": "enhancedexplosives:arrow_tunnel",
"category": "enhancedexplosives:arrows",
"pages": [
{
"type": "patchouli:crafting",
"text": "This arrow summons multiple explosions in front of it, along it's direction on impact, forming a tunnel in front.",
"recipe": "enhancedexplosives:arrow_tunnel"
}
]
}
@@ -1,12 +0,0 @@
{
"name": "Dynamite",
"icon": "enhancedexplosives:dynamite",
"category": "enhancedexplosives:other",
"pages": [
{
"type": "patchouli:crafting",
"text": "Can be thrown like a splash potion, but bounces on the ground and explodes like a tnt.",
"recipe": "enhancedexplosives:dynamite"
}
]
}
@@ -1,12 +0,0 @@
{
"name": "Quintuple Compressed TNT",
"icon": "enhancedexplosives:tnt_128",
"category": "enhancedexplosives:tnts",
"pages": [
{
"type": "patchouli:crafting",
"text": "This TNT behaves like vanilla TNT, but with 32x the explosion strength.",
"recipe": "enhancedexplosives:tnt_128"
}
]
}
@@ -1,12 +0,0 @@
{
"name": "Double Compressed TNT",
"icon": "enhancedexplosives:tnt_16",
"category": "enhancedexplosives:tnts",
"pages": [
{
"type": "patchouli:crafting",
"text": "This TNT behaves like vanilla TNT, but with 4x the explosion strength.",
"recipe": "enhancedexplosives:tnt_16"
}
]
}
@@ -1,12 +0,0 @@
{
"name": "Triple Compressed TNT",
"icon": "enhancedexplosives:tnt_32",
"category": "enhancedexplosives:tnts",
"pages": [
{
"type": "patchouli:crafting",
"text": "This TNT behaves like vanilla TNT, but with 8x the explosion strength.",
"recipe": "enhancedexplosives:tnt_32"
}
]
}
@@ -1,12 +0,0 @@
{
"name": "Quadruple Compressed TNT",
"icon": "enhancedexplosives:tnt_64",
"category": "enhancedexplosives:tnts",
"pages": [
{
"type": "patchouli:crafting",
"text": "This TNT behaves like vanilla TNT, but with 16x the explosion strength.",
"recipe": "enhancedexplosives:tnt_64"
}
]
}
@@ -1,12 +0,0 @@
{
"name": "Compressed TNT",
"icon": "enhancedexplosives:tnt_8",
"category": "enhancedexplosives:tnts",
"pages": [
{
"type": "patchouli:crafting",
"text": "This TNT behaves like vanilla TNT, but with 2x the explosion strength.",
"recipe": "enhancedexplosives:tnt_8"
}
]
}
@@ -1,12 +0,0 @@
{
"name": "Bedrock TNT",
"icon": "enhancedexplosives:tnt_bedrock",
"category": "enhancedexplosives:tnts",
"pages": [
{
"type": "patchouli:crafting",
"text": "This TNT removes the block below it if it's bedrock.",
"recipe": "enhancedexplosives:tnt_bedrock"
}
]
}
@@ -1,12 +0,0 @@
{
"name": "Black Hole TNT",
"icon": "enhancedexplosives:tnt_black_hole",
"category": "enhancedexplosives:tnts",
"pages": [
{
"type": "patchouli:crafting",
"text": "This TNT pulls entities towards itself.",
"recipe": "enhancedexplosives:tnt_black_hole"
}
]
}
@@ -1,12 +0,0 @@
{
"name": "Claymore TNT",
"icon": "enhancedexplosives:tnt_claymore",
"category": "enhancedexplosives:tnts",
"pages": [
{
"type": "patchouli:crafting",
"text": "This TNT shoots many arrows in a circle around the TNT, instead of exploding.",
"recipe": "enhancedexplosives:tnt_claymore"
}
]
}
@@ -1,12 +0,0 @@
{
"name": "2× TNT Cluster",
"icon": "enhancedexplosives:tnt_cluster_2",
"category": "enhancedexplosives:tnts",
"pages": [
{
"type": "patchouli:crafting",
"text": "This TNT splits into 2 smaller TNTs when primed",
"recipe": "enhancedexplosives:tnt_cluster_2"
}
]
}
@@ -1,12 +0,0 @@
{
"name": "4× TNT Cluster",
"icon": "enhancedexplosives:tnt_cluster_4",
"category": "enhancedexplosives:tnts",
"pages": [
{
"type": "patchouli:crafting",
"text": "This TNT splits into 4 smaller TNTs when primed",
"recipe": "enhancedexplosives:tnt_cluster_4"
}
]
}
@@ -1,12 +0,0 @@
{
"name": "8× TNT Cluster",
"icon": "enhancedexplosives:tnt_cluster_8",
"category": "enhancedexplosives:tnts",
"pages": [
{
"type": "patchouli:crafting",
"text": "This TNT splits into 8 smaller TNTs when primed",
"recipe": "enhancedexplosives:tnt_cluster_8"
}
]
}
@@ -1,12 +0,0 @@
{
"name": "Ender TNT",
"icon": "enhancedexplosives:tnt_ender",
"category": "enhancedexplosives:tnts",
"pages": [
{
"type": "patchouli:crafting",
"text": "This TNT teleports like an enderman when primed.",
"recipe": "enhancedexplosives:tnt_ender"
}
]
}
@@ -1,12 +0,0 @@
{
"name": "Entity TNT",
"icon": "enhancedexplosives:tnt_entity",
"category": "enhancedexplosives:tnts",
"pages": [
{
"type": "patchouli:crafting",
"text": "This TNT does not damage blocks.",
"recipe": "enhancedexplosives:tnt_entity"
}
]
}
@@ -1,12 +0,0 @@
{
"name": "Homing TNT",
"icon": "enhancedexplosives:tnt_homing",
"category": "enhancedexplosives:tnts",
"pages": [
{
"type": "patchouli:crafting",
"text": "This TNT follows the closest mob.",
"recipe": "enhancedexplosives:tnt_homing"
}
]
}
@@ -1,12 +0,0 @@
{
"name": "Repulsive TNT",
"icon": "enhancedexplosives:tnt_repulsive",
"category": "enhancedexplosives:tnts",
"pages": [
{
"type": "patchouli:crafting",
"text": "This TNT pushes close entities away.",
"recipe": "enhancedexplosives:tnt_repulsive"
}
]
}
@@ -1,12 +0,0 @@
{
"name": "Selective TNT",
"icon": "enhancedexplosives:tnt_selective",
"category": "enhancedexplosives:tnts",
"pages": [
{
"type": "patchouli:crafting",
"text": "This TNT will only destroy the type of block it is sitting upon when exploding. It will still honour the blocks blast resistance, e.g. it won't destroy bedrock.",
"recipe": "enhancedexplosives:tnt_selective"
}
]
}
@@ -1,7 +0,0 @@
{
"name": "EE Manual",
"landing_text": "If you find bugs or have suggestions for improving this mod, please message me on curseforge, my discord, or gitea (link in mod info).",
"version": 1,
"creative_tab": "enhancedexplosives:enhancedexplosives",
"use_resource_pack": true
}