All your basin are output to us

- Added useful goggle information to chutes
- (0.3.0) Chutes can no longer carry a fan-like air stream
- Fixed chutes overwriting contained items when picking them up from below
- Basins can now push outputs to any open inventory
- Basin output can now be controlled using a wrench
This commit is contained in:
simibubi 2020-11-27 01:37:22 +01:00
parent d5ddb476c5
commit b2e74463e3
18 changed files with 301 additions and 137 deletions

View file

@ -394,16 +394,16 @@ a3a11524cd3515fc01d905767b4b7ea782adaf03 assets/create/blockstates/yellow_seat.j
7f39521b211441f5c3e06d60c5978cebe16cacfb assets/create/blockstates/zinc_block.json
b7181bcd8182b2f17088e5aa881f374c9c65470c assets/create/blockstates/zinc_ore.json
67f9a92292948241e01ce6043445b2b3ddcf5350 assets/create/lang/en_ud.json
ea9f7788b7cae3ddd4ba1ae74c54f558d6b3f584 assets/create/lang/en_us.json
d2741d202f1b76c0c57fbd25d5f35cfab258edb0 assets/create/lang/unfinished/de_de.json
ce08c4a4163e667a5c20dfd241cb56b0ff5d064e assets/create/lang/unfinished/fr_fr.json
6fe663867f28389fdac5ac75a12089ca7279a0cb assets/create/lang/unfinished/it_it.json
28b1bbb303a20f43266ae089b5d8b920523ee854 assets/create/lang/unfinished/ja_jp.json
cfc50d41b77b5dfeb49da61b95496a65b3d71169 assets/create/lang/unfinished/ko_kr.json
9f9e817483a92c960db5a6cdd30e0c9e0ac0b2f3 assets/create/lang/unfinished/nl_nl.json
6d638fa512c863203ff7207c9a68782ba4fd9997 assets/create/lang/unfinished/pt_br.json
0dc96a32325dc79e7f0cf980a7011475aa22ecc3 assets/create/lang/unfinished/ru_ru.json
311937a993d6c186ba4c433cd7befca8e4da6d89 assets/create/lang/unfinished/zh_cn.json
79560607a2c0adb5aee4e55dc5b1976136968b72 assets/create/lang/en_us.json
cd2dd93ca311499263387c5780ad08bc2351bb35 assets/create/lang/unfinished/de_de.json
e4a404357a223f97225651bdc35ef903f72abad4 assets/create/lang/unfinished/fr_fr.json
45b3eb5e4b3ad1dab08f5eeb87ffabe67fb42c34 assets/create/lang/unfinished/it_it.json
1b6513cb8880f8b02180c89857789851426e0888 assets/create/lang/unfinished/ja_jp.json
a1ca7668181dc77f04e637cc709cde8015246b10 assets/create/lang/unfinished/ko_kr.json
490f27bd5fe2c421f0d8e8b1dbd939f36a6ea147 assets/create/lang/unfinished/nl_nl.json
f885cbe3cdf420406bd9baa3ee06b2eaf44ee195 assets/create/lang/unfinished/pt_br.json
91a06ec754fb97031f70b09253f1ce7a12b7aadf assets/create/lang/unfinished/ru_ru.json
413c285cacf4484d1ff5f2b6b70a8d23595333e4 assets/create/lang/unfinished/zh_cn.json
846200eb548d3bfa2e77b41039de159b4b6cfb45 assets/create/models/block/acacia_window.json
1930fa3a3c98d53dd19e4ee7f55bc27fd47aa281 assets/create/models/block/acacia_window_pane_noside.json
1763ea2c9b981d187f5031ba608f3d5d3be3986a assets/create/models/block/acacia_window_pane_noside_alt.json

View file

