Added paintable coated variant of the exhaust pipe.

This commit is contained in:
DangerousMilk 2025-06-15 19:55:37 +02:00
parent 3303df8345
commit b328130edb
8 changed files with 210 additions and 0 deletions

View File

@ -791,6 +791,7 @@ public class ModBlocks {
public static Block fluid_duct_paintable;
public static Block fluid_duct_gauge;
public static Block fluid_duct_exhaust;
public static Block fluid_duct_paintable_block_exhaust;
public static Block fluid_valve;
public static Block fluid_switch;
public static Block fluid_pump;
@ -1919,6 +1920,7 @@ public class ModBlocks {
fluid_duct_neo = new FluidDuctStandard(Material.iron).setBlockName("fluid_duct_neo").setStepSound(ModSoundTypes.pipe).setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":pipe_neo");
fluid_duct_box = new FluidDuctBox(Material.iron).setBlockName("fluid_duct_box").setStepSound(ModSoundTypes.pipe).setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":fluid_duct_box");
fluid_duct_exhaust = new FluidDuctBoxExhaust(Material.iron).setBlockName("fluid_duct_exhaust").setStepSound(ModSoundTypes.pipe).setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":fluid_duct_box");
fluid_duct_paintable_block_exhaust = new FluidDuctPaintableBlockExhaust().setBlockName("fluid_duct_paintable_block_exhaust").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
fluid_duct_paintable = new FluidDuctPaintable().setBlockName("fluid_duct_paintable").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
fluid_duct_gauge = new FluidDuctGauge().setBlockName("fluid_duct_gauge").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
fluid_valve = new FluidValve(Material.iron).setBlockName("fluid_valve").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
@ -3185,6 +3187,7 @@ public class ModBlocks {
register(fluid_duct_neo);
register(fluid_duct_box);
register(fluid_duct_exhaust);
register(fluid_duct_paintable_block_exhaust);
register(fluid_duct_paintable);
register(fluid_duct_gauge);
register(fluid_valve);

View File

@ -0,0 +1,202 @@
package com.hbm.blocks.network;
import api.hbm.block.IToolable;
import com.hbm.blocks.IBlockMultiPass;
import com.hbm.blocks.ILookOverlay;
import com.hbm.interfaces.ICopiable;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.lib.Library;
import com.hbm.lib.RefStrings;
import com.hbm.render.block.RenderBlockMultipass;
import com.hbm.tileentity.network.TileEntityPipeExhaust;
import com.hbm.util.i18n.I18nUtil;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
import net.minecraftforge.common.util.ForgeDirection;
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);
}
@Override
public TileEntity createNewTileEntity(World world, int meta) {
return new TileEntityPipeExhaustPaintable();
}
public boolean canConnectTo(IBlockAccess world, int x, int y, int z, ForgeDirection dir, TileEntity tile) {
return Library.canConnectFluid(world, x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, dir, Fluids.SMOKE) ||
Library.canConnectFluid(world, x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, dir, Fluids.SMOKE_LEADED) ||
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) {
this.blockIcon = reg.registerIcon(RefStrings.MODID + ":fluid_duct_paintable_block_exhaust");
this.overlay = reg.registerIcon(RefStrings.MODID + ":fluid_duct_paintable_overlay");
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
TileEntity tile = world.getTileEntity(x, y, z);
if(tile instanceof TileEntityPipeExhaustPaintable) {
TileEntityPipeExhaustPaintable pipe = (TileEntityPipeExhaustPaintable) tile;
if(pipe.block != null) {
if(RenderBlockMultipass.currentPass == 1) {
return this.overlay;
} else {
return pipe.block.getIcon(side, pipe.meta);
}
}
}
return this.blockIcon;
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float fX, float fY, float fZ) {
ItemStack stack = player.getHeldItem();
if(stack != null && stack.getItem() instanceof ItemBlock) {
ItemBlock ib = (ItemBlock) stack.getItem();
Block block = ib.field_150939_a;
if(block.renderAsNormalBlock() && block != this) {
TileEntity tile = world.getTileEntity(x, y, z);
if(tile instanceof TileEntityPipeExhaustPaintable) {
TileEntityPipeExhaustPaintable pipe = (TileEntityPipeExhaustPaintable) tile;
if(pipe.block == null) {
pipe.block = block;
pipe.meta = stack.getItemDamage() & 15;
world.markBlockForUpdate(x, y, z);
pipe.markDirty();
return true;
}
}
}
}
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;
}
@Override
public int getRenderType(){
return IBlockMultiPass.getRenderType();
}
public static class TileEntityPipeExhaustPaintable extends TileEntityPipeExhaust implements ICopiable {
private Block block;
private int meta;
private Block lastBlock;
private int lastMeta;
@Override
public void updateEntity() {
super.updateEntity();
if(worldObj.isRemote && (lastBlock != block || lastMeta != meta)) {
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
lastBlock = block;
lastMeta = meta;
}
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
int id = nbt.getInteger("block");
this.block = id == 0 ? null : Block.getBlockById(id);
this.meta = nbt.getInteger("meta");
}
@Override
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
if(block != null) nbt.setInteger("block", Block.getIdFromBlock(block));
nbt.setInteger("meta", meta);
}
@Override
public NBTTagCompound getSettings(World world, int x, int y, int z) {
NBTTagCompound nbt = new NBTTagCompound();
if(block != null) {
nbt.setInteger("paintblock", Block.getIdFromBlock(block));
nbt.setInteger("paintmeta", meta);
}
return nbt;
}
@Override
public void pasteSettings(NBTTagCompound nbt, int index, World world, EntityPlayer player, int x, int y, int z) {
if(nbt.hasKey("paintblock")) {
this.block = Block.getBlockById(nbt.getInteger("paintblock"));
this.meta = nbt.getInteger("paintmeta");
}
}
}
}

