Changed Mechanical Piston to use TileBlock system
This commit is contained in:
parent
34c6b75057
commit
40c13a9e37
4 changed files with 49 additions and 79 deletions
|
@ -29,7 +29,6 @@ import resonantinduction.mechanical.logistic.belt.BlockManipulator;
|
|||
import resonantinduction.mechanical.logistic.belt.TileDetector;
|
||||
import resonantinduction.mechanical.logistic.belt.TileManipulator;
|
||||
import resonantinduction.mechanical.logistic.belt.TileSorter;
|
||||
import resonantinduction.mechanical.process.crusher.BlockMechanicalPiston;
|
||||
import resonantinduction.mechanical.process.crusher.TileMechanicalPiston;
|
||||
import resonantinduction.mechanical.process.grinder.BlockGrindingWheel;
|
||||
import resonantinduction.mechanical.process.grinder.TileGrinderWheel;
|
||||
|
@ -126,7 +125,7 @@ public class Mechanical
|
|||
// Machines
|
||||
blockGrinderWheel = contentRegistry.createTile(BlockGrindingWheel.class, TileGrinderWheel.class);
|
||||
blockPurifier = contentRegistry.createTile(BlockMixer.class, TileMixer.class);
|
||||
blockMechanicalPiston = contentRegistry.createTile(BlockMechanicalPiston.class, TileMechanicalPiston.class);
|
||||
blockMechanicalPiston = contentRegistry.newBlock(TileMechanicalPiston.class);
|
||||
OreDictionary.registerOre("gear", itemGear);
|
||||
|
||||
proxy.preInit();
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package resonantinduction.mechanical.energy.grid;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
@ -8,14 +9,25 @@ import resonantinduction.core.grid.INodeProvider;
|
|||
import resonantinduction.core.grid.Node;
|
||||
import resonantinduction.mechanical.Mechanical;
|
||||
import universalelectricity.api.vector.Vector3;
|
||||
import calclavia.lib.content.module.TileBase;
|
||||
import calclavia.lib.network.IPacketReceiver;
|
||||
import calclavia.lib.network.PacketHandler;
|
||||
import calclavia.lib.prefab.tile.TileAdvanced;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
public abstract class TileMechanical extends TileAdvanced implements INodeProvider, IPacketReceiver
|
||||
public abstract class TileMechanical extends TileBase implements INodeProvider, IPacketReceiver
|
||||
{
|
||||
@Deprecated
|
||||
public TileMechanical()
|
||||
{
|
||||
super(null);
|
||||
}
|
||||
|
||||
public TileMechanical(Material material)
|
||||
{
|
||||
super(material);
|
||||
}
|
||||
|
||||
protected static final int PACKET_VELOCITY = Mechanical.contentRegistry.getNextPacketID();
|
||||
|
||||
public MechanicalNode mechanicalNode = new PacketMechanicalNode(this).setLoad(0.5f);
|
||||
|
|
|
@ -1,51 +0,0 @@
|
|||
package resonantinduction.mechanical.process.crusher;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import resonantinduction.core.Reference;
|
||||
import calclavia.lib.prefab.block.BlockRotatable;
|
||||
import calclavia.lib.render.block.BlockRenderingHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
/**
|
||||
* A block used to build machines.
|
||||
*
|
||||
* @author Calclavia
|
||||
*
|
||||
*/
|
||||
public class BlockMechanicalPiston extends BlockRotatable
|
||||
{
|
||||
public BlockMechanicalPiston(int id)
|
||||
{
|
||||
super(id, Material.wood);
|
||||
setTextureName(Reference.PREFIX + "material_steel_dark");
|
||||
rotationMask = Byte.parseByte("111111", 2);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return BlockRenderingHandler.ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world)
|
||||
{
|
||||
return new TileMechanicalPiston();
|
||||
}
|
||||
}
|
|
@ -6,23 +6,27 @@ import codechicken.multipart.MultipartHelper;
|
|||
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.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import resonantinduction.mechanical.energy.grid.TileMechanical;
|
||||
import universalelectricity.api.vector.Vector3;
|
||||
import calclavia.lib.prefab.tile.IRotatable;
|
||||
import calclavia.lib.utility.MovementUtility;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
|
||||
public class TileMechanicalPiston extends TileMechanical
|
||||
public class TileMechanicalPiston extends TileMechanical implements IRotatable
|
||||
{
|
||||
// Planned CalCore option @ConfigInt()
|
||||
private int breakCount = 5;
|
||||
// Planned CalCore option @ConfigInt()
|
||||
private int breakCount = 5;
|
||||
|
||||
public TileMechanicalPiston()
|
||||
{
|
||||
super(Material.piston);
|
||||
|
||||
mechanicalNode = new PacketMechanicalNode(this)
|
||||
{
|
||||
@Override
|
||||
|
@ -45,6 +49,12 @@ public class TileMechanicalPiston extends TileMechanical
|
|||
}
|
||||
|
||||
}.setLoad(0.5f);
|
||||
|
||||
isOpaqueCube = false;
|
||||
normalRender = false;
|
||||
customItemRender = true;
|
||||
rotationMask = Byte.parseByte("111111", 2);
|
||||
textureName = "material_steel_dark";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -63,7 +73,7 @@ public class TileMechanicalPiston extends TileMechanical
|
|||
{
|
||||
TileEntity tileEntity = from.getTileEntity(worldObj);
|
||||
|
||||
if (this.equals(to.getTileEntity(getWorldObj())))
|
||||
if (this.equals(to.getTileEntity(getWorldObj())))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -181,28 +191,28 @@ public class TileMechanicalPiston extends TileMechanical
|
|||
}
|
||||
}
|
||||
|
||||
public void hitOreBlock(Block oreBlock, Vector3 blockPos)
|
||||
{
|
||||
if (worldObj.isRemote)
|
||||
{
|
||||
// Spawn hit particles logic only, all other information is done Server Side
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this.breakCount <= 0)
|
||||
{
|
||||
getWorldObj().setBlockToAir(blockPos.intX(), blockPos.intY(), blockPos.intZ());
|
||||
public void hitOreBlock(Block oreBlock, Vector3 blockPos)
|
||||
{
|
||||
if (worldObj.isRemote)
|
||||
{
|
||||
// Spawn hit particles logic only, all other information is done Server Side
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this.breakCount <= 0)
|
||||
{
|
||||
getWorldObj().setBlockToAir(blockPos.intX(), blockPos.intY(), blockPos.intZ());
|
||||
|
||||
}
|
||||
this.breakCount--;
|
||||
}
|
||||
}
|
||||
this.breakCount--;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private void spawnParticles(Vector3 blockPos)
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
private void spawnParticles(Vector3 blockPos)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue