Added small waste incinerator. Metal ladders are easier to break. Missing Override annotations added. Experimental factory dropper concept impl added.

This commit is contained in:
stfwi 2019-05-19 08:18:37 +02:00
parent dec60ad3e6
commit 5b1a6e0877
23 changed files with 1114 additions and 27 deletions

View file

@ -4,4 +4,4 @@ org.gradle.jvmargs=-Xmx8G
version_minecraft=1.12.2
version_forge=14.23.5.2768
version_jei=4.10.0.198
version_engineersdecor=1.0.5
version_engineersdecor=1.0.6-b1

View file

@ -1,6 +1,7 @@
{
"homepage": "https://www.curseforge.com/minecraft/mc-mods/engineers-decor/",
"1.12.2": {
"1.0.6-b1": "[A] Added small waste incinerator (delayed fifo-buffered item disposal).\n[M] Fixed item/block name capitalization (by Voxelo).\n[M] Metal ladders are easier to break/harvest.",
"1.0.5": "[R] Release based on v1.0.5-b1. Release-to-release changes: * Small electrical passthrough-furnace added. * Passive fluid accumulator added. * Config options added. * Sign plates added. * Minor bug fixes.\n[A] Added sign \"Electrical hazzard\"/\"Caution hot wire\".\n[A] Added sign \"Caution dangerous there\" (skull/bones).",
"1.0.5-b1": "[A] Added passive fluid accumulator.\n[A] Added small electrical passthrough-furnace.\n[F] Fixed version check URL.\n[M] Opt-out config options for valves, passive fluid accumulator, and furni.",
"1.0.4": "[R] Release based on v1.0.4-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 pressurized transfer. * Tool tip documentation (CTRL-SHIFT) for stairs added. * Internal code cleanups. * Recipes tuned.\n[E] Added pass-through electrical furnace (experimental, see config).",
@ -36,6 +37,6 @@
},
"promos": {
"1.12.2-recommended": "1.0.5",
"1.12.2-latest": "1.0.5"
"1.12.2-latest": "1.0.6-b1"
}
}

View file

@ -10,6 +10,10 @@ Mod sources for Minecraft version 1.12.2.
----
## Revision history
- v1.0.6-b1 [A] Added small waste incinerator (delayed fifo-buffered item disposal).
[M] Fixed item/block name capitalization (by Voxelo).
[M] Metal ladders are easier to break/harvest.
-------------------------------------------------------------------
- v1.0.5 [R] Release based on v1.0.5-b1. Release-to-release changes:
* Small electrical passthrough-furnace added.

View file

@ -155,6 +155,7 @@ public class ModEngineersDecor
public static final int GUIID_SMALL_LAB_FURNACE = 213102;
public static final int GUIID_ELECTRICAL_LAB_FURNACE = 213103;
public static final int GUIID_SMALL_WASTE_INCINERATOR = 213104;
public static final int GUIID_FACTORY_DROPPER = 213105;
@Override
public Object getServerGuiElement(final int guiid, final EntityPlayer player, final World world, int x, int y, int z)
@ -166,6 +167,7 @@ public class ModEngineersDecor
case GUIID_SMALL_LAB_FURNACE: return BlockDecorFurnace.getServerGuiElement(player, world, pos, te);
case GUIID_ELECTRICAL_LAB_FURNACE: return BlockDecorFurnaceElectrical.getServerGuiElement(player, world, pos, te);
case GUIID_SMALL_WASTE_INCINERATOR: return BlockDecorWasteIncinerator.getServerGuiElement(player, world, pos, te);
case GUIID_FACTORY_DROPPER: return BlockDecorDropper.getServerGuiElement(player, world, pos, te);
}
return null;
}
@ -181,10 +183,10 @@ public class ModEngineersDecor
case GUIID_SMALL_LAB_FURNACE: return BlockDecorFurnace.getClientGuiElement(player, world, pos, te);
case GUIID_ELECTRICAL_LAB_FURNACE: return BlockDecorFurnaceElectrical.getClientGuiElement(player, world, pos, te);
case GUIID_SMALL_WASTE_INCINERATOR: return BlockDecorWasteIncinerator.getClientGuiElement(player, world, pos, te);
case GUIID_FACTORY_DROPPER: return BlockDecorDropper.getClientGuiElement(player, world, pos, te);
}
return null;
}
}
@Mod.EventBusSubscriber

View file

@ -73,8 +73,7 @@ public class BlockDecorCraftingTable extends BlockDecorDirected
}
@Override
@SuppressWarnings("deprecation")
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer, EnumHand hand)
{ return getDefaultState().withProperty(FACING, placer.getHorizontalFacing().getOpposite()); }
@Override

View file

@ -0,0 +1,900 @@
/*
* @file BlockDecorDropper.java
* @author Stefan Wilhelm (wile)
* @copyright (C) 2019 Stefan Wilhelm
* @license MIT (see https://opensource.org/licenses/MIT)
*
* Dropper factory automation suitable.
*/
package wile.engineersdecor.blocks;
import wile.engineersdecor.ModEngineersDecor;
import net.minecraft.block.properties.PropertyBool;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.block.BlockDoor;
import net.minecraft.world.World;
import net.minecraft.world.Explosion;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.EntityLivingBase;
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.item.*;
import net.minecraft.inventory.*;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.util.*;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraftforge.common.capabilities.Capability;
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 wile.engineersdecor.detail.Networking;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.io.IOException;
public class BlockDecorDropper extends BlockDecorDirected
{
public static final PropertyBool OPEN = BlockDoor.OPEN;
public BlockDecorDropper(@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); }
@Override
protected BlockStateContainer createBlockState()
{ return new BlockStateContainer(this, FACING, OPEN); }
@Override
public IBlockState getStateFromMeta(int meta)
{ return super.getStateFromMeta(meta).withProperty(OPEN, (meta & 0x8)!=0); }
@Override
public int getMetaFromState(IBlockState state)
{ return super.getMetaFromState(state) | (state.getValue(OPEN) ? 0x8 : 0x0); }
@Override
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer, EnumHand hand)
{ return super.getStateForPlacement(world, pos, facing, hitX, hitY, hitZ, meta, placer, hand).withProperty(OPEN, false); }
@Override
@SuppressWarnings("deprecation")
public boolean hasComparatorInputOverride(IBlockState state)
{ return true; }
@Override
@SuppressWarnings("deprecation")
public int getComparatorInputOverride(IBlockState blockState, World world, BlockPos pos)
{ return Container.calcRedstone(world.getTileEntity(pos)); }
@Override
public boolean hasTileEntity(IBlockState state)
{ return true; }
@Nullable
public TileEntity createTileEntity(World world, IBlockState state)
{ return new BlockDecorDropper.BTileEntity(); }
@Override
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
{
if(world.isRemote) return;
if((!stack.hasTagCompound()) || (!stack.getTagCompound().hasKey("inventory"))) return;
NBTTagCompound inventory_nbt = stack.getTagCompound().getCompoundTag("inventory");
if(inventory_nbt.isEmpty()) return;
final TileEntity te = world.getTileEntity(pos);
if(!(te instanceof BlockDecorDropper.BTileEntity)) return;
((BlockDecorDropper.BTileEntity)te).readnbt(inventory_nbt, false);
((BlockDecorDropper.BTileEntity)te).markDirty();
}
@Override
public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest)
{
if(world.isRemote) return true;
TileEntity te = world.getTileEntity(pos);
if(!(te instanceof BTileEntity)) return super.removedByPlayer(state, world, pos, player, willHarvest);
ItemStack stack = new ItemStack(this, 1);
NBTTagCompound inventory_nbt = new NBTTagCompound();
ItemStackHelper.saveAllItems(inventory_nbt, ((BTileEntity)te).stacks_, false);
if(!inventory_nbt.isEmpty()) {
NBTTagCompound nbt = new NBTTagCompound();
nbt.setTag("inventory", inventory_nbt);
stack.setTagCompound(nbt);
}
world.spawnEntity(new EntityItem(world, pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, stack));
world.setBlockToAir(pos);
world.removeTileEntity(pos);
return false;
}
@Override
public void onBlockExploded(World world, BlockPos pos, Explosion explosion)
{
if(world.isRemote) return;
TileEntity te = world.getTileEntity(pos);
if(!(te instanceof BTileEntity)) return;
for(ItemStack stack: ((BTileEntity)te).stacks_) {
if(!stack.isEmpty()) world.spawnEntity(new EntityItem(world, pos.getX(), pos.getY(), pos.getZ(), stack));
}
((BTileEntity)te).reset();
super.onBlockExploded(world, pos, explosion);
}
@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_FACTORY_DROPPER, world, pos.getX(), pos.getY(), pos.getZ());
return true;
}
@Override
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block block, BlockPos neighborPos)
{
if(!(world instanceof World) || (((World) world).isRemote)) return;
TileEntity te = world.getTileEntity(pos);
if(!(te instanceof BTileEntity)) return;
((BTileEntity)te).block_updated();
}
//--------------------------------------------------------------------------------------------------------------------
// 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 mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException
{
super.mouseClicked(mouseX, mouseY, mouseButton);
BContainer container = (BContainer)inventorySlots;
if(container.fields_.length != 16) return;
int mx = mouseX - getGuiLeft(), my = mouseY - getGuiTop();
if(isPointInRegion(130, 10, 12, 25, mouseX, mouseY)) {
int force_percent = 100 - MathHelper.clamp(((my-10)*100)/25, 0, 100);
NBTTagCompound nbt = new NBTTagCompound();
nbt.setInteger("drop_speed", force_percent);
Networking.PacketTileNotify.sendToServer(te, nbt);
} else if(isPointInRegion(145, 10, 25, 25, mouseX, mouseY)) {
int xdev = MathHelper.clamp(((mx-157) * 100) / 12, -100, 100);
int ydev = -MathHelper.clamp(((my-22) * 100) / 12, -100, 100);
if(Math.abs(xdev) < 3) xdev = 0;
if(Math.abs(ydev) < 3) ydev = 0;
NBTTagCompound nbt = new NBTTagCompound();
nbt.setInteger("drop_xdev", xdev);
nbt.setInteger("drop_ydev", ydev);
Networking.PacketTileNotify.sendToServer(te, nbt);
} else if(isPointInRegion(129, 40, 44, 10, mouseX, mouseY)) {
int ndrop = (mx-135);
if(ndrop < -1) {
ndrop = container.fields_[4] - 1; // -
} else if(ndrop >= 36) {
ndrop = container.fields_[4] + 1; // +
} else {
ndrop = MathHelper.clamp(1+ndrop, 1, 32); // slider
}
NBTTagCompound nbt = new NBTTagCompound();
nbt.setInteger("drop_count", ndrop);
Networking.PacketTileNotify.sendToServer(te, nbt);
} else if(
isPointInRegion(114, 51, 9, 9, mouseX, mouseY) ||
isPointInRegion(162, 66, 7, 9, mouseX, mouseY)
) {
NBTTagCompound nbt = new NBTTagCompound();
nbt.setInteger("manual_trigger", 1);
Networking.PacketTileNotify.sendToServer(te, nbt);
}
}
@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/factory_dropper_gui.png"));
final int x0=getGuiLeft(), y0=getGuiTop(), w=getXSize(), h=getYSize();
drawTexturedModalRect(x0, y0, 0, 0, w, h);
BContainer container = (BContainer)inventorySlots;
if(container.fields_.length != 16) return; // no init, no cake.
// active drop slot
{
int drop_slot_index = container.fields_[15];
if((drop_slot_index < 0) || (drop_slot_index >= 16)) drop_slot_index = 0;
int x = (x0+9+((drop_slot_index % 6) * 18));
int y = (y0+5+((drop_slot_index / 6) * 17));
drawTexturedModalRect(x, y, 180, 45, 18, 18);
}
// filter LEDs
{
for(int i=0; i<3; ++i) {
int xt = 180 + (6 * container.fields_[12+i]), yt = 38;
int x = x0 + 31 + (i * 36), y = y0 + 65;
drawTexturedModalRect(x, y, xt, yt, 6, 6);
}
}
// force adjustment
{
int hy = 2 + (((100-container.fields_[0]) * 21) / 100);
int x = x0+135, y = y0+12, xt = 181;
int yt = 4 + (23-hy);
drawTexturedModalRect(x, y, xt, yt, 3, hy);
}
// angle adjustment
{
int x = x0 + 157 - 3 + ((container.fields_[1] * 12) / 100);
int y = y0 + 22 - 3 - ((container.fields_[2] * 12) / 100);
drawTexturedModalRect(x, y, 180, 30, 7, 7);
}
// drop count
{
int x = x0 + 134 - 2 + (container.fields_[4]);
int y = y0 + 44;
drawTexturedModalRect(x, y, 190, 31, 5, 5);
}
// redstone input
{
if(container.fields_[11] != 0) {
drawTexturedModalRect(x0+114, y0+51, 189, 18, 9, 9);
}
}
}
}
//--------------------------------------------------------------------------------------------------------------------
// container
//--------------------------------------------------------------------------------------------------------------------
public static class BContainer extends Container
{
private static final int PLAYER_INV_START_SLOTNO = BTileEntity.NUM_OF_SLOTS;
private final World world;
private final BlockPos pos;
private final EntityPlayer player;
private final BTileEntity te;
private int fields_[] = new int[16];
public BContainer(InventoryPlayer playerInventory, World world, BlockPos pos, BTileEntity te)
{
this.player = playerInventory.player;
this.world = world;
this.pos = pos;
this.te = te;
int i=-1;
// input slots (stacks 0 to 11)
for(int y=0; y<2; ++y) {
for(int x=0; x<6; ++x) {
int xpos = 10+x*18, ypos = 6+y*17;
addSlotToContainer(new Slot(te, ++i, xpos, ypos));
}
}
// filter slots (stacks 12 to 14)
addSlotToContainer(new Slot(te, ++i, 19, 48));
addSlotToContainer(new Slot(te, ++i, 55, 48));
addSlotToContainer(new Slot(te, ++i, 91, 48));
// player slots
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
}
}
}
public BlockPos getPos()
{ return pos; }
@Override
public void addListener(IContainerListener listener)
{ super.addListener(listener); listener.sendAllWindowProperties(this, te); }
@Override
public void detectAndSendChanges()
{
super.detectAndSendChanges();
for(int il=0; il<listeners.size(); ++il) {
IContainerListener lis = listeners.get(il);
for(int k=0; k<16; ++k) {
int f = te.getField(k);
if(fields_[k] != f) {
fields_[k] = f;
lis.sendWindowProperty(this, k, f);
}
}
}
}
@Override
@SideOnly(Side.CLIENT)
public void updateProgressBar(int id, int value)
{
if((id < 0) || (id >= fields_.length)) return;
fields_[id] = value;
te.setField(id, value);
}
@Override
public boolean canInteractWith(EntityPlayer player)
{ return (world.getBlockState(pos).getBlock() instanceof BlockDecorDropper) && (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>=0) && (index<PLAYER_INV_START_SLOTNO)) {
// Device slots
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 slot
if(!mergeItemStack(slot_stack, 0, BTileEntity.INPUT_SLOTS_SIZE, false)) 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 TileEntity implements ITickable, ISidedInventory, IItemHandler, Networking.IPacketReceiver
{
public static final int TICK_INTERVAL = 32;
public static final int NUM_OF_SLOTS = 15;
public static final int INPUT_SLOTS_FIRST = 0;
public static final int INPUT_SLOTS_SIZE = 12;
public static final int CTRL_SLOTS_FIRST = INPUT_SLOTS_SIZE;
public static final int CTRL_SLOTS_SIZE = 3;
private int tick_timer_ = 0;
private int filter_matches_[] = new int[CTRL_SLOTS_SIZE];
private boolean active_ = false;
private boolean block_power_signal_ = false;
private boolean block_power_updated_ = false;
private int drop_speed_ = 10;
private int drop_noise_ = 0;
private int drop_xdev_ = 0;
private int drop_ydev_ = 0;
private int drop_slot_index_ = 0;
private int drop_count_ = 0;
protected NonNullList<ItemStack> stacks_;
public static void on_config(int cooldown_ticks)
{
// ModEngineersDecor.logger.info("Config factory dropper:");
}
public BTileEntity()
{ reset(); }
protected void reset()
{
stacks_ = NonNullList.<ItemStack>withSize(NUM_OF_SLOTS, ItemStack.EMPTY);
block_power_signal_ = false;
block_power_updated_ = false;
drop_count_ = 0;
for(int i=0; i<filter_matches_.length; ++i) filter_matches_[i] = 0;
}
public void readnbt(NBTTagCompound nbt, boolean update_packet)
{
stacks_ = NonNullList.<ItemStack>withSize(NUM_OF_SLOTS, ItemStack.EMPTY);
ItemStackHelper.loadAllItems(nbt, stacks_);
while(stacks_.size() < NUM_OF_SLOTS) stacks_.add(ItemStack.EMPTY);
active_ = nbt.getBoolean("active");
block_power_signal_ = nbt.getBoolean("powered");
drop_speed_ = nbt.getInteger("drop_speed");
drop_noise_ = nbt.getInteger("drop_noise");
drop_xdev_ = nbt.getInteger("drop_xdev");
drop_ydev_ = nbt.getInteger("drop_ydev");
drop_slot_index_ = nbt.getInteger("drop_slot_index");
drop_count_ = nbt.getInteger("drop_count");
}
protected void writenbt(NBTTagCompound nbt, boolean update_packet)
{
ItemStackHelper.saveAllItems(nbt, stacks_);
nbt.setBoolean("active", active_);
nbt.setBoolean("powered", block_power_signal_);
nbt.setInteger("drop_speed", drop_speed_);
nbt.setInteger("drop_noise", drop_noise_);
nbt.setInteger("drop_xdev", drop_xdev_);
nbt.setInteger("drop_ydev", drop_ydev_);
nbt.setInteger("drop_slot_index", drop_slot_index_);
nbt.setInteger("drop_count", drop_count_);
}
private ItemStack shiftStacks(final int index_from, final int index_to)
{
if(index_from >= index_to) return ItemStack.EMPTY;
ItemStack out_stack = ItemStack.EMPTY;
ItemStack stack = stacks_.get(index_from);
for(int i=index_from+1; i<=index_to; ++i) {
out_stack = stacks_.get(i);
stacks_.set(i, stack);
stack = out_stack;
}
stacks_.set(index_from, ItemStack.EMPTY);
return out_stack;
}
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;
}
public void block_updated()
{
// RS power check, both edges
boolean powered = world.isBlockPowered(pos);
if(block_power_signal_ != powered) block_power_updated_ = true;
block_power_signal_ = powered;
tick_timer_ = 1;
}
public boolean is_input_slot(int index)
{ return (index >= INPUT_SLOTS_FIRST) && (index < (INPUT_SLOTS_FIRST+INPUT_SLOTS_SIZE)); }
// TileEntity ------------------------------------------------------------------------------
@Override
public boolean shouldRefresh(World world, BlockPos pos, IBlockState os, IBlockState ns)
{ return (os.getBlock() != ns.getBlock()) || (!(ns.getBlock() instanceof BlockDecorDropper)); }
@Override
public void readFromNBT(NBTTagCompound nbt)
{ super.readFromNBT(nbt); readnbt(nbt, false); }
@Override
public NBTTagCompound writeToNBT(NBTTagCompound nbt)
{ super.writeToNBT(nbt); writenbt(nbt, false); return nbt; }
// IWorldNamable ---------------------------------------------------------------------------
@Override
public String getName()
{ final Block block=getBlockType(); return (block!=null) ? (block.getTranslationKey() + ".name") : (""); }
@Override
public boolean hasCustomName()
{ return false; }
@Override
public ITextComponent getDisplayName()
{ return new TextComponentTranslation(getName(), new Object[0]); }
// IInventory ------------------------------------------------------------------------------
@Override
public int getSizeInventory()
{ return stacks_.size(); }
@Override
public boolean isEmpty()
{ for(ItemStack stack: stacks_) { if(!stack.isEmpty()) return false; } return true; }
@Override
public ItemStack getStackInSlot(int index)
{ return (index < getSizeInventory()) ? stacks_.get(index) : ItemStack.EMPTY; }
@Override
public ItemStack decrStackSize(int index, int count)
{ return ItemStackHelper.getAndSplit(stacks_, index, count); }
@Override
public ItemStack removeStackFromSlot(int index)
{ return ItemStackHelper.getAndRemove(stacks_, index); }
@Override
public void setInventorySlotContents(int index, ItemStack stack)
{
stacks_.set(index, stack);
if(stack.getCount() > getInventoryStackLimit()) stack.setCount(getInventoryStackLimit());
tick_timer_ = 2;
markDirty();
}
@Override
public int getInventoryStackLimit()
{ return 64; }
@Override
public void markDirty()
{ super.markDirty(); }
@Override
public boolean isUsableByPlayer(EntityPlayer player)
{ return ((world.getTileEntity(pos) == this) && (player.getDistanceSq(pos.getX()+0.5d, pos.getY()+0.5d, pos.getZ()+0.5d) <= 64.0d)); }
@Override
public void openInventory(EntityPlayer player)
{}
@Override
public void closeInventory(EntityPlayer player)
{ markDirty(); }
@Override
public boolean isItemValidForSlot(int index, ItemStack stack)
{ return true; }
@Override
public int getField(int id)
{
switch(id) {
case 0: return drop_speed_;
case 1: return drop_xdev_;
case 2: return drop_ydev_;
case 3: return drop_noise_;
case 4: return drop_count_;
case 10: return active_ ? 1 : 0;
case 11: return block_power_signal_ ? 1 : 0;
case 12: return filter_matches_[0];
case 13: return filter_matches_[1];
case 14: return filter_matches_[2];
case 15: return drop_slot_index_;
default: return 0;
}
}
@Override
public void setField(int id, int value)
{
switch(id) {
case 0: drop_speed_ = MathHelper.clamp(value, 0, 100); return;
case 1: drop_xdev_ = MathHelper.clamp(value, -100, 100); return;
case 2: drop_ydev_ = MathHelper.clamp(value, -100, 100); return;
case 3: drop_noise_ = MathHelper.clamp(value, 0, 100); return;
case 4: drop_count_ = MathHelper.clamp(value, 1, 64); return;
case 10: active_ = (value != 0); return;
case 11: block_power_signal_ = (value != 0); return;
case 12: filter_matches_[0] = (value & 0x3); return;
case 13: filter_matches_[1] = (value & 0x3); return;
case 14: filter_matches_[2] = (value & 0x3); return;
case 15: drop_slot_index_ = MathHelper.clamp(value, INPUT_SLOTS_FIRST, INPUT_SLOTS_FIRST+INPUT_SLOTS_SIZE-1); return;
default: return;
}
}
@Override
public int getFieldCount()
{ return 16; }
@Override
public void clear()
{ stacks_.clear(); }
// ISidedInventory ----------------------------------------------------------------------------
private static final int[] SIDED_INV_SLOTS;
static {
SIDED_INV_SLOTS = new int[INPUT_SLOTS_SIZE];
for(int i=INPUT_SLOTS_FIRST; i<INPUT_SLOTS_SIZE; ++i) SIDED_INV_SLOTS[i] = i;
}
@Override
public int[] getSlotsForFace(EnumFacing side)
{ return SIDED_INV_SLOTS; }
@Override
public boolean canInsertItem(int index, ItemStack itemStackIn, EnumFacing direction)
{ return is_input_slot(index) && isItemValidForSlot(index, itemStackIn); }
@Override
public boolean canExtractItem(int index, ItemStack stack, EnumFacing direction)
{ return false; }
// IItemHandler --------------------------------------------------------------------------------
@Override
public int getSlots()
{ return SIDED_INV_SLOTS.length; }
@Override
public int getSlotLimit(int index)
{ return getInventoryStackLimit(); }
@Override
public boolean isItemValid(int slot, @Nonnull ItemStack stack)
{ return is_input_slot(slot); }
@Override
@Nonnull
public ItemStack insertItem(int index, @Nonnull ItemStack stack, boolean simulate)
{
if((stack.isEmpty()) || (!is_input_slot(index))) return ItemStack.EMPTY;
int slotno = 0;
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) || (!is_input_slot(index))) return ItemStack.EMPTY;
ItemStack stack = stacks_.get(index).copy();
if(stack.getCount() > amount) stack.setCount(amount);
if(simulate) return stack;
stacks_.get(index).shrink(stack.getCount());
return stack;
}
// Capability export ----------------------------------------------------------------------------
@Override
public boolean hasCapability(Capability<?> cap, EnumFacing facing)
{ return (cap==CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) || super.hasCapability(cap, facing); }
@Override
@SuppressWarnings("unchecked")
@Nullable
public <T> T getCapability(Capability<T> capability, @Nullable EnumFacing facing)
{
if((facing != null) && (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY)) {
return (T)this;
} else {
return super.getCapability(capability, facing);
}
}
// IPacketReceiver -------------------------------------------------------------------------------
@Override
public void onServerPacketReceived(NBTTagCompound nbt)
{}
@Override
public void onClientPacketReceived(EntityPlayer player, NBTTagCompound nbt)
{
if(nbt.hasKey("drop_speed")) drop_speed_ = MathHelper.clamp(nbt.getInteger("drop_speed"), 0, 100);
if(nbt.hasKey("drop_xdev")) drop_xdev_ = MathHelper.clamp(nbt.getInteger("drop_xdev"), -100, 100);
if(nbt.hasKey("drop_ydev")) drop_ydev_ = MathHelper.clamp(nbt.getInteger("drop_ydev"), -100, 100);
if(nbt.hasKey("drop_count")) drop_count_ = MathHelper.clamp(nbt.getInteger("drop_count"), 1, 64);
if(nbt.hasKey("manual_trigger") && (nbt.getInteger("manual_trigger")!=0)) { block_power_signal_ = true; block_power_updated_ = true; tick_timer_ = 1; }
markDirty();
}
// ITickable and aux methods ---------------------------------------------------------------------
private static void drop(World world, BlockPos pos, EnumFacing facing, ItemStack stack, int speed_percent, int xdeviation, int ydeviation, int noise_percent)
{
final double ofs = facing==EnumFacing.DOWN ? 0.8 : 0.7;
Vec3d v0 = new Vec3d(facing.getXOffset(), facing.getYOffset(), facing.getZOffset());
final EntityItem ei = new EntityItem(world, (pos.getX()+0.5)+(ofs*v0.x), (pos.getY()+0.5)+(ofs*v0.y), (pos.getZ()+0.5)+(ofs*v0.z), stack);
if((xdeviation != 0) || (ydeviation != 0)) {
double vdx = 1e-2 * MathHelper.clamp(xdeviation, -100, 100);
double vdy = 1e-2 * MathHelper.clamp(ydeviation, -100, 100);
switch(facing) { // switch-case faster than coorsys fwd transform
case DOWN: v0 = v0.add( vdx, 0, vdy); break; // down/up: use xz
case NORTH: v0 = v0.add( vdx, vdy, 0); break;
case SOUTH: v0 = v0.add(-vdx, vdy, 0); break;
case EAST: v0 = v0.add(0, vdy, vdx); break;
case WEST: v0 = v0.add(0, vdy, -vdx); break;
case UP: v0 = v0.add( vdx, 0, vdy); break;
}
}
if(noise_percent > 0) {
v0 = v0.add(
((world.rand.nextDouble()-0.5) * 1e-3 * noise_percent),
((world.rand.nextDouble()-0.5) * 1e-3 * noise_percent),
((world.rand.nextDouble()-0.5) * 1e-3 * noise_percent)
);
}
if(speed_percent < 5) speed_percent = 5;
double speed = 1e-2 * speed_percent;
if(noise_percent > 0) speed += (world.rand.nextDouble()-0.5) * 1e-4 * noise_percent;
v0 = v0.normalize().scale(speed);
ei.motionX = v0.x;
ei.motionY = v0.y;
ei.motionZ = v0.z;
world.spawnEntity(ei);
}
@Nullable
IBlockState update_blockstate()
{
IBlockState state = world.getBlockState(pos);
if(!(state.getBlock() instanceof BlockDecorDropper)) return null;
if(state.getValue(OPEN) != active_) {
state = state.withProperty(OPEN, active_);
world.setBlockState(pos, state);
}
return state;
}
private static int next_slot(int i)
{ return (i<INPUT_SLOTS_SIZE-1) ? (i+1) : INPUT_SLOTS_FIRST; }
@Override
public void update()
{
if((world.isRemote) || (--tick_timer_ > 0)) return;
tick_timer_ = TICK_INTERVAL;
final IBlockState state = update_blockstate();
if(state == null) { block_power_signal_= false; return; }
boolean dirty = block_power_updated_;
boolean trigger = (block_power_signal_ && block_power_updated_);
int drop_count = MathHelper.clamp(drop_count_, 1, 64);
boolean slot_assigned = false;
if(!trigger) {
int last_filter_matches_[] = filter_matches_.clone();
for(int ci=0; ci<CTRL_SLOTS_SIZE; ++ci) {
filter_matches_[ci] = 0;
final ItemStack cmp_stack = stacks_.get(CTRL_SLOTS_FIRST+ci);
if(cmp_stack.isEmpty()) continue;
filter_matches_[ci] = 1;
final int cmp_stack_count = cmp_stack.getCount();
int dropslot = drop_slot_index_;
for(int i=INPUT_SLOTS_FIRST; i<(INPUT_SLOTS_FIRST+INPUT_SLOTS_SIZE); ++i) {
final ItemStack inp_stack = stacks_.get(dropslot);
if((inp_stack.getCount() < cmp_stack_count) || (!inp_stack.isItemEqual(cmp_stack))) {
dropslot = next_slot(dropslot);
continue;
}
trigger = true;
dirty = true;
filter_matches_[ci] = 2;
if(!slot_assigned) {
slot_assigned = true;
drop_slot_index_ = dropslot;
}
break;
}
}
for(int i=0; i<filter_matches_.length; ++i) {
if(filter_matches_[i] != last_filter_matches_[i]) { dirty = true; break; }
}
}
if(trigger) {
boolean tr = world.isBlockPowered(pos); // effect active next cycle
block_power_updated_ = (block_power_signal_ != tr);
block_power_signal_ = tr;
ItemStack drop_stack = ItemStack.EMPTY;
for(int i=0; i<INPUT_SLOTS_SIZE; ++i) {
if(drop_slot_index_ >= INPUT_SLOTS_SIZE) drop_slot_index_ = 0;
int ic = drop_slot_index_;
drop_slot_index_ = next_slot(drop_slot_index_);
ItemStack ds = stacks_.get(ic);
if((!ds.isEmpty()) && (ds.getCount() >= drop_count)) {
drop_stack = ds.splitStack(drop_count);
break;
}
}
for(int i=0; i<INPUT_SLOTS_SIZE; ++i) {
if(!stacks_.get(drop_slot_index_).isEmpty()) break;
drop_slot_index_ = next_slot(drop_slot_index_);
}
if(!drop_stack.isEmpty()) {
dirty = true;
// todo: Check inventory insert before ...
drop(world, pos, state.getValue(FACING), drop_stack, drop_speed_, drop_xdev_, drop_ydev_, drop_noise_);
}
}
if(dirty) markDirty();
if(trigger && (tick_timer_ > 10)) tick_timer_ = 10;
}
}
}

