Added experimental electrical pass-through furnace. Release version commit v1.0.4-mc1.12.2.

This commit is contained in:
stfwi 2019-05-04 13:11:35 +02:00
parent 6822334299
commit 62b4a8c312
25 changed files with 994 additions and 84 deletions

View file

@ -4,4 +4,4 @@ org.gradle.jvmargs=-Xmx8G
version_minecraft=1.12.2 version_minecraft=1.12.2
version_forge=14.23.5.2768 version_forge=14.23.5.2768
version_jei=4.10.0.198 version_jei=4.10.0.198
version_engineersdecor=1.0.4-b9 version_engineersdecor=1.0.4

View file

@ -1,7 +1,8 @@
{ {
"homepage": "https://www.curseforge.com/minecraft/mc-mods/engineers-decor/", "homepage": "https://www.curseforge.com/minecraft/mc-mods/engineers-decor/",
"1.12.2": { "1.12.2": {
"1.0.4-b9": "[F] Inserting fluids with pressurized tag only into IE piping.\n[F] Valve redstone connector rendering does not check for \"can connect redstone\" but only for \"can provide power\".\n[M] Valves are adpted to be detected as pipe by IE.", "1.0.4": "[R] Release based on v1.0.3-b9. Release-to-release changes: * Crafting table: Quick crafting history re-fab, JEI integration. * Rendering improvements and issue fixes (stairs, ambient occlusion, optifine, etc). * Walls with texture variations. * Thin/thick steel poles with support feet/heads. * Horizontal steel double-T support beams added. * Fluid pipe valves added: Check valve, redstone controlled valve, analog redstone controlled valve. Support pressuzized transfer. * Tooltip documentation (CTRL-SHIFT) for stairs added. * Internal code cleanups. * Recipes tuned.\n[E] Added pass-through electrical furnace (experimental, see config).",
"1.0.4-b9": "[F] Inserting fluids with pressurized tag only into IE piping.\n[F] Valve redstone connector rendering does not check for \"can connect redstone\" but only for \"can provide power\".\n[M] Valves are adapted to be detected as pipe by IE.",
"1.0.4-b8": "[F] Fixed stairs rendering without smooth light (thanks rastot9).\n[E] Added passive fluid accumulator (experimental feature, see config).", "1.0.4-b8": "[F] Fixed stairs rendering without smooth light (thanks rastot9).\n[E] Added passive fluid accumulator (experimental feature, see config).",
"1.0.4-b7": "[F] Fixed recipe loading issue if IE is not installed.\n[M] Valves support IE pressurized fluid transfer.", "1.0.4-b7": "[F] Fixed recipe loading issue if IE is not installed.\n[M] Valves support IE pressurized fluid transfer.",
"1.0.4-b6": "[A] Added redstone controlled fluid valve.\n[A] Added redstone controlled analog fluid valve.\n[M] Check valve recipe adapted (thanks majijn).", "1.0.4-b6": "[A] Added redstone controlled fluid valve.\n[A] Added redstone controlled analog fluid valve.\n[M] Check valve recipe adapted (thanks majijn).",
@ -32,7 +33,7 @@
"1.0.0-b1": "[A] Initial structure.\n[A] Added clinker bricks and clinker brick stairs.\n[A] Added slag bricks and slag brick stairs.\n[A] Added metal rung ladder.\n[A] Added staggered metal steps ladder.\n[A] Added treated wood ladder.\n[A] Added treated wood pole.\n[A] Added treated wood table." "1.0.0-b1": "[A] Initial structure.\n[A] Added clinker bricks and clinker brick stairs.\n[A] Added slag bricks and slag brick stairs.\n[A] Added metal rung ladder.\n[A] Added staggered metal steps ladder.\n[A] Added treated wood ladder.\n[A] Added treated wood pole.\n[A] Added treated wood table."
}, },
"promos": { "promos": {
"1.12.2-recommended": "1.0.3", "1.12.2-recommended": "1.0.4",
"1.12.2-latest": "1.0.4-b9" "1.12.2-latest": "1.0.4"
} }
} }

View file

@ -10,10 +10,26 @@ Mod sources for Minecraft version 1.12.2.
---- ----
## Revision history ## Revision history
-------------------------------------------------------------------
- v1.0.4 [R] Release based on v1.0.3-b9. Release-to-release changes:
* Crafting table: Quick crafting history re-fab, JEI integration.
* Rendering improvements and issue fixes (stairs, ambient occlusion,
optifine, etc).
* Walls with texture variations.
* Thin/thick steel poles with support feet/heads.
* Horizontal steel double-T support beams added.
* Fluid pipe valves added: Check valve, redstone controlled valve,
analog redstone controlled valve. Support pressuzized transfer.
* Tooltip documentation (CTRL-SHIFT) for stairs added.
* Internal code cleanups.
* Recipes tuned.
-------------------------------------------------------------------
[E] Added pass-through electrical furnace (experimental, see config).
- v1.0.4-b9 [F] Inserting fluids with pressurized tag only into IE piping. - v1.0.4-b9 [F] Inserting fluids with pressurized tag only into IE piping.
[F] Valve redstone connector rendering does not check for [F] Valve redstone connector rendering does not check for
"can connect redstone" but only for "can provide power". "can connect redstone" but only for "can provide power".
[M] Valves are adpted to be detected as pipe by IE. [M] Valves are adapted to be detected as pipe by IE.
- v1.0.4-b8 [F] Fixed stairs rendering without smooth light (thanks rastot9). - v1.0.4-b8 [F] Fixed stairs rendering without smooth light (thanks rastot9).
[E] Added passive fluid accumulator (experimental feature, see config). [E] Added passive fluid accumulator (experimental feature, see config).

View file

@ -153,6 +153,7 @@ public class ModEngineersDecor
{ {
public static final int GUIID_CRAFTING_TABLE = 213101; public static final int GUIID_CRAFTING_TABLE = 213101;
public static final int GUIID_SMALL_LAB_FURNACE = 213102; public static final int GUIID_SMALL_LAB_FURNACE = 213102;
public static final int GUIID_ELECTRICAL_LAB_FURNACE = 213103;
@Override @Override
public Object getServerGuiElement(final int guiid, final EntityPlayer player, final World world, int x, int y, int z) public Object getServerGuiElement(final int guiid, final EntityPlayer player, final World world, int x, int y, int z)
@ -162,6 +163,7 @@ public class ModEngineersDecor
switch(guiid) { switch(guiid) {
case GUIID_CRAFTING_TABLE: return BlockDecorCraftingTable.getServerGuiElement(player, world, pos, te); case GUIID_CRAFTING_TABLE: return BlockDecorCraftingTable.getServerGuiElement(player, world, pos, te);
case GUIID_SMALL_LAB_FURNACE: return BlockDecorFurnace.getServerGuiElement(player, world, pos, te); case GUIID_SMALL_LAB_FURNACE: return BlockDecorFurnace.getServerGuiElement(player, world, pos, te);
case GUIID_ELECTRICAL_LAB_FURNACE: return BlockDecorFurnaceElectrical.getServerGuiElement(player, world, pos, te);
} }
return null; return null;
} }
@ -175,6 +177,7 @@ public class ModEngineersDecor
switch(guiid) { switch(guiid) {
case GUIID_CRAFTING_TABLE: return BlockDecorCraftingTable.getClientGuiElement(player, world, pos, te); case GUIID_CRAFTING_TABLE: return BlockDecorCraftingTable.getClientGuiElement(player, world, pos, te);
case GUIID_SMALL_LAB_FURNACE: return BlockDecorFurnace.getClientGuiElement(player, world, pos, te); case GUIID_SMALL_LAB_FURNACE: return BlockDecorFurnace.getClientGuiElement(player, world, pos, te);
case GUIID_ELECTRICAL_LAB_FURNACE: return BlockDecorFurnaceElectrical.getClientGuiElement(player, world, pos, te);
} }
return null; return null;
} }

View file