View File

@ -4183,6 +4183,7 @@ tile.floodlight.name=Elektrischer Scheinwerfer
tile.fluid_duct.name=Universelles Flüssigkeitsrohr (Veraltet)
tile.fluid_duct_box.name=Universelles Flüssigkeitsrohr (Boxrohr)
tile.fluid_duct_exhaust.name=Abgasrohr
tile.fluid_duct_paintable_block_exhaust.name=Geschirmtes Abgasrohr (Färbbar)
tile.fluid_duct_gauge.name=Flussmessrohr
tile.fluid_duct_gauge.desc=Rohr welches anzeight, wie viel Flüssigkeit$sich pro Tick im Netzwerk bewegt.$Geteilte Netzwerke die über Fässer oder Tanks$verbunden sind, werden als ein einzelnes gezählt.
tile.fluid_duct_neo.name=Universelles Flüssigkeitsrohr

View File

@ -5308,6 +5308,7 @@ tile.floodlight.name=Powered Floodlight
tile.fluid_duct.name=Universal Fluid Duct (Deprecated)
tile.fluid_duct_box.name=Universal Fluid Duct (Boxduct)
tile.fluid_duct_exhaust.name=Exhaust Pipe
tile.fluid_duct_paintable_block_exhaust.name=Paintable Coated Exhaust Pipe
tile.fluid_duct_gauge.name=Flow Gauge Pipe
tile.fluid_duct_gauge.desc=Pipe that displays how much fluid$moves within the network per tick.$Split networks connected by barrels$or tanks are considered as one shared network.
tile.fluid_duct_neo.name=Universal Fluid Duct

View File

@ -5551,6 +5551,7 @@ tile.floodlight.name=Электрический прожектор
tile.fluid_duct.name=Универсальная жидкостная труба (Устаревшее)
tile.fluid_duct_box.name=Универсальная жидкостная труба (Boxduct)
tile.fluid_duct_exhaust.name=Выхлопная труба
tile.fluid_duct_paintable_block_exhaust.name=Окрашиваемая покрытая выхлопная труба
tile.fluid_duct_gauge.name=Труба с измерителем потока
tile.fluid_duct_gauge.desc=Труба которая показывает сколько жидкости$перемещается внутри сети за тик.$Разделенные сети, соединенные бочками$или резервуары рассматриваются как одна общая сеть.
tile.fluid_duct_neo.name=Универсальная жидкостная труба

View File

@ -5288,6 +5288,7 @@ tile.floodlight.name=Потужний прожектор
tile.fluid_duct.name=Універсальний рідинний трубопровід (Застаріло)
tile.fluid_duct_box.name=Універсальний рідинний трубопровід (Boxduct)
tile.fluid_duct_exhaust.name=Вихлопна труба
tile.fluid_duct_paintable_block_exhaust.name=Вихлопна труба з покриттям
tile.fluid_duct_gauge.name=Вимірювальна труба
tile.fluid_duct_gauge.desc=Труба, що показує, скільки рідини$переміщується в мережі за один тік.$Розділені мережі, з'єднані бочками$або цистернами, вважаються однією спільною мережею.
tile.fluid_duct_neo.name=Універсальний рідинний трубопровід

View File

@ -5021,6 +5021,7 @@ tile.floodlight.name=电力泛光灯
tile.fluid_duct.name=通用流体管道
tile.fluid_duct_box.name=通用流体管道(方形)
tile.fluid_duct_exhaust.name=排气管
tile.fluid_duct_paintable_block_exhaust.name=具有涂装性的排气管
tile.fluid_duct_gauge.name=流量计管
tile.fluid_duct_gauge.desc=显示每个游戏刻在管网有多少流体移动的管道$由桶或罐连接的分离网络被视为一个共享网络。
tile.fluid_duct_neo.name=通用流体管道

Binary file not shown.

After

Width:  |  Height:  |  Size: 649 B