Compare commits

...

4 Commits

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

View File

@ -1,8 +1,13 @@
# For info on the mod go to either
* [the wiki](https://git.smthng.de/Jenny/Enhanced-Explosives/wiki)
* [modrinth](https://modrinth.com/mod/enhanced-explosives)
* [curseforge](https://www.curseforge.com/minecraft/mc-mods/enhanced-explosives)
* in-game wiki (guidebook & patchouli)
# How to run the mod in an IDE
* If you use Intellij, you can import the project from git
* You will have to run "runData" once, else textures will be missing
# How to run / build the mod in an IDE
* git clone the project
* run the _runData_ gradle task, it generates the item & block models
* the data generation only works in versions =>1.20.1, as I didn't backport it. If you want to build the
mod for versions before that, you can run the _runData_ gradle task in the 1.20.1 branch and switch back to the
branch for your desired version
* run _runClient_ to start a minecraft session, or run _jar_ to generate a .jar file of the mod (located at _.
/build/reobfJar/output.jar_)

View File

@ -14,7 +14,7 @@ base {
}
java {
toolchain.languageVersion = JavaLanguageVersion.of(17)
toolchain.languageVersion = JavaLanguageVersion.of(21)
}
minecraft {
@ -77,22 +77,22 @@ minecraft {
// You can set various levels here.
// Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
property 'forge.logging.console.level', 'debug'
mods {
"${mod_id}" {
source sourceSets.main
}
}
}
client {
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
property 'forge.enabledGameTestNamespaces', mod_id
// fixes patchouli mixin error
property 'mixin.env.remapRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
}
server {
property 'forge.enabledGameTestNamespaces', mod_id
args '--nogui'
// fixes patchouli mixin error
property 'mixin.env.remapRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
}
// This run config launches GameTestServer and runs all registered gametests, then exits.
@ -108,6 +108,10 @@ minecraft {
// Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
// fixes patchouli mixin error
property 'mixin.env.remapRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
}
}
}
@ -116,39 +120,18 @@ minecraft {
sourceSets.main.resources { srcDir 'src/generated/resources' }
repositories {
// Put repositories for dependencies here
// ForgeGradle automatically adds the Forge maven and Maven Central for you
// If you have mod jar dependencies in ./libs, you can declare them as a repository like so.
// See https://docs.gradle.org/current/userguide/declaring_repositories.html#sub:flat_dir_resolver
// flatDir {
// dir 'libs'
// }
maven {
url "https://cursemaven.com"
content {
includeGroup "curse.maven"
}
}
}
dependencies {
// Specify the version of Minecraft to use.
// Any artifact can be supplied so long as it has a "userdev" classifier artifact and is a compatible patcher artifact.
// The "userdev" classifier will be requested and setup by ForgeGradle.
// If the group id is "net.minecraft" and the artifact id is one of ["client", "server", "joined"],
// then special handling is done to allow a setup of a vanilla dependency without the use of an external repository.
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
// Example mod dependency with JEI - using fg.deobf() ensures the dependency is remapped to your development mappings
// The JEI API is declared for compile time use, while the full JEI artifact is used at runtime
// compileOnly fg.deobf("mezz.jei:jei-${mc_version}-common-api:${jei_version}")
// compileOnly fg.deobf("mezz.jei:jei-${mc_version}-forge-api:${jei_version}")
// runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}-forge:${jei_version}")
// Example mod dependency using a mod jar from ./libs with a flat dir repository
// This maps to ./libs/coolmod-${mc_version}-${coolmod_version}.jar
// The group id is ignored when searching -- in this case, it is "blank"
// implementation fg.deobf("blank:coolmod-${mc_version}:${coolmod_version}")
// For more info:
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
// http://www.gradle.org/docs/current/userguide/dependency_management.html
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.
@ -188,3 +171,9 @@ tasks.named('jar', Jar).configure {
tasks.withType(JavaCompile).configureEach {
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
}

View File

@ -1,18 +1,18 @@
org.gradle.jvmargs=-Xmx3G
# CreateCoredumpOnCrash only works on jdk9+
org.gradle.jvmargs=-Xmx3G -XX:-CreateCoredumpOnCrash
org.gradle.daemon=false
minecraft_version=1.20.1
minecraft_version_range=[1.20.1,1.20.2]
forge_version=47.3.22
forge_version_range=[47,)
loader_version_range=[47,)
minecraft_version=1.20.6
minecraft_version_range=[1.20.6]
forge_version=50.1.0
forge_version_range=[50,)
loader_version_range=[50,)
mapping_channel=parchment
mapping_version=2023.09.03-1.20.1
mapping_version=2024.06.16-1.20.6
mod_id=enhancedexplosives
mod_name=Enhanced Explosives
mod_license=All Rights Reserved
mod_version=0.13.2
mod_version=0.15.0
mod_group_id=com.jenny
mod_authors=Jenny
mod_authors=xJenny69
mod_description=strong & throwable explosives

View File

@ -1,16 +1,19 @@
package com.jenny.enhancedexplosives;
import com.jenny.enhancedexplosives.entities.entities;
import com.jenny.enhancedexplosives.particles.ArrowParticle;
import com.jenny.enhancedexplosives.particles.particles;
import net.minecraft.client.Minecraft;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.client.event.RegisterParticleProvidersEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import static com.jenny.enhancedexplosives.EnhancedExplosives.MODID;
@Mod.EventBusSubscriber(modid = MODID, bus = Mod.EventBusSubscriber.Bus.MOD)
public class eventBusEvents {
@Mod.EventBusSubscriber(modid = MODID, bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT)
public class ClientEvents {
@SubscribeEvent
public static void registerParticleFactories(final RegisterParticleProvidersEvent event) {
Minecraft.getInstance().particleEngine.register(particles.CONCUSSIVE_ARROW_PARTICLE.get(),
@ -22,4 +25,9 @@ public class eventBusEvents {
Minecraft.getInstance().particleEngine.register(particles.TUNNEL_ARROW_PARTICLE.get(),
ArrowParticle.Provider::new);
}
@SubscribeEvent
public static void onClientSetup(FMLClientSetupEvent event) {
entities.registerRenderers();
}
}

View File

@ -7,7 +7,6 @@ import com.jenny.enhancedexplosives.entities.entities;
import com.jenny.enhancedexplosives.items.items;
import com.jenny.enhancedexplosives.particles.particles;
import com.mojang.logging.LogUtils;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.server.ServerStartingEvent;
import net.minecraftforge.eventbus.api.IEventBus;
@ -15,7 +14,6 @@ import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.ModLoadingContext;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.config.ModConfig;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import org.slf4j.Logger;
@ -54,14 +52,4 @@ public class EnhancedExplosives {
public void onServerStarting(ServerStartingEvent event) {
}
// You can use EventBusSubscriber to automatically register all static methods in the class annotated with @SubscribeEvent
@Mod.EventBusSubscriber(modid = MODID, bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT)
public static class ClientModEvents {
@SubscribeEvent
public static void onClientSetup(FMLClientSetupEvent event) {
entities.registerRenderers();
}
}
}

View File

@ -0,0 +1,59 @@
package com.jenny.enhancedexplosives.blocks;
import com.jenny.enhancedexplosives.entities.tnt.bedrockPrimedTNT;
import com.jenny.enhancedexplosives.entities.tnt.selectivePrimedTNT;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.Explosion;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.TntBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.gameevent.GameEvent;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nullable;
public class bedrockTNTBlock extends TntBlock {
public final float pRadius;
public final int fuseTime;
public bedrockTNTBlock(Properties p_57422_, float pRadius, int fuseTime) {
super(p_57422_);
this.pRadius = pRadius;
this.fuseTime = fuseTime;
}
@Override
public void onCaughtFire(@NotNull BlockState state, @NotNull Level world, @NotNull BlockPos pos, @Nullable Direction face, @Nullable LivingEntity igniter) {
explode(world, pos, igniter, this.pRadius, this.fuseTime);
}
@Deprecated
public static void explode(Level p_57434_, BlockPos p_57435_, float pRadius, int fuseTime) {
explode(p_57434_, p_57435_, (LivingEntity)null, pRadius, fuseTime);
}
@Deprecated
private static void explode(Level p_57437_, BlockPos p_57438_, @Nullable LivingEntity p_57439_, float pRadius, int fuseTime) {
if (!p_57437_.isClientSide) {
bedrockPrimedTNT primedtnt = new bedrockPrimedTNT(p_57437_, (double)p_57438_.getX() + (double)0.5F, (double)p_57438_.getY(), (double)p_57438_.getZ() + (double)0.5F, p_57439_, pRadius, fuseTime);
p_57437_.addFreshEntity(primedtnt);
p_57437_.playSound((Player)null, primedtnt.getX(), primedtnt.getY(), primedtnt.getZ(), SoundEvents.TNT_PRIMED, SoundSource.BLOCKS, 1.0F, 1.0F);
p_57437_.gameEvent(p_57439_, GameEvent.PRIME_FUSE, p_57438_);
}
}
@Override
public void wasExploded(Level level, @NotNull BlockPos blockPos, @NotNull Explosion pExplosion) {
if (!level.isClientSide) {
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.getIndirectSourceEntity(), pRadius, ft);
level.addFreshEntity(primedtnt);
}
}
}

View File

@ -1,9 +1,9 @@
package com.jenny.enhancedexplosives.blocks;
import com.jenny.enhancedexplosives.items.BlockItemTooltip;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.material.MapColor;
import net.minecraftforge.eventbus.api.IEventBus;
@ -14,51 +14,59 @@ import net.minecraftforge.registries.RegistryObject;
import static com.jenny.enhancedexplosives.EnhancedExplosives.MODID;
public class blocks {
private static final BlockBehaviour.Properties DEFAULT_PROPS = BlockBehaviour.Properties.of().mapColor(MapColor.FIRE).instabreak().sound(SoundType.GRASS).ignitedByLava();
public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, 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(BlockBehaviour.Properties.of().mapColor(MapColor.STONE), 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()));
public static final RegistryObject<Block> TNT_16 = BLOCKS.register("tnt_16", () -> new strongerTNTBlock(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_RED), 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()));
public static final RegistryObject<Block> TNT_32 = BLOCKS.register("tnt_32", () -> new strongerTNTBlock(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_RED), 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()));
public static final RegistryObject<Block> TNT_64 = BLOCKS.register("tnt_64", () -> new strongerTNTBlock(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_RED), 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()));
public static final RegistryObject<Block> TNT_128 = BLOCKS.register("tnt_128", () -> new strongerTNTBlock(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_RED), 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()));
public static final RegistryObject<Block> TNT_CLUSTER_2 = BLOCKS.register("tnt_cluster_2", () -> new ClusterTNTBlock(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_RED), 4.0f, 80, 2, 10));
public static final RegistryObject<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()));
public static final RegistryObject<Block> TNT_CLUSTER_4 = BLOCKS.register("tnt_cluster_4", () -> new ClusterTNTBlock(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_RED), 4.0f, 80, 4, 10));
public static final RegistryObject<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()));
public static final RegistryObject<Block> TNT_CLUSTER_8 = BLOCKS.register("tnt_cluster_8", () -> new ClusterTNTBlock(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_RED), 4.0f, 80, 8, 10));
public static final RegistryObject<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()));
public static final RegistryObject<Block> TNT_HOMING = BLOCKS.register("tnt_homing", () -> new homingTNTBlock(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_RED), 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()));
public static final RegistryObject<Block> TNT_BLACK_HOLE = BLOCKS.register("tnt_black_hole", () -> new blackHoleTNTBlock(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_RED), 4.0f, 80, 1));
public static final RegistryObject<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()));
public static final RegistryObject<Block> TNT_CLAYMORE = BLOCKS.register("tnt_claymore", () -> new claymoreTNTBlock(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_RED), 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()));
public static final RegistryObject<Block> TNT_SELECTIVE = BLOCKS.register("tnt_selective", () -> new selectiveTNTBlock(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_RED), 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()));
public static final RegistryObject<Block> TNT_ENDER = BLOCKS.register("tnt_ender", () -> new enderTNTBlock(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_RED), 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()));
public static final RegistryObject<Block> TNT_REPULSIVE = BLOCKS.register("tnt_repulsive", () -> new repulsiveTNTBlock(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_RED), 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()));
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()));
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()));
public static void register(IEventBus bus) {
BLOCKS.register(bus);

View File

@ -0,0 +1,59 @@
package com.jenny.enhancedexplosives.blocks;
import com.jenny.enhancedexplosives.entities.tnt.EntityPrimedTNT;
import com.jenny.enhancedexplosives.entities.tnt.bedrockPrimedTNT;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.Explosion;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.TntBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.gameevent.GameEvent;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nullable;
public class entityTNTBlock extends TntBlock {
public final float pRadius;
public final int fuseTime;
public entityTNTBlock(Properties p_57422_, float pRadius, int fuseTime) {
super(p_57422_);
this.pRadius = pRadius;
this.fuseTime = fuseTime;
}
@Override
public void onCaughtFire(@NotNull BlockState state, @NotNull Level world, @NotNull BlockPos pos, @Nullable Direction face, @Nullable LivingEntity igniter) {
explode(world, pos, igniter, this.pRadius, this.fuseTime);
}
@Deprecated
public static void explode(Level p_57434_, BlockPos p_57435_, float pRadius, int fuseTime) {
explode(p_57434_, p_57435_, (LivingEntity)null, pRadius, fuseTime);
}
@Deprecated
private static void explode(Level p_57437_, BlockPos p_57438_, @Nullable LivingEntity p_57439_, float pRadius, int fuseTime) {
if (!p_57437_.isClientSide) {
EntityPrimedTNT primedtnt = new EntityPrimedTNT(p_57437_, (double)p_57438_.getX() + (double)0.5F, (double)p_57438_.getY(), (double)p_57438_.getZ() + (double)0.5F, p_57439_, pRadius, fuseTime);
p_57437_.addFreshEntity(primedtnt);
p_57437_.playSound((Player)null, primedtnt.getX(), primedtnt.getY(), primedtnt.getZ(), SoundEvents.TNT_PRIMED, SoundSource.BLOCKS, 1.0F, 1.0F);
p_57437_.gameEvent(p_57439_, GameEvent.PRIME_FUSE, p_57438_);
}
}
@Override
public void wasExploded(Level level, @NotNull BlockPos blockPos, @NotNull Explosion pExplosion) {
if (!level.isClientSide) {
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.getIndirectSourceEntity(), pRadius, ft);
level.addFreshEntity(primedtnt);
}
}
}

