Merge pull request #2221 from DangerousMilk/exhaust-block

Paintable Coated Variant Of The Exhaust Pipe.
This commit is contained in:
HbmMods 2025-06-28 19:15:59 +02:00 committed by GitHub
commit 096cd046c5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 223 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;
@ -1920,6 +1921,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);
@ -3187,6 +3189,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,212 @@
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.network.NetworkManager;
import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
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();
}
@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 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) {
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 int getPasses() {
return 2;
}
@Override
public int getRenderType(){
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;
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 Packet getDescriptionPacket() {
NBTTagCompound nbt = new NBTTagCompound();
this.writeToNBT(nbt);
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 0, nbt);
}
@Override
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
this.readFromNBT(pkt.func_148857_g());
}
@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

@ -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 });

View File

@ -35,6 +35,7 @@ import com.hbm.blocks.network.CableDiode.TileEntityDiode;
import com.hbm.blocks.network.CranePartitioner.TileEntityCranePartitioner;
import com.hbm.blocks.network.FluidDuctGauge.TileEntityPipeGauge;
import com.hbm.blocks.network.FluidDuctPaintable.TileEntityPipePaintable;
import com.hbm.blocks.network.FluidDuctPaintableBlockExhaust.TileEntityPipeExhaustPaintable;
import com.hbm.blocks.network.FluidPump.TileEntityFluidPump;
import com.hbm.blocks.rail.RailStandardSwitch.TileEntityRailSwitch;
import com.hbm.tileentity.bomb.*;
@ -412,6 +413,7 @@ public class TileMappings {
put(TileEntityPipePaintable.class, "tileentity_pipe_paintable");
put(TileEntityPipeGauge.class, "tileentity_pipe_gauge");
put(TileEntityPipeExhaust.class, "tileentity_pipe_exhaust");
put(TileEntityPipeExhaustPaintable.class, "tileentity_pipe_exhaust_paintable");
put(TileEntityFluidValve.class, "tileentity_pipe_valve");
put(TileEntityFluidPump.class, "tileentity_pipe_pump");

View File

@ -4184,6 +4184,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

@ -5309,6 +5309,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