@ -471,7 +471,7 @@ public class BlockDecorFurnace extends BlockDecorDirected
private int proc_time_needed_; private int proc_time_needed_;
private int boost_energy_; // small, not saved in nbt. private int boost_energy_; // small, not saved in nbt.
private boolean heater_inserted_ = false; private boolean heater_inserted_ = false;
private NonNullList<ItemStack> stacks_; protected NonNullList<ItemStack> stacks_;
public static void on_config(int speed_percent, int fuel_efficiency_percent, int boost_energy_per_tick) public static void on_config(int speed_percent, int fuel_efficiency_percent, int boost_energy_per_tick)
{ {
@ -485,7 +485,7 @@ public class BlockDecorFurnace extends BlockDecorDirected
public BTileEntity() public BTileEntity()
{ reset(); } { reset(); }
public void reset() protected void reset()
{ {
stacks_ = NonNullList.<ItemStack>withSize(NUM_OF_SLOTS, ItemStack.EMPTY); stacks_ = NonNullList.<ItemStack>withSize(NUM_OF_SLOTS, ItemStack.EMPTY);
proc_time_elapsed_ = 0; proc_time_elapsed_ = 0;
@ -507,7 +507,7 @@ public class BlockDecorFurnace extends BlockDecorDirected
fuel_burntime_ = getItemBurnTime(stacks_.get(SMELTING_FUEL_SLOT_NO)); fuel_burntime_ = getItemBurnTime(stacks_.get(SMELTING_FUEL_SLOT_NO));
} }
private void writenbt(NBTTagCompound compound) protected void writenbt(NBTTagCompound compound)
{ {
compound.setInteger("BurnTime", MathHelper.clamp(burntime_left_,0 , MAX_BURNTIME)); compound.setInteger("BurnTime", MathHelper.clamp(burntime_left_,0 , MAX_BURNTIME));
compound.setInteger("CookTime", MathHelper.clamp(proc_time_elapsed_, 0, MAX_BURNTIME)); compound.setInteger("CookTime", MathHelper.clamp(proc_time_elapsed_, 0, MAX_BURNTIME));
@ -652,68 +652,6 @@ public class BlockDecorFurnace extends BlockDecorDirected
public void clear() public void clear()
{ stacks_.clear(); } { stacks_.clear(); }
@Override
public void update()
{
if(--tick_timer_ > 0) return;
tick_timer_ = TICK_INTERVAL;
final boolean was_burning = isBurning();
if(was_burning) burntime_left_ -= TICK_INTERVAL;
if(burntime_left_ < 0) burntime_left_ = 0;
if(world.isRemote) return;
boolean dirty = false;
if(--fifo_timer_ <= 0) {
fifo_timer_ = FIFO_INTERVAL/TICK_INTERVAL;
// note, intentionally not using bitwise OR piping.
if(transferItems(FIFO_OUTPUT_0_SLOT_NO, FIFO_OUTPUT_1_SLOT_NO, 1)) dirty = true;
if(transferItems(SMELTING_OUTPUT_SLOT_NO, FIFO_OUTPUT_0_SLOT_NO, 1)) dirty = true;
if(transferItems(FIFO_FUEL_0_SLOT_NO, SMELTING_FUEL_SLOT_NO, 1)) dirty = true;
if(transferItems(FIFO_FUEL_1_SLOT_NO, FIFO_FUEL_0_SLOT_NO, 1)) dirty = true;
if(transferItems(FIFO_INPUT_0_SLOT_NO, SMELTING_INPUT_SLOT_NO, 1)) dirty = true;
if(transferItems(FIFO_INPUT_1_SLOT_NO, FIFO_INPUT_0_SLOT_NO, 1)) dirty = true;
heater_inserted_ = (ExtItems.IE_EXTERNAL_HEATER==null) // without IE always allow electrical boost
|| (stacks_.get(AUX_0_SLOT_NO).getItem()==ExtItems.IE_EXTERNAL_HEATER)
|| (stacks_.get(AUX_1_SLOT_NO).getItem()==ExtItems.IE_EXTERNAL_HEATER);
}
ItemStack fuel = stacks_.get(SMELTING_FUEL_SLOT_NO);
if(isBurning() || (!fuel.isEmpty()) && (!(stacks_.get(SMELTING_INPUT_SLOT_NO)).isEmpty())) {
if(!isBurning() && canSmelt()) {
burntime_left_ = (int)MathHelper.clamp((proc_fuel_efficiency_ * getItemBurnTime(fuel)), 0, MAX_BURNTIME);
fuel_burntime_ = (burntime_left_ * proc_speed_interval_) / VANILLA_FURNACE_SPEED_INTERVAL;
if(isBurning()) {
dirty = true;
if(!fuel.isEmpty()) {
Item fuel_item = fuel.getItem();
fuel.shrink(1);
if(fuel.isEmpty()) stacks_.set(SMELTING_FUEL_SLOT_NO, fuel_item.getContainerItem(fuel));
}
}
}
if(isBurning() && canSmelt()) {
proc_time_elapsed_ += TICK_INTERVAL;
if(heater_inserted_ && (boost_energy_ >= boost_energy_consumption)) { boost_energy_ = 0; proc_time_elapsed_ += TICK_INTERVAL; }
if(proc_time_elapsed_ >= proc_time_needed_) {
proc_time_elapsed_ = 0;
proc_time_needed_ = getCookTime(stacks_.get(SMELTING_INPUT_SLOT_NO));
smeltItem();
dirty = true;
}
} else {
proc_time_elapsed_ = 0;
}
} else if(!isBurning() && (proc_time_elapsed_ > 0)) {
proc_time_elapsed_ = MathHelper.clamp(proc_time_elapsed_-2, 0, proc_time_needed_);
}
if(was_burning != isBurning()) {
dirty = true;
final IBlockState state = world.getBlockState(pos);
if(state.getBlock() instanceof BlockDecorFurnace) {
world.setBlockState(pos, state.withProperty(LIT, isBurning()));
}
}
if(dirty) markDirty();
}
public boolean isBurning() public boolean isBurning()
{ return burntime_left_ > 0; } { return burntime_left_ > 0; }
@ -754,7 +692,7 @@ public class BlockDecorFurnace extends BlockDecorDirected
return changed; return changed;
} }
private boolean canSmelt() protected boolean canSmelt()
{ {
if(stacks_.get(SMELTING_INPUT_SLOT_NO).isEmpty()) return false; if(stacks_.get(SMELTING_INPUT_SLOT_NO).isEmpty()) return false;
final ItemStack recipe_result_items = BRecipes.instance().getSmeltingResult(stacks_.get(SMELTING_INPUT_SLOT_NO)); final ItemStack recipe_result_items = BRecipes.instance().getSmeltingResult(stacks_.get(SMELTING_INPUT_SLOT_NO));
@ -772,7 +710,6 @@ public class BlockDecorFurnace extends BlockDecorDirected
final ItemStack smelting_input_stack = stacks_.get(SMELTING_INPUT_SLOT_NO); final ItemStack smelting_input_stack = stacks_.get(SMELTING_INPUT_SLOT_NO);
final ItemStack recipe_result_items = BRecipes.instance().getSmeltingResult(smelting_input_stack); final ItemStack recipe_result_items = BRecipes.instance().getSmeltingResult(smelting_input_stack);
final ItemStack smelting_output_stack = stacks_.get(SMELTING_OUTPUT_SLOT_NO); final ItemStack smelting_output_stack = stacks_.get(SMELTING_OUTPUT_SLOT_NO);
final ItemStack fuel_stack = stacks_.get(SMELTING_FUEL_SLOT_NO);
if(smelting_output_stack.isEmpty()) { if(smelting_output_stack.isEmpty()) {
stacks_.set(SMELTING_OUTPUT_SLOT_NO, recipe_result_items.copy()); stacks_.set(SMELTING_OUTPUT_SLOT_NO, recipe_result_items.copy());
} else if(smelting_output_stack.getItem() == recipe_result_items.getItem()) { } else if(smelting_output_stack.getItem() == recipe_result_items.getItem()) {
@ -853,6 +790,70 @@ public class BlockDecorFurnace extends BlockDecorDirected
return super.getCapability(capability, facing); return super.getCapability(capability, facing);
} }
} }
// ITickable ------------------------------------------------------------------------------------
@Override
public void update()
{
if(--tick_timer_ > 0) return;
tick_timer_ = TICK_INTERVAL;
final boolean was_burning = isBurning();
if(was_burning) burntime_left_ -= TICK_INTERVAL;
if(burntime_left_ < 0) burntime_left_ = 0;
if(world.isRemote) return;
boolean dirty = false;
if(--fifo_timer_ <= 0) {
fifo_timer_ = FIFO_INTERVAL/TICK_INTERVAL;
// note, intentionally not using bitwise OR piping.
if(transferItems(FIFO_OUTPUT_0_SLOT_NO, FIFO_OUTPUT_1_SLOT_NO, 1)) dirty = true;
if(transferItems(SMELTING_OUTPUT_SLOT_NO, FIFO_OUTPUT_0_SLOT_NO, 1)) dirty = true;
if(transferItems(FIFO_FUEL_0_SLOT_NO, SMELTING_FUEL_SLOT_NO, 1)) dirty = true;
if(transferItems(FIFO_FUEL_1_SLOT_NO, FIFO_FUEL_0_SLOT_NO, 1)) dirty = true;
if(transferItems(FIFO_INPUT_0_SLOT_NO, SMELTING_INPUT_SLOT_NO, 1)) dirty = true;
if(transferItems(FIFO_INPUT_1_SLOT_NO, FIFO_INPUT_0_SLOT_NO, 1)) dirty = true;
heater_inserted_ = (ExtItems.IE_EXTERNAL_HEATER==null) // without IE always allow electrical boost
|| (stacks_.get(AUX_0_SLOT_NO).getItem()==ExtItems.IE_EXTERNAL_HEATER)
|| (stacks_.get(AUX_1_SLOT_NO).getItem()==ExtItems.IE_EXTERNAL_HEATER);
}
ItemStack fuel = stacks_.get(SMELTING_FUEL_SLOT_NO);
if(isBurning() || (!fuel.isEmpty()) && (!(stacks_.get(SMELTING_INPUT_SLOT_NO)).isEmpty())) {
if(!isBurning() && canSmelt()) {
burntime_left_ = (int)MathHelper.clamp((proc_fuel_efficiency_ * getItemBurnTime(fuel)), 0, MAX_BURNTIME);
fuel_burntime_ = (burntime_left_ * proc_speed_interval_) / VANILLA_FURNACE_SPEED_INTERVAL;
if(isBurning()) {
dirty = true;
if(!fuel.isEmpty()) {
Item fuel_item = fuel.getItem();
fuel.shrink(1);
if(fuel.isEmpty()) stacks_.set(SMELTING_FUEL_SLOT_NO, fuel_item.getContainerItem(fuel));
}
}
}
if(isBurning() && canSmelt()) {
proc_time_elapsed_ += TICK_INTERVAL;
if(heater_inserted_ && (boost_energy_ >= boost_energy_consumption)) { boost_energy_ = 0; proc_time_elapsed_ += TICK_INTERVAL; }
if(proc_time_elapsed_ >= proc_time_needed_) {
proc_time_elapsed_ = 0;
proc_time_needed_ = getCookTime(stacks_.get(SMELTING_INPUT_SLOT_NO));
smeltItem();
dirty = true;
}
} else {
proc_time_elapsed_ = 0;
}
} else if(!isBurning() && (proc_time_elapsed_ > 0)) {
proc_time_elapsed_ = MathHelper.clamp(proc_time_elapsed_-2, 0, proc_time_needed_);
}
if(was_burning != isBurning()) {
dirty = true;
final IBlockState state = world.getBlockState(pos);
if(state.getBlock() instanceof BlockDecorFurnace) {
world.setBlockState(pos, state.withProperty(LIT, isBurning()));
}
}
if(dirty) markDirty();
}
} }
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------

View file

@ -0,0 +1,683 @@
/*
* @file BlockDecorFurnaceElectrical.java
* @author Stefan Wilhelm (wile)
* @copyright (C) 2019 Stefan Wilhelm
* @license MIT (see https://opensource.org/licenses/MIT)
*
* ED electrical furnace.
*/
package wile.engineersdecor.blocks;
import wile.engineersdecor.ModEngineersDecor;
import net.minecraft.stats.StatList;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.world.World;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.init.Items;
import net.minecraft.item.*;
import net.minecraft.inventory.*;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.*;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.energy.CapabilityEnergy;
import net.minecraftforge.energy.IEnergyStorage;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.ItemHandlerHelper;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.Random;
public class BlockDecorFurnaceElectrical extends BlockDecorFurnace
{
public BlockDecorFurnaceElectrical(@Nonnull String registryName, long config, @Nullable Material material, float hardness, float resistance, @Nullable SoundType sound, @Nonnull AxisAlignedBB unrotatedAABB)
{
super(registryName, config, material, hardness, resistance, sound, unrotatedAABB);
}
@Nullable
public TileEntity createTileEntity(World world, IBlockState state)
{ return new BlockDecorFurnaceElectrical.BTileEntity(); }
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
{
if(world.isRemote) return true;
player.openGui(ModEngineersDecor.instance, ModEngineersDecor.GuiHandler.GUIID_ELECTRICAL_LAB_FURNACE, world, pos.getX(), pos.getY(), pos.getZ());
player.addStat(StatList.FURNACE_INTERACTION);
return true;
}
@Override
@SideOnly(Side.CLIENT)
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rnd)
{}
//--------------------------------------------------------------------------------------------------------------------
// ModEngineersDecor.GuiHandler connectors
//--------------------------------------------------------------------------------------------------------------------
public static Object getServerGuiElement(final EntityPlayer player, final World world, final BlockPos pos, final TileEntity te)
{ return (te instanceof BTileEntity) ? (new BContainer(player.inventory, world, pos, (BTileEntity)te)) : null; }
public static Object getClientGuiElement(final EntityPlayer player, final World world, final BlockPos pos, final TileEntity te)
{ return (te instanceof BTileEntity) ? (new BGui(player.inventory, world, pos, (BTileEntity)te)) : null; }
//--------------------------------------------------------------------------------------------------------------------
// GUI
//--------------------------------------------------------------------------------------------------------------------
@SideOnly(Side.CLIENT)
private static class BGui extends GuiContainer
{
private final BTileEntity te;
public BGui(InventoryPlayer playerInventory, World world, BlockPos pos, BTileEntity te)
{ super(new BContainer(playerInventory, world, pos, te)); this.te = te; }
@Override
public void initGui()
{ super.initGui(); }
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks)
{
drawDefaultBackground();
super.drawScreen(mouseX, mouseY, partialTicks);
renderHoveredToolTip(mouseX, mouseY);
}
@Override
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY)
{
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
mc.getTextureManager().bindTexture(new ResourceLocation(ModEngineersDecor.MODID, "textures/gui/small_electrical_furnace_gui.png"));
final int x0=(width-xSize)/2, y0=(height-ySize)/2, w=xSize, h=ySize;
drawTexturedModalRect(x0, y0, 0, 0, w, h);
if(BTileEntity.isBurning(te)) {
if(BlockDecorFurnace.BTileEntity.isBurning(te)) {
final int hi = 13;
final int k = heat_px(hi);
drawTexturedModalRect(x0+61, y0+53+hi-k, 177, hi-k, 13, k);
}
}
drawTexturedModalRect(x0+79, y0+30, 176, 15, 1+progress_px(17), 15);
int we = energy_px(32, 8);
if(we>0) drawTexturedModalRect(x0+88, y0+53, 185, 30, we, 13);
}
private int progress_px(int pixels)
{ final int tc=te.getField(2), T=te.getField(3); return ((T>0) && (tc>0)) ? (tc * pixels / T) : (0); }
private int heat_px(int pixels)
{
int k = ((te.getField(0) * (pixels+1)) / (BlockDecorFurnaceElectrical.BTileEntity.HEAT_CAPACITY));
return (k < pixels) ? k : pixels;
}
private int energy_px(int maxwidth, int quantization)
{
int k = ((maxwidth * te.getField(1) * 9) / 8) / (te.getMaxEnergyStored()+1);
k = (k >= maxwidth-2) ? maxwidth : k;
if(quantization > 0) k = ((k+(quantization/2))/quantization) * quantization;
return k;
}
}
//--------------------------------------------------------------------------------------------------------------------
// container
//--------------------------------------------------------------------------------------------------------------------
public static class BContainer extends Container
{
private static final int PLAYER_INV_START_SLOTNO = 7;
private final World world;
private final BlockPos pos;
private final EntityPlayer player;
private final BTileEntity te;
private int burntime_left_, energy_stored_, proc_time_elapsed_, proc_time_needed_, speed_;
public BContainer(InventoryPlayer playerInventory, World world, BlockPos pos, BTileEntity te)
{
this.player = playerInventory.player;
this.world = world;
this.pos = pos;
this.te = te;
addSlotToContainer(new Slot(te, 0, 59, 28)); // smelting input
addSlotToContainer(new Slot(te, 1, 16, 52)); // aux
addSlotToContainer(new BSlotResult(playerInventory.player, te, 2, 101, 28)); // smelting result
addSlotToContainer(new BSlotInpFifo(te, 3, 34, 28)); // input fifo 0
addSlotToContainer(new BSlotInpFifo(te, 4, 16, 28)); // input fifo 1
addSlotToContainer(new BSlotOutFifo(playerInventory.player, te, 5, 126, 28)); // out fifo 0
addSlotToContainer(new BSlotOutFifo(playerInventory.player, te, 6, 144, 28)); // out fifo 1
for(int x=0; x<9; ++x) {
addSlotToContainer(new Slot(playerInventory, x, 8+x*18, 144)); // player slots: 0..8
}
for(int y=0; y<3; ++y) {
for(int x=0; x<9; ++x) {
addSlotToContainer(new Slot(playerInventory, x+y*9+9, 8+x*18, 86+y*18)); // player slots: 9..35
}
}
}
@Override
public void addListener(IContainerListener listener)
{ super.addListener(listener); listener.sendAllWindowProperties(this, te); }
@Override
public void detectAndSendChanges()
{
super.detectAndSendChanges();
for(int i=0; i<listeners.size(); ++i) {
IContainerListener lis = listeners.get(i);
if(burntime_left_ != te.getField(0)) lis.sendWindowProperty(this, 0, te.getField(0));
if(energy_stored_ != te.getField(1)) lis.sendWindowProperty(this, 1, te.getField(1));
if(proc_time_elapsed_ != te.getField(2)) lis.sendWindowProperty(this, 2, te.getField(2));
if(proc_time_needed_ != te.getField(3)) lis.sendWindowProperty(this, 3, te.getField(3));
if(speed_ != te.getField(4)) lis.sendWindowProperty(this, 4, te.getField(4));
}
burntime_left_ = te.getField(0);
energy_stored_ = te.getField(1);
proc_time_elapsed_ = te.getField(2);
proc_time_needed_ = te.getField(3);
speed_ = te.getField(4);
}
@Override
@SideOnly(Side.CLIENT)
public void updateProgressBar(int id, int data)
{ te.setField(id, data); }
@Override
public boolean canInteractWith(EntityPlayer player)
{ return (world.getBlockState(pos).getBlock() instanceof BlockDecorFurnaceElectrical) && (player.getDistanceSq(pos) <= 64); }
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int index)
{
Slot slot = inventorySlots.get(index);
if((slot==null) || (!slot.getHasStack())) return ItemStack.EMPTY;
ItemStack slot_stack = slot.getStack();
ItemStack transferred = slot_stack.copy();
if((index==2) || (index==5) || (index==6)) {
// Output slots
if(!mergeItemStack(slot_stack, PLAYER_INV_START_SLOTNO, PLAYER_INV_START_SLOTNO+36, true)) return ItemStack.EMPTY;
slot.onSlotChange(slot_stack, transferred);
} else if((index==0) || (index==3) || (index==4)) {
// Input slots
if(!mergeItemStack(slot_stack, PLAYER_INV_START_SLOTNO, PLAYER_INV_START_SLOTNO+36, false)) return ItemStack.EMPTY;
} else if(index==1) {
// Bypass slot
if(!mergeItemStack(slot_stack, PLAYER_INV_START_SLOTNO, PLAYER_INV_START_SLOTNO+36, false)) return ItemStack.EMPTY;
} else if((index >= PLAYER_INV_START_SLOTNO) && (index <= PLAYER_INV_START_SLOTNO+36)) {
// Player inventory
if(!BRecipes.instance().getSmeltingResult(slot_stack).isEmpty()) {
if(
(!mergeItemStack(slot_stack, 0, 1, false)) && // smelting input
(!mergeItemStack(slot_stack, 3, 4, false)) && // fifo0
(!mergeItemStack(slot_stack, 4, 5, false)) // fifo1
) return ItemStack.EMPTY;
} else if((index >= PLAYER_INV_START_SLOTNO) && (index < PLAYER_INV_START_SLOTNO+27)) {
// player inventory --> player hotbar
if(!mergeItemStack(slot_stack, PLAYER_INV_START_SLOTNO+27, PLAYER_INV_START_SLOTNO+36, false)) return ItemStack.EMPTY;
} else if((index >= PLAYER_INV_START_SLOTNO+27) && (index < PLAYER_INV_START_SLOTNO+36) && (!mergeItemStack(slot_stack, PLAYER_INV_START_SLOTNO, PLAYER_INV_START_SLOTNO+27, false))) {
// player hotbar --> player inventory
return ItemStack.EMPTY;
}
} else {
// invalid slot
return ItemStack.EMPTY;
}
if(slot_stack.isEmpty()) {
slot.putStack(ItemStack.EMPTY);
} else {
slot.onSlotChanged();
}
if(slot_stack.getCount() == transferred.getCount()) return ItemStack.EMPTY;
slot.onTake(player, slot_stack);
return transferred;
}
}
//--------------------------------------------------------------------------------------------------------------------
// Tile entity
//--------------------------------------------------------------------------------------------------------------------
public static class BTileEntity extends BlockDecorFurnace.BTileEntity implements ITickable, ISidedInventory, IEnergyStorage, IItemHandler
{
public static final int TICK_INTERVAL = 4;
public static final int FIFO_INTERVAL = 20;
public static final int HEAT_CAPACITY = 200;
public static final int HEAT_INCREMENT = 20;
public static final int MAX_ENERGY_TRANSFER = 256;
public static final int MAX_ENERGY_BUFFER = 32000;
public static final int MAX_SPEED_SETTING = 2;
public static final int NUM_OF_SLOTS = 7;
public static final int SMELTING_INPUT_SLOT_NO = 0;
public static final int SMELTING_AUX_SLOT_NO = 1;
public static final int SMELTING_OUTPUT_SLOT_NO = 2;
public static final int FIFO_INPUT_0_SLOT_NO = 3;
public static final int FIFO_INPUT_1_SLOT_NO = 4;
public static final int FIFO_OUTPUT_0_SLOT_NO = 5;
public static final int FIFO_OUTPUT_1_SLOT_NO = 6;
public static final int DEFAULT_SPEED_PERCENT = 200;
public static final int DEFAULT_ENERGY_CONSUMPTION = 16 ;
public static final int DEFAULT_SCALED_ENERGY_CONSUMPTION = DEFAULT_ENERGY_CONSUMPTION * HEAT_INCREMENT * DEFAULT_SPEED_PERCENT/100;
private static int energy_consumption_ = DEFAULT_SCALED_ENERGY_CONSUMPTION;
private static int transfer_energy_consumption_ = DEFAULT_SCALED_ENERGY_CONSUMPTION/8;
private static int proc_speed_percent_ = DEFAULT_SPEED_PERCENT;
private int burntime_left_;
private int proc_time_elapsed_;
private int proc_time_needed_;
private int energy_stored_;
private int speed_;
private int tick_timer_;
private int fifo_timer_;
public static void on_config(int speed_percent, int standard_energy_per_tick)
{
proc_speed_percent_ = MathHelper.clamp(speed_percent, 10, 500);
energy_consumption_ = MathHelper.clamp(standard_energy_per_tick, 10, 256) * HEAT_INCREMENT * proc_speed_percent_ / 100;
transfer_energy_consumption_ = MathHelper.clamp(energy_consumption_/8, 8, HEAT_INCREMENT);
ModEngineersDecor.logger.info("Config electrical furnace speed:" + proc_speed_percent_ + ", power consumption:" + energy_consumption_);
}
public BTileEntity()
{ super(); reset(); }
public void reset()
{
stacks_ = NonNullList.<ItemStack>withSize(NUM_OF_SLOTS, ItemStack.EMPTY);
burntime_left_ = 0;
proc_time_elapsed_ = 0;
proc_time_needed_ = 0;
fifo_timer_ = 0;
tick_timer_ = 0;
energy_stored_= 0;
speed_ = 0;
}
public void readnbt(NBTTagCompound compound)
{
reset();
ItemStackHelper.loadAllItems(compound, this.stacks_);
while(this.stacks_.size() < NUM_OF_SLOTS) this.stacks_.add(ItemStack.EMPTY);
burntime_left_ = compound.getInteger("BurnTime");
proc_time_elapsed_ = compound.getInteger("CookTime");
proc_time_needed_ = compound.getInteger("CookTimeTotal");
energy_stored_ = compound.getInteger("Energy");
speed_ = compound.getInteger("SpeedSetting");
}
protected void writenbt(NBTTagCompound compound)
{
compound.setInteger("BurnTime", MathHelper.clamp(burntime_left_,0 , HEAT_CAPACITY));
compound.setInteger("CookTime", MathHelper.clamp(proc_time_elapsed_, 0, MAX_BURNTIME));
compound.setInteger("CookTimeTotal", MathHelper.clamp(proc_time_needed_, 0, MAX_BURNTIME));
compound.setInteger("Energy", MathHelper.clamp(energy_stored_,0 , MAX_ENERGY_BUFFER));
compound.setInteger("SpeedSetting", MathHelper.clamp(speed_, -1, MAX_SPEED_SETTING));
ItemStackHelper.saveAllItems(compound, stacks_);
}
// TileEntity ------------------------------------------------------------------------------
// IWorldNamable ---------------------------------------------------------------------------
// IInventory ------------------------------------------------------------------------------
@Override
public boolean isItemValidForSlot(int index, ItemStack stack)
{
switch(index) {
case SMELTING_INPUT_SLOT_NO:
case FIFO_INPUT_0_SLOT_NO:
case FIFO_INPUT_1_SLOT_NO:
return true;
default:
return false;
}
}
@Override
public int getField(int id)
{
switch (id) {
case 0: return burntime_left_;
case 1: return energy_stored_;
case 2: return proc_time_elapsed_;
case 3: return proc_time_needed_;
case 4: return speed_;
default: return 0;
}
}
@Override
public void setField(int id, int value)
{
switch(id) {
case 0: burntime_left_ = value; break;
case 1: energy_stored_ = value; break;
case 2: proc_time_elapsed_ = value; break;
case 3: proc_time_needed_ = value; break;
case 4: speed_ = value; break;
}
}
@Override
public int getFieldCount()
{ return 7; }
public boolean isBurning()
{ return burntime_left_ > 0; }
private boolean transferItems(final int index_from, final int index_to, int count)
{
ItemStack from = stacks_.get(index_from);
if(from.isEmpty()) return false;
ItemStack to = stacks_.get(index_to);
if(from.getCount() < count) count = from.getCount();
if(count <= 0) return false;
boolean changed = true;
if(to.isEmpty()) {
stacks_.set(index_to, from.splitStack(count));
} else if(to.getCount() >= to.getMaxStackSize()) {
changed = false;
} else if((!from.isItemEqual(to)) || (!ItemStack.areItemStackTagsEqual(from, to))) {
changed = false;
} else {
if((to.getCount()+count) >= to.getMaxStackSize()) {
from.shrink(to.getMaxStackSize()-to.getCount());
to.setCount(to.getMaxStackSize());
} else {
from.shrink(count);
to.grow(count);
}
}
if(from.isEmpty() && from!=ItemStack.EMPTY) {
stacks_.set(index_from, ItemStack.EMPTY);
changed = true;
}
return changed;
}
// ISidedInventory ----------------------------------------------------------------------------
private static final int[] SIDED_INV_SLOTS = new int[] {
SMELTING_INPUT_SLOT_NO, SMELTING_AUX_SLOT_NO, SMELTING_OUTPUT_SLOT_NO,
FIFO_INPUT_0_SLOT_NO, FIFO_INPUT_1_SLOT_NO, FIFO_OUTPUT_0_SLOT_NO, FIFO_OUTPUT_1_SLOT_NO
};
@Override
public int[] getSlotsForFace(EnumFacing side)
{ return SIDED_INV_SLOTS; }
@Override
public boolean canInsertItem(int index, ItemStack itemStackIn, EnumFacing direction)
{ return isItemValidForSlot(index, itemStackIn); }
@Override
public boolean canExtractItem(int index, ItemStack stack, EnumFacing direction)
{ return ((index!=SMELTING_INPUT_SLOT_NO) && (index!=FIFO_INPUT_0_SLOT_NO) && (index!=FIFO_INPUT_1_SLOT_NO)) || (stack.getItem()==Items.BUCKET); }
// IEnergyStorage ----------------------------------------------------------------------------
public boolean canExtract()
{ return false; }
public boolean canReceive()
{ return true; }
public int getMaxEnergyStored()
{ return MAX_ENERGY_BUFFER; }
public int getEnergyStored()
{ return energy_stored_; }
public int extractEnergy(int maxExtract, boolean simulate)
{ return 0; }
public int receiveEnergy(int maxReceive, boolean simulate)
{
if(energy_stored_ >= MAX_ENERGY_BUFFER) return 0;
int n = Math.min(maxReceive, (MAX_ENERGY_BUFFER - energy_stored_));
if(n > MAX_ENERGY_TRANSFER) n = MAX_ENERGY_TRANSFER;
if(!simulate) {energy_stored_ += n; markDirty(); }
return n;
}
// IItemHandler --------------------------------------------------------------------------------
@Override
public int getSlots()
{ return SIDED_INV_SLOTS.length; }
@Override
@Nonnull
public ItemStack getStackInSlot(int index)
{ return ((index < 0) || (index >= SIDED_INV_SLOTS.length)) ? ItemStack.EMPTY : stacks_.get(SIDED_INV_SLOTS[index]); }
@Override
public int getSlotLimit(int index)
{ return getInventoryStackLimit(); }
@Override
public boolean isItemValid(int slot, @Nonnull ItemStack stack)
{ return true; }
@Override
@Nonnull
public ItemStack insertItem(int index, @Nonnull ItemStack stack, boolean simulate)
{
if(stack.isEmpty()) return ItemStack.EMPTY;
if((index < 0) || (index >= SIDED_INV_SLOTS.length)) return ItemStack.EMPTY;
int slotno = SIDED_INV_SLOTS[index];
ItemStack slotstack = getStackInSlot(slotno);
if(!slotstack.isEmpty())
{
if(slotstack.getCount() >= Math.min(slotstack.getMaxStackSize(), getSlotLimit(index))) return stack;
if(!ItemHandlerHelper.canItemStacksStack(stack, slotstack)) return stack;
if(!canInsertItem(slotno, stack, EnumFacing.UP) || (!isItemValidForSlot(slotno, stack))) return stack;
int n = Math.min(stack.getMaxStackSize(), getSlotLimit(index)) - slotstack.getCount();
if(stack.getCount() <= n) {
if(!simulate) {
ItemStack copy = stack.copy();
copy.grow(slotstack.getCount());
setInventorySlotContents(slotno, copy);
}
return ItemStack.EMPTY;
} else {
stack = stack.copy();
if(!simulate) {
ItemStack copy = stack.splitStack(n);
copy.grow(slotstack.getCount());
setInventorySlotContents(slotno, copy);
return stack;
} else {
stack.shrink(n);
return stack;
}
}
} else {
if(!canInsertItem(slotno, stack, EnumFacing.UP) || (!isItemValidForSlot(slotno, stack))) return stack;
int n = Math.min(stack.getMaxStackSize(), getSlotLimit(index));
if(n < stack.getCount()) {
stack = stack.copy();
if(!simulate) {
setInventorySlotContents(slotno, stack.splitStack(n));
return stack;
} else {
stack.shrink(n);
return stack;
}
} else {
if(!simulate) setInventorySlotContents(slotno, stack);
return ItemStack.EMPTY;
}
}
}
@Override
@Nonnull
public ItemStack extractItem(int index, int amount, boolean simulate)
{
if(amount == 0) return ItemStack.EMPTY;
if((index < 0) || (index >= SIDED_INV_SLOTS.length)) return ItemStack.EMPTY;
int slotno = SIDED_INV_SLOTS[index];
ItemStack stackInSlot = getStackInSlot(slotno);
if(stackInSlot.isEmpty()) return ItemStack.EMPTY;
if(!canExtractItem(slotno, stackInSlot, EnumFacing.DOWN)) return ItemStack.EMPTY;
if(simulate) {
if(stackInSlot.getCount() < amount) return stackInSlot.copy();
ItemStack ostack = stackInSlot.copy();
ostack.setCount(amount);
return ostack;
} else {
ItemStack ostack = decrStackSize(slotno, Math.min(stackInSlot.getCount(), amount));
markDirty();
return ostack;
}
}
// Capability export ----------------------------------------------------------------------------
@Override
public boolean hasCapability(Capability<?> cap, EnumFacing facing)
{ return ((cap==CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) || (cap==CapabilityEnergy.ENERGY)) || super.hasCapability(cap, facing); }
@Override
@SuppressWarnings("unchecked")
@Nullable
public <T> T getCapability(Capability<T> capability, @Nullable EnumFacing facing)
{
if((capability == CapabilityEnergy.ENERGY) || (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY)) {
return ((T)this);
} else {
return super.getCapability(capability, facing);
}
}
// ITickable ------------------------------------------------------------------------------------
private boolean adjacent_inventory_shift(boolean inp, boolean out)
{
boolean dirty = false;
if(energy_stored_ < transfer_energy_consumption_) return false;
final IBlockState state = world.getBlockState(pos);
if(!(state.getBlock() instanceof BlockDecorFurnaceElectrical)) return false;
final EnumFacing out_facing = state.getValue(FACING);
final EnumFacing inp_facing = state.getValue(FACING).getOpposite();
if(out && (!stacks_.get(FIFO_OUTPUT_1_SLOT_NO).isEmpty())) {
TileEntity te = world.getTileEntity(pos.offset(out_facing));
if((te!=null) && (te.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, inp_facing))) {
IItemHandler hnd = te.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, inp_facing);
ItemStack remaining = ItemHandlerHelper.insertItemStacked(hnd, stacks_.get(FIFO_OUTPUT_1_SLOT_NO).copy(), false);
stacks_.set(FIFO_OUTPUT_1_SLOT_NO, remaining);
energy_stored_ -= transfer_energy_consumption_;
dirty = true;
}
}
if(inp && (stacks_.get(FIFO_INPUT_1_SLOT_NO).isEmpty())) {
TileEntity te = world.getTileEntity(pos.offset(inp_facing));
if((te!=null) && (te.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, out_facing))) {
IItemHandler hnd = te.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, out_facing);
for(int i=0; i< hnd.getSlots(); ++i) {
ItemStack adj_stack = hnd.getStackInSlot(i);
if(!adj_stack.isEmpty()) {
ItemStack my_stack = adj_stack.copy();
if(my_stack.getCount() > getInventoryStackLimit()) my_stack.setCount(getInventoryStackLimit());
adj_stack.shrink(my_stack.getCount());
stacks_.set(FIFO_INPUT_1_SLOT_NO, my_stack);
energy_stored_ -= transfer_energy_consumption_;
dirty = true;
break;
}
}
}
}
return dirty;
}
// returns TE dirty
private boolean heat_up()
{
if(energy_stored_ < (energy_consumption_)) return false;
if(burntime_left_ >= (HEAT_CAPACITY-HEAT_INCREMENT)) return false;
energy_stored_ -= energy_consumption_;
burntime_left_ += HEAT_INCREMENT;
this.markDirty();
return true;
}
@Override
public void update()
{
if(--tick_timer_ > 0) return;
tick_timer_ = TICK_INTERVAL;
final boolean was_burning = isBurning();
if(was_burning) burntime_left_ -= TICK_INTERVAL;
if(burntime_left_ < 0) burntime_left_ = 0;
if(world.isRemote) return;
boolean dirty = false;
boolean shift_in = false;
boolean shift_out = false;
if(--fifo_timer_ <= 0) {
fifo_timer_ = FIFO_INTERVAL/TICK_INTERVAL;
if(transferItems(FIFO_OUTPUT_0_SLOT_NO, FIFO_OUTPUT_1_SLOT_NO, 64)) { dirty = true; } else { shift_out = true; }
if(transferItems(SMELTING_OUTPUT_SLOT_NO, FIFO_OUTPUT_0_SLOT_NO, 64)) dirty = true;
if(transferItems(FIFO_INPUT_0_SLOT_NO, SMELTING_INPUT_SLOT_NO, 64)) dirty = true;
if(transferItems(FIFO_INPUT_1_SLOT_NO, FIFO_INPUT_0_SLOT_NO, 64)) { dirty = true; } else { shift_in = true; }
}
if((!(stacks_.get(SMELTING_INPUT_SLOT_NO)).isEmpty()) && (energy_stored_ >= energy_consumption_)) {
final boolean can_smelt = canSmelt();
if((!can_smelt) && (BRecipes.instance().getSmeltingResult(stacks_.get(SMELTING_INPUT_SLOT_NO)).isEmpty())) {
// bypass
if(transferItems(SMELTING_INPUT_SLOT_NO, SMELTING_OUTPUT_SLOT_NO, 1)) dirty = true;
} else {
// smelt
if(!isBurning() && can_smelt) {
if(heat_up()) dirty = true;
}
if(isBurning() && can_smelt) {
if(heat_up()) dirty = true;
proc_time_elapsed_ += (TICK_INTERVAL * proc_speed_percent_/100);
if(proc_time_elapsed_ >= proc_time_needed_) {
proc_time_elapsed_ = 0;
proc_time_needed_ = getCookTime(stacks_.get(SMELTING_INPUT_SLOT_NO));
smeltItem();
dirty = true;
shift_out = true;
}
} else {
proc_time_elapsed_ = 0;
}
}
} else if(proc_time_elapsed_ > 0) {
proc_time_elapsed_ -= ((stacks_.get(SMELTING_INPUT_SLOT_NO)).isEmpty() ? 20 : 1);
if(proc_time_elapsed_ < 0) { proc_time_elapsed_ = 0; shift_out = true; }
}
if(was_burning != isBurning()) {
dirty = true;
final IBlockState state = world.getBlockState(pos);
if(state.getBlock() instanceof BlockDecorFurnace) {
world.setBlockState(pos, state.withProperty(LIT, isBurning()));
}
}
if(adjacent_inventory_shift(shift_in, shift_out)) dirty = true;
if(dirty) markDirty();
}
}
}

