add assembly table, advanced crafting table and charging table models; improve pipe/gate speed further; add NEI support for gate recipes

This commit is contained in:
asiekierka 2015-03-16 16:46:18 +01:00
parent 8acd085b2b
commit 54088c2249
31 changed files with 281 additions and 37 deletions

View file

@ -159,6 +159,10 @@ gate.trigger.machine.energyStoredHigh=High Energy Stored
gate.trigger.machine.energyStoredLow=Low Energy Stored
gate.trigger.light.bright=Bright
gate.trigger.light.dark=Dark
gate.trigger.time.0=Night
gate.trigger.time.6=Morning
gate.trigger.time.12=Afternoon
gate.trigger.time.18=Evening
gui.building.resources=Building Resources
gui.building.fluids=Fluid Tanks
@ -411,7 +415,7 @@ achievement.blueprintAchievement.desc=Craft a blueprint
achievement.templateAchievement=Basis
achievement.templateAchievement.desc=Craft a template
achievement.blueprintLibraryAchievement=Ideas live on
achievement.blueprintLibraryAchievement.desc=Craft a blueprint library
achievement.blueprintLibraryAchievement.desc=Craft an electronic library
bc_update.new_version=§cNew version of BuildCraft available: %s for Minecraft %s
bc_update.download=§cDownload from http://www.mod-buildcraft.com/download

Binary file not shown.

Before

Width:  |  Height:  |  Size: 334 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 343 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 597 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 334 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 276 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 423 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 379 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 959 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 333 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 464 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 387 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 330 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 520 B

View file

@ -0,0 +1,69 @@
package buildcraft.core.lib.render;
import net.minecraft.util.IIcon;
public class SubIcon implements IIcon {
private final IIcon icon;
private float u, v;
private final int w, h;
private float uScale, vScale;
public SubIcon(IIcon icon, int u, int v) {
this(icon, u, v, 16, 16);
}
public SubIcon(IIcon icon, int u, int v, int w, int h) {
this.icon = icon;
this.uScale = icon.getMaxU() - icon.getMinU();
this.vScale = icon.getMaxV() - icon.getMinV();
this.u = icon.getMinU() + (this.uScale * u / icon.getIconWidth());
this.v = icon.getMinV() + (this.vScale * v / icon.getIconHeight());
this.w = w;
this.h = h;
}
@Override
public int getIconWidth() {
return w;
}
@Override
public int getIconHeight() {
return h;
}
@Override
public float getMinU() {
return u;
}
@Override
public float getMaxU() {
return u + (uScale * w / icon.getIconWidth());
}
@Override
public float getInterpolatedU(double p_94214_1_) {
return u + (uScale * (float) p_94214_1_ / (float) icon.getIconWidth());
}
@Override
public float getMinV() {
return v;
}
@Override
public float getMaxV() {
return v + (vScale * h / icon.getIconHeight());
}
@Override
public float getInterpolatedV(double p_94207_1_) {
return v + (vScale * (float) p_94207_1_ / (float) icon.getIconHeight());
}
@Override
public String getIconName() {
return icon.getIconName();
}
}

View file

@ -38,7 +38,7 @@ public class BlockLaserTable extends BlockBuildCraft implements ILaserTargetBloc
public BlockLaserTable() {
super(Material.iron);
setBlockBounds(0, 0, 0, 1, 9F / 16F, 1);
setBlockBounds(0, 0, 0, 1, 8F / 16F, 1);
setHardness(10F);
setCreativeTab(BCCreativeTab.get("main"));
}
@ -53,6 +53,11 @@ public class BlockLaserTable extends BlockBuildCraft implements ILaserTargetBloc
return false;
}
@Override
public int getRenderType() {
return SiliconProxy.laserTableModel;
}
@Override
public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer entityplayer, int par6, float par7, float par8, float par9) {
if (super.onBlockActivated(world, i, j, k, entityplayer, par6, par7, par8, par9)) {

View file

@ -14,6 +14,7 @@ public class SiliconProxy {
@SidedProxy(clientSide = "buildcraft.silicon.SiliconProxyClient", serverSide = "buildcraft.silicon.SiliconProxy")
public static SiliconProxy proxy;
public static int laserBlockModel = -1;
public static int laserTableModel = -1;
public void registerRenderers() {
}

View file

@ -11,6 +11,7 @@ package buildcraft.silicon;
import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.client.registry.RenderingRegistry;
import buildcraft.silicon.render.RenderLaserBlock;
import buildcraft.silicon.render.RenderLaserTable;
import buildcraft.silicon.render.RenderLaserTile;
public class SiliconProxyClient extends SiliconProxy {
@ -19,6 +20,9 @@ public class SiliconProxyClient extends SiliconProxy {
SiliconProxy.laserBlockModel = RenderingRegistry.getNextAvailableRenderId();
RenderingRegistry.registerBlockHandler(new RenderLaserBlock());
SiliconProxy.laserTableModel = RenderingRegistry.getNextAvailableRenderId();
RenderingRegistry.registerBlockHandler(new RenderLaserTable());
ClientRegistry.bindTileEntitySpecialRenderer(TileLaser.class, new RenderLaserTile());
}
}

View file

@ -0,0 +1,115 @@
package buildcraft.silicon.render;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import buildcraft.core.lib.block.BlockBuildCraft;
import buildcraft.core.lib.render.RenderUtils;
import buildcraft.core.lib.render.SubIcon;
import buildcraft.silicon.SiliconProxy;
import buildcraft.transport.render.FakeBlock;
/**
* Created by asie on 3/15/15.
*/
public class RenderLaserTable implements ISimpleBlockRenderingHandler {
@Override
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
BlockBuildCraft bcBlock = (BlockBuildCraft) block;
switch (metadata) {
case 0:
renderAssemblyTable(renderer, true, 0, 0, 0, bcBlock);
break;
case 1:
renderAdvancedCraftingTable(renderer, true, 0, 0, 0, bcBlock);
break;
case 3:
renderChargingTable(renderer, true, 0, 0, 0, bcBlock);
break;
}
}
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
BlockBuildCraft bcBlock = (BlockBuildCraft) block;
switch (world.getBlockMetadata(x, y, z)) {
case 0:
renderAssemblyTable(renderer, false, x, y, z, bcBlock);
break;
case 1:
renderAdvancedCraftingTable(renderer, false, x, y, z, bcBlock);
break;
case 3:
renderChargingTable(renderer, false, x, y, z, bcBlock);
break;
}
return true;
}
private void renderCube(RenderBlocks renderer, boolean isInventory, int xPos, int yPos, int zPos, float xB, float yB, float zB, int w, int h, int d, int topX, int topY, IIcon base, int mask) {
int xI = (int) (xB * 16.0F);
int yI = 16 - (int) (yB * 16.0F) - h;
int zI = (int) (zB * 16.0F);
FakeBlock block = FakeBlock.INSTANCE;
block.setRenderMask(mask);
block.setColor(0xFFFFFF);
IIcon[] icons = block.getTextureState().popArray();
icons[0] = new SubIcon(base, topX + w - xI, topY - zI, 16, 16);
icons[1] = new SubIcon(base, topX - xI, topY - zI, 16, 16);
icons[2] = new SubIcon(base, topX - xI, topY + d - yI, 16, 16);
icons[3] = new SubIcon(base, topX + w + d - xI, topY + d - yI, 16, 16);
icons[4] = new SubIcon(base, topX - d - zI, topY + d - yI, 16, 16);
icons[5] = new SubIcon(base, topX + w - zI, topY + d - yI, 16, 16);
renderer.setRenderBounds(xB, yB, zB, xB + (w / 16.0F), yB + (h / 16.0F), zB + (d / 16.0F));
if (isInventory) {
RenderUtils.drawBlockItem(renderer, Tessellator.instance, block, 0);
} else {
renderer.renderStandardBlock(block, xPos, yPos, zPos);
}
}
private void renderAssemblyTable(RenderBlocks renderer, boolean isInv, int x, int y, int z, BlockBuildCraft block) {
IIcon base = block.getIcon(0, 0);
renderCube(renderer, isInv, x, y, z, 0, 0, 0, 16, 2, 16, 16, 21, base, 0x3f); // bottom
renderCube(renderer, isInv, x, y, z, 0.0625F, 0.125F, 0.0625F, 14, 1, 14, 18, 39, base, 0x3c); // middle (no top/bottom rendered)
renderCube(renderer, isInv, x, y, z, 0, 0.1875F, 0, 16, 5, 16, 16, 0, base, 0x3f); // top
}
private void renderChargingTable(RenderBlocks renderer, boolean isInv, int x, int y, int z, BlockBuildCraft block) {
IIcon base = block.getIcon(0, 3);
renderCube(renderer, isInv, x, y, z, 0.0625F, 0, 0.0625F, 14, 5, 14, 14, 19, base, 0x3d); // bottom (no top)
renderCube(renderer, isInv, x, y, z, 0, 0.3125F, 0, 16, 3, 16, 16, 0, base, 0x3f); // top
// sides (no top)
renderCube(renderer, isInv, x, y, z, 0, 0, 0, 3, 5, 3, 3, 6, base, 0x3d);
renderCube(renderer, isInv, x, y, z, 0.8125F, 0, 0, 3, 5, 3, 3, 6, base, 0x3d);
renderCube(renderer, isInv, x, y, z, 0, 0, 0.8125F, 3, 5, 3, 3, 6, base, 0x3d);
renderCube(renderer, isInv, x, y, z, 0.8125F, 0, 0.8125F, 3, 5, 3, 3, 6, base, 0x3d);
}
private void renderAdvancedCraftingTable(RenderBlocks renderer, boolean isInv, int x, int y, int z, BlockBuildCraft block) {
IIcon base = block.getIcon(0, 1);
renderCube(renderer, isInv, x, y, z, 0.125F, 0, 0.125F, 12, 3, 12, 12, 21, base, 0x3d); // bottom (no top)
renderCube(renderer, isInv, x, y, z, 0, 0.1875F, 0, 16, 5, 16, 16, 0, base, 0x3f); // top
// sides (no top)
renderCube(renderer, isInv, x, y, z, 0, 0, 0, 3, 3, 3, 3, 0, base, 0x3d);
renderCube(renderer, isInv, x, y, z, 0.8125F, 0, 0, 3, 3, 3, 3, 0, base, 0x3d);
renderCube(renderer, isInv, x, y, z, 0, 0, 0.8125F, 3, 3, 3, 3, 0, base, 0x3d);
renderCube(renderer, isInv, x, y, z, 0.8125F, 0, 0.8125F, 3, 3, 3, 3, 0, base, 0x3d);
}
@Override
public boolean shouldRender3DInInventory(int modelId) {
return true;
}
@Override
public int getRenderId() {
return SiliconProxy.laserTableModel;
}
}

View file

@ -79,10 +79,10 @@ public final class Gate implements IGate, ISidedStatementContainer, IRedstoneSta
* state of the renderer, and update moveStage accordingly.
*/
public boolean isPulsing = false;
private float pulseStage = 0;
private ForgeDirection direction;
private HashMultiset<IStatement> statementCounts = HashMultiset.create();
private int[] actionGroups = new int [] {0, 1, 2, 3, 4, 5, 6, 7};
// / CONSTRUCTOR
public Gate(Pipe<?> pipe, GateMaterial material, GateLogic logic, ForgeDirection direction) {
@ -124,7 +124,10 @@ public final class Gate implements IGate, ISidedStatementContainer, IRedstoneSta
actionParameters[position][i] = null;
}
}
actions[position] = action;
recalculateActionGroups();
}
public IStatement getAction(int position) {
@ -137,6 +140,8 @@ public final class Gate implements IGate, ISidedStatementContainer, IRedstoneSta
public void setActionParameter(int action, int param, IStatementParameter p) {
actionParameters[action][param] = p;
recalculateActionGroups();
}
public IStatementParameter getTriggerParameter(int trigger, int param) {
@ -261,6 +266,8 @@ public final class Gate implements IGate, ISidedStatementContainer, IRedstoneSta
}
}
}
recalculateActionGroups();
}
public boolean verifyGateStatements() {
@ -293,6 +300,10 @@ public final class Gate implements IGate, ISidedStatementContainer, IRedstoneSta
}
}
if (warning) {
recalculateActionGroups();
}
return !warning;
}
@ -389,32 +400,6 @@ public final class Gate implements IGate, ISidedStatementContainer, IRedstoneSta
// Tell the gate to prepare for resolving actions. (Disable pulser)
startResolution();
int [] actionGroups = new int [] {0, 1, 2, 3, 4, 5, 6, 7};
for (int i = 0; i < MAX_STATEMENTS; ++i) {
for (int j = i - 1; j >= 0; --j) {
if (actions[i] != null && actions[j] != null
&& actions[i].getUniqueTag().equals(actions[j].getUniqueTag())) {
boolean sameParams = true;
for (int p = 0; p < MAX_PARAMETERS; ++p) {
if ((actionParameters[i][p] != null && actionParameters[j][p] == null)
|| (actionParameters[i][p] == null && actionParameters[j][p] != null)
|| (actionParameters[i][p] != null
&& actionParameters[j][p] != null
&& !actionParameters[i][p].equals(actionParameters[j][p]))) {
sameParams = false;
}
}
if (sameParams) {
actionGroups[i] = j;
}
}
}
}
// Computes the actions depending on the triggers
for (int it = 0; it < MAX_STATEMENTS; ++it) {
actionsState[it] = ActionActiveState.Deactivated;
@ -621,8 +606,32 @@ public final class Gate implements IGate, ISidedStatementContainer, IRedstoneSta
}
}
public float getPulseStage() {
return pulseStage;
private void recalculateActionGroups() {
for (int i = 0; i < MAX_STATEMENTS; ++i) {
actionGroups[i] = i;
for (int j = i - 1; j >= 0; --j) {
if (actions[i] != null && actions[j] != null
&& actions[i].getUniqueTag().equals(actions[j].getUniqueTag())) {
boolean sameParams = true;
for (int p = 0; p < MAX_PARAMETERS; ++p) {
if ((actionParameters[i][p] != null && actionParameters[j][p] == null)
|| (actionParameters[i][p] == null && actionParameters[j][p] != null)
|| (actionParameters[i][p] != null
&& actionParameters[j][p] != null
&& !actionParameters[i][p].equals(actionParameters[j][p]))) {
sameParams = false;
break;
}
}
if (sameParams) {
actionGroups[i] = j;
}
}
}
}
}
public void broadcastSignal(PipeWire color) {

View file

@ -62,7 +62,6 @@ public abstract class Pipe<T extends PipeTransport> implements IDropControlInven
this.item = item;
eventBus.registerHandler(this);
eventBus.registerHandler(new LensFilterHandler(this));
}
public void setTile(TileEntity tile) {

View file

@ -226,13 +226,13 @@ public class PipeTransportFluids extends PipeTransport implements IFluidHandler
moveFluids();
if (tracker.markTimeIfDelay(container.getWorldObj())) {
boolean init = false;
if (++clientSyncCounter > BuildCraftCore.longUpdateFactor) {
clientSyncCounter = 0;
init = true;
}
PacketFluidUpdate packet = computeFluidUpdate(init, true);
if (packet != null) {
BuildCraftTransport.instance.sendToPlayers(packet, container.getWorldObj(), container.xCoord, container.yCoord, container.zCoord, DefaultProps.PIPE_CONTENTS_RENDER_DIST);
}

View file

@ -49,6 +49,12 @@ public class PipeTransportItems extends PipeTransport implements IDebuggable {
public boolean allowBouncing = false;
public final TravelerSet items = new TravelerSet(this);
@Override
public void initialize() {
super.initialize();
container.pipe.eventBus.registerHandler(new LensFilterHandler(container.pipe));
}
@Override
public IPipeTile.PipeType getPipeType() {
return IPipeTile.PipeType.ITEM;

View file

@ -8,6 +8,8 @@
*/
package buildcraft.transport.recipes;
import java.util.ArrayList;
import java.util.Collection;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
@ -24,6 +26,7 @@ import buildcraft.silicon.recipes.IntegrationTableRecipe;
import buildcraft.transport.ItemFacade;
import buildcraft.transport.ItemFacade.FacadeState;
import buildcraft.transport.ItemPipeWire;
import buildcraft.transport.gates.ItemGate;
public class AdvancedFacadeRecipe extends IntegrationTableRecipe {
@ -95,4 +98,21 @@ public class AdvancedFacadeRecipe extends IntegrationTableRecipe {
return null;
}
}
@Override
public Collection<Object> getInputs() {
ArrayList<Object> inputs = new ArrayList<Object>();
//inputs.add(ItemFacade.allFacades);
//inputs.add(ItemRedstoneChipset.Chipset.RED.getStack());
return inputs;
}
@Override
public Collection<Object> getOutput() {
ArrayList<Object> outputs = new ArrayList<Object>();
return outputs;
}
}

View file

@ -82,15 +82,15 @@ public class GateExpansionRecipe extends IntegrationTableRecipe {
return inputs;
}
/*@Override
@Override
public Collection<Object> getOutput() {
ArrayList<Object> gates = new ArrayList<Object>();
for (ItemStack stack : ItemGate.getAllGates()) {
ItemStack newStack = stack.copy();
ItemGate.addGateExpansion(stack, expansion);
ItemGate.addGateExpansion(newStack, expansion);
gates.add(newStack);
}
return gates;
}*/
}
}

View file

@ -66,4 +66,16 @@ public class GateLogicSwapRecipe extends IntegrationTableRecipe {
return inputs;
}
@Override
public Collection<Object> getOutput() {
ArrayList<Object> gates = new ArrayList<Object>();
for (ItemStack stack : ItemGate.getAllGates()) {
ItemStack newStack = stack.copy();
ItemGate.setLogic(newStack, ItemGate.getLogic(newStack) == GateLogic.AND ? GateLogic.OR : GateLogic.AND);
gates.add(newStack);
}
return gates;
}
}