@ -974,6 +974,15 @@
"create.tunnel.selection_mode.randomize": "Randomize",
"create.tunnel.selection_mode.synchronize": "Synchronize Inputs",
"create.tooltip.chute.header": "Chute Information",
"create.tooltip.chute.items_move_down": "Items move Downward",
"create.tooltip.chute.items_move_up": "Items move Upward",
"create.tooltip.chute.no_fans_attached": "No attached fans",
"create.tooltip.chute.fans_push_up": "Fans push from Below",
"create.tooltip.chute.fans_push_down": "Fans push from Above",
"create.tooltip.chute.fans_pull_up": "Fans pull from Above",
"create.tooltip.chute.fans_pull_down": "Fans pull from Below",
"create.hint.mechanical_arm_no_targets.title": "No Targets",
"create.hint.mechanical_arm_no_targets": "It appears this _Mechanical_ _Arm_ has not been assigned any _targets._ Select belts, depots, funnels and other blocks by _right-clicking_ them while _holding_ the _Mechanical_ _Arm_ in your _hand_.",
"create.hint.horizontal_funnel.title": "Horizontal Funnels",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 1043",
"_": "Missing Localizations: 1051",
"_": "->------------------------] Game Elements [------------------------<-",
@ -975,6 +975,15 @@
"create.tunnel.selection_mode.randomize": "UNLOCALIZED: Randomize",
"create.tunnel.selection_mode.synchronize": "UNLOCALIZED: Synchronize Inputs",
"create.tooltip.chute.header": "UNLOCALIZED: Chute Information",
"create.tooltip.chute.items_move_down": "UNLOCALIZED: Items move Downward",
"create.tooltip.chute.items_move_up": "UNLOCALIZED: Items move Upward",
"create.tooltip.chute.no_fans_attached": "UNLOCALIZED: No attached fans",
"create.tooltip.chute.fans_push_up": "UNLOCALIZED: Fans push from Below",
"create.tooltip.chute.fans_push_down": "UNLOCALIZED: Fans push from Above",
"create.tooltip.chute.fans_pull_up": "UNLOCALIZED: Fans pull from Above",
"create.tooltip.chute.fans_pull_down": "UNLOCALIZED: Fans pull from Below",
"create.hint.mechanical_arm_no_targets.title": "UNLOCALIZED: No Targets",
"create.hint.mechanical_arm_no_targets": "UNLOCALIZED: It appears this _Mechanical_ _Arm_ has not been assigned any _targets._ Select belts, depots, funnels and other blocks by _right-clicking_ them while _holding_ the _Mechanical_ _Arm_ in your _hand_.",
"create.hint.horizontal_funnel.title": "UNLOCALIZED: Horizontal Funnels",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 672",
"_": "Missing Localizations: 680",
"_": "->------------------------] Game Elements [------------------------<-",
@ -975,6 +975,15 @@
"create.tunnel.selection_mode.randomize": "UNLOCALIZED: Randomize",
"create.tunnel.selection_mode.synchronize": "UNLOCALIZED: Synchronize Inputs",
"create.tooltip.chute.header": "UNLOCALIZED: Chute Information",
"create.tooltip.chute.items_move_down": "UNLOCALIZED: Items move Downward",
"create.tooltip.chute.items_move_up": "UNLOCALIZED: Items move Upward",
"create.tooltip.chute.no_fans_attached": "UNLOCALIZED: No attached fans",
"create.tooltip.chute.fans_push_up": "UNLOCALIZED: Fans push from Below",
"create.tooltip.chute.fans_push_down": "UNLOCALIZED: Fans push from Above",
"create.tooltip.chute.fans_pull_up": "UNLOCALIZED: Fans pull from Above",
"create.tooltip.chute.fans_pull_down": "UNLOCALIZED: Fans pull from Below",
"create.hint.mechanical_arm_no_targets.title": "UNLOCALIZED: No Targets",
"create.hint.mechanical_arm_no_targets": "UNLOCALIZED: It appears this _Mechanical_ _Arm_ has not been assigned any _targets._ Select belts, depots, funnels and other blocks by _right-clicking_ them while _holding_ the _Mechanical_ _Arm_ in your _hand_.",
"create.hint.horizontal_funnel.title": "UNLOCALIZED: Horizontal Funnels",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 656",
"_": "Missing Localizations: 664",
"_": "->------------------------] Game Elements [------------------------<-",
@ -975,6 +975,15 @@
"create.tunnel.selection_mode.randomize": "UNLOCALIZED: Randomize",
"create.tunnel.selection_mode.synchronize": "UNLOCALIZED: Synchronize Inputs",
"create.tooltip.chute.header": "UNLOCALIZED: Chute Information",
"create.tooltip.chute.items_move_down": "UNLOCALIZED: Items move Downward",
"create.tooltip.chute.items_move_up": "UNLOCALIZED: Items move Upward",
"create.tooltip.chute.no_fans_attached": "UNLOCALIZED: No attached fans",
"create.tooltip.chute.fans_push_up": "UNLOCALIZED: Fans push from Below",
"create.tooltip.chute.fans_push_down": "UNLOCALIZED: Fans push from Above",
"create.tooltip.chute.fans_pull_up": "UNLOCALIZED: Fans pull from Above",
"create.tooltip.chute.fans_pull_down": "UNLOCALIZED: Fans pull from Below",
"create.hint.mechanical_arm_no_targets.title": "UNLOCALIZED: No Targets",
"create.hint.mechanical_arm_no_targets": "UNLOCALIZED: It appears this _Mechanical_ _Arm_ has not been assigned any _targets._ Select belts, depots, funnels and other blocks by _right-clicking_ them while _holding_ the _Mechanical_ _Arm_ in your _hand_.",
"create.hint.horizontal_funnel.title": "UNLOCALIZED: Horizontal Funnels",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 655",
"_": "Missing Localizations: 663",
"_": "->------------------------] Game Elements [------------------------<-",
@ -975,6 +975,15 @@
"create.tunnel.selection_mode.randomize": "UNLOCALIZED: Randomize",
"create.tunnel.selection_mode.synchronize": "UNLOCALIZED: Synchronize Inputs",
"create.tooltip.chute.header": "UNLOCALIZED: Chute Information",
"create.tooltip.chute.items_move_down": "UNLOCALIZED: Items move Downward",
"create.tooltip.chute.items_move_up": "UNLOCALIZED: Items move Upward",
"create.tooltip.chute.no_fans_attached": "UNLOCALIZED: No attached fans",
"create.tooltip.chute.fans_push_up": "UNLOCALIZED: Fans push from Below",
"create.tooltip.chute.fans_push_down": "UNLOCALIZED: Fans push from Above",
"create.tooltip.chute.fans_pull_up": "UNLOCALIZED: Fans pull from Above",
"create.tooltip.chute.fans_pull_down": "UNLOCALIZED: Fans pull from Below",
"create.hint.mechanical_arm_no_targets.title": "UNLOCALIZED: No Targets",
"create.hint.mechanical_arm_no_targets": "UNLOCALIZED: It appears this _Mechanical_ _Arm_ has not been assigned any _targets._ Select belts, depots, funnels and other blocks by _right-clicking_ them while _holding_ the _Mechanical_ _Arm_ in your _hand_.",
"create.hint.horizontal_funnel.title": "UNLOCALIZED: Horizontal Funnels",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 656",
"_": "Missing Localizations: 664",
"_": "->------------------------] Game Elements [------------------------<-",
@ -975,6 +975,15 @@
"create.tunnel.selection_mode.randomize": "UNLOCALIZED: Randomize",
"create.tunnel.selection_mode.synchronize": "UNLOCALIZED: Synchronize Inputs",
"create.tooltip.chute.header": "UNLOCALIZED: Chute Information",
"create.tooltip.chute.items_move_down": "UNLOCALIZED: Items move Downward",
"create.tooltip.chute.items_move_up": "UNLOCALIZED: Items move Upward",
"create.tooltip.chute.no_fans_attached": "UNLOCALIZED: No attached fans",
"create.tooltip.chute.fans_push_up": "UNLOCALIZED: Fans push from Below",
"create.tooltip.chute.fans_push_down": "UNLOCALIZED: Fans push from Above",
"create.tooltip.chute.fans_pull_up": "UNLOCALIZED: Fans pull from Above",
"create.tooltip.chute.fans_pull_down": "UNLOCALIZED: Fans pull from Below",
"create.hint.mechanical_arm_no_targets.title": "UNLOCALIZED: No Targets",
"create.hint.mechanical_arm_no_targets": "UNLOCALIZED: It appears this _Mechanical_ _Arm_ has not been assigned any _targets._ Select belts, depots, funnels and other blocks by _right-clicking_ them while _holding_ the _Mechanical_ _Arm_ in your _hand_.",
"create.hint.horizontal_funnel.title": "UNLOCALIZED: Horizontal Funnels",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 984",
"_": "Missing Localizations: 992",
"_": "->------------------------] Game Elements [------------------------<-",
@ -975,6 +975,15 @@
"create.tunnel.selection_mode.randomize": "UNLOCALIZED: Randomize",
"create.tunnel.selection_mode.synchronize": "UNLOCALIZED: Synchronize Inputs",
"create.tooltip.chute.header": "UNLOCALIZED: Chute Information",
"create.tooltip.chute.items_move_down": "UNLOCALIZED: Items move Downward",
"create.tooltip.chute.items_move_up": "UNLOCALIZED: Items move Upward",
"create.tooltip.chute.no_fans_attached": "UNLOCALIZED: No attached fans",
"create.tooltip.chute.fans_push_up": "UNLOCALIZED: Fans push from Below",
"create.tooltip.chute.fans_push_down": "UNLOCALIZED: Fans push from Above",
"create.tooltip.chute.fans_pull_up": "UNLOCALIZED: Fans pull from Above",
"create.tooltip.chute.fans_pull_down": "UNLOCALIZED: Fans pull from Below",
"create.hint.mechanical_arm_no_targets.title": "UNLOCALIZED: No Targets",
"create.hint.mechanical_arm_no_targets": "UNLOCALIZED: It appears this _Mechanical_ _Arm_ has not been assigned any _targets._ Select belts, depots, funnels and other blocks by _right-clicking_ them while _holding_ the _Mechanical_ _Arm_ in your _hand_.",
"create.hint.horizontal_funnel.title": "UNLOCALIZED: Horizontal Funnels",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 1050",
"_": "Missing Localizations: 1058",
"_": "->------------------------] Game Elements [------------------------<-",
@ -975,6 +975,15 @@
"create.tunnel.selection_mode.randomize": "UNLOCALIZED: Randomize",
"create.tunnel.selection_mode.synchronize": "UNLOCALIZED: Synchronize Inputs",
"create.tooltip.chute.header": "UNLOCALIZED: Chute Information",
"create.tooltip.chute.items_move_down": "UNLOCALIZED: Items move Downward",
"create.tooltip.chute.items_move_up": "UNLOCALIZED: Items move Upward",
"create.tooltip.chute.no_fans_attached": "UNLOCALIZED: No attached fans",
"create.tooltip.chute.fans_push_up": "UNLOCALIZED: Fans push from Below",
"create.tooltip.chute.fans_push_down": "UNLOCALIZED: Fans push from Above",
"create.tooltip.chute.fans_pull_up": "UNLOCALIZED: Fans pull from Above",
"create.tooltip.chute.fans_pull_down": "UNLOCALIZED: Fans pull from Below",
"create.hint.mechanical_arm_no_targets.title": "UNLOCALIZED: No Targets",
"create.hint.mechanical_arm_no_targets": "UNLOCALIZED: It appears this _Mechanical_ _Arm_ has not been assigned any _targets._ Select belts, depots, funnels and other blocks by _right-clicking_ them while _holding_ the _Mechanical_ _Arm_ in your _hand_.",
"create.hint.horizontal_funnel.title": "UNLOCALIZED: Horizontal Funnels",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 325",
"_": "Missing Localizations: 333",
"_": "->------------------------] Game Elements [------------------------<-",
@ -975,6 +975,15 @@
"create.tunnel.selection_mode.randomize": "UNLOCALIZED: Randomize",
"create.tunnel.selection_mode.synchronize": "UNLOCALIZED: Synchronize Inputs",
"create.tooltip.chute.header": "UNLOCALIZED: Chute Information",
"create.tooltip.chute.items_move_down": "UNLOCALIZED: Items move Downward",
"create.tooltip.chute.items_move_up": "UNLOCALIZED: Items move Upward",
"create.tooltip.chute.no_fans_attached": "UNLOCALIZED: No attached fans",
"create.tooltip.chute.fans_push_up": "UNLOCALIZED: Fans push from Below",
"create.tooltip.chute.fans_push_down": "UNLOCALIZED: Fans push from Above",
"create.tooltip.chute.fans_pull_up": "UNLOCALIZED: Fans pull from Above",
"create.tooltip.chute.fans_pull_down": "UNLOCALIZED: Fans pull from Below",
"create.hint.mechanical_arm_no_targets.title": "UNLOCALIZED: No Targets",
"create.hint.mechanical_arm_no_targets": "UNLOCALIZED: It appears this _Mechanical_ _Arm_ has not been assigned any _targets._ Select belts, depots, funnels and other blocks by _right-clicking_ them while _holding_ the _Mechanical_ _Arm_ in your _hand_.",
"create.hint.horizontal_funnel.title": "UNLOCALIZED: Horizontal Funnels",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 338",
"_": "Missing Localizations: 346",
"_": "->------------------------] Game Elements [------------------------<-",
@ -975,6 +975,15 @@
"create.tunnel.selection_mode.randomize": "UNLOCALIZED: Randomize",
"create.tunnel.selection_mode.synchronize": "UNLOCALIZED: Synchronize Inputs",
"create.tooltip.chute.header": "UNLOCALIZED: Chute Information",
"create.tooltip.chute.items_move_down": "UNLOCALIZED: Items move Downward",
"create.tooltip.chute.items_move_up": "UNLOCALIZED: Items move Upward",
"create.tooltip.chute.no_fans_attached": "UNLOCALIZED: No attached fans",
"create.tooltip.chute.fans_push_up": "UNLOCALIZED: Fans push from Below",
"create.tooltip.chute.fans_push_down": "UNLOCALIZED: Fans push from Above",
"create.tooltip.chute.fans_pull_up": "UNLOCALIZED: Fans pull from Above",
"create.tooltip.chute.fans_pull_down": "UNLOCALIZED: Fans pull from Below",
"create.hint.mechanical_arm_no_targets.title": "UNLOCALIZED: No Targets",
"create.hint.mechanical_arm_no_targets": "UNLOCALIZED: It appears this _Mechanical_ _Arm_ has not been assigned any _targets._ Select belts, depots, funnels and other blocks by _right-clicking_ them while _holding_ the _Mechanical_ _Arm_ in your _hand_.",
"create.hint.horizontal_funnel.title": "UNLOCALIZED: Horizontal Funnels",

