Merge branch 'engine' of https://github.com/dmillerw/BuildCraft into dmillerw-engine
|
@ -180,6 +180,7 @@ tile.blockFuel.name=Fuel
|
||||||
tile.blockHopper.name=Chute
|
tile.blockHopper.name=Chute
|
||||||
tile.blockOil.name=Oil
|
tile.blockOil.name=Oil
|
||||||
tile.builderBlock.name=Builder
|
tile.builderBlock.name=Builder
|
||||||
|
tile.engineCreative.name=Creative Engine
|
||||||
tile.engineIron.name=Combustion Engine
|
tile.engineIron.name=Combustion Engine
|
||||||
tile.engineStone.name=Stirling Engine
|
tile.engineStone.name=Stirling Engine
|
||||||
tile.engineWood.name=Redstone Engine
|
tile.engineWood.name=Redstone Engine
|
||||||
|
|
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 365 B After Width: | Height: | Size: 365 B |
After Width: | Height: | Size: 365 B |
After Width: | Height: | Size: 365 B |
After Width: | Height: | Size: 2.5 KiB |
|
@ -8,32 +8,32 @@
|
||||||
*/
|
*/
|
||||||
package buildcraft.energy;
|
package buildcraft.energy;
|
||||||
|
|
||||||
import java.util.List;
|
import buildcraft.BuildCraftCore;
|
||||||
import java.util.Random;
|
import buildcraft.core.BlockBuildCraft;
|
||||||
|
import buildcraft.core.CreativeTabBuildCraft;
|
||||||
|
import buildcraft.core.ICustomHighlight;
|
||||||
|
import buildcraft.core.IItemPipe;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.AxisAlignedBB;
|
||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.IIcon;
|
||||||
|
import net.minecraft.util.MovingObjectPosition;
|
||||||
|
import net.minecraft.util.Vec3;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
import buildcraft.BuildCraftCore;
|
|
||||||
import buildcraft.core.BlockBuildCraft;
|
import java.util.List;
|
||||||
import buildcraft.core.CreativeTabBuildCraft;
|
import java.util.Random;
|
||||||
import buildcraft.core.IItemPipe;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
import net.minecraft.util.MovingObjectPosition;
|
|
||||||
import buildcraft.core.ICustomHighlight;
|
|
||||||
import net.minecraft.util.AxisAlignedBB;
|
|
||||||
import net.minecraft.entity.Entity;
|
|
||||||
import net.minecraft.util.Vec3;
|
|
||||||
|
|
||||||
import static net.minecraft.util.AxisAlignedBB.getBoundingBox;
|
import static net.minecraft.util.AxisAlignedBB.getBoundingBox;
|
||||||
|
|
||||||
|
@ -82,11 +82,16 @@ public class BlockEngine extends BlockBuildCraft implements ICustomHighlight {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createTileEntity(World world, int metadata) {
|
public TileEntity createTileEntity(World world, int metadata) {
|
||||||
if (metadata == 1) {
|
switch (metadata) {
|
||||||
|
case 0:
|
||||||
|
return new TileEngineWood();
|
||||||
|
case 1:
|
||||||
return new TileEngineStone();
|
return new TileEngineStone();
|
||||||
} else if (metadata == 2) {
|
case 2:
|
||||||
return new TileEngineIron();
|
return new TileEngineIron();
|
||||||
} else {
|
case 3:
|
||||||
|
return new TileEngineCreative();
|
||||||
|
default:
|
||||||
return new TileEngineWood();
|
return new TileEngineWood();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -118,10 +123,11 @@ public class BlockEngine extends BlockBuildCraft implements ICustomHighlight {
|
||||||
|
|
||||||
TileEngine tile = (TileEngine) world.getTileEntity(i, j, k);
|
TileEngine tile = (TileEngine) world.getTileEntity(i, j, k);
|
||||||
|
|
||||||
|
// REMOVED DUE TO CREATIVE ENGINE REQUIREMENTS - dmillerw
|
||||||
// Drop through if the player is sneaking
|
// Drop through if the player is sneaking
|
||||||
if (player.isSneaking()) {
|
// if (player.isSneaking()) {
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
|
|
||||||
// Do not open guis when having a pipe in hand
|
// Do not open guis when having a pipe in hand
|
||||||
if (player.getCurrentEquippedItem() != null) {
|
if (player.getCurrentEquippedItem() != null) {
|
||||||
|
@ -236,10 +242,11 @@ public class BlockEngine extends BlockBuildCraft implements ICustomHighlight {
|
||||||
@Override
|
@Override
|
||||||
public void getSubBlocks(Item item, CreativeTabs par2CreativeTabs, List itemList) {
|
public void getSubBlocks(Item item, CreativeTabs par2CreativeTabs, List itemList) {
|
||||||
if (par2CreativeTabs == CreativeTabBuildCraft.TIER_1.get()) {
|
if (par2CreativeTabs == CreativeTabBuildCraft.TIER_1.get()) {
|
||||||
itemList.add(new ItemStack(this, 1, 0));
|
itemList.add(new ItemStack(this, 1, 0)); // WOOD
|
||||||
itemList.add(new ItemStack(this, 1, 1));
|
itemList.add(new ItemStack(this, 1, 1)); // STONE
|
||||||
} else {
|
} else {
|
||||||
itemList.add(new ItemStack(this, 1, 2));
|
itemList.add(new ItemStack(this, 1, 2)); // IRON
|
||||||
|
itemList.add(new ItemStack(this, 1, 3)); // CREATIVE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@ public class EnergyProxy {
|
||||||
GameRegistry.registerTileEntity(TileEngineWood.class, "net.minecraft.src.buildcraft.energy.TileEngineWood");
|
GameRegistry.registerTileEntity(TileEngineWood.class, "net.minecraft.src.buildcraft.energy.TileEngineWood");
|
||||||
GameRegistry.registerTileEntity(TileEngineStone.class, "net.minecraft.src.buildcraft.energy.TileEngineStone");
|
GameRegistry.registerTileEntity(TileEngineStone.class, "net.minecraft.src.buildcraft.energy.TileEngineStone");
|
||||||
GameRegistry.registerTileEntity(TileEngineIron.class, "net.minecraft.src.buildcraft.energy.TileEngineIron");
|
GameRegistry.registerTileEntity(TileEngineIron.class, "net.minecraft.src.buildcraft.energy.TileEngineIron");
|
||||||
|
GameRegistry.registerTileEntity(TileEngineCreative.class, "net.minecraft.src.buildcraft.energy.TileEngineCreative");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerBlockRenderers() {
|
public void registerBlockRenderers() {
|
||||||
|
|
|
@ -31,8 +31,10 @@ public class EnergyProxyClient extends EnergyProxy {
|
||||||
@Override
|
@Override
|
||||||
public void registerBlockRenderers() {
|
public void registerBlockRenderers() {
|
||||||
//RenderingEntityBlocks.blockByEntityRenders.put(new EntityRenderIndex(BuildCraftEnergy.emitterBlock, 0), new RenderEnergyEmitter());
|
//RenderingEntityBlocks.blockByEntityRenders.put(new EntityRenderIndex(BuildCraftEnergy.emitterBlock, 0), new RenderEnergyEmitter());
|
||||||
RenderingEntityBlocks.blockByEntityRenders.put(new EntityRenderIndex(BuildCraftEnergy.engineBlock, 0), new RenderEngine(TileEngine.WOOD_TEXTURE));
|
//TODO Update me to grab differing trunk textures
|
||||||
RenderingEntityBlocks.blockByEntityRenders.put(new EntityRenderIndex(BuildCraftEnergy.engineBlock, 1), new RenderEngine(TileEngine.STONE_TEXTURE));
|
RenderingEntityBlocks.blockByEntityRenders.put(new EntityRenderIndex(BuildCraftEnergy.engineBlock, 0), new RenderEngine(TileEngine.BASE_TEXTURES[0], TileEngine.CHAMBER_TEXTURES[0], TileEngine.TRUNK_BLUE_TEXTURE));
|
||||||
RenderingEntityBlocks.blockByEntityRenders.put(new EntityRenderIndex(BuildCraftEnergy.engineBlock, 2), new RenderEngine(TileEngine.IRON_TEXTURE));
|
RenderingEntityBlocks.blockByEntityRenders.put(new EntityRenderIndex(BuildCraftEnergy.engineBlock, 1), new RenderEngine(TileEngine.BASE_TEXTURES[1], TileEngine.CHAMBER_TEXTURES[1], TileEngine.TRUNK_BLUE_TEXTURE));
|
||||||
|
RenderingEntityBlocks.blockByEntityRenders.put(new EntityRenderIndex(BuildCraftEnergy.engineBlock, 2), new RenderEngine(TileEngine.BASE_TEXTURES[2], TileEngine.CHAMBER_TEXTURES[2], TileEngine.TRUNK_BLUE_TEXTURE));
|
||||||
|
RenderingEntityBlocks.blockByEntityRenders.put(new EntityRenderIndex(BuildCraftEnergy.engineBlock, 3), new RenderEngine(TileEngine.BASE_TEXTURES[3], TileEngine.CHAMBER_TEXTURES[3], TileEngine.TRUNK_TEXTURES[3]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,11 +8,11 @@
|
||||||
*/
|
*/
|
||||||
package buildcraft.energy;
|
package buildcraft.energy;
|
||||||
|
|
||||||
|
import buildcraft.core.CreativeTabBuildCraft;
|
||||||
|
import buildcraft.core.ItemBlockBuildCraft;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import buildcraft.core.CreativeTabBuildCraft;
|
|
||||||
import buildcraft.core.ItemBlockBuildCraft;
|
|
||||||
|
|
||||||
public class ItemEngine extends ItemBlockBuildCraft {
|
public class ItemEngine extends ItemBlockBuildCraft {
|
||||||
|
|
||||||
|
@ -29,12 +29,17 @@ public class ItemEngine extends ItemBlockBuildCraft {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getUnlocalizedName(ItemStack itemstack) {
|
public String getUnlocalizedName(ItemStack itemstack) {
|
||||||
if (itemstack.getItemDamage() == 0) {
|
switch (itemstack.getItemDamage()) {
|
||||||
|
case 0:
|
||||||
return "tile.engineWood";
|
return "tile.engineWood";
|
||||||
} else if (itemstack.getItemDamage() == 1) {
|
case 1:
|
||||||
return "tile.engineStone";
|
return "tile.engineStone";
|
||||||
} else {
|
case 2:
|
||||||
return "tile.engineIron";
|
return "tile.engineIron";
|
||||||
|
case 3:
|
||||||
|
return "tile.engineCreative";
|
||||||
|
default:
|
||||||
|
return "tile.engineWood";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,14 +8,6 @@
|
||||||
*/
|
*/
|
||||||
package buildcraft.energy;
|
package buildcraft.energy;
|
||||||
|
|
||||||
import java.util.LinkedList;
|
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.inventory.ICrafting;
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
|
||||||
import buildcraft.BuildCraftEnergy;
|
import buildcraft.BuildCraftEnergy;
|
||||||
import buildcraft.api.gates.IOverrideDefaultTriggers;
|
import buildcraft.api.gates.IOverrideDefaultTriggers;
|
||||||
import buildcraft.api.gates.ITrigger;
|
import buildcraft.api.gates.ITrigger;
|
||||||
|
@ -34,12 +26,45 @@ import buildcraft.core.TileBuffer;
|
||||||
import buildcraft.core.TileBuildCraft;
|
import buildcraft.core.TileBuildCraft;
|
||||||
import buildcraft.core.network.NetworkData;
|
import buildcraft.core.network.NetworkData;
|
||||||
import buildcraft.energy.gui.ContainerEngine;
|
import buildcraft.energy.gui.ContainerEngine;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.inventory.ICrafting;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
|
import java.util.LinkedList;
|
||||||
|
|
||||||
public abstract class TileEngine extends TileBuildCraft implements IPowerReceptor, IPowerEmitter, IOverrideDefaultTriggers, IPipeConnection {
|
public abstract class TileEngine extends TileBuildCraft implements IPowerReceptor, IPowerEmitter, IOverrideDefaultTriggers, IPipeConnection {
|
||||||
|
|
||||||
public static final ResourceLocation WOOD_TEXTURE = new ResourceLocation(DefaultProps.TEXTURE_PATH_BLOCKS + "/base_wood.png");
|
// Index corresponds to metadata
|
||||||
public static final ResourceLocation STONE_TEXTURE = new ResourceLocation(DefaultProps.TEXTURE_PATH_BLOCKS + "/base_stone.png");
|
public static final ResourceLocation[] BASE_TEXTURES = new ResourceLocation[]{
|
||||||
public static final ResourceLocation IRON_TEXTURE = new ResourceLocation(DefaultProps.TEXTURE_PATH_BLOCKS + "/base_iron.png");
|
new ResourceLocation(DefaultProps.TEXTURE_PATH_BLOCKS + "/base_wood.png"),
|
||||||
|
new ResourceLocation(DefaultProps.TEXTURE_PATH_BLOCKS + "/base_stone.png"),
|
||||||
|
new ResourceLocation(DefaultProps.TEXTURE_PATH_BLOCKS + "/base_iron.png"),
|
||||||
|
new ResourceLocation(DefaultProps.TEXTURE_PATH_BLOCKS + "/base_creative.png")
|
||||||
|
};
|
||||||
|
|
||||||
|
public static final ResourceLocation[] CHAMBER_TEXTURES = new ResourceLocation[]{
|
||||||
|
new ResourceLocation(DefaultProps.TEXTURE_PATH_BLOCKS + "/chamber_wood.png"),
|
||||||
|
new ResourceLocation(DefaultProps.TEXTURE_PATH_BLOCKS + "/chamber_stone.png"),
|
||||||
|
new ResourceLocation(DefaultProps.TEXTURE_PATH_BLOCKS + "/chamber_iron.png"),
|
||||||
|
new ResourceLocation(DefaultProps.TEXTURE_PATH_BLOCKS + "/chamber_creative.png")
|
||||||
|
};
|
||||||
|
|
||||||
|
// THESE ARE ONLY BLUE TRUNKS. OTHER HEAT STAGES ARE HANDLED PER TILE
|
||||||
|
public static final ResourceLocation[] TRUNK_TEXTURES = new ResourceLocation[]{
|
||||||
|
new ResourceLocation(DefaultProps.TEXTURE_PATH_BLOCKS + "/trunk_wood.png"),
|
||||||
|
new ResourceLocation(DefaultProps.TEXTURE_PATH_BLOCKS + "/trunk_stone.png"),
|
||||||
|
new ResourceLocation(DefaultProps.TEXTURE_PATH_BLOCKS + "/trunk_iron.png"),
|
||||||
|
new ResourceLocation(DefaultProps.TEXTURE_PATH_BLOCKS + "/trunk_creative.png")
|
||||||
|
};
|
||||||
|
|
||||||
|
// TEMP
|
||||||
|
public static final ResourceLocation TRUNK_BLUE_TEXTURE = new ResourceLocation(DefaultProps.TEXTURE_PATH_BLOCKS + "/trunk_blue.png");
|
||||||
|
public static final ResourceLocation TRUNK_GREEN_TEXTURE = new ResourceLocation(DefaultProps.TEXTURE_PATH_BLOCKS + "/trunk_green.png");
|
||||||
|
public static final ResourceLocation TRUNK_YELLOW_TEXTURE = new ResourceLocation(DefaultProps.TEXTURE_PATH_BLOCKS + "/trunk_yellow.png");
|
||||||
|
public static final ResourceLocation TRUNK_RED_TEXTURE = new ResourceLocation(DefaultProps.TEXTURE_PATH_BLOCKS + "/trunk_red.png");
|
||||||
|
|
||||||
public enum EnergyStage {
|
public enum EnergyStage {
|
||||||
BLUE, GREEN, YELLOW, RED, OVERHEAT;
|
BLUE, GREEN, YELLOW, RED, OVERHEAT;
|
||||||
|
@ -82,7 +107,24 @@ public abstract class TileEngine extends TileBuildCraft implements IPowerRecepto
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract ResourceLocation getTextureFile();
|
public abstract ResourceLocation getBaseTexture();
|
||||||
|
|
||||||
|
public abstract ResourceLocation getChamberTexture();
|
||||||
|
|
||||||
|
public ResourceLocation getTrunkTexture(EnergyStage stage) {
|
||||||
|
switch (stage) {
|
||||||
|
case BLUE:
|
||||||
|
return TRUNK_BLUE_TEXTURE;
|
||||||
|
case GREEN:
|
||||||
|
return TRUNK_GREEN_TEXTURE;
|
||||||
|
case YELLOW:
|
||||||
|
return TRUNK_YELLOW_TEXTURE;
|
||||||
|
case RED:
|
||||||
|
return TRUNK_RED_TEXTURE;
|
||||||
|
default:
|
||||||
|
return TRUNK_RED_TEXTURE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public boolean onBlockActivated(EntityPlayer player, ForgeDirection side) {
|
public boolean onBlockActivated(EntityPlayer player, ForgeDirection side) {
|
||||||
return false;
|
return false;
|
||||||
|
|
119
common/buildcraft/energy/TileEngineCreative.java
Normal file
|
@ -0,0 +1,119 @@
|
||||||
|
package buildcraft.energy;
|
||||||
|
|
||||||
|
import buildcraft.api.tools.IToolWrench;
|
||||||
|
import buildcraft.core.utils.StringUtils;
|
||||||
|
import buildcraft.transport.pipes.PipePowerIron;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.util.ChatComponentText;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
|
public class TileEngineCreative extends TileEngine {
|
||||||
|
|
||||||
|
private PipePowerIron.PowerMode powerMode = PipePowerIron.PowerMode.M2;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResourceLocation getBaseTexture() {
|
||||||
|
return BASE_TEXTURES[3];
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResourceLocation getChamberTexture() {
|
||||||
|
return CHAMBER_TEXTURES[3];
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResourceLocation getTrunkTexture(EnergyStage stage) {
|
||||||
|
return TRUNK_TEXTURES[3];
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected EnergyStage computeEnergyStage() {
|
||||||
|
return EnergyStage.BLUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onBlockActivated(EntityPlayer player, ForgeDirection side) {
|
||||||
|
Item equipped = player.getCurrentEquippedItem() != null ? player.getCurrentEquippedItem().getItem() : null;
|
||||||
|
|
||||||
|
if (equipped instanceof IToolWrench && ((IToolWrench) equipped).canWrench(player, xCoord, yCoord, zCoord)) {
|
||||||
|
powerMode = powerMode.getNext();
|
||||||
|
energy = 0;
|
||||||
|
|
||||||
|
if (!getWorld().isRemote) {
|
||||||
|
player.addChatMessage(new ChatComponentText(String.format(StringUtils.localize("chat.pipe.power.iron.mode"), powerMode.maxPower)));
|
||||||
|
}
|
||||||
|
|
||||||
|
((IToolWrench) equipped).wrenchUsed(player, xCoord, yCoord, zCoord);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readFromNBT(NBTTagCompound data) {
|
||||||
|
super.readFromNBT(data);
|
||||||
|
|
||||||
|
powerMode = PipePowerIron.PowerMode.fromId(data.getByte("mode"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeToNBT(NBTTagCompound data) {
|
||||||
|
super.writeToNBT(data);
|
||||||
|
|
||||||
|
data.setByte("mode", (byte) powerMode.ordinal());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getPistonSpeed() {
|
||||||
|
return 0.02F * (powerMode.ordinal() + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void engineUpdate() {
|
||||||
|
super.engineUpdate();
|
||||||
|
|
||||||
|
if (isRedstonePowered) {
|
||||||
|
addEnergy(getCurrentOutput());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isBurning() {
|
||||||
|
return isRedstonePowered;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getScaledBurnTime(int scale) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double maxEnergyReceived() {
|
||||||
|
return getCurrentOutput();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double maxEnergyExtracted() {
|
||||||
|
return getCurrentOutput();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getMaxEnergy() {
|
||||||
|
return getCurrentOutput();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getCurrentOutput() {
|
||||||
|
return powerMode.maxPower;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float explosionRange() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -8,20 +8,6 @@
|
||||||
*/
|
*/
|
||||||
package buildcraft.energy;
|
package buildcraft.energy;
|
||||||
|
|
||||||
import java.util.LinkedList;
|
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.inventory.ICrafting;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
|
||||||
import net.minecraft.world.biome.BiomeGenBase;
|
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
|
||||||
import net.minecraftforge.fluids.Fluid;
|
|
||||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
|
||||||
import net.minecraftforge.fluids.FluidTankInfo;
|
|
||||||
import net.minecraftforge.fluids.IFluidHandler;
|
|
||||||
import buildcraft.BuildCraftCore;
|
import buildcraft.BuildCraftCore;
|
||||||
import buildcraft.BuildCraftEnergy;
|
import buildcraft.BuildCraftEnergy;
|
||||||
import buildcraft.api.fuels.IronEngineCoolant;
|
import buildcraft.api.fuels.IronEngineCoolant;
|
||||||
|
@ -35,9 +21,17 @@ import buildcraft.core.fluids.FluidUtils;
|
||||||
import buildcraft.core.fluids.Tank;
|
import buildcraft.core.fluids.Tank;
|
||||||
import buildcraft.core.fluids.TankManager;
|
import buildcraft.core.fluids.TankManager;
|
||||||
import buildcraft.core.inventory.InvUtils;
|
import buildcraft.core.inventory.InvUtils;
|
||||||
import buildcraft.core.proxy.CoreProxy;
|
|
||||||
import buildcraft.core.utils.Utils;
|
|
||||||
import buildcraft.energy.gui.ContainerEngine;
|
import buildcraft.energy.gui.ContainerEngine;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.inventory.ICrafting;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraft.world.biome.BiomeGenBase;
|
||||||
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
import net.minecraftforge.fluids.*;
|
||||||
|
|
||||||
|
import java.util.LinkedList;
|
||||||
|
|
||||||
public class TileEngineIron extends TileEngineWithInventory implements IFluidHandler {
|
public class TileEngineIron extends TileEngineWithInventory implements IFluidHandler {
|
||||||
|
|
||||||
|
@ -61,8 +55,13 @@ public class TileEngineIron extends TileEngineWithInventory implements IFluidHan
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResourceLocation getTextureFile() {
|
public ResourceLocation getBaseTexture() {
|
||||||
return IRON_TEXTURE;
|
return BASE_TEXTURES[2];
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResourceLocation getChamberTexture() {
|
||||||
|
return CHAMBER_TEXTURES[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -8,14 +8,13 @@
|
||||||
*/
|
*/
|
||||||
package buildcraft.energy;
|
package buildcraft.energy;
|
||||||
|
|
||||||
import buildcraft.BuildCraftEnergy;
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class is just intended to update pre 4.0 engines to the design.
|
* This class is just intended to update pre 4.0 engines to the design.
|
||||||
*
|
* <p/>
|
||||||
* It can be deleted someday.
|
* It can be deleted someday.
|
||||||
*/
|
*/
|
||||||
public class TileEngineLegacy extends TileEngine {
|
public class TileEngineLegacy extends TileEngine {
|
||||||
|
@ -42,8 +41,13 @@ public class TileEngineLegacy extends TileEngine {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResourceLocation getTextureFile() {
|
public ResourceLocation getBaseTexture() {
|
||||||
return WOOD_TEXTURE;
|
return BASE_TEXTURES[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResourceLocation getChamberTexture() {
|
||||||
|
return CHAMBER_TEXTURES[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -8,8 +8,13 @@
|
||||||
*/
|
*/
|
||||||
package buildcraft.energy;
|
package buildcraft.energy;
|
||||||
|
|
||||||
import java.util.LinkedList;
|
import buildcraft.BuildCraftCore;
|
||||||
|
import buildcraft.BuildCraftEnergy;
|
||||||
|
import buildcraft.api.gates.ITrigger;
|
||||||
|
import buildcraft.core.GuiIds;
|
||||||
|
import buildcraft.core.inventory.InvUtils;
|
||||||
|
import buildcraft.core.utils.MathUtils;
|
||||||
|
import buildcraft.energy.gui.ContainerEngine;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.ICrafting;
|
import net.minecraft.inventory.ICrafting;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
@ -17,14 +22,8 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.tileentity.TileEntityFurnace;
|
import net.minecraft.tileentity.TileEntityFurnace;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
import buildcraft.BuildCraftCore;
|
|
||||||
import buildcraft.BuildCraftEnergy;
|
import java.util.LinkedList;
|
||||||
import buildcraft.api.gates.ITrigger;
|
|
||||||
import buildcraft.core.GuiIds;
|
|
||||||
import buildcraft.core.inventory.InvUtils;
|
|
||||||
import buildcraft.core.proxy.CoreProxy;
|
|
||||||
import buildcraft.core.utils.MathUtils;
|
|
||||||
import buildcraft.energy.gui.ContainerEngine;
|
|
||||||
|
|
||||||
public class TileEngineStone extends TileEngineWithInventory {
|
public class TileEngineStone extends TileEngineWithInventory {
|
||||||
|
|
||||||
|
@ -42,6 +41,16 @@ public class TileEngineStone extends TileEngineWithInventory {
|
||||||
super(1);
|
super(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResourceLocation getBaseTexture() {
|
||||||
|
return BASE_TEXTURES[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResourceLocation getChamberTexture() {
|
||||||
|
return CHAMBER_TEXTURES[1];
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(EntityPlayer player, ForgeDirection side) {
|
public boolean onBlockActivated(EntityPlayer player, ForgeDirection side) {
|
||||||
if (!worldObj.isRemote) {
|
if (!worldObj.isRemote) {
|
||||||
|
@ -50,11 +59,6 @@ public class TileEngineStone extends TileEngineWithInventory {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public ResourceLocation getTextureFile() {
|
|
||||||
return STONE_TEXTURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float explosionRange() {
|
public float explosionRange() {
|
||||||
return 2;
|
return 2;
|
||||||
|
|
|
@ -9,18 +9,22 @@
|
||||||
package buildcraft.energy;
|
package buildcraft.energy;
|
||||||
|
|
||||||
import buildcraft.api.power.PowerHandler;
|
import buildcraft.api.power.PowerHandler;
|
||||||
|
import buildcraft.api.transport.IPipeTile.PipeType;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
import buildcraft.api.transport.IPipeTile.PipeType;
|
|
||||||
import buildcraft.core.proxy.CoreProxy;
|
|
||||||
|
|
||||||
public class TileEngineWood extends TileEngine {
|
public class TileEngineWood extends TileEngine {
|
||||||
|
|
||||||
public static final float OUTPUT = 0.05F;
|
public static final float OUTPUT = 0.05F;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResourceLocation getTextureFile() {
|
public ResourceLocation getBaseTexture() {
|
||||||
return WOOD_TEXTURE;
|
return BASE_TEXTURES[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResourceLocation getChamberTexture() {
|
||||||
|
return CHAMBER_TEXTURES[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -10,10 +10,8 @@ package buildcraft.energy.render;
|
||||||
|
|
||||||
import buildcraft.BuildCraftCore;
|
import buildcraft.BuildCraftCore;
|
||||||
import buildcraft.BuildCraftCore.RenderMode;
|
import buildcraft.BuildCraftCore.RenderMode;
|
||||||
import buildcraft.core.DefaultProps;
|
|
||||||
import buildcraft.core.IInventoryRenderer;
|
import buildcraft.core.IInventoryRenderer;
|
||||||
import buildcraft.energy.TileEngine;
|
import buildcraft.energy.TileEngine;
|
||||||
import buildcraft.energy.TileEngine.EnergyStage;
|
|
||||||
import net.minecraft.client.model.ModelBase;
|
import net.minecraft.client.model.ModelBase;
|
||||||
import net.minecraft.client.model.ModelRenderer;
|
import net.minecraft.client.model.ModelRenderer;
|
||||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||||
|
@ -21,29 +19,12 @@ import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
import static net.minecraftforge.common.util.ForgeDirection.DOWN;
|
|
||||||
import static net.minecraftforge.common.util.ForgeDirection.EAST;
|
|
||||||
import static net.minecraftforge.common.util.ForgeDirection.NORTH;
|
|
||||||
import static net.minecraftforge.common.util.ForgeDirection.SOUTH;
|
|
||||||
import static net.minecraftforge.common.util.ForgeDirection.UP;
|
|
||||||
import static net.minecraftforge.common.util.ForgeDirection.WEST;
|
|
||||||
|
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
import static net.minecraftforge.common.util.ForgeDirection.*;
|
||||||
|
|
||||||
public class RenderEngine extends TileEntitySpecialRenderer implements IInventoryRenderer {
|
public class RenderEngine extends TileEntitySpecialRenderer implements IInventoryRenderer {
|
||||||
|
|
||||||
private static final ResourceLocation CHAMBER_TEXTURE = new ResourceLocation(DefaultProps.TEXTURE_PATH_BLOCKS + "/chamber.png");
|
|
||||||
private static final ResourceLocation TRUNK_BLUE_TEXTURE = new ResourceLocation(DefaultProps.TEXTURE_PATH_BLOCKS + "/trunk_blue.png");
|
|
||||||
private static final ResourceLocation TRUNK_GREEN_TEXTURE = new ResourceLocation(DefaultProps.TEXTURE_PATH_BLOCKS + "/trunk_green.png");
|
|
||||||
private static final ResourceLocation TRUNK_YELLOW_TEXTURE = new ResourceLocation(DefaultProps.TEXTURE_PATH_BLOCKS + "/trunk_yellow.png");
|
|
||||||
private static final ResourceLocation TRUNK_RED_TEXTURE = new ResourceLocation(DefaultProps.TEXTURE_PATH_BLOCKS + "/trunk_red.png");
|
|
||||||
private ModelBase model = new ModelBase() {
|
|
||||||
};
|
|
||||||
private ModelRenderer box;
|
|
||||||
private ModelRenderer trunk;
|
|
||||||
private ModelRenderer movingBox;
|
|
||||||
private ModelRenderer chamber;
|
|
||||||
private ResourceLocation baseTexture;
|
|
||||||
private static final float[] angleMap = new float[6];
|
private static final float[] angleMap = new float[6];
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
@ -55,9 +36,19 @@ public class RenderEngine extends TileEntitySpecialRenderer implements IInventor
|
||||||
angleMap[NORTH.ordinal()] = (float) -Math.PI / 2;
|
angleMap[NORTH.ordinal()] = (float) -Math.PI / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
public RenderEngine() {
|
private ModelBase model = new ModelBase() {
|
||||||
|
};
|
||||||
|
|
||||||
// constructor:
|
private ModelRenderer box;
|
||||||
|
private ModelRenderer trunk;
|
||||||
|
private ModelRenderer movingBox;
|
||||||
|
private ModelRenderer chamber;
|
||||||
|
|
||||||
|
private ResourceLocation baseTexture;
|
||||||
|
private ResourceLocation chamberTexture;
|
||||||
|
private ResourceLocation trunkTexture;
|
||||||
|
|
||||||
|
public RenderEngine() {
|
||||||
box = new ModelRenderer(model, 0, 1);
|
box = new ModelRenderer(model, 0, 1);
|
||||||
box.addBox(-8F, -8F, -8F, 16, 4, 16);
|
box.addBox(-8F, -8F, -8F, 16, 4, 16);
|
||||||
box.rotationPointX = 8;
|
box.rotationPointX = 8;
|
||||||
|
@ -83,15 +74,17 @@ public class RenderEngine extends TileEntitySpecialRenderer implements IInventor
|
||||||
chamber.rotationPointZ = 8F;
|
chamber.rotationPointZ = 8F;
|
||||||
}
|
}
|
||||||
|
|
||||||
public RenderEngine(ResourceLocation baseTexture) {
|
public RenderEngine(ResourceLocation baseTexture, ResourceLocation chamberTexture, ResourceLocation trunkTexture) {
|
||||||
this();
|
this();
|
||||||
this.baseTexture = baseTexture;
|
this.baseTexture = baseTexture;
|
||||||
|
this.chamberTexture = chamberTexture;
|
||||||
|
this.trunkTexture = trunkTexture;
|
||||||
field_147501_a = TileEntityRendererDispatcher.instance;
|
field_147501_a = TileEntityRendererDispatcher.instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void inventoryRender(double x, double y, double z, float f, float f1) {
|
public void inventoryRender(double x, double y, double z, float f, float f1) {
|
||||||
render(EnergyStage.BLUE, 0.25F, ForgeDirection.UP, baseTexture, x, y, z);
|
render(0.25F, ForgeDirection.UP, baseTexture, chamberTexture, trunkTexture, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -100,11 +93,11 @@ public class RenderEngine extends TileEntitySpecialRenderer implements IInventor
|
||||||
TileEngine engine = ((TileEngine) tileentity);
|
TileEngine engine = ((TileEngine) tileentity);
|
||||||
|
|
||||||
if (engine != null) {
|
if (engine != null) {
|
||||||
render(engine.getEnergyStage(), engine.progress, engine.orientation, engine.getTextureFile(), x, y, z);
|
render(engine.progress, engine.orientation, engine.getBaseTexture(), engine.getChamberTexture(), engine.getTrunkTexture(engine.getEnergyStage()), x, y, z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void render(EnergyStage energy, float progress, ForgeDirection orientation, ResourceLocation baseTexture, double x, double y, double z) {
|
private void render(float progress, ForgeDirection orientation, ResourceLocation baseTexture, ResourceLocation chamberTexture, ResourceLocation trunkTexture, double x, double y, double z) {
|
||||||
|
|
||||||
if (BuildCraftCore.render == RenderMode.NoDynamic) {
|
if (BuildCraftCore.render == RenderMode.NoDynamic) {
|
||||||
return;
|
return;
|
||||||
|
@ -171,7 +164,7 @@ public class RenderEngine extends TileEntitySpecialRenderer implements IInventor
|
||||||
movingBox.render(factor);
|
movingBox.render(factor);
|
||||||
GL11.glTranslatef(-translate[0] * translatefact, -translate[1] * translatefact, -translate[2] * translatefact);
|
GL11.glTranslatef(-translate[0] * translatefact, -translate[1] * translatefact, -translate[2] * translatefact);
|
||||||
|
|
||||||
bindTexture(CHAMBER_TEXTURE);
|
bindTexture(chamberTexture);
|
||||||
|
|
||||||
float chamberf = 2F / 16F;
|
float chamberf = 2F / 16F;
|
||||||
|
|
||||||
|
@ -184,24 +177,7 @@ public class RenderEngine extends TileEntitySpecialRenderer implements IInventor
|
||||||
GL11.glTranslatef(-translate[0] * chamberf, -translate[1] * chamberf, -translate[2] * chamberf);
|
GL11.glTranslatef(-translate[0] * chamberf, -translate[1] * chamberf, -translate[2] * chamberf);
|
||||||
}
|
}
|
||||||
|
|
||||||
ResourceLocation texture;
|
bindTexture(trunkTexture);
|
||||||
|
|
||||||
switch (energy) {
|
|
||||||
case BLUE:
|
|
||||||
texture = TRUNK_BLUE_TEXTURE;
|
|
||||||
break;
|
|
||||||
case GREEN:
|
|
||||||
texture = TRUNK_GREEN_TEXTURE;
|
|
||||||
break;
|
|
||||||
case YELLOW:
|
|
||||||
texture = TRUNK_YELLOW_TEXTURE;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
texture = TRUNK_RED_TEXTURE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
bindTexture(texture);
|
|
||||||
|
|
||||||
trunk.render(factor);
|
trunk.render(factor);
|
||||||
|
|
||||||
|
|