View file

@ -79,8 +79,7 @@ public class BlockDecorFurnace extends BlockDecorDirected
{ return (state.getValue(FACING).getHorizontalIndex() & 0x3) | (state.getValue(LIT) ? 4 : 0); }
@Override
@SuppressWarnings("deprecation")
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer, EnumHand hand)
{ return getDefaultState().withProperty(FACING, placer.getHorizontalFacing().getOpposite()).withProperty(LIT, false); }
@Override
@ -747,21 +746,27 @@ public class BlockDecorFurnace extends BlockDecorDirected
// IEnergyStorage ----------------------------------------------------------------------------
@Override
public boolean canExtract()
{ return false; }
@Override
public boolean canReceive()
{ return true; }
@Override
public int getMaxEnergyStored()
{ return boost_energy_consumption; }
@Override
public int getEnergyStored()
{ return boost_energy_; }
@Override
public int extractEnergy(int maxExtract, boolean simulate)
{ return 0; }
@Override
public int receiveEnergy(int maxReceive, boolean simulate)
{ // only speedup support, no buffering, not in nbt -> no markdirty
if((boost_energy_ >= boost_energy_consumption) || (maxReceive < boost_energy_consumption)) return 0;

View file

@ -450,21 +450,27 @@ public class BlockDecorFurnaceElectrical extends BlockDecorFurnace
// IEnergyStorage ----------------------------------------------------------------------------
@Override
public boolean canExtract()
{ return false; }
@Override
public boolean canReceive()
{ return true; }
@Override
public int getMaxEnergyStored()
{ return MAX_ENERGY_BUFFER; }
@Override
public int getEnergyStored()
{ return energy_stored_; }
@Override
public int extractEnergy(int maxExtract, boolean simulate)
{ return 0; }
@Override
public int receiveEnergy(int maxReceive, boolean simulate)
{
if(energy_stored_ >= MAX_ENERGY_BUFFER) return 0;

View file

@ -98,8 +98,7 @@ public class BlockDecorLadder extends BlockLadder
{ return canAttachTo(world, pos.west(), side) || canAttachTo(world, pos.east(), side) || canAttachTo(world, pos.north(), side) || canAttachTo(world, pos.south(), side); }
@Override
@SuppressWarnings("deprecation")
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer, EnumHand hand)
{
if(facing.getAxis().isHorizontal() && canAttachTo(world, pos.offset(facing.getOpposite()), facing)) return this.getDefaultState().withProperty(FACING, facing);
for(EnumFacing e:EnumFacing.Plane.HORIZONTAL) {

View file

@ -70,8 +70,7 @@ public class BlockDecorWasteIncinerator extends BlockDecor
{ return (state.getValue(LIT) ? 4 : 0); }
@Override
@SuppressWarnings("deprecation")
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer, EnumHand hand)
{ return getDefaultState().withProperty(LIT, false); }
@Override
@ -320,7 +319,7 @@ public class BlockDecorWasteIncinerator extends BlockDecor
private int tick_timer_;
private int check_timer_;
private int energy_stored_;
protected NonNullList<ItemStack> stacks_;
protected NonNullList<ItemStack> stacks_ = NonNullList.<ItemStack>withSize(NUM_OF_SLOTS, ItemStack.EMPTY);
public static void on_config(int speed_percent, int fuel_efficiency_percent, int boost_energy_per_tick)
{
@ -340,9 +339,10 @@ public class BlockDecorWasteIncinerator extends BlockDecor
public void readnbt(NBTTagCompound compound)
{
reset();
ItemStackHelper.loadAllItems(compound, stacks_);
while(stacks_.size() < NUM_OF_SLOTS) stacks_.add(ItemStack.EMPTY);
NonNullList<ItemStack> stacks = NonNullList.<ItemStack>withSize(NUM_OF_SLOTS, ItemStack.EMPTY);
ItemStackHelper.loadAllItems(compound, stacks);
while(stacks.size() < NUM_OF_SLOTS) stacks.add(ItemStack.EMPTY);
stacks_ = stacks;
energy_stored_ = compound.getInteger("Energy");
}
@ -436,7 +436,7 @@ public class BlockDecorWasteIncinerator extends BlockDecor
@Override
public ItemStack getStackInSlot(int index)
{ return (index < getSizeInventory()) ? stacks_.get(index) : ItemStack.EMPTY; }
{ return ((index >= 0) && (index < getSizeInventory())) ? stacks_.get(index) : ItemStack.EMPTY; }
@Override
public ItemStack decrStackSize(int index, int count)
@ -512,21 +512,27 @@ public class BlockDecorWasteIncinerator extends BlockDecor
// IEnergyStorage ----------------------------------------------------------------------------
@Override
public boolean canExtract()
{ return false; }
@Override
public boolean canReceive()
{ return true; }
@Override
public int getMaxEnergyStored()
{ return MAX_ENERGY_BUFFER; }
@Override
public int getEnergyStored()
{ return energy_stored_; }
@Override
public int extractEnergy(int maxExtract, boolean simulate)
{ return 0; }
@Override
public int receiveEnergy(int maxReceive, boolean simulate)
{
if(energy_stored_ >= MAX_ENERGY_BUFFER) return 0;

View file

@ -12,13 +12,13 @@
*/
package wile.engineersdecor.blocks;
import net.minecraft.tileentity.TileEntity;
import wile.engineersdecor.ModEngineersDecor;
import wile.engineersdecor.detail.ModAuxiliaries;
import wile.engineersdecor.detail.ModConfig;
import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.util.ResourceLocation;
@ -56,9 +56,9 @@ public class ModBlocks
public static final BlockDecorWall CONCRETE_WALL = new BlockDecorWall("concrete_wall", BlockDecor.CFG_DEFAULT, Material.ROCK, 5f, 20f, SoundType.STONE);
public static final BlockDecorLadder METAL_RUNG_LADDER = new BlockDecorLadder("metal_rung_ladder", 0, Material.IRON, 1.0f, 20f, SoundType.METAL);
public static final BlockDecorLadder METAL_RUNG_STEPS = new BlockDecorLadder("metal_rung_steps", 0, Material.IRON, 1.0f, 20f, SoundType.METAL);
public static final BlockDecorLadder TREATED_WOOD_LADDER = new BlockDecorLadder("treated_wood_ladder", 0, Material.WOOD, 1.0f, 10f, SoundType.WOOD);
public static final BlockDecorLadder METAL_RUNG_LADDER = new BlockDecorLadder("metal_rung_ladder", 0, Material.IRON, 0.5f, 20f, SoundType.METAL);
public static final BlockDecorLadder METAL_RUNG_STEPS = new BlockDecorLadder("metal_rung_steps", 0, Material.IRON, 0.5f, 20f, SoundType.METAL);
public static final BlockDecorLadder TREATED_WOOD_LADDER = new BlockDecorLadder("treated_wood_ladder", 0, Material.WOOD, 0.5f, 10f, SoundType.WOOD);
public static final BlockDecorGlassBlock PANZERGLASS_BLOCK = new BlockDecorGlassBlock("panzerglass_block", 0, Material.GLASS, 0.8f, 2000f, SoundType.GLASS);
@ -162,14 +162,15 @@ public class ModBlocks
public static final BlockDecorFurnace SMALL_LAB_FURNACE = new BlockDecorFurnace(
"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|
BlockDecor.CFG_ELECTRICAL,
Material.IRON, 0.35f, 15f, SoundType.METAL,
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,
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_HORIZIONTAL|BlockDecor.CFG_LOOK_PLACEMENT|BlockDecor.CFG_ELECTRICAL,
Material.IRON, 0.35f, 15f, SoundType.METAL,
ModAuxiliaries.getPixeledAABB(0,0,0, 16,16,16)
);
@ -243,7 +244,14 @@ public class ModBlocks
public static final BlockDecorWasteIncinerator SMALL_WASTE_INCINERATOR = new BlockDecorWasteIncinerator(
"small_waste_incinerator",
BlockDecor.CFG_DEFAULT,
BlockDecor.CFG_DEFAULT|BlockDecor.CFG_ELECTRICAL,
Material.IRON, 0.3f, 15f, SoundType.METAL,
ModAuxiliaries.getPixeledAABB(0,0,0, 16,16,16)
);
public static final BlockDecorDropper FACTORY_DROPPER = new BlockDecorDropper(
"factory_dropper",
BlockDecor.CFG_LOOK_PLACEMENT|BlockDecor.CFG_REDSTONE_CONTROLLED,
Material.IRON, 0.3f, 15f, SoundType.METAL,
ModAuxiliaries.getPixeledAABB(0,0,0, 16,16,16)
);
@ -277,6 +285,9 @@ public class ModBlocks
private static final TileEntityRegistrationData WASTE_INCINERATOR_TEI = new TileEntityRegistrationData(
BlockDecorWasteIncinerator.BTileEntity.class, "te_small_waste_incinerator"
);
private static final TileEntityRegistrationData FACTORY_DROPPER_TEI = new TileEntityRegistrationData(
BlockDecorDropper.BTileEntity.class, "te_factory_dropper"
);
//--------------------------------------------------------------------------------------------------------------------
//-- Registration list
@ -319,12 +330,13 @@ public class ModBlocks
STRAIGHT_CHECK_VALVE, STRAIGHT_REDSTONE_VALVE, STRAIGHT_REDSTONE_ANALOG_VALVE, STRAIGHT_PIPE_VALVE_TEI,
PASSIVE_FLUID_ACCUMULATOR, PASSIVE_FLUID_ACCUMULATOR_TEI,
SMALL_ELECTRICAL_FURNACE, SMALL_ELECTRICAL_FURNACE_TEI,
SIGN_HOTWIRE, SIGN_DANGER
SIGN_HOTWIRE, SIGN_DANGER,
SMALL_WASTE_INCINERATOR, WASTE_INCINERATOR_TEI,
};
private static final Object dev_content[] = {
SIGN_MINDSTEP,
SMALL_WASTE_INCINERATOR, WASTE_INCINERATOR_TEI
FACTORY_DROPPER, FACTORY_DROPPER_TEI
};
//--------------------------------------------------------------------------------------------------------------------
@ -346,7 +358,7 @@ public class ModBlocks
final boolean woor = ModConfig.isWithoutOptOutRegistration();
for(Object e:content) {
if(e instanceof Block) {
if((!woor) || (!ModConfig.isOptedOut((Block)e))) {
if((!woor) || (!ModConfig.isOptedOut((Block)e)) || (e==SIGN_MODLOGO)) {
registeredBlocks.add((Block) e);
} else {
++num_block_registrations_skipped;

View file

@ -118,11 +118,23 @@ public class ModConfig
@Config.Comment({"Disable check valve, and redstone controlled valves."})
@Config.Name("Without valves")
@Config.RequiresMcRestart
public boolean without_valves = false;
@Config.Comment({"Disable the passive fluid accumulator."})
@Config.Name("Without fluid accumulator")
@Config.RequiresMcRestart
public boolean without_passive_fluid_accumulator = false;
@Config.Comment({"Disable item disposal/trash/void incinerator device."})
@Config.Name("Without waste incinerator")
@Config.RequiresMcRestart
public boolean without_waste_incinerator = false;
@Config.Comment({"Disable decorative sign plates (caution, hazards, etc)."})
@Config.Name("Without signs")
@Config.RequiresMcRestart
public boolean without_sign_plates = false;
}
@Config.Comment({
@ -292,9 +304,11 @@ public class ModConfig
if(optout.without_lab_furnace && ((block instanceof BlockDecorFurnace)) && (!(block instanceof BlockDecorFurnaceElectrical))) return true;
if(optout.without_electrical_furnace && (block instanceof BlockDecorFurnaceElectrical)) return true;
if(optout.without_passive_fluid_accumulator && (block instanceof BlockDecorPassiveFluidAccumulator)) return true;
if(optout.without_waste_incinerator && (block instanceof BlockDecorWasteIncinerator)) return true;
if(optout.without_windows && rn.endsWith("_window")) return true;
if(optout.without_light_sources && rn.endsWith("_light")) return true;
if(optout.without_ladders && (block instanceof BlockDecorLadder)) return true;
if(optout.without_sign_plates && rn.startsWith("sign_")) return true;
if(optout.without_walls && rn.endsWith("_wall")) return true;
if(optout.without_stairs && rn.endsWith("_stairs")) return true;
if(optout.without_valves && rn.contains("_pipe_valve")) return true;

View file

@ -0,0 +1,12 @@
{
"forge_marker": 1,
"defaults": {
"model": "engineersdecor:device/factory_dropper_model"
},
"variants": {
"normal": [{}],
"inventory": [{}],
"facing": { "north":{"y":0}, "south":{"y":180}, "west":{"y":270}, "east":{"y":90}, "up": {"x":-90}, "down": {"x":90} },
"open": { "true":{}, "false":{} }
}
}

View file

@ -121,6 +121,9 @@ tile.engineersdecor.passive_fluid_accumulator.name=Passive Fluid Accumulator
tile.engineersdecor.passive_fluid_accumulator.help=§6Vacuum suction based fluid collector.§r Has one output, all other sides are input. \
Drains fluids from adjacent tanks when being drained from the output port by a pump.
#-----------------------------------------------------------------------------------------------------------
tile.engineersdecor.factory_dropper.name=Factory Dropper
tile.engineersdecor.factory_dropper.help=§6Dropper suitable for advanced factory automation.§r
#-----------------------------------------------------------------------------------------------------------
tile.engineersdecor.sign_decor.name=Sign Plate (Engineer's decor)
tile.engineersdecor.sign_decor.help=§6This should not be craftable or visible in JEI. Used for creative tab and screenshots.
tile.engineersdecor.sign_hotwire.name=Sign "Caution Hot Wire"

View file

@ -114,6 +114,9 @@ tile.engineersdecor.passive_fluid_accumulator.name=Passive fluid accumulator
#tile.engineersdecor.passive_fluid_accumulator.help=§6Vacuum suction based fluid collector.§r Has one output, all other sides are input. \
Drains fluids from adjacent tanks when being drained from the output port by a pump.
#-----------------------------------------------------------------------------------------------------------
tile.engineersdecor.factory_dropper.name=Factory dropper
#tile.engineersdecor.factory_dropper.help=§6Dropper suitable for advanced factory automation.§r
#-----------------------------------------------------------------------------------------------------------
tile.engineersdecor.sign_decor.name=Sign plate (Engineer's decor logo)
#tile.engineersdecor.sign_decor.help=§6This should not be craftable or visible in JEI. Used for creative tab and screenshots.
tile.engineersdecor.sign_hotwire.name=Sign "Caution hot wire"

View file

@ -0,0 +1,83 @@
{
"parent": "block/cube",
"textures": {
"top": "engineersdecor:blocks/device/factory_dropper_top",
"bottom": "engineersdecor:blocks/device/factory_dropper_bottom",
"side": "engineersdecor:blocks/device/factory_dropper_side",
"particle": "engineersdecor:blocks/device/factory_dropper_side"
},
"elements": [
{
"from": [0, 0, 2],
"to": [16, 16, 16],
"faces": {
"north": {"texture": "#bottom"},
"east": {"texture": "#side"},
"south": {"texture": "#top"},
"west": {"texture": "#side"},
"up": {"texture": "#side"},
"down": {"texture": "#side"}
}
},
{
"from": [12, 0, 0],
"to": [16, 16, 2],
"faces": {
"north": {"texture": "#bottom"},
"east": {"texture": "#side"},
"south": {"texture": "#top"},
"west": {"texture": "#side"},
"up": {"texture": "#side"},
"down": {"texture": "#side"}
}
},
{
"from": [0, 0, 0],
"to": [4, 16, 2],
"faces": {
"north": {"texture": "#bottom"},
"east": {"texture": "#side"},
"south": {"texture": "#top"},
"west": {"texture": "#side"},
"up": {"texture": "#side"},
"down": {"texture": "#side"}
}
},
{
"from": [4, 12, 0],
"to": [12, 16, 2],
"faces": {
"north": {"texture": "#bottom"},
"east": {"texture": "#side"},
"south": {"texture": "#top"},
"west": {"texture": "#side"},
"up": {"texture": "#side"},
"down": {"texture": "#side"}
}
},
{
"from": [4, 0, 0],
"to": [12, 4, 2],
"faces": {
"north": {"texture": "#bottom"},
"east": {"texture": "#side"},
"south": {"texture": "#top"},
"west": {"texture": "#side"},
"up": {"texture": "#side"},
"down": {"texture": "#side"}
}
}
],
"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

@ -225,6 +225,10 @@
"ingredient": { "item": "minecraft:furnace", "data": 0 },
"name": "itemFurnace"
},
{
"ingredient": { "item": "minecraft:dropper", "data": 0 },
"name": "itemDropper"
},
{
"ingredient": { "item": "minecraft:paper", "data": 0 },
"name": "paperAny"

View file

@ -0,0 +1,33 @@
{
"conditions": [
{
"type": "engineersdecor:grc",
"result": "engineersdecor:factory_dropper",
"required": ["immersiveengineering:material"]
}
],
"type": "minecraft:crafting_shaped",
"pattern": [
"WWW",
"WDW",
"WPW"
],
"key": {
"D": {
"item": "#itemDropper",
"data": 0
},
"P": {
"item": "#plateIron",
"data": 0
},
"W": {
"item": "#plankTreatedWood",
"data": 0
}
},
"result": {
"item": "engineersdecor:factory_dropper",
"count": 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 640 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 555 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 572 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

View file

@ -1,6 +1,7 @@
{
"homepage": "https://www.curseforge.com/minecraft/mc-mods/engineers-decor/",
"1.12.2": {
"1.0.6-b1": "[A] Added small waste incinerator (delayed fifo-buffered item disposal).\n[M] Fixed item/block name capitalization (by Voxelo).\n[M] Metal ladders are easier to break/harvest.",
"1.0.5": "[R] Release based on v1.0.5-b1. Release-to-release changes: * Small electrical passthrough-furnace added. * Passive fluid accumulator added. * Config options added. * Sign plates added. * Minor bug fixes.\n[A] Added sign \"Electrical hazzard\"/\"Caution hot wire\".\n[A] Added sign \"Caution dangerous there\" (skull/bones).",
"1.0.5-b1": "[A] Added passive fluid accumulator.\n[A] Added small electrical passthrough-furnace.\n[F] Fixed version check URL.\n[M] Opt-out config options for valves, passive fluid accumulator, and furni.",
"1.0.4": "[R] Release based on v1.0.4-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 pressurized transfer. * Tool tip documentation (CTRL-SHIFT) for stairs added. * Internal code cleanups. * Recipes tuned.\n[E] Added pass-through electrical furnace (experimental, see config).",
@ -45,7 +46,7 @@
},
"promos": {
"1.12.2-recommended": "1.0.5",
"1.12.2-latest": "1.0.5",
"1.12.2-latest": "1.0.6-b1",
"1.13.2-recommended": "",
"1.13.2-latest": "1.0.4-b3"
}