1
0
Fork 0

add new furnaces

This commit is contained in:
Sen 2025-08-11 20:34:05 +02:00
parent 8f879e9932
commit 08acee12b7
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
16 changed files with 131 additions and 57 deletions

View file

Before

Width:  |  Height:  |  Size: 564 B

After

Width:  |  Height:  |  Size: 564 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 550 B

After

Width:  |  Height:  |  Size: 550 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 615 B

After

Width:  |  Height:  |  Size: 615 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 661 B

After

Width:  |  Height:  |  Size: 661 B

Before After
Before After

Binary file not shown.

After

Width:  |  Height:  |  Size: 564 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 550 B

View file

@ -3,8 +3,8 @@ package common.ai;
import common.block.Block;
import common.block.artificial.BlockBed;
import common.block.tech.BlockChest;
import common.block.tech.BlockFurnace;
import common.entity.animal.EntityCat;
import common.init.Blocks;
import common.tileentity.TileEntity;
import common.tileentity.TileEntityChest;
import common.util.BlockPos;
@ -98,7 +98,7 @@ public class EntityAICatSit extends EntityAIMoveToBlock
}
else
{
if (block == Blocks.lit_furnace)
if (block instanceof BlockFurnace furnace && furnace.isLit())
{
return true;
}

View file

@ -169,10 +169,10 @@ public class BlockDispenser extends Block implements ITileEntityProvider, Direct
public Model getModel(ModelProvider provider, String name, State state) {
if(state.getValue(FACING) == Facing.DOWN || state.getValue(FACING) == Facing.UP)
return provider.getModel("furnace_top").add().dnswe().u(name + "_front_vertical")
return provider.getModel("dispenser_top").add().dnswe().u(name + "_front_vertical")
.rotate(state.getValue(FACING) == Facing.DOWN ? ModelRotation.X180_Y0 : ModelRotation.X0_Y0);
else
return provider.getModel(name + "_front_horizontal").add().du("furnace_top").n()
.s("furnace_side").we("furnace_side").rotate(ModelRotation.getNorthRot(state.getValue(FACING)));
return provider.getModel(name + "_front_horizontal").add().du("dispenser_top").n()
.s("dispenser_side").we("dispenser_side").rotate(ModelRotation.getNorthRot(state.getValue(FACING)));
}
}

View file