View file

@ -163,21 +163,28 @@ public class ModBlocks
public static final BlockDecorFurnace SMALL_LAB_FURNACE = new BlockDecorFurnace( public static final BlockDecorFurnace SMALL_LAB_FURNACE = new BlockDecorFurnace(
"small_lab_furnace", "small_lab_furnace",
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_HORIZIONTAL|BlockDecor.CFG_LOOK_PLACEMENT|BlockDecor.CFG_OPPOSITE_PLACEMENT, BlockDecor.CFG_CUTOUT|BlockDecor.CFG_HORIZIONTAL|BlockDecor.CFG_LOOK_PLACEMENT|BlockDecor.CFG_OPPOSITE_PLACEMENT,
Material.IRON, 1.0f, 15f, SoundType.METAL, Material.IRON, 0.35f, 15f, SoundType.METAL,
ModAuxiliaries.getPixeledAABB(1,0,1, 15,15,16.0) ModAuxiliaries.getPixeledAABB(1,0,1, 15,15,16)
);
public static final BlockDecorFurnaceElectrical SMALL_ELECTRICAL_FURNACE = new BlockDecorFurnaceElectrical(
"small_electrical_furnace",
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_HORIZIONTAL|BlockDecor.CFG_LOOK_PLACEMENT,
Material.IRON, 0.35f, 15f, SoundType.METAL,
ModAuxiliaries.getPixeledAABB(0,0,0, 16,16,16)
); );
public static final BlockDecorDirected SIGN_MODLOGO = new BlockDecorDirected( public static final BlockDecorDirected SIGN_MODLOGO = new BlockDecorDirected(
"sign_decor", "sign_decor",
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_OPPOSITE_PLACEMENT|(1<<BlockDecor.CFG_LIGHT_VALUE_SHIFT), BlockDecor.CFG_CUTOUT|BlockDecor.CFG_OPPOSITE_PLACEMENT|(1<<BlockDecor.CFG_LIGHT_VALUE_SHIFT),
Material.WOOD, 0.1f, 1000f, SoundType.WOOD, Material.WOOD, 0.1f, 1000f, SoundType.WOOD,
ModAuxiliaries.getPixeledAABB(0,0,15.6, 16,16,16.0) ModAuxiliaries.getPixeledAABB(0,0,15.6, 16,16,16)
); );
public static final BlockDecorHorizontalSupport STEEL_DOUBLE_T_SUPPORT = new BlockDecorHorizontalSupport( public static final BlockDecorHorizontalSupport STEEL_DOUBLE_T_SUPPORT = new BlockDecorHorizontalSupport(
"steel_double_t_support", "steel_double_t_support",
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_HORIZIONTAL|BlockDecor.CFG_LOOK_PLACEMENT, BlockDecor.CFG_CUTOUT|BlockDecor.CFG_HORIZIONTAL|BlockDecor.CFG_LOOK_PLACEMENT,
Material.IRON, 1.0f, 15f, SoundType.METAL, Material.IRON, 0.5f, 15f, SoundType.METAL,
ModAuxiliaries.getPixeledAABB(5,11,0, 11,16,16) ModAuxiliaries.getPixeledAABB(5,11,0, 11,16,16)
); );
@ -185,7 +192,7 @@ public class ModBlocks
"straight_pipe_valve", "straight_pipe_valve",
BlockDecor.CFG_FACING_PLACEMENT|BlockDecor.CFG_OPPOSITE_PLACEMENT|BlockDecor.CFG_FLIP_PLACEMENT_SHIFTCLICK| BlockDecor.CFG_FACING_PLACEMENT|BlockDecor.CFG_OPPOSITE_PLACEMENT|BlockDecor.CFG_FLIP_PLACEMENT_SHIFTCLICK|
BlockDecor.CFG_CUTOUT, BlockDecor.CFG_CUTOUT,
Material.IRON, 0.5f, 15f, SoundType.METAL, Material.IRON, 0.35f, 15f, SoundType.METAL,
ModAuxiliaries.getPixeledAABB(4,4,0, 12,12,16) ModAuxiliaries.getPixeledAABB(4,4,0, 12,12,16)
); );
@ -193,7 +200,7 @@ public class ModBlocks
"straight_pipe_valve_redstone", "straight_pipe_valve_redstone",
BlockDecor.CFG_FACING_PLACEMENT|BlockDecor.CFG_OPPOSITE_PLACEMENT|BlockDecor.CFG_FLIP_PLACEMENT_SHIFTCLICK| BlockDecor.CFG_FACING_PLACEMENT|BlockDecor.CFG_OPPOSITE_PLACEMENT|BlockDecor.CFG_FLIP_PLACEMENT_SHIFTCLICK|
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_REDSTONE_CONTROLLED, BlockDecor.CFG_CUTOUT|BlockDecor.CFG_REDSTONE_CONTROLLED,
Material.IRON, 0.5f, 15f, SoundType.METAL, Material.IRON, 0.35f, 15f, SoundType.METAL,
ModAuxiliaries.getPixeledAABB(4,4,0, 12,12,16) ModAuxiliaries.getPixeledAABB(4,4,0, 12,12,16)
); );
@ -201,7 +208,7 @@ public class ModBlocks
"straight_pipe_valve_redstone_analog", "straight_pipe_valve_redstone_analog",
BlockDecor.CFG_FACING_PLACEMENT|BlockDecor.CFG_OPPOSITE_PLACEMENT|BlockDecor.CFG_FLIP_PLACEMENT_SHIFTCLICK| BlockDecor.CFG_FACING_PLACEMENT|BlockDecor.CFG_OPPOSITE_PLACEMENT|BlockDecor.CFG_FLIP_PLACEMENT_SHIFTCLICK|
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_REDSTONE_CONTROLLED|BlockDecor.CFG_ANALOG, BlockDecor.CFG_CUTOUT|BlockDecor.CFG_REDSTONE_CONTROLLED|BlockDecor.CFG_ANALOG,
Material.IRON, 0.5f, 15f, SoundType.METAL, Material.IRON, 0.35f, 15f, SoundType.METAL,
ModAuxiliaries.getPixeledAABB(4,4,0, 12,12,16) ModAuxiliaries.getPixeledAABB(4,4,0, 12,12,16)
); );
@ -209,7 +216,7 @@ public class ModBlocks
"passive_fluid_accumulator", "passive_fluid_accumulator",
BlockDecor.CFG_FACING_PLACEMENT|BlockDecor.CFG_OPPOSITE_PLACEMENT|BlockDecor.CFG_FLIP_PLACEMENT_SHIFTCLICK| BlockDecor.CFG_FACING_PLACEMENT|BlockDecor.CFG_OPPOSITE_PLACEMENT|BlockDecor.CFG_FLIP_PLACEMENT_SHIFTCLICK|
BlockDecor.CFG_CUTOUT, BlockDecor.CFG_CUTOUT,
Material.IRON, 0.5f, 15f, SoundType.METAL, Material.IRON, 0.35f, 15f, SoundType.METAL,
ModAuxiliaries.getPixeledAABB(0,0,0, 16,16,16) ModAuxiliaries.getPixeledAABB(0,0,0, 16,16,16)
); );
@ -230,6 +237,9 @@ public class ModBlocks
private static final TileEntityRegistrationData SMALL_LAB_FURNACE_TEI = new TileEntityRegistrationData( private static final TileEntityRegistrationData SMALL_LAB_FURNACE_TEI = new TileEntityRegistrationData(
BlockDecorFurnace.BTileEntity.class, "te_small_lab_furnace" BlockDecorFurnace.BTileEntity.class, "te_small_lab_furnace"
); );
private static final TileEntityRegistrationData SMALL_ELECTRICAL_FURNACE_TEI = new TileEntityRegistrationData(
BlockDecorFurnaceElectrical.BTileEntity.class, "te_electrical_lab_furnace"
);
private static final TileEntityRegistrationData STRAIGHT_PIPE_VALVE_TEI = new TileEntityRegistrationData( private static final TileEntityRegistrationData STRAIGHT_PIPE_VALVE_TEI = new TileEntityRegistrationData(
BlockDecorPipeValve.BTileEntity.class, "te_pipe_valve" BlockDecorPipeValve.BTileEntity.class, "te_pipe_valve"
); );
@ -279,7 +289,8 @@ public class ModBlocks
}; };
private static final Object dev_content[] = { private static final Object dev_content[] = {
PASSIVE_FLUID_ACCUMULATOR, PASSIVE_FLUID_ACCUMULATOR_TEI PASSIVE_FLUID_ACCUMULATOR, PASSIVE_FLUID_ACCUMULATOR_TEI,
SMALL_ELECTRICAL_FURNACE, SMALL_ELECTRICAL_FURNACE_TEI
}; };
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------

View file

@ -221,6 +221,25 @@ public class ModConfig
@Config.Name("Valves: Redstone slope") @Config.Name("Valves: Redstone slope")
@Config.RangeInt(min=1, max=10000) @Config.RangeInt(min=1, max=10000)
public int pipevalve_redstone_slope = 20; public int pipevalve_redstone_slope = 20;
@Config.Comment({
"Defines, in percent, how fast the electrical furnace smelts compared to " +
"a vanilla furnace. 100% means vanilla furnace speed, 150% means the " +
"electrical furnace is faster. The value can be changed on-the-fly for tuning."
})
@Config.Name("E-furnace: Smelting speed %")
@Config.RangeInt(min=50, max=500)
public int e_furnace_speed_percent = BlockDecorFurnaceElectrical.BTileEntity.DEFAULT_SPEED_PERCENT;
@Config.Comment({
"Defines how much RF per tick the the electrical furnace consumed (average) for smelting. " +
"The feeders transferring items from/to adjacent have this consumption/8 for each stack transaction. " +
"The default value is only slightly higher than a furnace with an IE external heater (and no burning fuel inside)." +
"The config value can be changed on-the-fly for tuning."
})
@Config.Name("E-furnace: Power consumption")
@Config.RangeInt(min=10, max=256)
public int e_furnace_power_consumption = BlockDecorFurnaceElectrical.BTileEntity.DEFAULT_ENERGY_CONSUMPTION;
} }
@SuppressWarnings("unused") @SuppressWarnings("unused")
@ -289,6 +308,7 @@ public class ModConfig
BlockDecorLadder.on_config(optout.without_ladder_speed_boost); BlockDecorLadder.on_config(optout.without_ladder_speed_boost);
BlockDecorCraftingTable.on_config(optout.without_crafting_table_history, false, tweaks.with_crafting_quickmove_buttons); BlockDecorCraftingTable.on_config(optout.without_crafting_table_history, false, tweaks.with_crafting_quickmove_buttons);
BlockDecorPipeValve.on_config(tweaks.pipevalve_max_flowrate, tweaks.pipevalve_redstone_slope); BlockDecorPipeValve.on_config(tweaks.pipevalve_max_flowrate, tweaks.pipevalve_redstone_slope);
BlockDecorFurnaceElectrical.BTileEntity.on_config(tweaks.e_furnace_speed_percent, tweaks.e_furnace_power_consumption);
} }
} }