View file

@ -142,7 +142,7 @@ public class ItemDrainRenderer extends SmartTileEntityRenderer<ItemDrainTileEnti
.getValue(partialTicks);
if (!fluidStack.isEmpty() && level != 0) {
float yMin = 4f / 16f;
float yMin = 5f / 16f;
float min = 2f / 16f;
float max = min + (12 / 16f);
float yOffset = (8 / 16f) * level;

View file

@ -10,15 +10,14 @@ import com.simibubi.create.foundation.block.ITE;
import com.simibubi.create.foundation.fluid.FluidHelper;
import com.simibubi.create.foundation.item.ItemHelper;
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
import com.simibubi.create.foundation.tileEntity.behaviour.belt.DirectBeltInputBehaviour;
import com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringBehaviour;
import com.simibubi.create.foundation.utility.Iterate;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.ItemEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.BlockItemUseContext;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUseContext;
import net.minecraft.state.DirectionProperty;
@ -73,7 +72,9 @@ public class BasinBlock extends Block implements ITE<BasinTileEntity>, IWrenchab
@Override
public ActionResultType onWrenched(BlockState state, ItemUseContext context) {
return ActionResultType.FAIL;
if (!context.getWorld().isRemote)
withTileEntityDo(context.getWorld(), context.getPos(), bte -> bte.onWrenched(context.getFace()));
return ActionResultType.SUCCESS;
}
@Override
@ -142,11 +143,6 @@ public class BasinBlock extends Block implements ITE<BasinTileEntity>, IWrenchab
return AllShapes.BASIN_BLOCK_SHAPE;
}
@Override
public void onBlockAdded(BlockState state, World world, BlockPos pos, BlockState p_220082_4_, boolean p_220082_5_) {
updateDiagonalNeighbours(state, world, pos);
}
@Override
public VoxelShape getCollisionShape(BlockState state, IBlockReader reader, BlockPos pos, ISelectionContext ctx) {
if (ctx.getEntity() instanceof ItemEntity)
@ -156,7 +152,6 @@ public class BasinBlock extends Block implements ITE<BasinTileEntity>, IWrenchab
@Override
public void onReplaced(BlockState state, World worldIn, BlockPos pos, BlockState newState, boolean isMoving) {
updateDiagonalNeighbours(state, worldIn, pos);
if (!state.hasTileEntity() || state.getBlock() == newState.getBlock())
return;
TileEntityBehaviour.destroy(worldIn, pos, FilteringBehaviour.TYPE);
@ -186,35 +181,14 @@ public class BasinBlock extends Block implements ITE<BasinTileEntity>, IWrenchab
return BasinTileEntity.class;
}
@Override
public BlockState getStateForPlacement(BlockItemUseContext ctx) {
BlockState state = super.getStateForPlacement(ctx);
World world = ctx.getWorld();
BlockPos pos = ctx.getPos();
return updateDiagonalState(state, world, pos);
}
protected void updateDiagonalNeighbours(BlockState state, World world, BlockPos pos) {
for (Direction direction : Iterate.horizontalDirections) {
BlockPos toUpdate = pos.up()
public static boolean canOutputTo(IBlockReader world, BlockPos basinPos, Direction direction) {
BlockPos offset = basinPos.down()
.offset(direction);
BlockState stateToUpdate = world.getBlockState(toUpdate);
BlockState updated = updateDiagonalState(stateToUpdate, world, toUpdate);
if (stateToUpdate != updated && !world.isRemote)
world.setBlockState(toUpdate, updated);
}
}
public static BlockState updateDiagonalState(BlockState state, IBlockReader world, BlockPos pos) {
if (!(state.getBlock() instanceof BasinBlock))
return state;
for (Direction direction : Iterate.horizontalDirections) {
BlockState diagonaloutputBasin = world.getBlockState(pos.down()
.offset(direction));
if (diagonaloutputBasin.getBlock() instanceof BasinBlock)
return state.with(FACING, direction);
}
return state.with(FACING, Direction.DOWN);
DirectBeltInputBehaviour directBeltInputBehaviour =
TileEntityBehaviour.get(world, offset, DirectBeltInputBehaviour.TYPE);
if (directBeltInputBehaviour != null)
return directBeltInputBehaviour.canInsertFromSide(direction);
return false;
}
}

View file

@ -107,8 +107,17 @@ public class BasinRenderer extends SmartTileEntityRenderer<BasinTileEntity> {
.add(directionVec.scale(.55)
.subtract(0, 1 / 2f, 0));
boolean outToBasin = basin.getWorld()
.getBlockState(basin.getPos()
.offset(direction))
.getBlock() instanceof BasinBlock;
for (IntAttached<ItemStack> intAttached : basin.visualizedOutputItems) {
float progress = 1 - (intAttached.getFirst() - partialTicks) / BasinTileEntity.OUTPUT_ANIMATION_TIME;
if (!outToBasin && progress > .35f)
continue;
ms.push();
MatrixStacker.of(ms)
.translate(outVec)

View file

@ -36,6 +36,8 @@ import com.simibubi.create.foundation.utility.VecHelper;
import net.minecraft.block.BlockState;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.ListNBT;
import net.minecraft.nbt.StringNBT;
import net.minecraft.particles.IParticleData;
import net.minecraft.tileentity.ITickableTileEntity;
import net.minecraft.tileentity.TileEntity;
@ -79,6 +81,9 @@ public class BasinTileEntity extends SmartTileEntity implements ITickableTileEnt
protected LazyOptional<IItemHandlerModifiable> itemCapability;
protected LazyOptional<IFluidHandler> fluidCapability;
List<Direction> disabledSpoutputs;
Direction preferredSpoutput;
public static final int OUTPUT_ANIMATION_TIME = 10;
List<IntAttached<ItemStack>> visualizedOutputItems;
List<IntAttached<FluidStack>> visualizedOutputFluids;
@ -100,6 +105,8 @@ public class BasinTileEntity extends SmartTileEntity implements ITickableTileEnt
tanks = Couple.create(inputTank, outputTank);
visualizedOutputItems = Collections.synchronizedList(new ArrayList<>());
visualizedOutputFluids = Collections.synchronizedList(new ArrayList<>());
disabledSpoutputs = new ArrayList<>();
preferredSpoutput = null;
}
@Override
@ -129,6 +136,13 @@ public class BasinTileEntity extends SmartTileEntity implements ITickableTileEnt
inputInventory.deserializeNBT(compound.getCompound("InputItems"));
outputInventory.deserializeNBT(compound.getCompound("OutputItems"));
preferredSpoutput = null;
if (compound.contains("PreferredSpoutput"))
preferredSpoutput = NBTHelper.readEnum(compound, "PreferredSpoutput", Direction.class);
disabledSpoutputs.clear();
ListNBT disabledList = compound.getList("DisabledSpoutput", NBT.TAG_STRING);
disabledList.forEach(d -> disabledSpoutputs.add(Direction.valueOf(((StringNBT) d).getString())));
if (!clientPacket)
return;
@ -145,6 +159,12 @@ public class BasinTileEntity extends SmartTileEntity implements ITickableTileEnt
compound.put("InputItems", inputInventory.serializeNBT());
compound.put("OutputItems", outputInventory.serializeNBT());
if (preferredSpoutput != null)
NBTHelper.writeEnum(compound, "PreferredSpoutput", preferredSpoutput);
ListNBT disabledList = new ListNBT();
disabledSpoutputs.forEach(d -> disabledList.add(StringNBT.of(d.name())));
compound.put("DisabledSpoutput", disabledList);
if (!clientPacket)
return;
@ -186,8 +206,10 @@ public class BasinTileEntity extends SmartTileEntity implements ITickableTileEnt
@Override
public void lazyTick() {
super.lazyTick();
updateSpoutput();
if (!world.isRemote)
return;
TileEntity tileEntity = world.getTileEntity(pos.up(2));
if (!(tileEntity instanceof MechanicalMixerTileEntity)) {
setAreFluidsMoving(false);
@ -197,6 +219,45 @@ public class BasinTileEntity extends SmartTileEntity implements ITickableTileEnt
setAreFluidsMoving(mixer.running && mixer.runningTicks <= 20);
}
public void onWrenched(Direction face) {
BlockState blockState = getBlockState();
Direction currentFacing = blockState.get(BasinBlock.FACING);
disabledSpoutputs.remove(face);
if (currentFacing == face) {
if (preferredSpoutput == face)
preferredSpoutput = null;
disabledSpoutputs.add(face);
} else
preferredSpoutput = face;
updateSpoutput();
}
private void updateSpoutput() {
if (world.isRemote)
return;
BlockState blockState = getBlockState();
Direction currentFacing = blockState.get(BasinBlock.FACING);
if (currentFacing != Direction.DOWN)
notifyChangeOfContents();
Direction newFacing = Direction.DOWN;
for (Direction test : Iterate.horizontalDirections) {
boolean canOutputTo = BasinBlock.canOutputTo(world, pos, test);
if (canOutputTo && !disabledSpoutputs.contains(test))
newFacing = test;
}
if (preferredSpoutput != null && BasinBlock.canOutputTo(world, pos, preferredSpoutput))
newFacing = preferredSpoutput;
if (newFacing != currentFacing)
world.setBlockState(pos, blockState.with(BasinBlock.FACING, newFacing));
}
@Override
public void tick() {
super.tick();
@ -309,15 +370,15 @@ public class BasinTileEntity extends SmartTileEntity implements ITickableTileEnt
// Output basin, try moving items to it
TileEntity te = world.getTileEntity(pos.down()
.offset(direction));
if (!(te instanceof BasinTileEntity))
if (te == null)
return false;
targetInv = te.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY)
targetInv = te.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, direction.getOpposite())
.orElse(null);
targetTank = te.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY)
targetTank = te.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, direction.getOpposite())
.orElse(null);
}
if (targetInv == null)
if (targetInv == null && !outputItems.isEmpty())
return false;
for (ItemStack itemStack : outputItems)
if (!ItemHandlerHelper.insertItemStacked(targetInv, itemStack.copy(), simulate)
@ -326,14 +387,21 @@ public class BasinTileEntity extends SmartTileEntity implements ITickableTileEnt
else if (!simulate)
visualizedOutputItems.add(IntAttached.withZero(itemStack));
if (outputFluids.isEmpty())
return true;
if (targetTank == null)
return false;
for (FluidStack fluidStack : outputFluids)
if (targetTank.fill(fluidStack.copy(), simulate ? FluidAction.SIMULATE : FluidAction.EXECUTE) != fluidStack
.getAmount())
for (FluidStack fluidStack : outputFluids) {
FluidAction action = simulate ? FluidAction.SIMULATE : FluidAction.EXECUTE;
int fill = targetTank instanceof SmartFluidTankBehaviour.InternalFluidHandler
? ((SmartFluidTankBehaviour.InternalFluidHandler) targetTank).forceFill(fluidStack.copy(), action)
: targetTank.fill(fluidStack.copy(), action);
if (fill != fluidStack.getAmount())
return false;
else if (!simulate)
visualizedOutputFluids.add(IntAttached.withZero(fluidStack));
}
return true;
}