@ -1,12 +1,13 @@
package common.block.tech;
import java.util.List;
import common.block.Block;
import common.block.ITileEntityProvider;
import common.block.Rotatable;
import common.block.Material;
import common.init.Blocks;
import common.init.Items;
import common.block.SoundType;
import common.entity.npc.EntityNPC;
import common.item.Item;
import common.item.ItemStack;
import common.model.Model;
import common.model.Model.ModelProvider;
import common.model.ModelRotation;
@ -14,22 +15,46 @@ import common.rng.Random;
import common.tileentity.TileEntity;
import common.tileentity.DeviceFurnace;
import common.util.BlockPos;
import common.util.Clientside;
import common.util.Color;
import common.util.Facing;
import common.util.ParticleType;
import common.world.State;
import common.world.World;
import common.world.AWorldServer;
public class BlockFurnace extends BlockMachine implements ITileEntityProvider, Rotatable {
public class BlockFurnace extends BlockMachine {
private static boolean keepInventory;
private final boolean isBurning;
private final int burnTime;
private final int fuelEfficiency;
private BlockFurnace other;
public BlockFurnace(boolean isBurning, int burnTime) {
private BlockFurnace(boolean isBurning, int burnTime, int fuelEfficiency) {
super(Material.SOLID);
this.isBurning = isBurning;
this.burnTime = burnTime;
this.fuelEfficiency = fuelEfficiency;
this.setHardness(3.5F).setSound(SoundType.STONE);
if(this.isBurning)
this.setLight(0.875F);
}
public BlockFurnace(int burnTime, int fuelEfficiency) {
this(false, burnTime, fuelEfficiency);
}
public BlockFurnace(BlockFurnace other) {
this(true, other.burnTime, other.fuelEfficiency);
this.other = other;
other.other = this;
this.setDisplay(other.getDisplay());
}
public boolean isLit() {
return this.isBurning;
}
public void onAdded(AWorldServer worldIn, BlockPos pos, State state) {
@ -62,6 +87,7 @@ public class BlockFurnace extends BlockMachine implements ITileEntityProvider, R
}
}
@Clientside
public void displayTick(World worldIn, BlockPos pos, State state, Random rand) {
if(this.isBurning) {
Facing enumfacing = (Facing)state.getValue(FACING);
@ -94,22 +120,15 @@ public class BlockFurnace extends BlockMachine implements ITileEntityProvider, R
}
}
public static void setState(boolean active, World worldIn, BlockPos pos) {
public void setState(boolean active, World worldIn, BlockPos pos) {
State iblockstate = worldIn.getState(pos);
if(iblockstate.getBlock() != this || ((BlockFurnace)iblockstate.getBlock()).isBurning == active)
return;
TileEntity tileentity = worldIn.getTileEntity(pos);
keepInventory = true;
if(active) {
worldIn.setState(pos, Blocks.lit_furnace.getState().withProperty(FACING, iblockstate.getValue(FACING)), 3);
worldIn.setState(pos, Blocks.lit_furnace.getState().withProperty(FACING, iblockstate.getValue(FACING)), 3);
}
else {
worldIn.setState(pos, Blocks.furnace.getState().withProperty(FACING, iblockstate.getValue(FACING)), 3);
worldIn.setState(pos, Blocks.furnace.getState().withProperty(FACING, iblockstate.getValue(FACING)), 3);
}
worldIn.setState(pos, this.other.getState().withProperty(FACING, iblockstate.getValue(FACING)), 3);
worldIn.setState(pos, this.other.getState().withProperty(FACING, iblockstate.getValue(FACING)), 3);
keepInventory = false;
if(tileentity != null) {
tileentity.validate();
worldIn.setTileEntity(pos, tileentity);
@ -117,7 +136,7 @@ public class BlockFurnace extends BlockMachine implements ITileEntityProvider, R
}
public TileEntity createNewTileEntity() {
return new DeviceFurnace(this.burnTime);
return new DeviceFurnace(this.burnTime, this.fuelEfficiency);
}
public void onRemoved(AWorldServer worldIn, BlockPos pos, State state) {
@ -126,14 +145,27 @@ public class BlockFurnace extends BlockMachine implements ITileEntityProvider, R
}
public Item getItem() {
return Items.furnace;
}
public Model getModel(ModelProvider provider, String name, State state) {
return provider.getModel("furnace_side").add().du("furnace_top").n("furnace_front_" + (this.isBurning ? "on" : "off")).s().we().rotate(ModelRotation.getNorthRot(state.getValue(FACING)));
return this.isBurning ? this.other.getItem() : super.getItem();
}
protected boolean hasRegisteredItem() {
return !this.isBurning;
}
@Clientside
public Model getModel(ModelProvider provider, String name, State state) {
name = name.replace("lit_", "");
return provider.getModel(name + "_side").add().du(name + "_top").n(name + "_front_" + (this.isBurning ? "on" : "off")).s().we().rotate(ModelRotation.getNorthRot(state.getValue(FACING)));
}
@Clientside
public void getTooltips(ItemStack stack, EntityNPC player, List<String> tooltip) {
tooltip.add(Color.DARK_GREEN + "Schmelzzeit: " + Color.GREEN + (this.burnTime / 20) + " s");
tooltip.add(Color.CYAN + "Effizienz: " + Color.NEON + this.fuelEfficiency + " %");
}
@Clientside
public String getInfo(World world, BlockPos pos, State state, EntityNPC player) {
return Color.DARK_GREEN + "Schmelzzeit: " + Color.GREEN + (this.burnTime / 20) + " s" + Color.DARK_GRAY + " | " + Color.CYAN + "Effizienz: " + Color.NEON + this.fuelEfficiency + " %";
}
}

View file

@ -540,10 +540,28 @@ public abstract class BlockRegistry {
register("core", new BlockCore().setHardness(1.5F).setResistance(10.0F).setSound(SoundType.STONE).setDisplay("Chunk-Lade-Kern"));
register("mob_spawner", (new BlockMobSpawner()).setHardness(3.0F).setResistance(8.0F).setSound(SoundType.STONE).setDisplay("Mob-Spawner"));
register("workbench", (new BlockWorkbench(3)).setHardness(2.5F).setSound(SoundType.WOOD).setDisplay("Werkbank"));
register("furnace", (new BlockFurnace(false, 200)).setHardness(3.5F).setSound(SoundType.STONE).setDisplay("Ofen")
.setTab(CheatTab.TECHNOLOGY));
register("lit_furnace", (new BlockFurnace(true, 200)).setHardness(3.5F).setSound(SoundType.STONE).setLight(0.875F)
.setDisplay("Ofen (Gefeuert)").setTab(CheatTab.TECHNOLOGY));
register("construction_table", (new BlockWorkbench(4)).setHardness(2.5F).setSound(SoundType.WOOD).setDisplay("Konstruktionstisch"));
register("assembly_unit", (new BlockWorkbench(5)).setHardness(2.5F).setSound(SoundType.WOOD).setDisplay("Fertigungseinheit"));
BlockFurnace stone_furnace = (BlockFurnace)register("stone_furnace", new BlockFurnace(200, 100).setDisplay("Steinofen"));
register("lit_stone_furnace", new BlockFurnace(stone_furnace));
BlockFurnace iron_furnace = (BlockFurnace)register("iron_furnace", new BlockFurnace(150, 100).setDisplay("Eiserner Ofen"));
register("lit_iron_furnace", new BlockFurnace(iron_furnace));
BlockFurnace titanium_furnace = (BlockFurnace)register("titanium_furnace", new BlockFurnace(100, 100).setDisplay("Titanofen"));
register("lit_titanium_furnace", new BlockFurnace(titanium_furnace));
BlockFurnace neptunium_furnace = (BlockFurnace)register("neptunium_furnace", new BlockFurnace(50, 70).setDisplay("Neptuniumofen"));
register("lit_neptunium_furnace", new BlockFurnace(neptunium_furnace));
BlockFurnace plutonium_furnace = (BlockFurnace)register("plutonium_furnace", new BlockFurnace(20, 50).setDisplay("Plutoniumofen"));
register("lit_plutonium_furnace", new BlockFurnace(plutonium_furnace));
BlockFurnace hell_furnace = (BlockFurnace)register("hell_furnace", new BlockFurnace(180, 120).setDisplay("Höllensteinofen"));
register("lit_hell_furnace", new BlockFurnace(hell_furnace));
BlockFurnace ardite_furnace = (BlockFurnace)register("ardite_furnace", new BlockFurnace(120, 140).setDisplay("Arditofen"));
register("lit_ardite_furnace", new BlockFurnace(ardite_furnace));
BlockFurnace black_metal_furnace = (BlockFurnace)register("black_metal_furnace", new BlockFurnace(80, 200).setDisplay("Schwarzmetallofen"));
register("lit_black_metal_furnace", new BlockFurnace(black_metal_furnace));
for(int z = 0; z < BlockAnvil.ANVILS.length; z++) {
register("anvil" + (z == 0 ? "" : "_damaged_" + z), (new BlockAnvil(z)).setHardness(5.0F).setSound(SoundType.ANVIL).setResistance(2000.0F).setDisplay((z == 0 ? "" : (z == 1 ? "Leicht beschädigter " : "Stark beschädigter ")) + "Amboss"));
}
@ -551,8 +569,6 @@ public abstract class BlockRegistry {
register("brewing_stand", (new BlockBrewingStand()).setHardness(0.5F).setLight(0.125F).setDisplay("Braustand").setTab(CheatTab.TECHNOLOGY));
register("cauldron", (new BlockCauldron()).setHardness(2.0F).setDisplay("Kessel").setTab(CheatTab.TECHNOLOGY));
register("effect_generator", (new BlockEffectGenerator()).setDisplay("Effektgenerator").setLight(1.0F));
register("construction_table", (new BlockWorkbench(4)).setHardness(2.5F).setSound(SoundType.WOOD).setDisplay("Konstruktionstisch"));
register("assembly_unit", (new BlockWorkbench(5)).setHardness(2.5F).setSound(SoundType.WOOD).setDisplay("Fertigungseinheit"));
register("wood_chest", new BlockChest(9, 3).setDisplay("Holztruhe"));
register("stone_chest", new BlockChest(9, 6).setDisplay("Steintruhe"));

View file

@ -228,7 +228,6 @@ public abstract class Blocks {
public static final BlockDynamicLiquid flowing_slime = get("flowing_slime");
public static final BlockDynamicLiquid flowing_spring_water = get("flowing_spring_water");
public static final BlockDynamicLiquid flowing_water = get("flowing_water");
public static final BlockFurnace furnace = get("furnace");
public static final BlockGlass glass = get("glass");
public static final BlockPane glass_pane = get("glass_pane");
public static final BlockGlowstone glowstone = get("glowstone");
@ -290,7 +289,6 @@ public abstract class Blocks {
public static final BlockStainedGlassPane light_blue_glass_pane = get("light_blue_glass_pane");
public static final BlockWool light_blue_wool = get("light_blue_wool");
public static final BlockPressurePlateWeighted light_weighted_pressure_plate = get("light_weighted_pressure_plate");
public static final BlockFurnace lit_furnace = get("lit_furnace");
public static final BlockMetalBlock lithium_block = get("lithium_block");
public static final BlockMetalOre lithium_ore = get("lithium_ore");
public static final BlockCarpet magenta_carpet = get("magenta_carpet");
@ -854,6 +852,22 @@ public abstract class Blocks {
public static final BlockCompressable thetium_block = get("thetium_block");
public static final BlockCompressable coal_block_compressed = get("coal_block_compressed");
public static final BlockCompressable coal_block_compressed_2 = get("coal_block_compressed_2");
public static final BlockFurnace stone_furnace = get("stone_furnace");
public static final BlockFurnace lit_stone_furnace = get("lit_stone_furnace");
public static final BlockFurnace ardite_furnace = get("ardite_furnace");
public static final BlockFurnace black_metal_furnace = get("black_metal_furnace");
public static final BlockFurnace hell_furnace = get("hell_furnace");
public static final BlockFurnace iron_furnace = get("iron_furnace");
public static final BlockFurnace lit_ardite_furnace = get("lit_ardite_furnace");
public static final BlockFurnace lit_black_metal_furnace = get("lit_black_metal_furnace");
public static final BlockFurnace lit_hell_furnace = get("lit_hell_furnace");
public static final BlockFurnace lit_iron_furnace = get("lit_iron_furnace");
public static final BlockFurnace lit_neptunium_furnace = get("lit_neptunium_furnace");
public static final BlockFurnace lit_plutonium_furnace = get("lit_plutonium_furnace");
public static final BlockFurnace lit_titanium_furnace = get("lit_titanium_furnace");
public static final BlockFurnace neptunium_furnace = get("neptunium_furnace");
public static final BlockFurnace plutonium_furnace = get("plutonium_furnace");
public static final BlockFurnace titanium_furnace = get("titanium_furnace");
private static <T extends Block> T get(String id) {
T block = (T)BlockRegistry.byNameExact(id);

View file

@ -90,7 +90,7 @@ public abstract class CraftingRegistry
addShapeless(new ItemStack(Items.blazing_powder, 2), Items.demon_rod);
add(new ItemStack(Items.warp_chest), "###", "#E#", "###", '#', Items.obsidian, 'E', Items.charged_orb);
add(new ItemStack(Items.furnace), "###", "# #", "###", '#', Items.cobblestone);
add(new ItemStack(Items.stone_furnace), "###", "# #", "###", '#', Items.cobblestone);
add(new ItemStack(Items.sandstone), "##", "##", '#', Items.sand);
add(new ItemStack(Items.smooth_sandstone, 4), "##", "##", '#', Items.sandstone);
add(new ItemStack(Items.stonebrick, 4), "##", "##", '#', Items.stone);

View file

@ -344,7 +344,6 @@ public abstract class Items {
public static final Item floor_tiles_red = get("floor_tiles_red");
public static final Item floor_tiles_white = get("floor_tiles_white");
public static final Item flowerpot = get("flowerpot");
public static final Item furnace = get("furnace");
public static final Item gold_coin = get("gold_coin");
public static final Item ghi_fragment = get("ghi_fragment");
public static final Item glass = get("glass");
@ -1238,6 +1237,14 @@ public abstract class Items {
public static final Item blackened_stone_stairs = get("blackened_stone_stairs");
public static final Item coal_block_compressed = get("coal_block_compressed");
public static final Item coal_block_compressed_2 = get("coal_block_compressed_2");
public static final Item stone_furnace = get("stone_furnace");
public static final Item ardite_furnace = get("ardite_furnace");
public static final Item black_metal_furnace = get("black_metal_furnace");
public static final Item hell_furnace = get("hell_furnace");
public static final Item iron_furnace = get("iron_furnace");
public static final Item neptunium_furnace = get("neptunium_furnace");
public static final Item plutonium_furnace = get("plutonium_furnace");
public static final Item titanium_furnace = get("titanium_furnace");
private static <T extends Item> T get(String id) {
T item = (T)ItemRegistry.byName(id);

View file

@ -1,5 +1,6 @@
package common.tileentity;
import common.block.Block;
import common.block.tech.BlockFurnace;
import common.init.Items;
import common.init.SmeltingRegistry;
@ -18,12 +19,14 @@ public class DeviceFurnace extends Device implements ISidedInventory
private static final int[] slotsTop = new int[] {0};
private static final int[] slotsBottom = new int[] {2, 1};
private static final int[] slotsSides = new int[] {1};
private final int burnTime;
private final int fuelEfficiency;
public DeviceFurnace(int burnTime) {
public DeviceFurnace(int burnTime, int fuelEfficiency) {
super(2, 1, new MachineResource(Type.FUEL, "Brennzeit: $amount/$capacity t", 300, 0, 0));
this.burnTime = burnTime;
this.fuelEfficiency = fuelEfficiency;
}
public boolean hasProgress() {
@ -45,7 +48,7 @@ public class DeviceFurnace extends Device implements ISidedInventory
public void readTags(TagObject compound)
{
super.readTags(compound);
this.getResource(0).setValue(getItemBurnTime(this.getStackInSlot(1)));
this.getResource(0).setValue(this.getItemBurnTime(this.getStackInSlot(1)));
}
public boolean isBurning()
@ -67,7 +70,7 @@ public class DeviceFurnace extends Device implements ISidedInventory
{
if (!this.isBurning() && this.canSmelt())
{
int fuel = getItemBurnTime(this.getStackInSlot(1));
int fuel = this.getItemBurnTime(this.getStackInSlot(1));
this.getResource(0).setCapacity(fuel);
this.getResource(0).setValue(fuel);
@ -115,7 +118,9 @@ public class DeviceFurnace extends Device implements ISidedInventory
if (flag != this.isBurning())
{
flag1 = true;
BlockFurnace.setState(this.isBurning(), this.worldObj, this.pos);
Block block = this.getBlockType();
if(block instanceof BlockFurnace furnace)
furnace.setState(this.isBurning(), this.worldObj, this.pos);
}
if (flag1)
@ -166,14 +171,14 @@ public class DeviceFurnace extends Device implements ISidedInventory
}
}
public static int getItemBurnTime(ItemStack stack)
public int getItemBurnTime(ItemStack stack)
{
return stack != null ? stack.getItem().getFuelAmount() : 0;
return stack != null ? (stack.getItem().getFuelAmount() * this.fuelEfficiency) / 100 : 0;
}
public static boolean isItemFuel(ItemStack stack)
{
return getItemBurnTime(stack) > 0;
return stack != null && stack.getItem().getFuelAmount() > 0;
}
public boolean isItemValidForSlot(int index, ItemStack stack)

View file

@ -677,14 +677,14 @@ public abstract class Converter {
mapBlock(Blocks.farmland.getState().withProperty(BlockFarmland.MOISTURE, 5), 60, 5, 13);
mapBlock(Blocks.farmland.getState().withProperty(BlockFarmland.MOISTURE, 6), 60, 6, 14);
mapBlock(Blocks.farmland.getState().withProperty(BlockFarmland.MOISTURE, 7), 60, 7, 15);
mapBlock(Blocks.furnace.getState().withProperty(BlockFurnace.FACING, Facing.NORTH), 61);
mapBlock(Blocks.furnace.getState().withProperty(BlockFurnace.FACING, Facing.SOUTH), 61, 3, 9, 15);
mapBlock(Blocks.furnace.getState().withProperty(BlockFurnace.FACING, Facing.WEST), 61, 4, 10);
mapBlock(Blocks.furnace.getState().withProperty(BlockFurnace.FACING, Facing.EAST), 61, 5, 11);
mapBlock(Blocks.lit_furnace.getState().withProperty(BlockFurnace.FACING, Facing.NORTH), 62);
mapBlock(Blocks.lit_furnace.getState().withProperty(BlockFurnace.FACING, Facing.SOUTH), 62, 3, 9, 15);
mapBlock(Blocks.lit_furnace.getState().withProperty(BlockFurnace.FACING, Facing.WEST), 62, 4, 10);
mapBlock(Blocks.lit_furnace.getState().withProperty(BlockFurnace.FACING, Facing.EAST), 62, 5, 11);
mapBlock(Blocks.stone_furnace.getState().withProperty(BlockFurnace.FACING, Facing.NORTH), 61);
mapBlock(Blocks.stone_furnace.getState().withProperty(BlockFurnace.FACING, Facing.SOUTH), 61, 3, 9, 15);
mapBlock(Blocks.stone_furnace.getState().withProperty(BlockFurnace.FACING, Facing.WEST), 61, 4, 10);
mapBlock(Blocks.stone_furnace.getState().withProperty(BlockFurnace.FACING, Facing.EAST), 61, 5, 11);
mapBlock(Blocks.lit_stone_furnace.getState().withProperty(BlockFurnace.FACING, Facing.NORTH), 62);
mapBlock(Blocks.lit_stone_furnace.getState().withProperty(BlockFurnace.FACING, Facing.SOUTH), 62, 3, 9, 15);
mapBlock(Blocks.lit_stone_furnace.getState().withProperty(BlockFurnace.FACING, Facing.WEST), 62, 4, 10);
mapBlock(Blocks.lit_stone_furnace.getState().withProperty(BlockFurnace.FACING, Facing.EAST), 62, 5, 11);
mapBlock(Blocks.sign.getState().withProperty(BlockStandingSign.FACING, Facing.SOUTH), 63, 0, 1, 14, 15);
mapBlock(Blocks.sign.getState().withProperty(BlockStandingSign.FACING, Facing.WEST), 63, 2, 3, 4, 5);
mapBlock(Blocks.sign.getState().withProperty(BlockStandingSign.FACING, Facing.NORTH), 63, 6, 7, 8, 9);

View file

@ -896,8 +896,8 @@ public class StructureVillage
this.setBlockState(worldIn, Blocks.iron_bars.getState(), 9, 2, 4, structureBoundingBoxIn);
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 7, 2, 4, 8, 2, 5, Blocks.air.getState(), Blocks.air.getState(), false);
this.setBlockState(worldIn, Blocks.cobblestone.getState(), 6, 1, 3, structureBoundingBoxIn);
this.setBlockState(worldIn, Blocks.furnace.getState(), 6, 2, 3, structureBoundingBoxIn);
this.setBlockState(worldIn, Blocks.furnace.getState(), 6, 3, 3, structureBoundingBoxIn);
this.setBlockState(worldIn, Blocks.stone_furnace.getState(), 6, 2, 3, structureBoundingBoxIn);
this.setBlockState(worldIn, Blocks.stone_furnace.getState(), 6, 3, 3, structureBoundingBoxIn);
this.setBlockState(worldIn, Blocks.concrete.getState(), 8, 1, 1, structureBoundingBoxIn);
this.setBlockState(worldIn, Blocks.glass_pane.getState(), 0, 2, 2, structureBoundingBoxIn);
this.setBlockState(worldIn, Blocks.glass_pane.getState(), 0, 2, 4, structureBoundingBoxIn);