View file

@ -0,0 +1,12 @@
{
"forge_marker": 1,
"defaults": {
"model": "engineersdecor:furnace/small_electrical_furnace_model"
},
"variants": {
"normal": [{}],
"inventory": [{}],
"facing": { "north": {"y":0}, "south": {"y":180}, "west": {"y":-90}, "east": {"y":90}, "up":{}, "down":{} },
"lit": { "false":{ "textures":{ "gloom": "engineersdecor:blocks/furnace/small_electrical_furnace_gloom_off" } }, "true":{}}
}
}

View file

@ -93,6 +93,12 @@ tile.engineersdecor.small_lab_furnace.help=§6Small metal cased lab kiln.§r Sol
Two auxiliary slots e.g. for storage. Two stack internal hopper fifos for input, output, \ Two auxiliary slots e.g. for storage. Two stack internal hopper fifos for input, output, \
and fuel. Place an external heater into a aux slot and connect power for electrical \ and fuel. Place an external heater into a aux slot and connect power for electrical \
smelting speed boost. smelting speed boost.
tile.engineersdecor.small_electrical_furnace.name=Small electrical furnace
tile.engineersdecor.small_electrical_furnace.help=§6Small metal cased pass-through furnace.§r \
Automatically draws items from the input side and puts items into the inventory at the output side. \
Items can be inserted or drawn from all sides using hoppers. Implicitly bypasses items that cannot be \
smelted or cooked to the output. Slightly more energy efficient and faster than a heated cobblestone \
furnace. Fifos and feeders transfer whole stacks. Feeders require a bit of power.
#----------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------
tile.engineersdecor.straight_pipe_valve.name=Fluid pipe check valve tile.engineersdecor.straight_pipe_valve.name=Fluid pipe check valve
tile.engineersdecor.straight_pipe_valve.help=§6Straight fluid pipe fragment.§r Conducts fluids only in one direction. \ tile.engineersdecor.straight_pipe_valve.help=§6Straight fluid pipe fragment.§r Conducts fluids only in one direction. \