View file

@ -11,7 +11,6 @@ import com.simibubi.create.Create;
import com.simibubi.create.content.contraptions.components.fan.AirCurrent;
import com.simibubi.create.content.contraptions.components.fan.EncasedFanBlock;
import com.simibubi.create.content.contraptions.components.fan.EncasedFanTileEntity;
import com.simibubi.create.content.contraptions.components.fan.IAirCurrentSource;
import com.simibubi.create.content.contraptions.goggles.IHaveGoggleInformation;
import com.simibubi.create.content.contraptions.particle.AirParticleData;
import com.simibubi.create.content.logistics.block.chute.ChuteBlock.Shape;
@ -28,6 +27,7 @@ import com.simibubi.create.foundation.tileEntity.behaviour.belt.TransportedItemS
import com.simibubi.create.foundation.tileEntity.behaviour.belt.TransportedItemStackHandlerBehaviour.TransportedResult;
import com.simibubi.create.foundation.utility.BlockHelper;
import com.simibubi.create.foundation.utility.Iterate;
import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.foundation.utility.VecHelper;
import mcp.MethodsReturnNonnullByDefault;
@ -47,7 +47,6 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.World;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.items.CapabilityItemHandler;
@ -56,9 +55,13 @@ import net.minecraftforge.items.ItemHandlerHelper;
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
public class ChuteTileEntity extends SmartTileEntity implements IHaveGoggleInformation, IAirCurrentSource {
/*
* Commented Code: Chutes create air streams and act similarly to encased fans
* (Unfinished)
*/
public class ChuteTileEntity extends SmartTileEntity implements IHaveGoggleInformation { // , IAirCurrentSource {
public AirCurrent airCurrent;
// public AirCurrent airCurrent;
float pull;
float push;
@ -70,11 +73,11 @@ public class ChuteTileEntity extends SmartTileEntity implements IHaveGoggleInfor
boolean canPickUpItems;
float bottomPullDistance;
float beltBelowOffset;
TransportedItemStackHandlerBehaviour beltBelow;
boolean updateAirFlow;
int airCurrentUpdateCooldown;
int entitySearchCooldown;
boolean updateAirFlow;
TransportedItemStackHandlerBehaviour beltBelow;
float beltBelowOffset;
LazyOptional<IItemHandler> capAbove;
LazyOptional<IItemHandler> capBelow;
@ -89,12 +92,10 @@ public class ChuteTileEntity extends SmartTileEntity implements IHaveGoggleInfor
capAbove = LazyOptional.empty();
capBelow = LazyOptional.empty();
bottomPullDistance = 0;
airCurrent = new AirCurrent(this);
// airCurrent = new AirCurrent(this);
updateAirFlow = true;
}
@Override
public void addBehaviours(List<TileEntityBehaviour> behaviours) {
behaviours.add(new DirectBeltInputBehaviour(this).onlyInsertWhen((d) -> canDirectlyInsertCached()));
@ -177,7 +178,7 @@ public class ChuteTileEntity extends SmartTileEntity implements IHaveGoggleInfor
private void updateAirFlow(float itemSpeed) {
updateAirFlow = false;
airCurrent.rebuild();
// airCurrent.rebuild();
if (itemSpeed > 0 && world != null && !world.isRemote) {
float speed = pull - push;
beltBelow = null;
@ -213,8 +214,8 @@ public class ChuteTileEntity extends SmartTileEntity implements IHaveGoggleInfor
}
private void findEntities(float itemSpeed) {
if (getSpeed() != 0)
airCurrent.findEntities();
// if (getSpeed() != 0)
// airCurrent.findEntities();
if (bottomPullDistance <= 0 && !getItem().isEmpty() || itemSpeed <= 0 || world == null || world.isRemote)
return;
Vec3d center = VecHelper.getCenterOf(pos);
@ -254,14 +255,14 @@ public class ChuteTileEntity extends SmartTileEntity implements IHaveGoggleInfor
updateAirFlow(itemSpeed);
}
if (entitySearchCooldown-- <= 0) {
if (entitySearchCooldown-- <= 0 && item.isEmpty()) {
entitySearchCooldown = 5;
findEntities(itemSpeed);
}
extractFromBelt(itemSpeed);
if (getSpeed() != 0)
airCurrent.tick();
// if (getSpeed() != 0)
// airCurrent.tick();
}
public void blockBelowChanged() {
@ -319,16 +320,14 @@ public class ChuteTileEntity extends SmartTileEntity implements IHaveGoggleInfor
if (!capAbove.isPresent())
capAbove = grabCapability(Direction.UP);
if (capAbove.isPresent())
item =
ItemHelper.extract(capAbove.orElse(null), stack -> true, ExtractionCountMode.UPTO, 16, false);
item = ItemHelper.extract(capAbove.orElse(null), stack -> true, ExtractionCountMode.UPTO, 16, false);
}
private void handleInputFromBelow() {
if (!capBelow.isPresent())
capBelow = grabCapability(Direction.DOWN);
if (capBelow.isPresent())
item =
ItemHelper.extract(capBelow.orElse(null), stack -> true, ExtractionCountMode.UPTO, 16, false);
item = ItemHelper.extract(capBelow.orElse(null), stack -> true, ExtractionCountMode.UPTO, 16, false);
}
private boolean handleDownwardOutput(boolean simulate) {
@ -505,9 +504,11 @@ public class ChuteTileEntity extends SmartTileEntity implements IHaveGoggleInfor
pull = compound.getFloat("Pull");
push = compound.getFloat("Push");
bottomPullDistance = compound.getFloat("BottomAirFlowDistance");
super.read(compound, clientPacket);
if (clientPacket)
airCurrent.rebuild();
// if (clientPacket)
// airCurrent.rebuild();
if (hasWorld() && world != null && world.isRemote && !previousItem.equals(item, false) && !item.isEmpty()) {
if (world.rand.nextInt(3) != 0)
@ -667,9 +668,18 @@ public class ChuteTileEntity extends SmartTileEntity implements IHaveGoggleInfor
@Override
public boolean addToGoggleTooltip(List<String> tooltip, boolean isPlayerSneaking) {
tooltip.add(spacing + TextFormatting.GOLD + "Pull: " + TextFormatting.WHITE + pull);
tooltip.add(spacing + TextFormatting.GOLD + "Push: " + TextFormatting.WHITE + push);
tooltip.add(TextFormatting.YELLOW + "-> Item Motion: " + TextFormatting.WHITE + getItemMotion());
boolean downward = getItemMotion() < 0;
tooltip.add(spacing + Lang.translate("tooltip.chute.header"));
if (pull == 0 && push == 0)
tooltip.add(spacing + TextFormatting.GRAY + Lang.translate("tooltip.chute.no_fans_attached"));
if (pull != 0)
tooltip.add(spacing + TextFormatting.GRAY
+ Lang.translate("tooltip.chute.fans_" + (pull > 0 ? "pull_up" : "push_down")));
if (push != 0)
tooltip.add(spacing + TextFormatting.GRAY
+ Lang.translate("tooltip.chute.fans_" + (push > 0 ? "push_up" : "pull_down")));
tooltip.add(spacing + TextFormatting.YELLOW + "-> "
+ Lang.translate("tooltip.chute.items_move_" + (downward ? "down" : "up")));
return true;
}
@ -684,47 +694,47 @@ public class ChuteTileEntity extends SmartTileEntity implements IHaveGoggleInfor
return item;
}
@Override
@Nullable
public AirCurrent getAirCurrent() {
return airCurrent;
}
@Nullable
@Override
public World getAirCurrentWorld() {
return world;
}
@Override
public BlockPos getAirCurrentPos() {
return pos;
}
@Override
public float getSpeed() {
if (getBlockState().get(ChuteBlock.SHAPE) == Shape.NORMAL && getBlockState().get(ChuteBlock.FACING) != Direction.DOWN)
return 0;
return pull + push;
}
@Override
@Nullable
public Direction getAirFlowDirection() {
float speed = getSpeed();
if (speed == 0)
return null;
return speed > 0 ? Direction.UP : Direction.DOWN;
}
@Override
public boolean isSourceRemoved() {
return removed;
}
@Override
public Direction getAirflowOriginSide() {
return world != null && !(world.getTileEntity(pos.down()) instanceof IAirCurrentSource)
&& getBlockState().get(ChuteBlock.FACING) == Direction.DOWN ? Direction.DOWN : Direction.UP;
}
// @Override
// @Nullable
// public AirCurrent getAirCurrent() {
// return airCurrent;
// }
//
// @Nullable
// @Override
// public World getAirCurrentWorld() {
// return world;
// }
//
// @Override
// public BlockPos getAirCurrentPos() {
// return pos;
// }
//
// @Override
// public float getSpeed() {
// if (getBlockState().get(ChuteBlock.SHAPE) == Shape.NORMAL && getBlockState().get(ChuteBlock.FACING) != Direction.DOWN)
// return 0;
// return pull + push;
// }
//
// @Override
// @Nullable
// public Direction getAirFlowDirection() {
// float speed = getSpeed();
// if (speed == 0)
// return null;
// return speed > 0 ? Direction.UP : Direction.DOWN;
// }
//
// @Override
// public boolean isSourceRemoved() {
// return removed;
// }
//
// @Override
// public Direction getAirflowOriginSide() {
// return world != null && !(world.getTileEntity(pos.down()) instanceof IAirCurrentSource)
// && getBlockState().get(ChuteBlock.FACING) == Direction.DOWN ? Direction.DOWN : Direction.UP;
// }
}

View file

@ -188,7 +188,7 @@ public class SmartFluidTankBehaviour extends TileEntityBehaviour {
});
}
class InternalFluidHandler extends CombinedTankWrapper {
public class InternalFluidHandler extends CombinedTankWrapper {
public InternalFluidHandler(IFluidHandler[] handlers, boolean enforceVariety) {
super(handlers);
@ -203,6 +203,10 @@ public class SmartFluidTankBehaviour extends TileEntityBehaviour {
return super.fill(resource, action);
}
public int forceFill(FluidStack resource, FluidAction action) {
return super.fill(resource, action);
}
@Override
public FluidStack drain(FluidStack resource, FluidAction action) {
if (!extractionAllowed)

View file

@ -438,6 +438,15 @@
"create.tunnel.selection_mode.randomize": "Randomize",
"create.tunnel.selection_mode.synchronize": "Synchronize Inputs",
"create.tooltip.chute.header": "Chute Information",
"create.tooltip.chute.items_move_down": "Items move Downward",
"create.tooltip.chute.items_move_up": "Items move Upward",
"create.tooltip.chute.no_fans_attached": "No attached fans",
"create.tooltip.chute.fans_push_up": "Fans push from Below",
"create.tooltip.chute.fans_push_down": "Fans push from Above",
"create.tooltip.chute.fans_pull_up": "Fans pull from Above",
"create.tooltip.chute.fans_pull_down": "Fans pull from Below",
"create.hint.mechanical_arm_no_targets.title": "No Targets",
"create.hint.mechanical_arm_no_targets": "It appears this _Mechanical_ _Arm_ has not been assigned any _targets._ Select belts, depots, funnels and other blocks by _right-clicking_ them while _holding_ the _Mechanical_ _Arm_ in your _hand_.",
"create.hint.horizontal_funnel.title": "Horizontal Funnels",