Skip to content

Commit a4ded7f

Browse files
General cleanup
1 parent eb7eee5 commit a4ded7f

10 files changed

+30
-45
lines changed

src/main/java/fl205/ironfurnaces/blocks/BlockLogicCustomFurnace.java

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@
2121
public abstract class BlockLogicCustomFurnace extends BlockLogicRotatable {
2222
protected final boolean isActive;
2323
public static boolean keepFurnaceInventory = false;
24-
protected final int activeId;
2524
protected final int idleID;
26-
public BlockLogicCustomFurnace(Block<?> block, boolean isActive, int activeID, int idleID) {
25+
26+
public BlockLogicCustomFurnace(Block<?> block, boolean isActive, int idleID) {
2727
super(block, Material.metal);
2828
this.isActive = isActive;
29-
this.activeId = activeID;
3029
this.idleID = idleID;
3130
}
3231

32+
@SuppressWarnings("ConstantConditions")
3333
public ItemStack[] getBreakResult(World world, EnumDropCause dropCause, int x, int y, int z, int meta, TileEntity tileEntity) {
3434
switch (dropCause) {
3535
case PICK_BLOCK:
@@ -46,23 +46,23 @@ public ItemStack[] getBreakResult(World world, EnumDropCause dropCause, int x, i
4646
public void animationTick(World world, int x, int y, int z, Random rand) {
4747
if (this.isActive) {
4848
int l = world.getBlockMetadata(x, y, z);
49-
double poxX = (double)x + 0.5;
50-
double posY = (double)y + 0.0 + (double)(rand.nextFloat() * 6.0F / 16.0F);
51-
double posZ = (double)z + 0.5;
52-
double f3 = 0.5199999809265137;
49+
double poxX = (double) x + (double) 0.5F;
50+
double posY = (double) y + (double) 0.0F + (double) (rand.nextFloat() * 6.0F / 16.0F);
51+
double posZ = (double) z + (double) 0.5F;
52+
double f3 = 0.52F;
5353
double f4 = (rand.nextFloat() * 0.6F - 0.3F);
5454
if (l == 4) {
55-
world.spawnParticle("smoke", poxX - f3, posY, posZ + f4, 0.0, 0.0, 0.0, 0);
56-
world.spawnParticle("flame", poxX - f3, posY, posZ + f4, 0.0, 0.0, 0.0, 0);
55+
world.spawnParticle("smoke", poxX - f3, posY, posZ + f4, 0.0F, 0.0F, 0.0F, 0);
56+
world.spawnParticle("flame", poxX - f3, posY, posZ + f4, 0.0F, 0.0F, 0.0F, 0);
5757
} else if (l == 5) {
58-
world.spawnParticle("smoke", poxX + f3, posY, posZ + f4, 0.0, 0.0, 0.0, 0);
59-
world.spawnParticle("flame", poxX + f3, posY, posZ + f4, 0.0, 0.0, 0.0, 0);
58+
world.spawnParticle("smoke", poxX + f3, posY, posZ + f4, 0.0F, 0.0F, 0.0F, 0);
59+
world.spawnParticle("flame", poxX + f3, posY, posZ + f4, 0.0F, 0.0F, 0.0F, 0);
6060
} else if (l == 2) {
61-
world.spawnParticle("smoke", poxX + f4, posY, posZ - f3, 0.0, 0.0, 0.0, 0);
62-
world.spawnParticle("flame", poxX + f4, posY, posZ - f3, 0.0, 0.0, 0.0, 0);
61+
world.spawnParticle("smoke", poxX + f4, posY, posZ - f3, 0.0F, 0.0F, 0.0F, 0);
62+
world.spawnParticle("flame", poxX + f4, posY, posZ - f3, 0.0F, 0.0F, 0.0F, 0);
6363
} else if (l == 3) {
64-
world.spawnParticle("smoke", poxX + f4, posY, posZ + f3, 0.0, 0.0, 0.0, 0);
65-
world.spawnParticle("flame", poxX + f4, posY, posZ + f3, 0.0, 0.0, 0.0, 0);
64+
world.spawnParticle("smoke", poxX + f4, posY, posZ + f3, 0.0F, 0.0F, 0.0F, 0);
65+
world.spawnParticle("flame", poxX + f4, posY, posZ + f3, 0.0F, 0.0F, 0.0F, 0);
6666
}
6767

6868
}

src/main/java/fl205/ironfurnaces/blocks/BlockLogicDiamondFurnace.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
public class BlockLogicDiamondFurnace extends BlockLogicCustomFurnace {
99
public BlockLogicDiamondFurnace(Block<?> block, boolean isActive) {
10-
super(block, isActive, config.getInt("IDs.diamondFurnaceIdleID") + 1, config.getInt("IDs.diamondFurnaceIdleID"));
10+
super(block, isActive, config.getInt("IDs.diamondFurnaceIdleID"));
1111
block.withEntity(TileEntityDiamondFurnace::new);
1212
}
1313
}

src/main/java/fl205/ironfurnaces/blocks/BlockLogicGoldFurnace.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
public class BlockLogicGoldFurnace extends BlockLogicCustomFurnace {
99
public BlockLogicGoldFurnace(Block<?> block, boolean isActive) {
10-
super(block, isActive, config.getInt("IDs.goldFurnaceIdleID") + 1, config.getInt("IDs.goldFurnaceIdleID"));
10+
super(block, isActive, config.getInt("IDs.goldFurnaceIdleID"));
1111
block.withEntity(TileEntityGoldFurnace::new);
1212
}
1313
}

src/main/java/fl205/ironfurnaces/blocks/BlockLogicIronFurnace.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
public class BlockLogicIronFurnace extends BlockLogicCustomFurnace {
99
public BlockLogicIronFurnace(Block<?> block, boolean isActive) {
10-
super(block, isActive, config.getInt("IDs.ironFurnaceIdleID") + 1, config.getInt("IDs.ironFurnaceIdleID"));
10+
super(block, isActive, config.getInt("IDs.ironFurnaceIdleID"));
1111
block.withEntity(TileEntityIronFurnace::new);
1212
}
1313
}

src/main/java/fl205/ironfurnaces/blocks/BlockLogicSteelFurnace.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
public class BlockLogicSteelFurnace extends BlockLogicCustomFurnace {
99
public BlockLogicSteelFurnace(Block<?> block, boolean isActive) {
10-
super(block, isActive, config.getInt("IDs.steelFurnaceIdleID") + 1, config.getInt("IDs.steelFurnaceIdleID"));
10+
super(block, isActive, config.getInt("IDs.steelFurnaceIdleID"));
1111
block.withEntity(TileEntitySteelFurnace::new);
1212
}
1313
}

src/main/java/fl205/ironfurnaces/tileEntities/TileEntityCustomFurnace.java

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import java.util.List;
55
import java.util.Random;
66

7-
import net.minecraft.core.block.Block;
87
import net.minecraft.core.block.Blocks;
98
import net.minecraft.core.block.entity.TileEntityFurnace;
109
import net.minecraft.core.crafting.LookupFuelFurnace;
@@ -19,14 +18,13 @@ public abstract class TileEntityCustomFurnace extends TileEntityFurnace {
1918
private final Random random = new Random();
2019
protected final int speedModifier;
2120
protected final int fuelYieldModifier;
22-
protected final Block<?> furnaceIdle;
23-
public TileEntityCustomFurnace(int speedModifier, int fuelYieldModifier, Block<?> furnaceIdle){
21+
protected final int idleID;
22+
public TileEntityCustomFurnace(int speedModifier, int fuelYieldModifier, int idleID){
2423
this.speedModifier = speedModifier;
2524
this.fuelYieldModifier = fuelYieldModifier;
26-
this.furnaceIdle = furnaceIdle;
25+
this.idleID = idleID;
2726
maxCookTime = 20000 / speedModifier;
2827
}
29-
public abstract String getInvName();
3028

3129
public void tick() {
3230
boolean isBurnTimeHigherThan0 = this.currentBurnTime > 0;
@@ -35,8 +33,8 @@ public void tick() {
3533
--this.currentBurnTime;
3634
}
3735

38-
if (this.worldObj != null && !this.worldObj.isClientSide) {
39-
if (this.worldObj.getBlockId(this.x, this.y, this.z) == furnaceIdle.id() && this.currentBurnTime == 0 && this.furnaceItemStacks[0] == null && this.furnaceItemStacks[1] != null && this.furnaceItemStacks[1].itemID == Blocks.COBBLE_NETHERRACK.id()) {
36+
if (this.worldObj == null || !this.worldObj.isClientSide) {
37+
if ((this.worldObj == null || this.worldObj.getBlockId(this.x, this.y, this.z) == idleID) && this.currentBurnTime == 0 && this.furnaceItemStacks[0] == null && this.furnaceItemStacks[1] != null && this.furnaceItemStacks[1].itemID == Blocks.COBBLE_NETHERRACK.id()) {
4038
--this.furnaceItemStacks[1].stackSize;
4139
if (this.furnaceItemStacks[1].stackSize <= 0) {
4240
this.furnaceItemStacks[1] = null;
@@ -114,11 +112,10 @@ private boolean canSmelt() {
114112

115113
protected void updateFurnace(boolean forceLit) {
116114
if (this.worldObj != null) {
117-
BlockLogicCustomFurnace.updateFurnaceBlockState(forceLit | this.currentBurnTime > 0, this.worldObj, this.x, this.y, this.z, furnaceIdle.id());
115+
BlockLogicCustomFurnace.updateFurnaceBlockState(forceLit | this.currentBurnTime > 0, this.worldObj, this.x, this.y, this.z, idleID);
118116
} else if (this.carriedBlock != null) {
119-
this.carriedBlock.blockId = forceLit | this.currentBurnTime > 0 ? furnaceIdle.id() + 1 : furnaceIdle.id();
117+
this.carriedBlock.blockId = forceLit | this.currentBurnTime > 0 ? idleID + 1 : idleID;
120118
}
121-
122119
}
123120

124121
private int getBurnTimeFromItem(ItemStack itemStack) {

src/main/java/fl205/ironfurnaces/tileEntities/TileEntityDiamondFurnace.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66

77
public class TileEntityDiamondFurnace extends TileEntityCustomFurnace {
88
public TileEntityDiamondFurnace(){
9-
super(config.getInt("Speed.diamondFurnace"), config.getInt("Fuel Yield.diamondFurnace"), IronFurnaces.furnaceDiamondIdle);
10-
}
11-
public String getInvName() {
12-
return "Diamond Furnace";
9+
super(config.getInt("Speed.diamondFurnace"), config.getInt("Fuel Yield.diamondFurnace"), IronFurnaces.furnaceDiamondIdle.id());
1310
}
1411
}

src/main/java/fl205/ironfurnaces/tileEntities/TileEntityGoldFurnace.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66

77
public class TileEntityGoldFurnace extends TileEntityCustomFurnace {
88
public TileEntityGoldFurnace(){
9-
super(config.getInt("Speed.goldFurnace"), config.getInt("Fuel Yield.goldFurnace"), IronFurnaces.furnaceGoldIdle);
10-
}
11-
public String getInvName() {
12-
return "Gold Furnace";
9+
super(config.getInt("Speed.goldFurnace"), config.getInt("Fuel Yield.goldFurnace"), IronFurnaces.furnaceGoldIdle.id());
1310
}
1411
}

src/main/java/fl205/ironfurnaces/tileEntities/TileEntityIronFurnace.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66

77
public class TileEntityIronFurnace extends TileEntityCustomFurnace {
88
public TileEntityIronFurnace(){
9-
super(config.getInt("Speed.ironFurnace"), config.getInt("Fuel Yield.ironFurnace"), IronFurnaces.furnaceIronIdle);
10-
}
11-
public String getInvName() {
12-
return "Iron Furnace";
9+
super(config.getInt("Speed.ironFurnace"), config.getInt("Fuel Yield.ironFurnace"), IronFurnaces.furnaceIronIdle.id());
1310
}
1411
}

src/main/java/fl205/ironfurnaces/tileEntities/TileEntitySteelFurnace.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66

77
public class TileEntitySteelFurnace extends TileEntityCustomFurnace {
88
public TileEntitySteelFurnace(){
9-
super(config.getInt("Speed.steelFurnace"), config.getInt("Fuel Yield.steelFurnace"), IronFurnaces.furnaceSteelIdle);
10-
}
11-
public String getInvName() {
12-
return "Steel Furnace";
9+
super(config.getInt("Speed.steelFurnace"), config.getInt("Fuel Yield.steelFurnace"), IronFurnaces.furnaceSteelIdle.id());
1310
}
1411
}

0 commit comments

Comments
 (0)