View file

@ -86,6 +86,12 @@ tile.engineersdecor.steel_framed_window.name=Окно со стальной ра
#----------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------
tile.engineersdecor.small_lab_furnace.name=Компактная лабораторная печь tile.engineersdecor.small_lab_furnace.name=Компактная лабораторная печь
tile.engineersdecor.small_lab_furnace.help=§6Лабораторная печь в металлическом корпусе.§r Подача твёрдого топлива - сверху. Немного горячее чем каменная, поэтому быстрее. Два внутренних слота для ввода, выхода и топлива. tile.engineersdecor.small_lab_furnace.help=§6Лабораторная печь в металлическом корпусе.§r Подача твёрдого топлива - сверху. Немного горячее чем каменная, поэтому быстрее. Два внутренних слота для ввода, выхода и топлива.
tile.engineersdecor.small_electrical_furnace.name=Small electrical furnace
#tile.engineersdecor.small_electrical_furnace.help=§6Small metal cased pass-through furnace.§r \
Automatically draws items from the input side and puts items into the inventory at the output side. \
Items can be inserted or drawn from all sides using hoppers. Implicitly bypasses items that cannot be \
smelted or cooked to the output. Slightly more energy efficient and faster than a heated cobblestone \
furnace. Fifos and feeders transfer whole stacks. Feeders require a bit of power.
#----------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------
tile.engineersdecor.straight_pipe_valve.name=Straight fluid valve tile.engineersdecor.straight_pipe_valve.name=Straight fluid valve
#tile.engineersdecor.straight_pipe_valve.help=§6Straight fluid pipe fragment.§r Conducts fluids only in one direction. \ #tile.engineersdecor.straight_pipe_valve.help=§6Straight fluid pipe fragment.§r Conducts fluids only in one direction. \

View file

