mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-19 03:49:07 +00:00
Work on things
This commit is contained in:
1 parent
5bb4b5d9a5
commit
3bf37f8838
31 files changed
+519
-762
No files matched your search
@@ -1,6 +1,7 @@
|
||||
package binnie.core.machines;
|
||||
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.core.machines.component.IRender;
|
||||
import binnie.core.util.TileUtil;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
@@ -19,16 +20,19 @@ import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
class BlockMachine extends BlockContainer implements IBlockMachine {
|
||||
private MachineGroup group;
|
||||
public static final PropertyInteger MACHINE_TYPE = PropertyInteger.create("machine_type", 0, 15);
|
||||
|
||||
public BlockMachine(final MachineGroup group, final String blockName) {
|
||||
public BlockMachine(MachineGroup group, String blockName) {
|
||||
super(Material.IRON);
|
||||
this.group = group;
|
||||
this.setHardness(1.5f);
|
||||
@@ -43,22 +47,7 @@ class BlockMachine extends BlockContainer implements IBlockMachine {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public boolean isOpaqueCube() {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean renderAsNormalBlock() {
|
||||
// return !this.group.customRenderer;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int getRenderType() {
|
||||
// return Binnie.Machine.getMachineRenderID();
|
||||
// }
|
||||
//
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
return false;
|
||||
@@ -112,7 +101,6 @@ class BlockMachine extends BlockContainer implements IBlockMachine {
|
||||
return this.group.getPackage(meta).createTileEntity();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, @Nullable ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
if (!BinnieCore.proxy.isSimulating(world)) {
|
||||
@@ -143,15 +131,6 @@ class BlockMachine extends BlockContainer implements IBlockMachine {
|
||||
}
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public IIcon getIcon(final IBlockAccess world, final int x, final int y, final int z, final int side) {
|
||||
// final TileEntity entity = world.getTileEntity(x, y, z);
|
||||
// if (entity instanceof TileEntityMachine && ((TileEntityMachine) entity).getMachine().hasInterface(IMachineTexturedFaces.class)) {
|
||||
// return ((TileEntityMachine) entity).getMachine().getInterface(IMachineTexturedFaces.class).getIcon(side);
|
||||
// }
|
||||
// return Blocks.dirt.getIcon(0, 0);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state) {
|
||||
final TileEntityMachine entity = TileUtil.getTile(world, pos, TileEntityMachine.class);
|
||||
@@ -161,22 +140,16 @@ class BlockMachine extends BlockContainer implements IBlockMachine {
|
||||
super.breakBlock(world, pos, state);
|
||||
}
|
||||
|
||||
// @Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public void registerBlockIcons(final IIconRegister register) {
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public void randomDisplayTick(final World world, final int x, final int y, final int z, final Random rand) {
|
||||
// final IMachine machine = Machine.getMachine(world.getTileEntity(x, y, z));
|
||||
// if (machine != null) {
|
||||
// for (final IRender.RandomDisplayTick renders : machine.getInterfaces(IRender.RandomDisplayTick.class)) {
|
||||
// renders.onRandomDisplayTick(world, x, y, z, rand);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand) {
|
||||
IMachine machine = Machine.getMachine(world.getTileEntity(pos));
|
||||
if (machine != null) {
|
||||
for (IRender.RandomDisplayTick renders : machine.getInterfaces(IRender.RandomDisplayTick.class)) {
|
||||
renders.onRandomDisplayTick(world, pos, rand);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
@@ -192,9 +165,4 @@ class BlockMachine extends BlockContainer implements IBlockMachine {
|
||||
}
|
||||
return world.setBlockToAir(pos);
|
||||
}
|
||||
|
||||
|
||||
public interface IMachineTexturedFaces {
|
||||
//IIcon getIcon(final int p0);
|
||||
}
|
||||
}
|
||||
@@ -6,11 +6,11 @@ import net.minecraft.world.World;
|
||||
import java.util.Collection;
|
||||
|
||||
public interface IMachine extends IOwnable {
|
||||
void addComponent(final MachineComponent p0);
|
||||
void addComponent(MachineComponent component);
|
||||
|
||||
MachineUtil getMachineUtil();
|
||||
|
||||
<T> T getInterface(final Class<T> p0);
|
||||
<T> T getInterface(Class<T> Interface);
|
||||
|
||||
void markDirty();
|
||||
|
||||
@@ -18,7 +18,7 @@ public interface IMachine extends IOwnable {
|
||||
|
||||
TileEntity getTileEntity();
|
||||
|
||||
<T> Collection<T> getInterfaces(final Class<T> p0);
|
||||
<T> Collection<T> getInterfaces(Class<T> Interface);
|
||||
|
||||
MachinePackage getPackage();
|
||||
}
|
||||
@@ -160,8 +160,8 @@ public class Machine implements INetworkedEntity, INbtReadable, INbtWritable, IN
|
||||
component.onUpdate();
|
||||
}
|
||||
} else {
|
||||
for (final IRender.DisplayTick renders : this.getInterfaces(IRender.DisplayTick.class)) {
|
||||
renders.onDisplayTick(this.getWorld(), this.getTileEntity().getPos().getX(), this.getTileEntity().getPos().getY(), this.getTileEntity().getPos().getZ(), this.getWorld().rand);
|
||||
for (IRender.DisplayTick renders : this.getInterfaces(IRender.DisplayTick.class)) {
|
||||
renders.onDisplayTick(this.getWorld(), this.getTileEntity().getPos(), this.getWorld().rand);
|
||||
}
|
||||
}
|
||||
if (this.queuedInventoryUpdate) {
|
||||
|
||||
@@ -46,8 +46,8 @@ public class MachineGroup {
|
||||
}
|
||||
Binnie.Machine.registerMachineGroup(this);
|
||||
this.block = new BlockMachine(this, blockName);
|
||||
GameRegistry.register(this.block);
|
||||
Item i = GameRegistry.register(new ItemMachine(this.block));
|
||||
mod.getProxy().registerBlock(this.block);
|
||||
Item i = mod.getProxy().registerItem(new ItemMachine(this.block));
|
||||
for (int j = 0; j < types.length; j++) {
|
||||
BinnieCore.proxy.registermodel(i, j, new ModelResourceLocation(i.getRegistryName(), "machine_type=" + j));
|
||||
}
|
||||
|
||||
@@ -27,6 +27,8 @@ public abstract class MachinePackage {
|
||||
public abstract TileEntity createTileEntity();
|
||||
|
||||
public abstract void register();
|
||||
|
||||
public abstract void renderMachine(Machine machine, double x, double y, double z, float partialTicks, int destroyStage);//, final RenderBlocks p5);
|
||||
|
||||
public final String getDisplayName() {
|
||||
return Binnie.Language.localise(this.group.getMod(), "machine." + this.group.getShortUID() + "." + this.getUID());
|
||||
@@ -48,8 +50,6 @@ public abstract class MachinePackage {
|
||||
this.group = group;
|
||||
}
|
||||
|
||||
public abstract void renderMachine(final Machine p0, final double p1, final double p2, final double p3, final float p4);//, final RenderBlocks p5);
|
||||
|
||||
public boolean isActive() {
|
||||
return this.active;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ public class ManagerMachine extends ManagerBase {
|
||||
private Map<Integer, Class<?>> networkIDToComponent;
|
||||
private Map<Class<?>, Integer> componentToNetworkID;
|
||||
private int nextNetworkID;
|
||||
private int machineRenderID;
|
||||
|
||||
public ManagerMachine() {
|
||||
this.componentInterfaceMap = new HashMap<>();
|
||||
@@ -69,14 +68,9 @@ public class ManagerMachine extends ManagerBase {
|
||||
return this.networkIDToComponent.get(networkID);
|
||||
}
|
||||
|
||||
public int getMachineRenderID() {
|
||||
return this.machineRenderID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
//TODO renderupdate
|
||||
//this.machineRenderID = BinnieCore.proxy.getUniqueRenderID();
|
||||
SlotValidator.IconBee = new ValidatorIcon(BinnieCore.instance, "validator/bee.0", "validator/bee.1");
|
||||
SlotValidator.IconFrame = new ValidatorIcon(BinnieCore.instance, "validator/frame.0", "validator/frame.1");
|
||||
SlotValidator.IconCircuit = new ValidatorIcon(BinnieCore.instance, "validator/circuit.0", "validator/circuit.1");
|
||||
@@ -85,8 +79,7 @@ public class ManagerMachine extends ManagerBase {
|
||||
|
||||
@Override
|
||||
public void postInit() {
|
||||
//BinnieCore.proxy.registerBlockRenderer(BinnieCore.proxy.createObject("binnie.core.machines.RendererMachine"));
|
||||
//BinnieCore.proxy.registerTileEntity(TileEntityMachine.class, "binnie.tile.machine", BinnieCore.proxy.createObject("binnie.core.machines.RendererMachine"));
|
||||
BinnieCore.proxy.registerTileEntity(TileEntityMachine.class, "binnie.tile.machine", BinnieCore.proxy.createObject("binnie.core.machines.RendererMachine"));
|
||||
}
|
||||
|
||||
public Class<?>[] getComponentInterfaces(final Class<? extends MachineComponent> clss) {
|
||||
|
||||
@@ -1,72 +0,0 @@
|
||||
package binnie.core.machines;
|
||||
|
||||
import net.minecraft.client.renderer.VertexBuffer;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
|
||||
public class RendererMachine extends TileEntitySpecialRenderer<TileEntityMachine> //implements ISimpleBlockRenderingHandler
|
||||
{
|
||||
|
||||
|
||||
@Override
|
||||
public void renderTileEntityFast(TileEntityMachine te, double x, double y, double z, float partialTicks, int destroyStage, VertexBuffer VertexBuffer) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntityMachine te, double x, double y, double z, float partialTicks, int destroyStage) {
|
||||
if (te != null && te.getMachine() != null) {
|
||||
final MachinePackage machinePackage = te.getMachine().getPackage();
|
||||
//machinePackage.renderMachine(te.getMachine(), x, y, z, partialTicks);
|
||||
}
|
||||
}
|
||||
|
||||
// RenderBlocks blockRenderer;
|
||||
//
|
||||
// @Override
|
||||
// public void renderTileEntityAt(final TileEntity entity, final double x, final double y, final double z, final float var8) {
|
||||
// this.renderTileEntity((TileEntityMachine) entity, x, y, z, var8, this.blockRenderer);
|
||||
// }
|
||||
//
|
||||
// public void renderTileEntity(final TileEntityMachine entity, final double x, final double y, final double z, final float var8, final RenderBlocks renderer) {
|
||||
// if (entity != null && entity.getMachine() != null) {
|
||||
// final MachinePackage machinePackage = entity.getMachine().getPackage();
|
||||
// machinePackage.renderMachine(entity.getMachine(), x, y, z, var8, renderer);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public void renderInvBlock(final RenderBlocks renderblocks, final Block block, final int i, final int j) {
|
||||
// final TileEntity entity = block.createTileEntity((World) null, i);
|
||||
// this.renderTileEntity((TileEntityMachine) entity, 0.0, -0.1, 0.0, 0.0625f, renderblocks);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void renderInventoryBlock(final Block block, final int metadata, final int modelID, final RenderBlocks renderer) {
|
||||
// if (modelID == Binnie.Machine.getMachineRenderID()) {
|
||||
// this.renderInvBlock(renderer, block, metadata, modelID);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean renderWorldBlock(final IBlockAccess world, final int x, final int y, final int z, final Block block, final int modelId, final RenderBlocks renderer) {
|
||||
// final TileEntityMachine tile = (TileEntityMachine) world.getTileEntity(x, y, z);
|
||||
// if (tile != null && tile.getMachine() != null && tile.getMachine().getPackage() != null && tile.getMachine().getPackage().getGroup() != null && !tile.getMachine().getPackage().getGroup().customRenderer) {
|
||||
// this.renderTileEntity(tile, x, y, z, 1.0f, renderer);
|
||||
// }
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean shouldRender3DInInventory(final int i) {
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int getRenderId() {
|
||||
// return Binnie.Machine.getMachineRenderID();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void func_147496_a(final World par1World) {
|
||||
// this.blockRenderer = new RenderBlocks(par1World);
|
||||
// }
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package binnie.core.machines;
|
||||
|
||||
import net.minecraft.client.renderer.VertexBuffer;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
|
||||
public class TileEntityMachineRenderer extends TileEntitySpecialRenderer<TileEntityMachine> {
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntityMachine te, double x, double y, double z, float partialTicks, int destroyStage) {
|
||||
if (te != null && te.getMachine() != null) {
|
||||
te.getMachine().getPackage().renderMachine(te.getMachine(), x, y, z, partialTicks, destroyStage);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package binnie.core.machines.component;
|
||||
|
||||
import net.minecraft.client.renderer.RenderItem;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
@@ -10,16 +11,16 @@ import java.util.Random;
|
||||
public interface IRender {
|
||||
interface DisplayTick {
|
||||
@SideOnly(Side.CLIENT)
|
||||
void onDisplayTick(final World p0, final int p1, final int p2, final int p3, final Random p4);
|
||||
void onDisplayTick(World world, BlockPos pos, Random rand);
|
||||
}
|
||||
|
||||
interface RandomDisplayTick {
|
||||
@SideOnly(Side.CLIENT)
|
||||
void onRandomDisplayTick(final World p0, final int p1, final int p2, final int p3, final Random p4);
|
||||
void onRandomDisplayTick(World world, BlockPos pos, Random rand);
|
||||
}
|
||||
|
||||
interface Render {
|
||||
@SideOnly(Side.CLIENT)
|
||||
void renderInWorld(final RenderItem p0, final double p1, final double p2, final double p3);
|
||||
void renderInWorld(double xPos, double yPos, double zPos);
|
||||
}
|
||||
}
|
||||
@@ -56,8 +56,8 @@ enum Compartment implements IMachineType {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderMachine(final Machine machine, final double x, final double y, final double z, final float var8) {
|
||||
MachineRendererCompartment.instance.renderMachine(machine, 16777215, this.renderTexture, x, y, z, var8);
|
||||
public void renderMachine(Machine machine, double x, double y, double z, float partialTicks, int destroyStage) {
|
||||
MachineRendererCompartment.instance.renderMachine(machine, 16777215, renderTexture, x, y, z, partialTicks);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user