mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
redstone power switches
This commit is contained in:
parent
e619042446
commit
092f312c9f
@ -707,6 +707,7 @@ public class ModBlocks {
|
|||||||
public static Block red_pylon_large;
|
public static Block red_pylon_large;
|
||||||
public static Block substation;
|
public static Block substation;
|
||||||
public static Block cable_switch;
|
public static Block cable_switch;
|
||||||
|
public static Block cable_detector;
|
||||||
public static Block machine_detector;
|
public static Block machine_detector;
|
||||||
public static Block rf_cable;
|
public static Block rf_cable;
|
||||||
public static Block oil_duct_solid;
|
public static Block oil_duct_solid;
|
||||||
@ -1813,7 +1814,8 @@ public class ModBlocks {
|
|||||||
red_pylon = new PylonRedWire(Material.iron).setBlockName("red_pylon").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":red_pylon");
|
red_pylon = new PylonRedWire(Material.iron).setBlockName("red_pylon").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":red_pylon");
|
||||||
red_pylon_large = new PylonLarge(Material.iron).setBlockName("red_pylon_large").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":red_pylon_large");
|
red_pylon_large = new PylonLarge(Material.iron).setBlockName("red_pylon_large").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":red_pylon_large");
|
||||||
substation = new Substation(Material.iron).setBlockName("substation").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":substation");
|
substation = new Substation(Material.iron).setBlockName("substation").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":substation");
|
||||||
cable_switch = new CableSwitch(Material.iron).setBlockName("cable_switch").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":cable_switch_off");
|
cable_switch = new CableSwitch(Material.iron).setBlockName("cable_switch").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
|
||||||
|
cable_detector = new CableDetector(Material.iron).setBlockName("cable_detector").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
|
||||||
machine_detector = new PowerDetector(Material.iron).setBlockName("machine_detector").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":machine_detector_off");
|
machine_detector = new PowerDetector(Material.iron).setBlockName("machine_detector").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":machine_detector_off");
|
||||||
oil_duct_solid = new OilDuctSolid(Material.iron).setBlockName("oil_duct_solid").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":oil_duct_solid_alt");
|
oil_duct_solid = new OilDuctSolid(Material.iron).setBlockName("oil_duct_solid").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":oil_duct_solid_alt");
|
||||||
oil_duct = new BlockOilDuct(Material.iron).setBlockName("oil_duct").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":oil_duct_icon_alt");
|
oil_duct = new BlockOilDuct(Material.iron).setBlockName("oil_duct").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":oil_duct_icon_alt");
|
||||||
@ -2906,6 +2908,7 @@ public class ModBlocks {
|
|||||||
GameRegistry.registerBlock(red_pylon_large, ItemBlockBase.class, red_pylon_large.getUnlocalizedName());
|
GameRegistry.registerBlock(red_pylon_large, ItemBlockBase.class, red_pylon_large.getUnlocalizedName());
|
||||||
GameRegistry.registerBlock(substation, ItemBlockBase.class, substation.getUnlocalizedName());
|
GameRegistry.registerBlock(substation, ItemBlockBase.class, substation.getUnlocalizedName());
|
||||||
GameRegistry.registerBlock(cable_switch, cable_switch.getUnlocalizedName());
|
GameRegistry.registerBlock(cable_switch, cable_switch.getUnlocalizedName());
|
||||||
|
GameRegistry.registerBlock(cable_detector, cable_detector.getUnlocalizedName());
|
||||||
GameRegistry.registerBlock(machine_detector, machine_detector.getUnlocalizedName());
|
GameRegistry.registerBlock(machine_detector, machine_detector.getUnlocalizedName());
|
||||||
GameRegistry.registerBlock(rf_cable, rf_cable.getUnlocalizedName());
|
GameRegistry.registerBlock(rf_cable, rf_cable.getUnlocalizedName());
|
||||||
GameRegistry.registerBlock(oil_duct, oil_duct.getUnlocalizedName());
|
GameRegistry.registerBlock(oil_duct, oil_duct.getUnlocalizedName());
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package com.hbm.blocks.bomb;
|
|||||||
import com.hbm.explosion.ExplosionLarge;
|
import com.hbm.explosion.ExplosionLarge;
|
||||||
import com.hbm.explosion.ExplosionNT;
|
import com.hbm.explosion.ExplosionNT;
|
||||||
|
|
||||||
|
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class BlockChargeC4 extends BlockChargeBase {
|
public class BlockChargeC4 extends BlockChargeBase {
|
||||||
@ -24,8 +25,10 @@ public class BlockChargeC4 extends BlockChargeBase {
|
|||||||
return BombReturnCode.UNDEFINED;
|
return BombReturnCode.UNDEFINED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int renderID = RenderingRegistry.getNextAvailableRenderId();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getRenderType() {
|
public int getRenderType() {
|
||||||
return BlockChargeDynamite.renderID;
|
return renderID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,7 +7,6 @@ import com.hbm.entity.item.EntityTNTPrimedBase;
|
|||||||
import com.hbm.util.ChatBuilder;
|
import com.hbm.util.ChatBuilder;
|
||||||
|
|
||||||
import api.hbm.block.IToolable;
|
import api.hbm.block.IToolable;
|
||||||
import api.hbm.block.IToolable.ToolType;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
|||||||
68
src/main/java/com/hbm/blocks/network/CableDetector.java
Normal file
68
src/main/java/com/hbm/blocks/network/CableDetector.java
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
package com.hbm.blocks.network;
|
||||||
|
|
||||||
|
import com.hbm.lib.RefStrings;
|
||||||
|
import com.hbm.tileentity.network.TileEntityCableSwitch;
|
||||||
|
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.BlockContainer;
|
||||||
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.IIcon;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
public class CableDetector extends BlockContainer {
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
private IIcon iconOn;
|
||||||
|
|
||||||
|
public CableDetector(Material p_i45386_1_) {
|
||||||
|
super(p_i45386_1_);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||||
|
this.iconOn = iconRegister.registerIcon(RefStrings.MODID + ":cable_detector_on");
|
||||||
|
this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + ":cable_detector_off");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public IIcon getIcon(int side, int metadata) {
|
||||||
|
return metadata == 1 ? iconOn : blockIcon;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
|
||||||
|
return new TileEntityCableSwitch();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
|
||||||
|
|
||||||
|
boolean on = world.isBlockIndirectlyGettingPowered(x, y, z);
|
||||||
|
int meta = world.getBlockMetadata(x, y, z);
|
||||||
|
|
||||||
|
boolean update = false;
|
||||||
|
|
||||||
|
if(on && meta == 0) {
|
||||||
|
world.setBlockMetadataWithNotify(x, y, z, 1, 2);
|
||||||
|
world.playSoundEffect(x, y, z, "hbm:block.reactorStart", 1.0F, 1.0F);
|
||||||
|
update = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!on && meta == 1) {
|
||||||
|
world.setBlockMetadataWithNotify(x, y, z, 0, 2);
|
||||||
|
world.playSoundEffect(x, y, z, "hbm:block.reactorStart", 1.0F, 0.85F);
|
||||||
|
update = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(update) {
|
||||||
|
TileEntityCableSwitch te = (TileEntityCableSwitch) world.getTileEntity(x, y, z);
|
||||||
|
te.updateState();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,7 +1,6 @@
|
|||||||
package com.hbm.blocks.network;
|
package com.hbm.blocks.network;
|
||||||
|
|
||||||
import com.hbm.lib.RefStrings;
|
import com.hbm.lib.RefStrings;
|
||||||
import com.hbm.tileentity.network.TileEntityCableBaseNT;
|
|
||||||
import com.hbm.tileentity.network.TileEntityCableSwitch;
|
import com.hbm.tileentity.network.TileEntityCableSwitch;
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
@ -65,5 +64,4 @@ public class CableSwitch extends BlockContainer {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -643,6 +643,7 @@ public class ClientProxy extends ServerProxy {
|
|||||||
RenderingRegistry.registerBlockHandler(new RenderBlockMultipass());
|
RenderingRegistry.registerBlockHandler(new RenderBlockMultipass());
|
||||||
|
|
||||||
RenderingRegistry.registerBlockHandler(new RenderBlockRotated(ModBlocks.charge_dynamite.getRenderType(), ResourceManager.charge_dynamite));
|
RenderingRegistry.registerBlockHandler(new RenderBlockRotated(ModBlocks.charge_dynamite.getRenderType(), ResourceManager.charge_dynamite));
|
||||||
|
RenderingRegistry.registerBlockHandler(new RenderBlockRotated(ModBlocks.charge_c4.getRenderType(), ResourceManager.charge_c4));
|
||||||
|
|
||||||
RenderingRegistry.registerBlockHandler(new RenderRBMKRod());
|
RenderingRegistry.registerBlockHandler(new RenderRBMKRod());
|
||||||
RenderingRegistry.registerBlockHandler(new RenderRBMKReflector());
|
RenderingRegistry.registerBlockHandler(new RenderRBMKReflector());
|
||||||
|
|||||||
@ -1165,6 +1165,7 @@ public class ResourceManager {
|
|||||||
public static final IModelCustom cable_neo = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/blocks/cable_neo.obj"));
|
public static final IModelCustom cable_neo = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/blocks/cable_neo.obj"));
|
||||||
|
|
||||||
public static final IModelCustom charge_dynamite = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/blocks/charge_dynamite.obj"));
|
public static final IModelCustom charge_dynamite = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/blocks/charge_dynamite.obj"));
|
||||||
|
public static final IModelCustom charge_c4 = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/blocks/charge_c4.obj"));
|
||||||
|
|
||||||
//RBMK DEBRIS
|
//RBMK DEBRIS
|
||||||
public static final IModelCustom deb_blank = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/projectiles/deb_blank.obj"));
|
public static final IModelCustom deb_blank = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/projectiles/deb_blank.obj"));
|
||||||
|
|||||||
@ -1,9 +1,12 @@
|
|||||||
package com.hbm.tileentity.machine;
|
package com.hbm.tileentity.machine;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
import com.hbm.blocks.BlockDummyable;
|
import com.hbm.blocks.BlockDummyable;
|
||||||
import com.hbm.interfaces.IFluidAcceptor;
|
import com.hbm.interfaces.IFluidAcceptor;
|
||||||
import com.hbm.interfaces.IFluidContainer;
|
import com.hbm.interfaces.IFluidContainer;
|
||||||
import com.hbm.interfaces.Spaghetti;
|
import com.hbm.interfaces.Spaghetti;
|
||||||
|
import com.hbm.interfaces.Untested;
|
||||||
import com.hbm.inventory.FluidTank;
|
import com.hbm.inventory.FluidTank;
|
||||||
import com.hbm.inventory.fluid.FluidType;
|
import com.hbm.inventory.fluid.FluidType;
|
||||||
import com.hbm.inventory.fluid.Fluids;
|
import com.hbm.inventory.fluid.Fluids;
|
||||||
@ -43,6 +46,15 @@ public class TileEntityMachineGasCent extends TileEntityMachineBase implements I
|
|||||||
private static final int[] slots_bottom = new int[] {2, 3, 4};
|
private static final int[] slots_bottom = new int[] {2, 3, 4};
|
||||||
private static final int[] slots_side = new int[] { };
|
private static final int[] slots_side = new int[] { };
|
||||||
|
|
||||||
|
@Untested
|
||||||
|
private static HashMap<FluidType, PseudoFluidType> fluidConversions = new HashMap();
|
||||||
|
|
||||||
|
static {
|
||||||
|
fluidConversions.put(Fluids.UF6, PseudoFluidType.NUF6);
|
||||||
|
fluidConversions.put(Fluids.PUF6, PseudoFluidType.PF6);
|
||||||
|
fluidConversions.put(Fluids.WATZ, PseudoFluidType.MUD);
|
||||||
|
}
|
||||||
|
|
||||||
public TileEntityMachineGasCent() {
|
public TileEntityMachineGasCent() {
|
||||||
super(6);
|
super(6);
|
||||||
tank = new FluidTank(Fluids.UF6, 2000, 0);
|
tank = new FluidTank(Fluids.UF6, 2000, 0);
|
||||||
@ -319,23 +331,11 @@ public class TileEntityMachineGasCent extends TileEntityMachineBase implements I
|
|||||||
|
|
||||||
if(tank.getTankType() != newType) {
|
if(tank.getTankType() != newType) {
|
||||||
|
|
||||||
boolean success = false;
|
PseudoFluidType pseudo = fluidConversions.get(newType);
|
||||||
|
|
||||||
if(newType == Fluids.UF6) {
|
if(pseudo != null) {
|
||||||
inputTank.setTankType(PseudoFluidType.NUF6);
|
inputTank.setTankType(pseudo);
|
||||||
outputTank.setTankType(PseudoFluidType.NUF6.getOutputFluid());
|
outputTank.setTankType(pseudo.getOutputFluid());
|
||||||
success = true;
|
|
||||||
} else if(newType == Fluids.PUF6) {
|
|
||||||
inputTank.setTankType(PseudoFluidType.PF6);
|
|
||||||
outputTank.setTankType(PseudoFluidType.PF6.getOutputFluid());
|
|
||||||
success = true;
|
|
||||||
} else if(newType == Fluids.WATZ) {
|
|
||||||
inputTank.setTankType(PseudoFluidType.MUD);
|
|
||||||
outputTank.setTankType(PseudoFluidType.MUD.getOutputFluid());
|
|
||||||
success = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(success) {
|
|
||||||
tank.setTankType(newType);
|
tank.setTankType(newType);
|
||||||
tank.setFill(0);
|
tank.setFill(0);
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 412 B |
Binary file not shown.
|
After Width: | Height: | Size: 415 B |
Loading…
x
Reference in New Issue
Block a user