@ -0,0 +1,106 @@
{
"parent": "block/cube",
"textures": {
"top": "engineersdecor:blocks/furnace/small_electrical_furnace_top",
"particle": "engineersdecor:blocks/furnace/small_electrical_furnace_top",
"bottom": "engineersdecor:blocks/furnace/small_electrical_furnace_bottom",
"left": "engineersdecor:blocks/furnace/small_electrical_furnace_left",
"right": "engineersdecor:blocks/furnace/small_electrical_furnace_right",
"front": "engineersdecor:blocks/furnace/small_electrical_furnace_front",
"back": "engineersdecor:blocks/furnace/small_electrical_furnace_back"
},
"elements": [
{
"from": [12.75, 11.5, 1],
"to": [13.75, 17, 15],
"rotation": {"angle": 45, "axis": "z", "origin": [15.5, 13.5, 8]},
"faces": {
"north": {"uv": [0, 0, 1, 5.5], "texture": "#front"},
"east": {"uv": [0, 1, 5, 15], "rotation": 90, "texture": "#top"},
"south": {"uv": [0, 0, 1, 5.5], "texture": "#back"}
}
},
{
"from": [2.25, 11.5, 1],
"to": [3.25, 17, 15],
"rotation": {"angle": -45, "axis": "z", "origin": [0.5, 13.5, 8]},
"faces": {
"north": {"uv": [0, 0, 1, 5.5], "texture": "#front"},
"south": {"uv": [0, 0, 1, 5.5], "texture": "#back"},
"west": {"uv": [0, 1, 5, 15], "rotation": 270, "texture": "#top"}
}
},
{
"from": [4, 14, 0],
"to": [12, 16, 16],
"faces": {
"north": {"uv": [4, 0, 12, 2], "texture": "#front"},
"east": {"uv": [0, 0, 16, 2], "texture": "#left"},
"south": {"uv": [4, 0, 12, 2], "texture": "#back"},
"west": {"uv": [0, 0, 16, 2], "texture": "#right"},
"up": {"uv": [4, 0, 12, 16], "texture": "#top"},
"down": {"uv": [4, 0, 12, 16], "texture": "#bottom"}
}
},
{
"from": [2, 12, 0],
"to": [14, 13, 16],
"faces": {
"north": {"uv": [2, 3, 14, 4], "texture": "#front"},
"east": {"uv": [0, 3, 16, 4], "texture": "#left"},
"south": {"uv": [2, 3, 14, 4], "texture": "#back"},
"west": {"uv": [0, 3, 16, 4], "texture": "#right"},
"up": {"uv": [2, 0, 14, 16], "texture": "#top"},
"down": {"uv": [2, 0, 14, 16], "texture": "#bottom"}
}
},
{
"from": [1, 11, 0],
"to": [15, 12, 16],
"faces": {
"north": {"uv": [1, 4, 15, 5], "texture": "#front"},
"east": {"uv": [0, 4, 16, 5], "texture": "#left"},
"south": {"uv": [1, 4, 15, 5], "texture": "#back"},
"west": {"uv": [0, 4, 16, 5], "texture": "#right"},
"up": {"uv": [1, 0, 15, 16], "texture": "#top"},
"down": {"uv": [1, 0, 15, 16], "texture": "#bottom"}
}
},
{
"from": [3, 13, 0],
"to": [13, 14, 16],
"faces": {
"north": {"uv": [3, 2, 13, 3], "texture": "#front"},
"east": {"uv": [0, 2, 16, 3], "texture": "#left"},
"south": {"uv": [3, 2, 13, 3], "texture": "#back"},
"west": {"uv": [0, 2, 16, 3], "texture": "#right"},
"up": {"uv": [3, 0, 13, 16], "texture": "#top"},
"down": {"uv": [3, 0, 13, 16], "texture": "#bottom"}
}
},
{
"from": [0, 0, 0],
"to": [16, 11, 16],
"faces": {
"north": {"uv": [0, 5, 16, 16], "texture": "#front"},
"east": {"uv": [0, 5, 16, 16], "texture": "#right"},
"south": {"uv": [0, 5, 16, 16], "texture": "#back"},
"west": {"uv": [0, 5, 16, 16], "texture": "#left"},
"up": {"uv": [0, 0, 16, 16], "texture": "#top"},
"down": {"uv": [0, 0, 16, 16], "texture": "#bottom"}
}
}
],
"display": {
"ground": {
"scale": [0.2, 0.2, 0.2]
},
"gui": {
"rotation": [30, 225, 0],
"scale": [0.625, 0.625, 0.625]
},
"fixed": {
"scale": [0.5, 0.5, 0.5]
}
}
}

View file

@ -126,6 +126,17 @@
], ],
"name": "anyDirectedRedstoneConnector" "name": "anyDirectedRedstoneConnector"
}, },
{
"conditions": [
{ "type": "minecraft:item_exists", "item": "immersiveengineering:connector" }
],
"ingredient": [
{ "item": "immersiveengineering:connector", "data": 0 },
{ "item": "immersiveengineering:connector", "data": 2 },
{ "item": "immersiveengineering:connector", "data": 4 }
],
"name": "electricalConnector"
},
{ {
"ingredient": [ "ingredient": [
{ "type": "forge:ore_dict", "ore": "ingotBrick" }, { "type": "forge:ore_dict", "ore": "ingotBrick" },

View file

@ -0,0 +1,32 @@
{
"conditions": [
{
"type": "engineersdecor:grc",
"result": "engineersdecor:small_electrical_furnace",
"required": ["immersiveengineering:material", "engineersdecor:small_lab_furnace"]
}
],
"type": "minecraft:crafting_shaped",
"pattern": [
" C ",
"HFH"
],
"key": {
"F": {
"item": "engineersdecor:small_lab_furnace",
"data": 0
},
"C": {
"item": "#electricalConnector",
"data": 0
},
"H": {
"item": "#anyHopper",
"data": 0
}
},
"result": {
"item": "engineersdecor:small_electrical_furnace",
"count": 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 533 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 472 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 531 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 184 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 693 B

View file

@ -0,0 +1 @@
{ "animation":{ "frames": [0,1,2,3,4,5,6,7], "frametime":8, "interpolate":true }}

Binary file not shown.

After

Width:  |  Height:  |  Size: 522 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 517 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 484 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

View file

@ -1,7 +1,8 @@
{ {
"homepage": "https://www.curseforge.com/minecraft/mc-mods/engineers-decor/", "homepage": "https://www.curseforge.com/minecraft/mc-mods/engineers-decor/",
"1.12.2": { "1.12.2": {
"1.0.4-b9": "[F] Inserting fluids with pressurized tag only into IE piping.\n[F] Valve redstone connector rendering does not check for \"can connect redstone\" but only for \"can provide power\".\n[M] Valves are adpted to be detected as pipe by IE.", "1.0.4": "[R] Release based on v1.0.3-b9. Release-to-release changes: * Crafting table: Quick crafting history re-fab, JEI integration. * Rendering improvements and issue fixes (stairs, ambient occlusion, optifine, etc). * Walls with texture variations. * Thin/thick steel poles with support feet/heads. * Horizontal steel double-T support beams added. * Fluid pipe valves added: Check valve, redstone controlled valve, analog redstone controlled valve. Support pressuzized transfer. * Tooltip documentation (CTRL-SHIFT) for stairs added. * Internal code cleanups. * Recipes tuned.\n[E] Added pass-through electrical furnace (experimental, see config).",
"1.0.4-b9": "[F] Inserting fluids with pressurized tag only into IE piping.\n[F] Valve redstone connector rendering does not check for \"can connect redstone\" but only for \"can provide power\".\n[M] Valves are adapted to be detected as pipe by IE.",
"1.0.4-b8": "[F] Fixed stairs rendering without smooth light (thanks rastot9).\n[E] Added passive fluid accumulator (experimental feature, see config).", "1.0.4-b8": "[F] Fixed stairs rendering without smooth light (thanks rastot9).\n[E] Added passive fluid accumulator (experimental feature, see config).",
"1.0.4-b7": "[F] Fixed recipe loading issue if IE is not installed.\n[M] Valves support IE pressurized fluid transfer.", "1.0.4-b7": "[F] Fixed recipe loading issue if IE is not installed.\n[M] Valves support IE pressurized fluid transfer.",
"1.0.4-b6": "[A] Added redstone controlled fluid valve.\n[A] Added redstone controlled analog fluid valve.\n[M] Check valve recipe adapted (thanks majijn).", "1.0.4-b6": "[A] Added redstone controlled fluid valve.\n[A] Added redstone controlled analog fluid valve.\n[M] Check valve recipe adapted (thanks majijn).",
@ -41,8 +42,8 @@
"1.0.0-a1": "[A] Initial port to 1.13.2 with Forge beta." "1.0.0-a1": "[A] Initial port to 1.13.2 with Forge beta."
}, },
"promos": { "promos": {
"1.12.2-recommended": "1.0.3", "1.12.2-recommended": "1.0.4",
"1.12.2-latest": "1.0.4-b9", "1.12.2-latest": "1.0.4",
"1.13.2-recommended": "", "1.13.2-recommended": "",
"1.13.2-latest": "1.0.4-b3" "1.13.2-latest": "1.0.4-b3"
} }