Added recipe and changed function order to make more sense.

This commit is contained in:
DangerousMilk 2025-06-16 17:48:05 +02:00
parent b328130edb
commit 155595772c
2 changed files with 36 additions and 34 deletions

View File

@ -3,6 +3,7 @@ package com.hbm.blocks.network;
import api.hbm.block.IToolable;
import com.hbm.blocks.IBlockMultiPass;
import com.hbm.blocks.ILookOverlay;
import com.hbm.blocks.network.FluidDuctPaintable.TileEntityPipePaintable;
import com.hbm.interfaces.ICopiable;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.lib.Library;
@ -33,13 +34,13 @@ import java.util.ArrayList;
import java.util.List;
public class FluidDuctPaintableBlockExhaust extends FluidDuctBase implements IToolable, IBlockMultiPass, ILookOverlay {
@SideOnly(Side.CLIENT) protected IIcon overlay;
public FluidDuctPaintableBlockExhaust() {
super(Material.iron);
super(Material.iron);
}
@Override
public TileEntity createNewTileEntity(World world, int meta) {
return new TileEntityPipeExhaustPaintable();
@ -51,15 +52,6 @@ public class FluidDuctPaintableBlockExhaust extends FluidDuctBase implements ITo
Library.canConnectFluid(world, x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, dir, Fluids.SMOKE_POISON);
}
@Override
public void printHook(Pre event, World world, int x, int y, int z) {
List<String> text = new ArrayList();
text.add(Fluids.SMOKE.getLocalizedName());
text.add(Fluids.SMOKE_LEADED.getLocalizedName());
text.add(Fluids.SMOKE_POISON.getLocalizedName());
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text);
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister reg) {
@ -87,6 +79,27 @@ public class FluidDuctPaintableBlockExhaust extends FluidDuctBase implements ITo
return this.blockIcon;
}
@Override
public boolean onScrew(World world, EntityPlayer player, int x, int y, int z, int side, float fX, float fY, float fZ, ToolType tool) {
if(tool != ToolType.SCREWDRIVER) return false;
TileEntity tile = world.getTileEntity(x, y, z);
if(tile instanceof TileEntityPipeExhaustPaintable) {
TileEntityPipeExhaustPaintable pipe = (TileEntityPipeExhaustPaintable) tile;
if(pipe.block != null) {
pipe.block = null;
world.markBlockForUpdate(x, y, z);
pipe.markDirty();
return true;
}
}
return false;
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float fX, float fY, float fZ) {
@ -117,27 +130,6 @@ public class FluidDuctPaintableBlockExhaust extends FluidDuctBase implements ITo
return super.onBlockActivated(world, x, y, z, player, side, fX, fY, fZ);
}
@Override
public boolean onScrew(World world, EntityPlayer player, int x, int y, int z, int side, float fX, float fY, float fZ, ToolType tool) {
if(tool != ToolType.SCREWDRIVER) return false;
TileEntity tile = world.getTileEntity(x, y, z);
if(tile instanceof TileEntityPipeExhaustPaintable) {
TileEntityPipeExhaustPaintable pipe = (TileEntityPipeExhaustPaintable) tile;
if(pipe.block != null) {
pipe.block = null;
world.markBlockForUpdate(x, y, z);
pipe.markDirty();
return true;
}
}
return false;
}
@Override
public int getPasses() {
return 2;
@ -148,6 +140,15 @@ public class FluidDuctPaintableBlockExhaust extends FluidDuctBase implements ITo
return IBlockMultiPass.getRenderType();
}
@Override
public void printHook(Pre event, World world, int x, int y, int z) {
List<String> text = new ArrayList();
text.add(Fluids.SMOKE.getLocalizedName());
text.add(Fluids.SMOKE_LEADED.getLocalizedName());
text.add(Fluids.SMOKE_POISON.getLocalizedName());
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text);
}
public static class TileEntityPipeExhaustPaintable extends TileEntityPipeExhaust implements ICopiable {
private Block block;

View File

@ -604,6 +604,7 @@ public class CraftingManager {
addRecipeAuto(new ItemStack(ModBlocks.fluid_duct_neo, 8, 1), new Object[] { "IAI", " ", "IAI", 'I', IRON.plate(), 'A', AL.plate() });
addRecipeAuto(new ItemStack(ModBlocks.fluid_duct_neo, 8, 2), new Object[] { "ASA", " ", "ASA", 'S', STEEL.plate(), 'A', AL.plate() });
addRecipeAuto(new ItemStack(ModBlocks.fluid_duct_paintable, 8), new Object[] { "SAS", "A A", "SAS", 'S', STEEL.ingot(), 'A', AL.plate() });
addRecipeAuto(new ItemStack(ModBlocks.fluid_duct_paintable_block_exhaust, 8), new Object[] { "SAS", "A A", "SAS", 'S', IRON.ingot(), 'A', ModItems.plate_polymer});
addShapelessAuto(new ItemStack(ModBlocks.fluid_duct_gauge), new Object[] { ModBlocks.fluid_duct_paintable, STEEL.ingot(), DictFrame.fromOne(ModItems.circuit, EnumCircuitType.BASIC) });
addRecipeAuto(new ItemStack(ModBlocks.fluid_valve, 1), new Object[] { "S", "W", 'S', Blocks.lever, 'W', ModBlocks.fluid_duct_paintable });
addRecipeAuto(new ItemStack(ModBlocks.fluid_switch, 1), new Object[] { "S", "W", 'S', REDSTONE.dust(), 'W', ModBlocks.fluid_duct_paintable });