From bf819cbefef0b0eec2bb8f014e3ffc44d7aeb23d Mon Sep 17 00:00:00 2001 From: Jonathan Date: Tue, 8 Aug 2023 18:31:53 -0500 Subject: [PATCH] fixed 1.12 porting differences. --- src/main/java/ebf/tim/blocks/TileSwitch.java | 15 ++++++--------- src/main/java/ebf/tim/entities/EntityBogie.java | 9 +++++---- .../java/ebf/tim/entities/EntityTrainCore.java | 10 +++++----- .../ebf/tim/entities/GenericRailTransport.java | 2 +- src/main/java/ebf/tim/render/RenderWagon.java | 17 +++++++++-------- src/main/java/ebf/tim/utility/FuelHandler.java | 8 ++++---- .../java/ebf/tim/utility/HitboxDynamic.java | 2 +- 7 files changed, 31 insertions(+), 32 deletions(-) diff --git a/src/main/java/ebf/tim/blocks/TileSwitch.java b/src/main/java/ebf/tim/blocks/TileSwitch.java index 6eb17e2d2..b2047a11a 100644 --- a/src/main/java/ebf/tim/blocks/TileSwitch.java +++ b/src/main/java/ebf/tim/blocks/TileSwitch.java @@ -4,11 +4,9 @@ import fexcraft.tmt.slim.Vec3f; import net.minecraft.entity.item.EntityMinecart; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.ITickable; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.SoundCategory; -import net.minecraft.util.SoundEvent; +import net.minecraft.util.*; import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3i; import java.util.List; @@ -176,8 +174,8 @@ public void tickTile(){ public int checkBlockPower(int[] ... offset){ int signalStrength=0; for(int[] o : offset) { - signalStrength = getWorld().getStrongPower(pos.add(o[0], o[1], o[2])); - if (signalStrength == 0 && getWorld().isBlockPowered(pos.add(o[0], o[1], o[2]))) { + signalStrength = getWorld().getStrongPower(getPos().add(o[0], o[1], o[2])); + if (signalStrength == 0 && getWorld().isBlockPowered(getPos().add(o[0], o[1], o[2]))) { return 15; } else if(signalStrength!=0) { return signalStrength; @@ -189,11 +187,10 @@ public int checkBlockPower(int[] ... offset){ public int checkBlockPower(int[] offset, int depth){ int signalStrength=0; for(int o =-1;o0.3) { diff --git a/src/main/java/ebf/tim/render/RenderWagon.java b/src/main/java/ebf/tim/render/RenderWagon.java index a2144dacc..755dccd4f 100644 --- a/src/main/java/ebf/tim/render/RenderWagon.java +++ b/src/main/java/ebf/tim/render/RenderWagon.java @@ -53,18 +53,21 @@ public ResourceLocation getEntityTexture(GenericRailTransport entity){ return null; } + //manages culling, mostly just breaks stuff, leave to return true. + @Override + public boolean shouldRender(GenericRailTransport entity, ICamera camera, double camX, double camY, double camZ) { + return true; + } /** *

base render extension

* acts as a redirect for the base render function to our own function. * This is just to do typecasting and a few calculations beforehand so we only need to do them once per render. * todo: 1.9+ should support Entity so this typecasting method should be completely useless then. */ - /*@Override - public void doRender(Entity entity, double x, double y, double z, float yaw, float partialTick){ - if (entity instanceof GenericRailTransport){ - render((GenericRailTransport) entity, x, y, z, entity.rotationYaw + CommonUtil.wrapAngleTo180(entity.rotationYaw - entity.prevRotationYaw) * partialTick, - ((GenericRailTransport) entity).backBogie==null); - } + @Override + public void doRender(GenericRailTransport entity, double x, double y, double z, float yaw, float partialTick){ + render(entity, x, y, z, entity.rotationYaw + CommonUtil.wrapAngleTo180(entity.rotationYaw - entity.prevRotationYaw) * partialTick, + entity.backBogie==null); } @Override @@ -72,13 +75,11 @@ public void doRenderShadowAndFire(Entity entityIn, double x, double y, double z, {} public void render(GenericRailTransport entity, double x, double y, double z, float yaw, boolean isPaintBucket) { - renderBlocks=field_147909_c; doRender(entity,x,y,z,yaw,entity.backBogie!=null?entity.backBogie.yOffset:0, isPaintBucket, null, this); } public void render(GenericRailTransport entity, double x, double y, double z, float yaw, boolean isPaintBucket, TransportSkin textureURI) { - renderBlocks=field_147909_c; doRender(entity,x,y,z,yaw,entity.backBogie !=null?entity.backBogie.yOffset:0, isPaintBucket, textureURI, this); } diff --git a/src/main/java/ebf/tim/utility/FuelHandler.java b/src/main/java/ebf/tim/utility/FuelHandler.java index ebed650c9..3ebbda673 100644 --- a/src/main/java/ebf/tim/utility/FuelHandler.java +++ b/src/main/java/ebf/tim/utility/FuelHandler.java @@ -189,7 +189,7 @@ public void manageSteam(EntityTrainCore train){ train.fill(getUseableFluid(train.waterSlot().getSlotID(),train), true); if (!train.getBoolean(GenericRailTransport.boolValues.CREATIVE)) { train.getSlotIndexByID(train.waterSlot().getSlotID()).decrStackSize(1); - train.addItem(new ItemStack(Items.bucket)); + train.addItem(new ItemStack(Items.BUCKET)); train.markDirty(); } } @@ -419,11 +419,11 @@ public static void manageElectricFuel(EntityTrainCore train){ public static void manageTanker(GenericRailTransport transport){ if (getUseableFluid(transport.tankerInputSlot().getSlotID(),transport) !=null && - transport.fill(null,getUseableFluid(transport.tankerInputSlot().getSlotID(),transport),false)==getUseableFluid(transport.tankerInputSlot().getSlotID(),transport).amount) { - transport.fill(null,getUseableFluid(transport.tankerInputSlot().getSlotID(),transport), true); + transport.fill(getUseableFluid(transport.tankerInputSlot().getSlotID(),transport),false)==getUseableFluid(transport.tankerInputSlot().getSlotID(),transport).amount) { + transport.fill(getUseableFluid(transport.tankerInputSlot().getSlotID(),transport), true); if (!transport.getBoolean(GenericRailTransport.boolValues.CREATIVE)) { transport.getSlotIndexByID(transport.tankerInputSlot().getSlotID()).decrStackSize(1); - transport.addItem(new ItemStack(Items.bucket)); + transport.addItem(new ItemStack(Items.BUCKET)); } } //attempt to fill any buckets in the drain slot diff --git a/src/main/java/ebf/tim/utility/HitboxDynamic.java b/src/main/java/ebf/tim/utility/HitboxDynamic.java index 741535874..b5b9399bc 100644 --- a/src/main/java/ebf/tim/utility/HitboxDynamic.java +++ b/src/main/java/ebf/tim/utility/HitboxDynamic.java @@ -41,7 +41,7 @@ public HitboxDynamic(float depth, float height, float width, GenericRailTranspor width*0.5,height,width*0.5)); c.setPosition(entity.posX, entity.posY, entity.posZ); interactionBoxes.add(c); - entity.worldObj.spawnEntityInWorld(c); + entity.getWorld().spawnEntity(c); if(front==null){ front=c; } else{