View File

@ -31,6 +31,8 @@ public class ModBlockStateProvider extends BlockStateProvider {
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);

View File

@ -5,7 +5,6 @@ import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.projectile.AbstractArrow;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.Level;
import net.minecraft.world.phys.Vec3;
import org.jetbrains.annotations.NotNull;
@ -14,15 +13,15 @@ public class baseArrow extends AbstractArrow {
private int tick = 0;
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) {
super(pEntityType, pShooter, pLevel);
super(pEntityType, pShooter, pLevel, ItemStack.EMPTY);
}
public baseArrow(Level pLevel, EntityType<? extends baseArrow> pEntityType) {
super(pEntityType, pLevel);
super(pEntityType, pLevel, ItemStack.EMPTY);
}
public void tick() {
@ -37,7 +36,12 @@ public class baseArrow extends AbstractArrow {
@NotNull
protected ItemStack getPickupItem() {
return new ItemStack(Items.ARROW);
return ItemStack.EMPTY;
}
@Override
protected ItemStack getDefaultPickupItem() {
return ItemStack.EMPTY;
}
protected Vec3 particlePos(double dist) {

View File

@ -2,15 +2,12 @@ package com.jenny.enhancedexplosives.entities.arrows;
import com.jenny.enhancedexplosives.config.ConfigClient;
import com.jenny.enhancedexplosives.entities.entities;
import com.jenny.enhancedexplosives.items.items;
import com.jenny.enhancedexplosives.particles.particles;
import net.minecraft.util.RandomSource;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraft.world.phys.Vec3;
import org.jetbrains.annotations.NotNull;
public class carpetArrow extends baseArrow {
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
public void spawnParticles(float partialTicks) {
for (int i = 1; i <= ConfigClient.calcPCount(5); i++) {

View File

@ -3,13 +3,11 @@ package com.jenny.enhancedexplosives.entities.arrows;
import com.jenny.enhancedexplosives.config.ConfigClient;
import com.jenny.enhancedexplosives.config.ConfigServer;
import com.jenny.enhancedexplosives.entities.entities;
import com.jenny.enhancedexplosives.items.items;
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.LivingEntity;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraft.world.phys.Vec3;
import org.jetbrains.annotations.NotNull;
@ -48,11 +46,6 @@ public class carpetArrowPart extends baseArrow {
return super.hurt(pSource, pAmount) || pSource.is(DamageTypes.EXPLOSION);
}
@NotNull
protected ItemStack getPickupItem() {
return new ItemStack(items.CONCUSSIVE_ARROW.get());
}
@Override
public void spawnParticles(float partialTicks) {
for (int i = 1; i <= ConfigClient.calcPCount(1); i++) {

View File

@ -2,10 +2,8 @@ package com.jenny.enhancedexplosives.entities.arrows;
import com.jenny.enhancedexplosives.config.ConfigServer;
import com.jenny.enhancedexplosives.entities.entities;
import com.jenny.enhancedexplosives.items.items;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import org.jetbrains.annotations.NotNull;
@ -33,10 +31,4 @@ public class claymoreArrow extends baseArrow{
discard();
}
}
@Override
@NotNull
protected ItemStack getPickupItem() {
return new ItemStack(items.CONCUSSIVE_ARROW.get(), 0);
}
}

View File

@ -2,11 +2,9 @@ package com.jenny.enhancedexplosives.entities.arrows;
import com.jenny.enhancedexplosives.config.ConfigClient;
import com.jenny.enhancedexplosives.entities.entities;
import com.jenny.enhancedexplosives.items.items;
import com.jenny.enhancedexplosives.particles.particles;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraft.world.phys.Vec3;
import org.jetbrains.annotations.NotNull;
@ -35,11 +33,6 @@ public class concussiveArrow extends baseArrow{
this.discard();
}
@NotNull
protected ItemStack getPickupItem() {
return new ItemStack(items.CONCUSSIVE_ARROW.get());
}
@Override
public void spawnParticles(float partialTicks) {
for (int i = 1; i <= ConfigClient.calcPCount(5); i++) {

View File

@ -2,11 +2,9 @@ package com.jenny.enhancedexplosives.entities.arrows;
import com.jenny.enhancedexplosives.config.ConfigClient;
import com.jenny.enhancedexplosives.entities.entities;
import com.jenny.enhancedexplosives.items.items;
import com.jenny.enhancedexplosives.particles.particles;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraft.world.phys.Vec3;
import org.jetbrains.annotations.NotNull;
@ -35,15 +33,9 @@ public class tntArrow extends baseArrow {
this.discard();
}
@NotNull
protected ItemStack getPickupItem() {
return new ItemStack(items.TNT_ARROW.get());
}
@Override
public void spawnParticles(float partialTicks) {
for (int i = 1; i <= ConfigClient.calcPCount(5); i++) {
double m = (double) level().getRandom().nextIntBetweenInclusive(- 100, 100) / 100;
Vec3 DeltaMovement = getDeltaMovement();
Vec3 pos = particlePos(0.5);
level().addParticle(particles.TNT_ARROW_PARTICLE.get(), pos.x, pos.y, pos.z, DeltaMovement.x, DeltaMovement.y, DeltaMovement.z);

View File

@ -4,7 +4,6 @@ import com.jenny.enhancedexplosives.entities.arrows.*;
import com.jenny.enhancedexplosives.entities.client.*;
import com.jenny.enhancedexplosives.entities.throwable.dynamite;
import com.jenny.enhancedexplosives.entities.tnt.*;
import net.minecraft.client.renderer.entity.EntityRenderers;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.MobCategory;
@ -21,35 +20,44 @@ public class entities {
public static final RegistryObject<EntityType<homingPrimedTNT>> TNT_HOMING =
ENTITY_TYPES.register("tnt_homing", () -> EntityType.Builder.<homingPrimedTNT>of(homingPrimedTNT::new, MobCategory.MISC)
.sized(0.98F, 0.7F).fireImmune().clientTrackingRange(8).build("tnt_homing"));
.fireImmune().sized(0.98F, 0.98F).clientTrackingRange(10).updateInterval(10).build("tnt_homing"));
public static final RegistryObject<EntityType<StrongerPrimedTNT>> TNT_STRONGER =
ENTITY_TYPES.register("tnt_stronger", () -> EntityType.Builder.<StrongerPrimedTNT>of(StrongerPrimedTNT::new, MobCategory.MISC)
.sized(0.98F, 0.7F).fireImmune().clientTrackingRange(8).build("tnt_stronger"));
.fireImmune().sized(0.98F, 0.98F).clientTrackingRange(10).updateInterval(10).build("tnt_stronger"));
public static final RegistryObject<EntityType<ClusterPrimedTNT>> TNT_CLUSTER =
ENTITY_TYPES.register("tnt_cluster", () -> EntityType.Builder.<ClusterPrimedTNT>of(ClusterPrimedTNT::new, MobCategory.MISC)
.sized(0.48F, 0.48F).fireImmune().clientTrackingRange(8).build("tnt_cluster"));
.sized(0.48F, 0.48F).fireImmune().clientTrackingRange(10).updateInterval(10).build("tnt_cluster"));
public static final RegistryObject<EntityType<blackHolePrimedTNT>> TNT_BLACK_HOLE =
ENTITY_TYPES.register("tnt_blackhole", () -> EntityType.Builder.<blackHolePrimedTNT>of(blackHolePrimedTNT::new, MobCategory.MISC)
.sized(0.98F, 0.7F).fireImmune().clientTrackingRange(8).build("tnt_blackhole"));
.fireImmune().sized(0.98F, 0.98F).clientTrackingRange(10).updateInterval(10).build("tnt_blackhole"));
public static final RegistryObject<EntityType<selectivePrimedTNT>> TNT_SELECTIVE =
ENTITY_TYPES.register("tnt_selective", () -> EntityType.Builder.<selectivePrimedTNT>of(selectivePrimedTNT::new, MobCategory.MISC)
.sized(0.98F, 0.7F).fireImmune().clientTrackingRange(8).build("tnt_selective"));
.fireImmune().sized(0.98F, 0.98F).clientTrackingRange(10).updateInterval(10).build("tnt_selective"));
public static final RegistryObject<EntityType<claymorePrimedTNT>> TNT_CLAYMORE =
ENTITY_TYPES.register("tnt_claymore", () -> EntityType.Builder.<claymorePrimedTNT>of(claymorePrimedTNT::new, MobCategory.MISC)
.sized(0.98F, 0.7F).fireImmune().clientTrackingRange(8).build("tnt_claymore"));
.fireImmune().sized(0.98F, 0.98F).clientTrackingRange(10).updateInterval(10).build("tnt_claymore"));
public static final RegistryObject<EntityType<enderPrimedTNT>> TNT_ENDER =
ENTITY_TYPES.register("tnt_ender", () -> EntityType.Builder.<enderPrimedTNT>of(enderPrimedTNT::new, MobCategory.MISC)
.sized(0.98F, 0.7F).fireImmune().clientTrackingRange(8).build("tnt_ender"));
.fireImmune().sized(0.98F, 0.98F).clientTrackingRange(10).updateInterval(10).build("tnt_ender"));
public static final RegistryObject<EntityType<repulsivePrimedTNT>> TNT_REPULSIVE =
ENTITY_TYPES.register("tnt_repulsive", () -> EntityType.Builder.<repulsivePrimedTNT>of(repulsivePrimedTNT::new, MobCategory.MISC)
.sized(0.98F, 0.7F).fireImmune().clientTrackingRange(8).build("tnt_repulsive"));
.fireImmune().sized(0.98F, 0.98F).clientTrackingRange(10).updateInterval(10).build("tnt_repulsive"));
public static final RegistryObject<EntityType<bedrockPrimedTNT>> TNT_BEDROCK =
ENTITY_TYPES.register("tnt_bedrock", () -> EntityType.Builder.<bedrockPrimedTNT>of(bedrockPrimedTNT::new, MobCategory.MISC)
.sized(0.98F, 0.7F).fireImmune().clientTrackingRange(8).build("tnt_bedrock"));
public static final RegistryObject<EntityType<EntityPrimedTNT>> TNT_ENTITY =
ENTITY_TYPES.register("tnt_entity", () -> EntityType.Builder.<EntityPrimedTNT>of(EntityPrimedTNT::new, MobCategory.MISC)
.sized(0.98F, 0.7F).fireImmune().clientTrackingRange(8).build("tnt_entity"));
public static final RegistryObject<EntityType<tntArrow>> ARROW_TNT =
ENTITY_TYPES.register("arrow_tnt", () -> EntityType.Builder.<tntArrow>of(tntArrow::new, MobCategory.MISC)
@ -90,6 +98,8 @@ public class entities {
EntityRenderers.register(TNT_CLAYMORE.get(), BaseTNTRenderer::new);
EntityRenderers.register(TNT_ENDER.get(), BaseTNTRenderer::new);
EntityRenderers.register(TNT_REPULSIVE.get(), BaseTNTRenderer::new);
EntityRenderers.register(TNT_BEDROCK.get(), BaseTNTRenderer::new);
EntityRenderers.register(TNT_ENTITY.get(), BaseTNTRenderer::new);
EntityRenderers.register(TNT_SELECTIVE.get(), SelectiveTNTRenderer::new);

View File

@ -0,0 +1,53 @@
package com.jenny.enhancedexplosives.entities.tnt;
import com.jenny.enhancedexplosives.blocks.blocks;
import com.jenny.enhancedexplosives.entities.entities;
import net.minecraft.core.BlockPos;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Explosion;
import net.minecraft.world.level.ExplosionDamageCalculator;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.Vec3;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nullable;
import java.util.Objects;
public class EntityPrimedTNT extends basePrimedTNT {
static class noEntityExplosionCalculator extends ExplosionDamageCalculator {
public boolean shouldBlockExplode(@NotNull Explosion pExplosion, @NotNull BlockGetter pReader, @NotNull BlockPos pPos, @NotNull BlockState pState, float pPower) {
return false;
}
}
public EntityPrimedTNT(Level pLevel, double pX, double pY, double pZ, @Nullable LivingEntity pOwner, float power, int fuse) {
super(entities.TNT_ENTITY.get(), pLevel, pOwner, new Vec3(pX, pY, pZ), fuse, power);
}
public EntityPrimedTNT(EntityType<EntityPrimedTNT> entityType, Level level) {
super(entityType, level, null);
}
@Override
protected void explode() {
noEntityExplosionCalculator dmgCalc = new noEntityExplosionCalculator();
this.level().explode(this, null, dmgCalc, position(), getPower(), false, Level.ExplosionInteraction.TNT);
}
public BlockPos getBlockBelow() {
return new BlockPos((int) Math.floor(getX()), (int) Math.floor(getY()) - 1, (int) Math.floor(getZ()));
}
public String getBlock() {
return level().getBlockState(getBlockBelow()).getBlock().toString();
}
@Override
public Block renderBlock() {
return blocks.TNT_ENTITY.get();
}
}

View File

@ -25,20 +25,20 @@ public abstract class basePrimedTNT extends Entity implements TraceableEntity {
public basePrimedTNT(EntityType<? extends basePrimedTNT> pEntityType, @NotNull Level pLevel, @Nullable LivingEntity owner) {
super(pEntityType, pLevel);
commonInit(pLevel, owner);
this.fuse = getFuse();
}
private void commonInit(@NotNull Level pLevel, @Nullable LivingEntity owner) {
double d0 = pLevel.random.nextDouble() * (double)((float)Math.PI * 2F);
this.setDeltaMovement(-Math.sin(d0) * 0.02D, (double)0.2F, -Math.cos(d0) * 0.02D);
this.blocksBuilding = true;
this.setOwner(owner);
this.fuse = getFuse();
}
public basePrimedTNT(EntityType<? extends basePrimedTNT> pEntityType, @NotNull Level pLevel, @Nullable LivingEntity owner, Vec3 pos, int fuse, float power) {
super(pEntityType, pLevel);
commonInit(pLevel, owner);
this.blocksBuilding = true;
this.setOwner(owner);
double d0 = pLevel.random.nextDouble() * (double) ((float) Math.PI * 2F);
this.setDeltaMovement(-Math.sin(d0) * 0.02D, (double) 0.2F, -Math.cos(d0) * 0.02D);
xo = pos.x;
yo = pos.y;
zo = pos.z;
setPos(pos);
setFuse(fuse);
setPower(power);
@ -102,9 +102,10 @@ public abstract class basePrimedTNT extends Entity implements TraceableEntity {
return MovementEmission.NONE;
}
protected void defineSynchedData() {
this.entityData.define(DATA_FUSE_ID, 80);
this.entityData.define(DATA_POWER_ID, 4.0f);
@Override
protected void defineSynchedData(SynchedEntityData.@NotNull Builder builder) {
builder.define(DATA_FUSE_ID, 80);
builder.define(DATA_POWER_ID, 4.0f);
}
protected void addAdditionalSaveData(CompoundTag pCompound) {

View File

@ -0,0 +1,61 @@
package com.jenny.enhancedexplosives.entities.tnt;
import com.jenny.enhancedexplosives.blocks.blocks;
import com.jenny.enhancedexplosives.entities.entities;
import net.minecraft.core.BlockPos;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Explosion;
import net.minecraft.world.level.ExplosionDamageCalculator;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.Vec3;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nullable;
import java.util.Objects;
public class bedrockPrimedTNT extends basePrimedTNT {
static class noExplosionCalculator extends ExplosionDamageCalculator {
public boolean shouldBlockExplode(@NotNull Explosion pExplosion, @NotNull BlockGetter pReader, @NotNull BlockPos pPos, @NotNull BlockState pState, float pPower) {
return false;
}
}
public bedrockPrimedTNT(Level pLevel, double pX, double pY, double pZ, @Nullable LivingEntity pOwner, float power, int fuse) {
super(entities.TNT_BEDROCK.get(), pLevel, pOwner, new Vec3(pX, pY, pZ), fuse, power);
}
public bedrockPrimedTNT(EntityType<bedrockPrimedTNT> entityType, Level level) {
super(entityType, level, null);
}
@Override
protected void explode() {
noExplosionCalculator dmgCalc = new noExplosionCalculator();
this.level().explode(this, null, dmgCalc, position(), getPower(), false, Level.ExplosionInteraction.TNT);
explodeBelow();
}
public BlockPos getBlockBelow() {
return new BlockPos((int) Math.floor(getX()), (int) Math.floor(getY()) - 1, (int) Math.floor(getZ()));
}
public String getBlock() {
return level().getBlockState(getBlockBelow()).getBlock().toString();
}
private void explodeBelow()
{
if (Objects.equals(getBlock(), Blocks.BEDROCK.toString())) {
level().destroyBlock(getBlockBelow(), false);
}
}
@Override
public Block renderBlock() {
return blocks.TNT_BEDROCK.get();
}
}

View File

@ -6,11 +6,14 @@ import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.network.syncher.EntityDataSerializers;
import net.minecraft.network.syncher.SynchedEntityData;
import net.minecraft.world.entity.*;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.Vec3;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nullable;
import java.util.List;
@ -83,9 +86,9 @@ public class blackHolePrimedTNT extends basePrimedTNT {
}
@Override
protected void defineSynchedData() {
this.entityData.define(DATA_SPEED_ID, 4.0f);
super.defineSynchedData();
protected void defineSynchedData(SynchedEntityData.@NotNull Builder builder) {
builder.define(DATA_SPEED_ID, 4.0f);
super.defineSynchedData(builder);
}
@Override

View File

@ -14,6 +14,7 @@ import net.minecraft.world.entity.projectile.Projectile;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.phys.Vec3;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nullable;
@ -72,9 +73,9 @@ public class claymorePrimedTNT extends basePrimedTNT {
}
@Override
protected void defineSynchedData() {
this.entityData.define(DATA_PCOUNT_ID, 16);
super.defineSynchedData();
protected void defineSynchedData(SynchedEntityData.@NotNull Builder builder) {
builder.define(DATA_PCOUNT_ID, 16);
super.defineSynchedData(builder);
}
@Override

View File

@ -16,6 +16,7 @@ import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.Vec3;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nullable;
import java.util.ArrayList;
@ -116,9 +117,9 @@ public class homingPrimedTNT extends basePrimedTNT {
}
@Override
protected void defineSynchedData() {
this.entityData.define(DATA_SPEED_ID, 4.0f);
super.defineSynchedData();
protected void defineSynchedData(SynchedEntityData.@NotNull Builder builder) {
builder.define(DATA_SPEED_ID, 4.0f);
super.defineSynchedData(builder);
}
@Override

View File

@ -13,6 +13,7 @@ import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.Vec3;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nullable;
import java.util.List;
@ -86,9 +87,9 @@ public class repulsivePrimedTNT extends basePrimedTNT {
}
@Override
protected void defineSynchedData() {
this.entityData.define(DATA_SPEED_ID, 4.0f);
super.defineSynchedData();
protected void defineSynchedData(SynchedEntityData.@NotNull Builder builder) {
builder.define(DATA_SPEED_ID, 4.0f);
super.defineSynchedData(builder);
}
@Override

View File

@ -11,7 +11,6 @@ import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.level.Level;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.List;
@ -23,12 +22,12 @@ public abstract class ArrowAbstract extends ArrowItem {
}
@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);
MutableComponent toolTip = Component.translatable(key);
if (!toolTip.getString().equals(key)) {
pTooltipComponents.add(toolTip.withStyle(ChatFormatting.DARK_BLUE));
super.appendHoverText(pStack, pLevel, pTooltipComponents, pIsAdvanced);
super.appendHoverText(pStack, pContext, pTooltipComponents, pTooltipFlag);
}
}

View File

@ -7,10 +7,8 @@ import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.List;
@ -22,12 +20,12 @@ public class BlockItemTooltip extends BlockItem {
}
@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);
MutableComponent toolTip = Component.translatable(key);
if (!toolTip.getString().equals(key)) {
pTooltipComponents.add(toolTip.withStyle(ChatFormatting.DARK_BLUE));
super.appendHoverText(pStack, pLevel, pTooltipComponents, pIsAdvanced);
super.appendHoverText(pStack, pContext, pTooltipComponents, pTooltipFlag);
}
}
}

View File

@ -13,7 +13,6 @@ import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.level.Level;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.List;
@ -43,12 +42,12 @@ public class Dynamite extends Item {
}
@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);
MutableComponent toolTip = Component.translatable(key);
if (!toolTip.getString().equals(key)) {
pTooltipComponents.add(toolTip.withStyle(ChatFormatting.DARK_BLUE));
super.appendHoverText(pStack, pLevel, pTooltipComponents, pIsAdvanced);
super.appendHoverText(pStack, pContext, pTooltipComponents, pTooltipFlag);
}
}
}

View File

@ -1,16 +1,18 @@
package com.jenny.enhancedexplosives.items;
import com.jenny.enhancedexplosives.entities.arrows.baseArrow;
import com.jenny.enhancedexplosives.entities.entities;
import net.minecraft.core.Direction;
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.projectile.AbstractArrow;
import net.minecraft.world.entity.projectile.Projectile;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.ProjectileItem;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.DispenserBlock;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
@ -33,26 +35,38 @@ public class items {
}
public static void registerDispenser() {
class ArrowDispenseBehaviour extends AbstractProjectileDispenseBehavior {
private final EntityType<? extends baseArrow> arrowType;
class ArrowDispenseBehaviour extends DefaultDispenseItemBehavior {
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;
}
@Override
protected @NotNull Projectile getProjectile(@NotNull Level pLevel, @NotNull Position pPosition, @NotNull ItemStack pStack) {
baseArrow arrow = arrowType.create(pLevel);
assert arrow != null;
arrow.setPos(pPosition.x(), pPosition.y(), pPosition.z());
arrow.pickup = AbstractArrow.Pickup.ALLOWED;
return arrow;
public @NotNull ItemStack execute(@NotNull BlockSource pBlockSource, @NotNull ItemStack pItem) {
Level level = pBlockSource.level();
Direction dir = pBlockSource.state().getValue(DispenserBlock.FACING);
Position pos = this.dispenseConfig.positionFunction().getDispensePosition(pBlockSource, dir);
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(CONCUSSIVE_ARROW.get(), new ArrowDispenseBehaviour(entities.ARROW_CONCUSSIVE.get()));
DispenserBlock.registerBehavior(CARPET_ARROW.get(), new ArrowDispenseBehaviour(entities.ARROW_CARPET.get()));
DispenserBlock.registerBehavior(TUNNEL_ARROW.get(), new ArrowDispenseBehaviour(entities.ARROW_TUNNEL.get()));
DispenserBlock.registerBehavior(TNT_ARROW.get(), new ArrowDispenseBehaviour(
(ArrowAbstract) TNT_ARROW.get(), entities.ARROW_TNT.get()));
DispenserBlock.registerBehavior(CONCUSSIVE_ARROW.get(), new ArrowDispenseBehaviour(
(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()));
}
}

View File

@ -1,64 +1,24 @@
# This is an example mods.toml file. It contains the data relating to the loading mods.
# There are several mandatory fields (#mandatory), and many more that are optional (#optional).
# The overall format is standard TOML format, v0.5.0.
# Note that there are a couple of TOML lists in this file.
# Find more information on toml format here: https://github.com/toml-lang/toml
# The name of the mod loader type to load - for regular FML @Mod mods it should be javafml
modLoader = "javafml" #mandatory
modLoader = "javafml"
logoFile = "logo.png"
# A version range to match for said mod loader - for regular FML @Mod it will be the forge version
loaderVersion = "${loader_version_range}" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions.
# The license for you mod. This is mandatory metadata and allows for easier comprehension of your redistributive properties.
# Review your options at https://choosealicense.com/. All rights reserved is the default copyright stance, and is thus the default here.
loaderVersion = "${loader_version_range}"
license = "${mod_license}"
# A URL to refer people to when problems occur with this mod
#issueTrackerURL="https://change.me.to.your.issue.tracker.example.invalid/" #optional
# A list of mods - how many allowed here is determined by the individual mod loader
[[mods]] #mandatory
# The modid of the mod
modId = "${mod_id}" #mandatory
# The version number of the mod
version = "${mod_version}" #mandatory
# A display name for the mod
displayName = "${mod_name}" #mandatory
# A URL to query for updates for this mod. See the JSON update specification https://docs.minecraftforge.net/en/latest/misc/updatechecker/
#updateJSONURL="https://change.me.example.invalid/updates.json" #optional
# A URL for the "homepage" for this mod, displayed in the mod UI
#displayURL="https://change.me.to.your.mods.homepage.example.invalid/" #optional
# A file name (in the root of the mod JAR) containing a logo for display
#logoFile="enhancedexplosives.png" #optional
# A text field displayed in the mod UI
#credits="Thanks for this example mod goes to Java" #optional
# A text field displayed in the mod UI
authors = "${mod_authors}" #optional
# Display Test controls the display for your mod in the server connection screen
# MATCH_VERSION means that your mod will cause a red X if the versions on client and server differ. This is the default behaviour and should be what you choose if you have server and client elements to your mod.
# IGNORE_SERVER_VERSION means that your mod will not cause a red X if it's present on the server but not on the client. This is what you should use if you're a server only mod.
# IGNORE_ALL_VERSION means that your mod will not cause a red X if it's present on the client or the server. This is a special case and should only be used if your mod has no server component.
# NONE means that no display test is set on your mod. You need to do this yourself, see IExtensionPoint.DisplayTest for more information. You can define any scheme you wish with this value.
# IMPORTANT NOTE: this is NOT an instruction as to which environments (CLIENT or DEDICATED SERVER) your mod loads on. Your mod should load (and maybe do nothing!) whereever it finds itself.
#displayTest="MATCH_VERSION" # MATCH_VERSION is the default if nothing is specified (#optional)
# The description text for the mod (multi line!) (#mandatory)
[[mods]]
modId = "${mod_id}"
version = "${mod_version}"
displayName = "${mod_name}"
authors = "${mod_authors}"
displayTest = "MATCH_VERSION"
displayURL = "https://git.smthng.de/Jenny/Enhanced-Explosives"
description = '''${mod_description}'''
# A dependency - use the . to indicate dependency for a specific modid. Dependencies are optional.
[[dependencies."${mod_id}"]] #optional
# the modid of the dependency
modId = "forge" #mandatory
# Does this dependency have to exist - if not, ordering below must be specified
mandatory = true #mandatory
# The version range of the dependency
versionRange = "${forge_version_range}" #mandatory
# An ordering relationship for the dependency - BEFORE or AFTER required if the dependency is not mandatory
# BEFORE - This mod is loaded BEFORE the dependency
# AFTER - This mod is loaded AFTER the dependency
modId = "forge"
mandatory = true
versionRange = "${forge_version_range}"
ordering = "NONE"
# Side this dependency is applied on - BOTH, CLIENT, or SERVER
side = "BOTH"# Here's another dependency
side = "BOTH"
[[dependencies."${mod_id}"]]
modId = "minecraft"
mandatory = true
# This version range declares a minimum of the current minecraft version up to but not including the next major version
versionRange = "${minecraft_version_range}"
ordering = "NONE"
side = "BOTH"

View File

@ -0,0 +1,3 @@
[
"enhancedexplosives:books/guide_enhanced_explosives.xml"
]

View File

@ -13,6 +13,8 @@
"block.enhancedexplosives.tnt_selective": "Selective TNT",
"block.enhancedexplosives.tnt_ender": "Ender TNT",
"block.enhancedexplosives.tnt_repulsive": "Repulsive TNT",
"block.enhancedexplosives.tnt_bedrock": "Bedrock TNT",
"block.enhancedexplosives.tnt_entity": "Entity TNT",
"tooltip.enhancedexplosives.tnt_cluster_2": "splits into 2 small TNTs",
"tooltip.enhancedexplosives.tnt_cluster_4": "splits into 4 small TNTs",

Binary file not shown.

After

Width:  |  Height:  |  Size: 459 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 563 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 459 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 151 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1016 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 515 B

View File

@ -0,0 +1,14 @@
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "enhancedexplosives:tnt_bedrock"
}
]
}
]
}

View File

@ -0,0 +1,14 @@
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "enhancedexplosives:tnt_entity"
}
]
}
]
}

View File

@ -0,0 +1,17 @@
{
"type": "minecraft:crafting_shaped",
"category": "redstone",
"pattern": [
"AA ",
"AA ",
" "
],
"key": {
"A": {
"item": "enhancedexplosives:tnt_128"
}
},
"result": {
"item": "enhancedexplosives:tnt_bedrock"
}
}

View File

@ -0,0 +1,15 @@
{
"type": "minecraft:crafting_shapeless",
"category": "redstone",
"ingredients":[
{
"item": "minecraft:tnt"
},
{
"item": "minecraft:water_bucket"
}
],
"result": {
"item": "enhancedexplosives:tnt_entity"
}
}

View File

@ -10,6 +10,6 @@
}
],
"result": {
"item": "enhancedexplosives:tnt_black_hole"
"item": "enhancedexplosives:tnt_repulsive"
}
}

View File

@ -0,0 +1,15 @@
{
"type": "minecraft:crafting_shapeless",
"category": "combat",
"ingredients":[
{
"item": "minecraft:tnt"
},
{
"item": "minecraft:obsidian"
}
],
"result": {
"item": "enhancedexplosives:tnt_selective"
}
}