Compare commits

..

No commits in common. "183d0fe38af5f39e78f944422ee57a94cfd641b7" and "2325f0ce1846eff4c25de672016487cb8c09d2a5" have entirely different histories.

26 changed files with 105 additions and 199 deletions

View File

@ -7,7 +7,6 @@ import net.minecraft.data.PackOutput;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.block.*;
import net.minecraftforge.client.model.generators.BlockStateProvider;
import net.minecraftforge.client.model.generators.ConfiguredModel;
import net.minecraftforge.common.data.ExistingFileHelper;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegistryObject;
@ -27,6 +26,9 @@ public class ModBlockStateProvider extends BlockStateProvider {
sideTopBottom(blocks.TNT_32.get());
sideTopBottom(blocks.TNT_64.get());
sideTopBottom(blocks.TNT_128.get());
sideTopBottom(blocks.TNT_CLUSTER_2.get());
sideTopBottom(blocks.TNT_CLUSTER_4.get());
sideTopBottom(blocks.TNT_CLUSTER_8.get());
}
private void blockWithItem(RegistryObject<Block> blockRegistryObject) {
@ -60,7 +62,6 @@ public class ModBlockStateProvider extends BlockStateProvider {
public void sideTopBottom(Block block) {
ModelFile model = models().cubeBottomTop(name(block), extend(blockTexture(block), "_side"), extend(blockTexture(block), "_bottom"), extend(blockTexture(block), "_top"));
this.getVariantBuilder(block).forAllStates(blockState -> ConfiguredModel.builder().modelFile(model).build());
simpleBlockItem(block, model);
}

View File

@ -10,8 +10,12 @@ import javax.annotation.Nullable;
public class ClusterPrimedTNT extends basePrimedTNT {
public ClusterPrimedTNT (Level pLevel, double pX, double pY, double pZ, @Nullable LivingEntity pOwner, float power, int fuse, Vec3 move) {
super(entities.TNT_CLUSTER.get(), pLevel, pOwner, new Vec3(pX, pY, pZ), fuse, power, "cluster");
super(entities.TNT_CLUSTER.get(), pLevel, pOwner);
this.setPos(pX, pY, pZ);
this.setFuse(fuse);
this.setPower(power);
this.addDeltaMovement(move);
this.setRenderID("cluster");
}
public ClusterPrimedTNT(EntityType<ClusterPrimedTNT> entityType, Level level) {

View File

@ -3,13 +3,15 @@ package com.jenny.compressedtnt.entities;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.level.Level;
import net.minecraft.world.phys.Vec3;
import javax.annotation.Nullable;
public class StrongerPrimedTNT extends basePrimedTNT {
public StrongerPrimedTNT (Level pLevel, double pX, double pY, double pZ, @Nullable LivingEntity pOwner, float power, int fuse) {
super(entities.TNT_STRONGER.get(), pLevel, pOwner, new Vec3(pX, pY, pZ), fuse, power, "default");
super(entities.TNT_STRONGER.get(), pLevel, pOwner);
this.setPos(pX, pY, pZ);
this.setFuse(fuse);
this.setPower(power);
this.setRenderID(evalRenderID());
}

View File

@ -1,6 +1,5 @@
package com.jenny.compressedtnt.entities;
import net.minecraft.core.BlockPos;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.syncher.EntityDataAccessor;
@ -8,8 +7,6 @@ import net.minecraft.network.syncher.EntityDataSerializers;
import net.minecraft.network.syncher.SynchedEntityData;
import net.minecraft.world.entity.*;
import net.minecraft.world.level.Level;
import net.minecraft.world.phys.Vec3;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nullable;
@ -25,25 +22,12 @@ public abstract class basePrimedTNT extends Entity implements TraceableEntity {
public basePrimedTNT(EntityType<? extends basePrimedTNT> pEntityType, Level pLevel, @Nullable LivingEntity owner) {
super(pEntityType, pLevel);
commonInit(pLevel, owner);
}
private void commonInit(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.owner = owner;
}
public basePrimedTNT(EntityType<? extends basePrimedTNT> pEntityType, Level pLevel, @Nullable LivingEntity owner, Vec3 pos, int fuse, float power, String renderID) {
super(pEntityType, pLevel);
commonInit(pLevel, owner);
setPos(pos);
setFuse(fuse);
setPower(power);
setRenderID(renderID);
}
protected void explode() {
this.level().explode(this, this.getX(), this.getY(0.0625D), this.getZ(), this.getPower(), Level.ExplosionInteraction.TNT);
}
@ -132,8 +116,4 @@ public abstract class basePrimedTNT extends Entity implements TraceableEntity {
public String getRenderID() {
return this.entityData.get(DATA_RENDER_ID);
}
protected float getEyeHeight(@NotNull Pose pPose, @NotNull EntityDimensions pSize) {
return 0.15F;
}
}

View File

@ -8,6 +8,7 @@ import net.minecraft.world.entity.*;
import net.minecraft.world.level.Level;
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;
@ -16,14 +17,18 @@ public class blackHolePrimedTNT extends basePrimedTNT {
private static final EntityDataAccessor<Float> DATA_SPEED_ID = SynchedEntityData.defineId(blackHolePrimedTNT.class, EntityDataSerializers.FLOAT);
public blackHolePrimedTNT(Level pLevel, double pX, double pY, double pZ, @Nullable LivingEntity pOwner, float power, int fuse, float speed) {
super(entities.TNT_BLACK_HOLE.get(), pLevel, pOwner, new Vec3(pX, pY, pZ), fuse, power, "black_hole");
super(entities.TNT_BLACK_HOLE.get(), pLevel, pOwner);
this.setRenderID("black_hole");
this.setPos(pX, pY, pZ);
this.setOwner(pOwner);
this.setSpeed(speed);
this.setPower(power);
this.setFuse(fuse);
}
public blackHolePrimedTNT(EntityType<blackHolePrimedTNT> entityType, Level level) {
super(entityType, level, null);
this.setRenderID("black_hole");
this.setSpeed(this.getSpeed());
}
private Vec3 targetVector(Entity target) {
@ -85,4 +90,8 @@ public class blackHolePrimedTNT extends basePrimedTNT {
this.entityData.define(DATA_SPEED_ID, 4.0f);
super.defineSynchedData();
}
protected float getEyeHeight(@NotNull Pose pPose, @NotNull EntityDimensions pSize) {
return 0.15F;
}
}

View File

@ -1,25 +1,27 @@
package com.jenny.compressedtnt.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.world.entity.*;
import net.minecraft.world.entity.ai.targeting.TargetingConditions;
import net.minecraft.world.level.Level;
import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.Vec3;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nullable;
public class homingPrimedTNT extends basePrimedTNT {
private static final EntityDataAccessor<Float> DATA_SPEED_ID = SynchedEntityData.defineId(homingPrimedTNT.class, EntityDataSerializers.FLOAT);
float speed = 0;
Entity target;
public homingPrimedTNT (Level pLevel, double pX, double pY, double pZ, @Nullable LivingEntity pOwner, float power, int fuse, float speed) {
super(entities.TNT_HOMING.get(), pLevel, pOwner, new Vec3(pX, pY, pZ), fuse, power, "homing");
super(entities.TNT_HOMING.get(), pLevel, pOwner);
this.setPos(pX, pY, pZ);
this.setOwner(pOwner);
this.speed = speed;
this.target = null;
this.setSpeed(speed);
this.setPower(power);
this.setFuse(fuse);
this.setRenderID("homing");
}
public homingPrimedTNT(EntityType<homingPrimedTNT> entityType, Level level) {
@ -30,7 +32,6 @@ public class homingPrimedTNT extends basePrimedTNT {
double targetDist = getTargetDist();
Vec3 targetVec = new Vec3(0, 0, 0);
if (targetDist > 3) {
float speed = getSpeed();
targetVec = new Vec3(target.getX() - this.getX(), target.getY() - this.getY(), target.getZ() - this.getZ()).normalize().multiply(speed, speed, speed);
if (targetDist < 10) {
targetVec.multiply(targetDist / 10, targetDist / 10, targetDist / 10);
@ -48,6 +49,7 @@ public class homingPrimedTNT extends basePrimedTNT {
Vec3 corner2 = this.position().add(15, 15, 15);
AABB boundingBox = new AABB(corner1, corner2);
target = this.level().getNearestEntity(LivingEntity.class, TargetingConditions.forNonCombat(), null, this.getX(), this.getY(), this.getZ(), boundingBox);
}
@Override
@ -62,29 +64,7 @@ public class homingPrimedTNT extends basePrimedTNT {
super.tick();
}
@Override
protected void addAdditionalSaveData(CompoundTag pCompound) {
pCompound.putFloat("Speed", this.getSpeed());
super.addAdditionalSaveData(pCompound);
}
@Override
protected void readAdditionalSaveData(CompoundTag pCompound) {
this.setSpeed(pCompound.getFloat("Speed"));
super.readAdditionalSaveData(pCompound);
}
public void setSpeed(float speed) {
this.entityData.set(DATA_SPEED_ID, speed);
}
public float getSpeed() {
return this.entityData.get(DATA_SPEED_ID);
}
@Override
protected void defineSynchedData() {
this.entityData.define(DATA_SPEED_ID, 4.0f);
super.defineSynchedData();
protected float getEyeHeight(@NotNull Pose pPose, @NotNull EntityDimensions pSize) {
return 0.15F;
}
}

View File

@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "compressedtnt:block/tnt_128"
}
}
}

View File

@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "compressedtnt:block/tnt_16"
}
}
}

View File

@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "compressedtnt:block/tnt_32"
}
}
}

View File

@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "compressedtnt:block/tnt_64"
}
}
}

View File

@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "compressedtnt:block/tnt_8"
}
}
}

View File

@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "compressedtnt:block/ttn_black_hole"
}
}
}

View File

@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "compressedtnt:block/tnt_cluster_2"
}
}
}

View File

@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "compressedtnt:block/tnt_cluster_4"
}
}
}

View File

@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "compressedtnt:block/tnt_cluster_8"
}
}
}

View File

@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "compressedtnt:block/tnt_homing"
}
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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