Compare commits
7 Commits
183d0fe38a
...
e02551f4fb
Author | SHA1 | Date | |
---|---|---|---|
e02551f4fb | |||
509895e32c | |||
bd8024e2a6 | |||
8af4f751d8 | |||
bf562f23e0 | |||
db9309d9d8 | |||
8b5c7b53a5 |
@ -38,7 +38,7 @@ mod_name=Compressed TNT
|
||||
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
|
||||
mod_license=All Rights Reserved
|
||||
# The mod version. See https://semver.org/
|
||||
mod_version=0.2.0
|
||||
mod_version=0.5.0
|
||||
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
|
||||
# This should match the base package used for the mod sources.
|
||||
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||
|
@ -2,6 +2,7 @@ package com.jenny.compressedtnt;
|
||||
|
||||
import com.jenny.compressedtnt.blocks.blocks;
|
||||
import com.jenny.compressedtnt.entities.entities;
|
||||
import com.jenny.compressedtnt.items.items;
|
||||
import com.mojang.logging.LogUtils;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
@ -29,6 +30,7 @@ public class Compressedtnt {
|
||||
modEventBus.addListener(this::commonSetup);
|
||||
|
||||
blocks.register(modEventBus);
|
||||
items.register(modEventBus);
|
||||
creativeTab.register(modEventBus);
|
||||
entities.register(modEventBus);
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.jenny.compressedtnt.blocks;
|
||||
|
||||
import com.jenny.compressedtnt.entities.ClusterPrimedTNT;
|
||||
import com.jenny.compressedtnt.entities.tnt.ClusterPrimedTNT;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
@ -63,7 +63,7 @@ public class ClusterTNTBlock extends TntBlock {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void wasExploded(Level level, BlockPos blockPos, Explosion pExplosion) {
|
||||
public void wasExploded(Level level, @NotNull BlockPos blockPos, @NotNull Explosion pExplosion) {
|
||||
if (!level.isClientSide) {
|
||||
for (int i = 0; i < childCount; i++) {
|
||||
int ft = (short) (level.random.nextInt(fuseTime / 4) + fuseTime / 8);
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.jenny.compressedtnt.blocks;
|
||||
|
||||
import com.jenny.compressedtnt.entities.blackHolePrimedTNT;
|
||||
import com.jenny.compressedtnt.entities.tnt.blackHolePrimedTNT;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
@ -48,7 +48,7 @@ public class blackHoleTNTBlock extends TntBlock {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void wasExploded(Level level, BlockPos blockPos, Explosion pExplosion) {
|
||||
public void wasExploded(Level level, @NotNull BlockPos blockPos, @NotNull Explosion pExplosion) {
|
||||
if (!level.isClientSide) {
|
||||
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();
|
||||
|
@ -32,7 +32,7 @@ public class blocks {
|
||||
public static final RegistryObject<Item> TNT_128_ITEM = ITEMS.register("tnt_128", () -> new BlockItem(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<Item> TNT_CLUSTER__2ITEM = ITEMS.register("tnt_cluster_2", () -> new BlockItem(TNT_CLUSTER_2.get(), new Item.Properties()));
|
||||
public static final RegistryObject<Item> TNT_CLUSTER_2_ITEM = ITEMS.register("tnt_cluster_2", () -> new BlockItem(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<Item> TNT_CLUSTER_4_ITEM = ITEMS.register("tnt_cluster_4", () -> new BlockItem(TNT_CLUSTER_4.get(), new Item.Properties()));
|
||||
@ -46,6 +46,9 @@ public class blocks {
|
||||
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<Item> TNT_BLACK_HOLE_ITEM = ITEMS.register("tnt_black_hole", () -> new BlockItem(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<Item> TNT_CLAYMORE_ITEM = ITEMS.register("tnt_claymore", () -> new BlockItem(TNT_CLAYMORE.get(), new Item.Properties()));
|
||||
|
||||
|
||||
public static void register(IEventBus bus) {
|
||||
BLOCKS.register(bus);
|
||||
|
@ -0,0 +1,59 @@
|
||||
package com.jenny.compressedtnt.blocks;
|
||||
|
||||
import com.jenny.compressedtnt.entities.tnt.claymorePrimedTNT;
|
||||
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 claymoreTNTBlock extends TntBlock {
|
||||
public final float pRadius;
|
||||
public final int fuseTime;
|
||||
public final int projectileCount;
|
||||
|
||||
public claymoreTNTBlock(Properties p_57422_, float pRadius, int fuseTime, int projectileCount) {
|
||||
super(p_57422_);
|
||||
this.pRadius = pRadius;
|
||||
this.fuseTime = fuseTime;
|
||||
this.projectileCount = projectileCount;
|
||||
}
|
||||
|
||||
@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, this.projectileCount);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static void explode(Level p_57434_, BlockPos p_57435_, float pRadius, int fuseTime, int projectileCount) {
|
||||
explode(p_57434_, p_57435_, (LivingEntity)null, pRadius, fuseTime, projectileCount);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
private static void explode(Level level, BlockPos blockPos, @Nullable LivingEntity entity, float pRadius, int fuseTime, int projectileCount) {
|
||||
if (!level.isClientSide) {
|
||||
claymorePrimedTNT primedtnt = new claymorePrimedTNT(level, (double) blockPos.getX() + (double) 0.5F, (double) blockPos.getY(), (double) blockPos.getZ() + (double) 0.5F, entity, pRadius, fuseTime, projectileCount);
|
||||
level.addFreshEntity(primedtnt);
|
||||
level.gameEvent(entity, GameEvent.PRIME_FUSE, blockPos);
|
||||
level.playSound((Player) null, blockPos.getX(), blockPos.getY(), blockPos.getZ(), SoundEvents.TNT_PRIMED, SoundSource.BLOCKS, 1.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
|
||||
@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);
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
package com.jenny.compressedtnt.blocks;
|
||||
|
||||
import com.jenny.compressedtnt.entities.homingPrimedTNT;
|
||||
import com.jenny.compressedtnt.entities.tnt.homingPrimedTNT;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
@ -49,7 +49,7 @@ public class homingTNTBlock extends TntBlock {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void wasExploded(Level level, BlockPos blockPos, Explosion pExplosion) {
|
||||
public void wasExploded(Level level, @NotNull BlockPos blockPos, @NotNull Explosion pExplosion) {
|
||||
if (!level.isClientSide) {
|
||||
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();
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.jenny.compressedtnt.blocks;
|
||||
|
||||
import com.jenny.compressedtnt.entities.StrongerPrimedTNT;
|
||||
import com.jenny.compressedtnt.entities.tnt.StrongerPrimedTNT;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
@ -13,6 +13,7 @@ import net.minecraft.world.level.block.TntBlock;
|
||||
import net.minecraft.world.level.block.state.BlockBehaviour;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.gameevent.GameEvent;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@ -27,7 +28,7 @@ public class strongerTNTBlock extends TntBlock {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCaughtFire(BlockState state, Level world, BlockPos pos, @Nullable Direction face, @Nullable LivingEntity igniter) {
|
||||
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);
|
||||
}
|
||||
|
||||
@ -48,7 +49,7 @@ public class strongerTNTBlock extends TntBlock {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void wasExploded(Level level, BlockPos blockPos, Explosion pExplosion) {
|
||||
public void wasExploded(Level level, @NotNull BlockPos blockPos, @NotNull Explosion pExplosion) {
|
||||
if (!level.isClientSide) {
|
||||
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.getIndirectSourceEntity(), pRadius, ft);
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.jenny.compressedtnt;
|
||||
|
||||
import com.jenny.compressedtnt.blocks.blocks;
|
||||
import com.jenny.compressedtnt.items.items;
|
||||
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.network.chat.Component;
|
||||
@ -25,6 +26,9 @@ public class creativeTab {
|
||||
output.accept(blocks.TNT_CLUSTER_8.get());
|
||||
output.accept(blocks.TNT_HOMING.get());
|
||||
output.accept(blocks.TNT_BLACK_HOLE.get());
|
||||
output.accept(blocks.TNT_CLAYMORE.get());
|
||||
output.accept(items.TNT_ARROW.get());
|
||||
output.accept(items.CONCUSSIVE_ARROW.get());
|
||||
}).title(Component.literal("Compressed TNT")).build());
|
||||
|
||||
public static void register(IEventBus bus) {
|
||||
|
@ -22,5 +22,6 @@ public class DataGenerators {
|
||||
CompletableFuture<HolderLookup.Provider> lookupProvider = event.getLookupProvider();
|
||||
|
||||
generator.addProvider(event.includeClient(), new ModBlockStateProvider(packOutput, existingFileHelper));
|
||||
generator.addProvider(event.includeClient(), new ModItemModelProvider(packOutput, existingFileHelper));
|
||||
}
|
||||
}
|
@ -1,6 +1,5 @@
|
||||
package com.jenny.compressedtnt.datagen;
|
||||
|
||||
import com.jenny.compressedtnt.Compressedtnt;
|
||||
import com.jenny.compressedtnt.blocks.blocks;
|
||||
|
||||
import net.minecraft.data.PackOutput;
|
||||
@ -12,6 +11,7 @@ import net.minecraftforge.common.data.ExistingFileHelper;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraftforge.registries.RegistryObject;
|
||||
import net.minecraftforge.client.model.generators.ModelFile;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import static com.jenny.compressedtnt.Compressedtnt.MODID;
|
||||
|
||||
|
@ -0,0 +1,31 @@
|
||||
package com.jenny.compressedtnt.datagen;
|
||||
|
||||
import com.jenny.compressedtnt.items.items;
|
||||
|
||||
import net.minecraft.data.PackOutput;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraftforge.client.model.generators.ItemModelBuilder;
|
||||
import net.minecraftforge.client.model.generators.ItemModelProvider;
|
||||
import net.minecraftforge.common.data.ExistingFileHelper;
|
||||
import net.minecraftforge.registries.RegistryObject;
|
||||
|
||||
import static com.jenny.compressedtnt.Compressedtnt.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);
|
||||
}
|
||||
|
||||
private ItemModelBuilder simpleItem(RegistryObject<Item> item) {
|
||||
return withExistingParent(item.getId().getPath(),
|
||||
new ResourceLocation("item/generated")).texture("layer0",
|
||||
new ResourceLocation(MODID,"item/" + item.getId().getPath()));
|
||||
}
|
||||
}
|
@ -0,0 +1,231 @@
|
||||
package com.jenny.compressedtnt.entities.arrows;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
import net.minecraft.core.particles.ParticleTypes;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.ListTag;
|
||||
import net.minecraft.network.syncher.EntityDataAccessor;
|
||||
import net.minecraft.network.syncher.EntityDataSerializers;
|
||||
import net.minecraft.network.syncher.SynchedEntityData;
|
||||
import net.minecraft.world.effect.MobEffectInstance;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.projectile.AbstractArrow;
|
||||
import net.minecraft.world.entity.projectile.Arrow;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.item.alchemy.Potion;
|
||||
import net.minecraft.world.item.alchemy.PotionUtils;
|
||||
import net.minecraft.world.item.alchemy.Potions;
|
||||
import net.minecraft.world.level.Level;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Set;
|
||||
|
||||
public class baseArrow extends AbstractArrow {
|
||||
private static final int EXPOSED_POTION_DECAY_TIME = 600;
|
||||
private static final int NO_EFFECT_COLOR = -1;
|
||||
private static final EntityDataAccessor<Integer> ID_EFFECT_COLOR = SynchedEntityData.defineId(Arrow.class, EntityDataSerializers.INT);
|
||||
private static final byte EVENT_POTION_PUFF = 0;
|
||||
private Potion potion = Potions.EMPTY;
|
||||
private final Set<MobEffectInstance> effects = Sets.newHashSet();
|
||||
private boolean fixedColor;
|
||||
|
||||
public baseArrow(EntityType<? extends baseArrow> pEntityType, Level pLevel) {
|
||||
super(pEntityType, pLevel);
|
||||
}
|
||||
|
||||
public baseArrow(Level pLevel, double pX, double pY, double pZ, EntityType<? extends baseArrow> pEntityType) {
|
||||
super(pEntityType, pX, pY, pZ, pLevel);
|
||||
}
|
||||
|
||||
public baseArrow(Level pLevel, LivingEntity pShooter, EntityType<? extends baseArrow> pEntityType) {
|
||||
super(pEntityType, pShooter, pLevel);
|
||||
}
|
||||
|
||||
public void setEffectsFromItem(ItemStack pStack) {
|
||||
if (pStack.is(Items.TIPPED_ARROW)) {
|
||||
this.potion = PotionUtils.getPotion(pStack);
|
||||
Collection<MobEffectInstance> collection = PotionUtils.getCustomEffects(pStack);
|
||||
if (!collection.isEmpty()) {
|
||||
for(MobEffectInstance mobeffectinstance : collection) {
|
||||
this.effects.add(new MobEffectInstance(mobeffectinstance));
|
||||
}
|
||||
}
|
||||
|
||||
int i = getCustomColor(pStack);
|
||||
if (i == -1) {
|
||||
this.updateColor();
|
||||
} else {
|
||||
this.setFixedColor(i);
|
||||
}
|
||||
} else if (pStack.is(Items.ARROW)) {
|
||||
this.potion = Potions.EMPTY;
|
||||
this.effects.clear();
|
||||
this.entityData.set(ID_EFFECT_COLOR, -1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static int getCustomColor(ItemStack pStack) {
|
||||
CompoundTag compoundtag = pStack.getTag();
|
||||
return compoundtag != null && compoundtag.contains("CustomPotionColor", 99) ? compoundtag.getInt("CustomPotionColor") : -1;
|
||||
}
|
||||
|
||||
private void updateColor() {
|
||||
this.fixedColor = false;
|
||||
if (this.potion == Potions.EMPTY && this.effects.isEmpty()) {
|
||||
this.entityData.set(ID_EFFECT_COLOR, -1);
|
||||
} else {
|
||||
this.entityData.set(ID_EFFECT_COLOR, PotionUtils.getColor(PotionUtils.getAllEffects(this.potion, this.effects)));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void addEffect(MobEffectInstance pEffectInstance) {
|
||||
this.effects.add(pEffectInstance);
|
||||
this.getEntityData().set(ID_EFFECT_COLOR, PotionUtils.getColor(PotionUtils.getAllEffects(this.potion, this.effects)));
|
||||
}
|
||||
|
||||
protected void defineSynchedData() {
|
||||
super.defineSynchedData();
|
||||
this.entityData.define(ID_EFFECT_COLOR, -1);
|
||||
}
|
||||
|
||||
public void tick() {
|
||||
super.tick();
|
||||
if (this.level().isClientSide) {
|
||||
if (this.inGround) {
|
||||
if (this.inGroundTime % 5 == 0) {
|
||||
this.makeParticle(1);
|
||||
}
|
||||
} else {
|
||||
this.makeParticle(2);
|
||||
}
|
||||
} else if (this.inGround && this.inGroundTime != 0 && !this.effects.isEmpty() && this.inGroundTime >= 600) {
|
||||
this.level().broadcastEntityEvent(this, (byte)0);
|
||||
this.potion = Potions.EMPTY;
|
||||
this.effects.clear();
|
||||
this.entityData.set(ID_EFFECT_COLOR, -1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void makeParticle(int pParticleAmount) {
|
||||
int i = this.getColor();
|
||||
if (i != -1 && pParticleAmount > 0) {
|
||||
double d0 = (double)(i >> 16 & 255) / 255.0D;
|
||||
double d1 = (double)(i >> 8 & 255) / 255.0D;
|
||||
double d2 = (double)(i >> 0 & 255) / 255.0D;
|
||||
|
||||
for(int j = 0; j < pParticleAmount; ++j) {
|
||||
this.level().addParticle(ParticleTypes.ENTITY_EFFECT, this.getRandomX(0.5D), this.getRandomY(), this.getRandomZ(0.5D), d0, d1, d2);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public int getColor() {
|
||||
return this.entityData.get(ID_EFFECT_COLOR);
|
||||
}
|
||||
|
||||
private void setFixedColor(int pFixedColor) {
|
||||
this.fixedColor = true;
|
||||
this.entityData.set(ID_EFFECT_COLOR, pFixedColor);
|
||||
}
|
||||
|
||||
public void addAdditionalSaveData(@NotNull CompoundTag pCompound) {
|
||||
super.addAdditionalSaveData(pCompound);
|
||||
if (this.potion != Potions.EMPTY) {
|
||||
pCompound.putString("Potion", BuiltInRegistries.POTION.getKey(this.potion).toString());
|
||||
}
|
||||
|
||||
if (this.fixedColor) {
|
||||
pCompound.putInt("Color", this.getColor());
|
||||
}
|
||||
|
||||
if (!this.effects.isEmpty()) {
|
||||
ListTag listtag = new ListTag();
|
||||
|
||||
for(MobEffectInstance mobeffectinstance : this.effects) {
|
||||
listtag.add(mobeffectinstance.save(new CompoundTag()));
|
||||
}
|
||||
|
||||
pCompound.put("CustomPotionEffects", listtag);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void readAdditionalSaveData(@NotNull CompoundTag pCompound) {
|
||||
super.readAdditionalSaveData(pCompound);
|
||||
if (pCompound.contains("Potion", 8)) {
|
||||
this.potion = PotionUtils.getPotion(pCompound);
|
||||
}
|
||||
|
||||
for(MobEffectInstance mobeffectinstance : PotionUtils.getCustomEffects(pCompound)) {
|
||||
this.addEffect(mobeffectinstance);
|
||||
}
|
||||
|
||||
if (pCompound.contains("Color", 99)) {
|
||||
this.setFixedColor(pCompound.getInt("Color"));
|
||||
} else {
|
||||
this.updateColor();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected void doPostHurtEffects(@NotNull LivingEntity pLiving) {
|
||||
super.doPostHurtEffects(pLiving);
|
||||
Entity entity = this.getEffectSource();
|
||||
|
||||
for(MobEffectInstance mobeffectinstance : this.potion.getEffects()) {
|
||||
pLiving.addEffect(new MobEffectInstance(mobeffectinstance.getEffect(), Math.max(mobeffectinstance.mapDuration((p_268168_) -> {
|
||||
return p_268168_ / 8;
|
||||
}), 1), mobeffectinstance.getAmplifier(), mobeffectinstance.isAmbient(), mobeffectinstance.isVisible()), entity);
|
||||
}
|
||||
|
||||
if (!this.effects.isEmpty()) {
|
||||
for(MobEffectInstance mobeffectinstance1 : this.effects) {
|
||||
pLiving.addEffect(mobeffectinstance1, entity);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected ItemStack getPickupItem() {
|
||||
if (this.effects.isEmpty() && this.potion == Potions.EMPTY) {
|
||||
return new ItemStack(Items.ARROW);
|
||||
} else {
|
||||
ItemStack itemstack = new ItemStack(Items.TIPPED_ARROW);
|
||||
PotionUtils.setPotion(itemstack, this.potion);
|
||||
PotionUtils.setCustomEffects(itemstack, this.effects);
|
||||
if (this.fixedColor) {
|
||||
itemstack.getOrCreateTag().putInt("CustomPotionColor", this.getColor());
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
}
|
||||
}
|
||||
|
||||
public void handleEntityEvent(byte pId) {
|
||||
if (pId == 0) {
|
||||
int i = this.getColor();
|
||||
if (i != -1) {
|
||||
double d0 = (double)(i >> 16 & 255) / 255.0D;
|
||||
double d1 = (double)(i >> 8 & 255) / 255.0D;
|
||||
double d2 = (double)(i >> 0 & 255) / 255.0D;
|
||||
|
||||
for(int j = 0; j < 20; ++j) {
|
||||
this.level().addParticle(ParticleTypes.ENTITY_EFFECT, this.getRandomX(0.5D), this.getRandomY(), this.getRandomZ(0.5D), d0, d1, d2);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
super.handleEntityEvent(pId);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
package com.jenny.compressedtnt.entities.arrows;
|
||||
|
||||
import com.jenny.compressedtnt.entities.entities;
|
||||
import com.jenny.compressedtnt.items.items;
|
||||
import net.minecraft.client.particle.Particle;
|
||||
import net.minecraft.core.particles.ParticleOptions;
|
||||
import net.minecraft.core.particles.ParticleType;
|
||||
import net.minecraft.core.particles.ParticleTypes;
|
||||
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;
|
||||
|
||||
public class concussiveArrow extends baseArrow{
|
||||
public concussiveArrow(EntityType<concussiveArrow> pEntityType, Level pLevel) {
|
||||
super(pEntityType, pLevel);
|
||||
}
|
||||
|
||||
public concussiveArrow(Level pLevel, LivingEntity pShooter) {
|
||||
super(pLevel, pShooter, entities.ARROW_CONCUSSIVE.get());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
if (level().isClientSide()) {
|
||||
level().addParticle(ParticleTypes.SMOKE, this.getX(), this.getY(), this.getZ(), 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
if (this.inGround) {
|
||||
this.level().explode(this, getX(), getY(), getZ(), 8.0f, Level.ExplosionInteraction.NONE);
|
||||
//this.level().explode(this, null, new NilExplosionCalculator(), this.getX(), this.getY(), this.getZ(), 8, false, Level.ExplosionInteraction.NONE);
|
||||
this.discard();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doPostHurtEffects(@NotNull LivingEntity pTarget) {
|
||||
this.level().explode(this, getX(), getY(), getZ(), 8.0f, Level.ExplosionInteraction.NONE);
|
||||
//this.level().explode(this, null, new NilExplosionCalculator(), this.getX(), this.getY(), this.getZ(), 8, false, Level.ExplosionInteraction.NONE);
|
||||
this.discard();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected ItemStack getPickupItem() {
|
||||
return new ItemStack(items.CONCUSSIVE_ARROW.get());
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package com.jenny.compressedtnt.entities.arrows;
|
||||
|
||||
import com.jenny.compressedtnt.items.items;
|
||||
import com.jenny.compressedtnt.entities.entities;
|
||||
|
||||
import net.minecraft.core.particles.ParticleTypes;
|
||||
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;
|
||||
|
||||
public class tntArrow extends baseArrow {
|
||||
public tntArrow(EntityType<tntArrow> pEntityType, Level pLevel) {
|
||||
super(pEntityType, pLevel);
|
||||
}
|
||||
|
||||
public tntArrow(Level pLevel, LivingEntity pShooter) {
|
||||
super(pLevel, pShooter, entities.ARROW_TNT.get());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
if (level().isClientSide()) {
|
||||
level().addParticle(ParticleTypes.SMOKE, this.getX(), this.getY(), this.getZ(), 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
if (this.inGround) {
|
||||
this.level().explode(this, this.getX(), this.getY(), this.getZ(), 2, Level.ExplosionInteraction.TNT);
|
||||
this.discard();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doPostHurtEffects(@NotNull LivingEntity pTarget) {
|
||||
this.level().explode(this, this.getX(), this.getY(), this.getZ(), 2, Level.ExplosionInteraction.TNT);
|
||||
this.discard();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected ItemStack getPickupItem() {
|
||||
return new ItemStack(items.TNT_ARROW.get());
|
||||
}
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
package com.jenny.compressedtnt.entities.client;
|
||||
|
||||
import com.jenny.compressedtnt.blocks.blocks;
|
||||
import com.jenny.compressedtnt.entities.basePrimedTNT;
|
||||
import com.jenny.compressedtnt.entities.tnt.basePrimedTNT;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.math.Axis;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
|
@ -0,0 +1,44 @@
|
||||
package com.jenny.compressedtnt.entities.client;
|
||||
|
||||
import com.jenny.compressedtnt.entities.arrows.baseArrow;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.math.Axis;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.block.BlockRenderDispatcher;
|
||||
import net.minecraft.client.renderer.entity.EntityRenderer;
|
||||
import net.minecraft.client.renderer.entity.EntityRendererProvider;
|
||||
import net.minecraft.client.renderer.entity.TntMinecartRenderer;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlas;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class TNTArrowRenderer extends EntityRenderer<baseArrow> {
|
||||
private final BlockRenderDispatcher blockRenderer;
|
||||
private float i = 0;
|
||||
|
||||
public TNTArrowRenderer(EntityRendererProvider.Context pContext) {
|
||||
super(pContext);
|
||||
this.shadowRadius = 0.0F;
|
||||
this.blockRenderer = pContext.getBlockRenderDispatcher();
|
||||
}
|
||||
|
||||
public void render(@NotNull baseArrow pEntity, float pEntityYaw, float pPartialTicks, PoseStack pPoseStack, @NotNull MultiBufferSource pBuffer, int pPackedLight) {
|
||||
pPoseStack.pushPose();
|
||||
pPoseStack.translate(0.0F, 0.5F, 0.0F);
|
||||
pPoseStack.scale(0.5f, 0.5f, 0.5f);
|
||||
i += 0.1f;
|
||||
pPoseStack.mulPose(Axis.YP.rotationDegrees(-90.0F));
|
||||
pPoseStack.translate(-0.5F, -0.5F, 0.5F);
|
||||
pPoseStack.mulPose(Axis.YP.rotationDegrees(90.0F));
|
||||
TntMinecartRenderer.renderWhiteSolidBlock(this.blockRenderer, Blocks.TNT.defaultBlockState(), pPoseStack, pBuffer, pPackedLight, Math.round(Math.sin(i)) == 0);
|
||||
pPoseStack.popPose();
|
||||
super.render(pEntity, pEntityYaw, pPartialTicks, pPoseStack, pBuffer, pPackedLight);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public ResourceLocation getTextureLocation(@NotNull baseArrow pEntity) {
|
||||
return TextureAtlas.LOCATION_BLOCKS;
|
||||
}
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
package com.jenny.compressedtnt.entities.client;
|
||||
|
||||
import com.jenny.compressedtnt.entities.ClusterPrimedTNT;
|
||||
import com.jenny.compressedtnt.entities.tnt.ClusterPrimedTNT;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.math.Axis;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
|
@ -1,7 +1,11 @@
|
||||
package com.jenny.compressedtnt.entities;
|
||||
|
||||
import com.jenny.compressedtnt.entities.arrows.*;
|
||||
import com.jenny.compressedtnt.entities.client.BaseTNTRenderer;
|
||||
import com.jenny.compressedtnt.entities.client.TNTArrowRenderer;
|
||||
import com.jenny.compressedtnt.entities.client.clusterTNTRenderer;
|
||||
import com.jenny.compressedtnt.entities.tnt.*;
|
||||
|
||||
import net.minecraft.client.renderer.entity.EntityRenderers;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.MobCategory;
|
||||
@ -29,8 +33,20 @@ public class entities {
|
||||
.sized(0.48F, 0.48F).fireImmune().clientTrackingRange(8).build("tnt_cluster"));
|
||||
|
||||
public static final RegistryObject<EntityType<blackHolePrimedTNT>> TNT_BLACK_HOLE =
|
||||
ENTITY_TYPES.register("tnt_chunk", () -> EntityType.Builder.<blackHolePrimedTNT>of(blackHolePrimedTNT::new, MobCategory.MISC)
|
||||
.sized(0.98F, 0.7F).fireImmune().clientTrackingRange(8).build("tnt_chunk"));
|
||||
ENTITY_TYPES.register("tnt_blackhole", () -> EntityType.Builder.<blackHolePrimedTNT>of(blackHolePrimedTNT::new, MobCategory.MISC)
|
||||
.sized(0.98F, 0.7F).fireImmune().clientTrackingRange(8).build("tnt_blackhole"));
|
||||
|
||||
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"));
|
||||
|
||||
public static final RegistryObject<EntityType<tntArrow>> ARROW_TNT =
|
||||
ENTITY_TYPES.register("arrow_tnt", () -> EntityType.Builder.<tntArrow>of(tntArrow::new, MobCategory.MISC)
|
||||
.sized(0.48F, 0.48F).clientTrackingRange(64).build("arrow_tnt"));
|
||||
|
||||
public static final RegistryObject<EntityType<concussiveArrow>> ARROW_CONCUSSIVE =
|
||||
ENTITY_TYPES.register("arrow_concussive", () -> EntityType.Builder.<concussiveArrow>of(concussiveArrow::new, MobCategory.MISC)
|
||||
.sized(0.48F, 0.48F).clientTrackingRange(64).build("arrow_concussive"));
|
||||
|
||||
public static void register(IEventBus eventBus) {
|
||||
ENTITY_TYPES.register(eventBus);
|
||||
@ -40,8 +56,10 @@ public class entities {
|
||||
EntityRenderers.register(TNT_STRONGER.get(), BaseTNTRenderer::new);
|
||||
EntityRenderers.register(TNT_HOMING.get(), BaseTNTRenderer::new);
|
||||
EntityRenderers.register(TNT_BLACK_HOLE.get(), BaseTNTRenderer::new);
|
||||
EntityRenderers.register(TNT_CLAYMORE.get(), BaseTNTRenderer::new);
|
||||
EntityRenderers.register(TNT_CLUSTER.get(), clusterTNTRenderer::new);
|
||||
|
||||
|
||||
EntityRenderers.register(ARROW_TNT.get(), TNTArrowRenderer::new);
|
||||
EntityRenderers.register(ARROW_CONCUSSIVE.get(), TNTArrowRenderer::new);
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
package com.jenny.compressedtnt.entities;
|
||||
package com.jenny.compressedtnt.entities.tnt;
|
||||
|
||||
import com.jenny.compressedtnt.entities.entities;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.level.Level;
|
@ -1,5 +1,6 @@
|
||||
package com.jenny.compressedtnt.entities;
|
||||
package com.jenny.compressedtnt.entities.tnt;
|
||||
|
||||
import com.jenny.compressedtnt.entities.entities;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.level.Level;
|
@ -1,6 +1,5 @@
|
||||
package com.jenny.compressedtnt.entities;
|
||||
package com.jenny.compressedtnt.entities.tnt;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.particles.ParticleTypes;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.syncher.EntityDataAccessor;
|
||||
@ -94,7 +93,7 @@ public abstract class basePrimedTNT extends Entity implements TraceableEntity {
|
||||
return !this.isRemoved();
|
||||
}
|
||||
|
||||
protected Entity.MovementEmission getMovementEmission() {
|
||||
protected Entity.@NotNull MovementEmission getMovementEmission() {
|
||||
return Entity.MovementEmission.NONE;
|
||||
}
|
||||
|
||||
@ -121,7 +120,7 @@ public abstract class basePrimedTNT extends Entity implements TraceableEntity {
|
||||
return this.owner;
|
||||
}
|
||||
|
||||
public void setOwner(LivingEntity owner) {
|
||||
public void setOwner(@Nullable LivingEntity owner) {
|
||||
this.owner = owner;
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.jenny.compressedtnt.entities;
|
||||
package com.jenny.compressedtnt.entities.tnt;
|
||||
|
||||
import com.jenny.compressedtnt.entities.entities;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.syncher.EntityDataAccessor;
|
||||
import net.minecraft.network.syncher.EntityDataSerializers;
|
@ -0,0 +1,77 @@
|
||||
package com.jenny.compressedtnt.entities.tnt;
|
||||
|
||||
import com.jenny.compressedtnt.entities.entities;
|
||||
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.util.RandomSource;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.projectile.Arrow;
|
||||
import net.minecraft.world.entity.projectile.Projectile;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class claymorePrimedTNT extends basePrimedTNT {
|
||||
private static final EntityDataAccessor<Integer> DATA_PCOUNT_ID = SynchedEntityData.defineId(claymorePrimedTNT.class, EntityDataSerializers.INT);
|
||||
|
||||
public claymorePrimedTNT(Level pLevel, double pX, double pY, double pZ, @Nullable LivingEntity pOwner, float power, int fuse, int projectileCount) {
|
||||
super(entities.TNT_CLAYMORE.get(), pLevel, pOwner, new Vec3(pX, pY, pZ), fuse, power, "tnt_claymore");
|
||||
setPCount(projectileCount);
|
||||
}
|
||||
|
||||
public claymorePrimedTNT(EntityType<claymorePrimedTNT> entityType, Level level) {
|
||||
super(entityType, level, null);
|
||||
setRenderID("tnt_claymore");
|
||||
}
|
||||
|
||||
public Vec3 targetVector(RandomSource rng) {
|
||||
return new Vec3(
|
||||
(double) rng.nextInt(-10, 11) / 10,
|
||||
(double) rng.nextInt( 11) / 10,
|
||||
(double) rng.nextInt(-10, 11) / 10);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void explode() {
|
||||
super.explode();
|
||||
RandomSource rng = level().getRandom();
|
||||
for (int i = 0; i < getPCount(); i++) {
|
||||
Vec3 target = targetVector(rng);
|
||||
Vec3 pos = position().add(target);
|
||||
Projectile e = new Arrow(level(),pos.x, pos.y + 1, pos.z);
|
||||
e.setDeltaMovement(target.multiply(5, 0.1, 5));
|
||||
level().addFreshEntity(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addAdditionalSaveData(CompoundTag pCompound) {
|
||||
pCompound.putFloat("ProjectileCount", this.getPCount());
|
||||
super.addAdditionalSaveData(pCompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void readAdditionalSaveData(CompoundTag pCompound) {
|
||||
this.setPCount(pCompound.getInt("ProjectileCount"));
|
||||
super.readAdditionalSaveData(pCompound);
|
||||
}
|
||||
|
||||
public void setPCount(int pCount) {
|
||||
this.entityData.set(DATA_PCOUNT_ID, pCount);
|
||||
}
|
||||
|
||||
public int getPCount() {
|
||||
return this.entityData.get(DATA_PCOUNT_ID);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void defineSynchedData() {
|
||||
this.entityData.define(DATA_PCOUNT_ID, 16);
|
||||
super.defineSynchedData();
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
package com.jenny.compressedtnt.entities;
|
||||
package com.jenny.compressedtnt.entities.tnt;
|
||||
|
||||
import com.jenny.compressedtnt.entities.entities;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.syncher.EntityDataAccessor;
|
||||
import net.minecraft.network.syncher.EntityDataSerializers;
|
@ -0,0 +1,22 @@
|
||||
package com.jenny.compressedtnt.items;
|
||||
|
||||
import com.jenny.compressedtnt.entities.arrows.concussiveArrow;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.projectile.AbstractArrow;
|
||||
import net.minecraft.world.item.ArrowItem;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.Level;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class ArrowConcussive extends ArrowItem {
|
||||
public ArrowConcussive(Item.Properties properties){
|
||||
super(properties);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public AbstractArrow createArrow(@NotNull Level pLevel, @NotNull ItemStack pStack, @NotNull LivingEntity pShooter) {
|
||||
return new concussiveArrow(pLevel, pShooter);
|
||||
}
|
||||
}
|
22
src/main/java/com/jenny/compressedtnt/items/ArrowTNT.java
Normal file
22
src/main/java/com/jenny/compressedtnt/items/ArrowTNT.java
Normal file
@ -0,0 +1,22 @@
|
||||
package com.jenny.compressedtnt.items;
|
||||
|
||||
import com.jenny.compressedtnt.entities.arrows.tntArrow;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.projectile.AbstractArrow;
|
||||
import net.minecraft.world.item.ArrowItem;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.Level;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class ArrowTNT extends ArrowItem {
|
||||
public ArrowTNT(Item.Properties properties){
|
||||
super(properties);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public AbstractArrow createArrow(@NotNull Level pLevel, @NotNull ItemStack pStack, @NotNull LivingEntity pShooter) {
|
||||
return new tntArrow(pLevel, pShooter);
|
||||
}
|
||||
}
|
20
src/main/java/com/jenny/compressedtnt/items/items.java
Normal file
20
src/main/java/com/jenny/compressedtnt/items/items.java
Normal file
@ -0,0 +1,20 @@
|
||||
package com.jenny.compressedtnt.items;
|
||||
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraftforge.eventbus.api.IEventBus;
|
||||
import net.minecraftforge.registries.DeferredRegister;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraftforge.registries.RegistryObject;
|
||||
|
||||
import static com.jenny.compressedtnt.Compressedtnt.MODID;
|
||||
|
||||
public class items {
|
||||
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> CONCUSSIVE_ARROW = ITEMS.register("arrow_concussive", () -> new ArrowConcussive(new Item.Properties()));
|
||||
|
||||
public static void register(IEventBus bus) {
|
||||
ITEMS.register(bus);
|
||||
}
|
||||
}
|
16
src/main/resources/assets/compressedtnt/lang/en_us.json
Normal file
16
src/main/resources/assets/compressedtnt/lang/en_us.json
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"block.compressedtnt.tnt_8": "Compressed TNT",
|
||||
"block.compressedtnt.tnt_16": "Double Compressed TNT",
|
||||
"block.compressedtnt.tnt_32": "Triple Compressed TNT",
|
||||
"block.compressedtnt.tnt_64": "Quadruple Compressed TNT",
|
||||
"block.compressedtnt.tnt_128": "Quintuple Compressed TNT",
|
||||
"block.compressedtnt.tnt_cluster_2": "2× TNT Cluster",
|
||||
"block.compressedtnt.tnt_cluster_4": "4× TNT Cluster",
|
||||
"block.compressedtnt.tnt_cluster_8": "8× TNT Cluster",
|
||||
"block.compressedtnt.tnt_homing": "Homing TNT",
|
||||
"block.compressedtnt.tnt_black_hole": "Black Hole TNT",
|
||||
"block.compressedtnt.tnt_claymore": "Claymore TNT",
|
||||
|
||||
"item.compressedtnt.arrow_tnt": "TNT Arrow",
|
||||
"item.compressedtnt.arrow_concussive": "Concussive Arrow"
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 207 B |
Binary file not shown.
After Width: | Height: | Size: 196 B |
@ -0,0 +1,15 @@
|
||||
{
|
||||
"type": "minecraft:crafting_shapeless",
|
||||
"category": "redstone",
|
||||
"ingredients":[
|
||||
{
|
||||
"item": "compressedtnt:arrow_tnt"
|
||||
},
|
||||
{
|
||||
"item": "minecraft:water_bucket"
|
||||
}
|
||||
],
|
||||
"result": {
|
||||
"item": "compressedtnt:arrow_tnt"
|
||||
}
|
||||
}
|
15
src/main/resources/data/compressedtnt/recipes/arrow_tnt.json
Normal file
15
src/main/resources/data/compressedtnt/recipes/arrow_tnt.json
Normal file
@ -0,0 +1,15 @@
|
||||
{
|
||||
"type": "minecraft:crafting_shapeless",
|
||||
"category": "redstone",
|
||||
"ingredients":[
|
||||
{
|
||||
"item": "minecraft:arrow"
|
||||
},
|
||||
{
|
||||
"item": "minecraft:tnt"
|
||||
}
|
||||
],
|
||||
"result": {
|
||||
"item": "compressedtnt:arrow_tnt"
|
||||
}
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
{
|
||||
"type": "minecraft:crafting_shapeless",
|
||||
"category": "redstone",
|
||||
"ingredients":[
|
||||
{
|
||||
"item": "minecraft:tnt"
|
||||
},
|
||||
{
|
||||
"item": "minecraft:arrow"
|
||||
},
|
||||
{
|
||||
"item": "minecraft:arrow"
|
||||
},
|
||||
{
|
||||
"item": "minecraft:arrow"
|
||||
},
|
||||
{
|
||||
"item": "minecraft:arrow"
|
||||
},
|
||||
{
|
||||
"item": "minecraft:arrow"
|
||||
},
|
||||
{
|
||||
"item": "minecraft:arrow"
|
||||
},
|
||||
{
|
||||
"item": "minecraft:arrow"
|
||||
},
|
||||
{
|
||||
"item": "minecraft:arrow"
|
||||
}
|
||||
],
|
||||
"result": {
|
||||
"item": "compressedtnt:tnt_claymore"
|
||||
}
|
||||
}
|
6
src/main/resources/data/minecraft/tags/items/arrows.json
Normal file
6
src/main/resources/data/minecraft/tags/items/arrows.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"values": [
|
||||
"compressedtnt:arrow_tnt",
|
||||
"compressedtnt:arrow_concussive"
|
||||
]
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user