Added basic wires
This commit is contained in:
parent
4597384813
commit
e5c071a8aa
5 changed files with 101 additions and 7 deletions
BIN
resources/assets/resonantinduction/textures/blocks/wire.png
Normal file
BIN
resources/assets/resonantinduction/textures/blocks/wire.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.7 KiB |
|
@ -26,6 +26,7 @@ import resonantinduction.multimeter.ItemBlockMultimeter;
|
||||||
import resonantinduction.multimeter.TileEntityMultimeter;
|
import resonantinduction.multimeter.TileEntityMultimeter;
|
||||||
import resonantinduction.tesla.BlockTesla;
|
import resonantinduction.tesla.BlockTesla;
|
||||||
import resonantinduction.tesla.TileEntityTesla;
|
import resonantinduction.tesla.TileEntityTesla;
|
||||||
|
import resonantinduction.wire.BlockWire;
|
||||||
import universalelectricity.core.item.IItemElectric;
|
import universalelectricity.core.item.IItemElectric;
|
||||||
import cpw.mods.fml.common.FMLLog;
|
import cpw.mods.fml.common.FMLLog;
|
||||||
import cpw.mods.fml.common.Loader;
|
import cpw.mods.fml.common.Loader;
|
||||||
|
@ -126,6 +127,7 @@ public class ResonantInduction
|
||||||
public static Block blockMultimeter;
|
public static Block blockMultimeter;
|
||||||
public static Block blockEMContractor;
|
public static Block blockEMContractor;
|
||||||
public static Block blockBattery;
|
public static Block blockBattery;
|
||||||
|
public static Block blockWire;
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void preInit(FMLPreInitializationEvent evt)
|
public void preInit(FMLPreInitializationEvent evt)
|
||||||
|
@ -160,6 +162,7 @@ public class ResonantInduction
|
||||||
blockMultimeter = new BlockMultimeter(getNextBlockID());
|
blockMultimeter = new BlockMultimeter(getNextBlockID());
|
||||||
blockEMContractor = new BlockEMContractor(getNextBlockID());
|
blockEMContractor = new BlockEMContractor(getNextBlockID());
|
||||||
blockBattery = new BlockBattery(getNextBlockID());
|
blockBattery = new BlockBattery(getNextBlockID());
|
||||||
|
blockWire = new BlockWire(getNextBlockID());
|
||||||
|
|
||||||
CONFIGURATION.save();
|
CONFIGURATION.save();
|
||||||
|
|
||||||
|
|
|
@ -15,9 +15,9 @@ import net.minecraftforge.common.ForgeDirection;
|
||||||
import resonantinduction.PacketHandler;
|
import resonantinduction.PacketHandler;
|
||||||
import resonantinduction.ResonantInduction;
|
import resonantinduction.ResonantInduction;
|
||||||
import resonantinduction.base.IPacketReceiver;
|
import resonantinduction.base.IPacketReceiver;
|
||||||
import resonantinduction.battery.TileEntityBattery;
|
import universalelectricity.core.block.IElectricalStorage;
|
||||||
import resonantinduction.tesla.TileEntityTesla;
|
|
||||||
import universalelectricity.prefab.tile.TileEntityAdvanced;
|
import universalelectricity.prefab.tile.TileEntityAdvanced;
|
||||||
|
import universalelectricity.prefab.tile.TileEntityElectrical;
|
||||||
|
|
||||||
import com.google.common.io.ByteArrayDataInput;
|
import com.google.common.io.ByteArrayDataInput;
|
||||||
|
|
||||||
|
@ -25,6 +25,8 @@ import cpw.mods.fml.common.network.PacketDispatcher;
|
||||||
import cpw.mods.fml.common.network.Player;
|
import cpw.mods.fml.common.network.Player;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Block that detects power.
|
||||||
|
*
|
||||||
* @author Calclavia
|
* @author Calclavia
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -155,14 +157,13 @@ public class TileEntityMultimeter extends TileEntityAdvanced implements IPacketR
|
||||||
|
|
||||||
public static float getDetectedEnergy(TileEntity tileEntity)
|
public static float getDetectedEnergy(TileEntity tileEntity)
|
||||||
{
|
{
|
||||||
// TODO: Universal Compatiblity in the future.
|
if (tileEntity instanceof TileEntityElectrical)
|
||||||
if (tileEntity instanceof TileEntityTesla)
|
|
||||||
{
|
{
|
||||||
return ((TileEntityTesla) tileEntity).getEnergyStored();
|
return ((TileEntityElectrical) tileEntity).getEnergyStored();
|
||||||
}
|
}
|
||||||
else if (tileEntity instanceof TileEntityBattery)
|
else if (tileEntity instanceof IElectricalStorage)
|
||||||
{
|
{
|
||||||
return ((TileEntityBattery) tileEntity).getEnergyStored();
|
return ((IElectricalStorage) tileEntity).getEnergyStored();
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
66
src/resonantinduction/wire/BlockWire.java
Normal file
66
src/resonantinduction/wire/BlockWire.java
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
package resonantinduction.wire;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import resonantinduction.ResonantInduction;
|
||||||
|
import universalelectricity.prefab.block.BlockConductor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A copper wire block that can change its collision bounds based on the connection.
|
||||||
|
*
|
||||||
|
* @author Calclavia, Aidancbrady
|
||||||
|
*/
|
||||||
|
public class BlockWire extends BlockConductor
|
||||||
|
{
|
||||||
|
public BlockWire(int id)
|
||||||
|
{
|
||||||
|
super(ResonantInduction.CONFIGURATION.getItem("wire", id).getInt(id), Material.cloth);
|
||||||
|
this.setUnlocalizedName(ResonantInduction.PREFIX + "wire");
|
||||||
|
this.setStepSound(soundClothFootstep);
|
||||||
|
this.setResistance(0.2F);
|
||||||
|
this.setHardness(0.1f);
|
||||||
|
this.setBlockBounds(0.3f, 0.3f, 0.3f, 0.7f, 0.7f, 0.7f);
|
||||||
|
this.setCreativeTab(CreativeTabs.tabRedstone);
|
||||||
|
Block.setBurnProperties(this.blockID, 30, 60);
|
||||||
|
this.func_111022_d(ResonantInduction.PREFIX + "wire");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the
|
||||||
|
* shared face of two adjacent blocks and also whether the player can attach torches, redstone
|
||||||
|
* wire, etc to this block.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean isOpaqueCube()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If this block doesn't render as an ordinary block it will return False (examples: signs,
|
||||||
|
* buttons, stairs, etc)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean renderAsNormalBlock()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type of render function that is called for this block
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int getRenderType()
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TileEntity createNewTileEntity(World var1)
|
||||||
|
{
|
||||||
|
return new TileEntityWire();
|
||||||
|
}
|
||||||
|
}
|
24
src/resonantinduction/wire/TileEntityWire.java
Normal file
24
src/resonantinduction/wire/TileEntityWire.java
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
package resonantinduction.wire;
|
||||||
|
|
||||||
|
import universalelectricity.compatibility.TileEntityUniversalConductor;
|
||||||
|
|
||||||
|
public class TileEntityWire extends TileEntityUniversalConductor
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Changed this if your mod wants to nerf Basic Component's copper wire.
|
||||||
|
*/
|
||||||
|
public static float RESISTANCE = 0.05F;
|
||||||
|
public static float MAX_AMPS = 200;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getResistance()
|
||||||
|
{
|
||||||
|
return RESISTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getCurrentCapacity()
|
||||||
|
{
|
||||||
|
return MAX_AMPS;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue