Filtered Basin Processing

- Basins can now be assigned a filter to narrow down the range of recipes that can be applied to its ingredients
- Some random asset updates
This commit is contained in:
simibubi 2020-09-04 15:16:07 +02:00
parent 121dd935b5
commit 5a7c09aa25
33 changed files with 202 additions and 124 deletions

View file

@ -361,16 +361,16 @@ a3a11524cd3515fc01d905767b4b7ea782adaf03 assets/create/blockstates/yellow_seat.j
7f39521b211441f5c3e06d60c5978cebe16cacfb assets/create/blockstates/zinc_block.json 7f39521b211441f5c3e06d60c5978cebe16cacfb assets/create/blockstates/zinc_block.json
b7181bcd8182b2f17088e5aa881f374c9c65470c assets/create/blockstates/zinc_ore.json b7181bcd8182b2f17088e5aa881f374c9c65470c assets/create/blockstates/zinc_ore.json
1fe3d6fb515b8951750daf6ff274006e14c96b32 assets/create/lang/en_ud.json 1fe3d6fb515b8951750daf6ff274006e14c96b32 assets/create/lang/en_ud.json
ba81a0874d90e126eb6b5e6edf22d69176888ae3 assets/create/lang/en_us.json e4c4fa83b8549dec363bbda95fa9fda7b285de5c assets/create/lang/en_us.json
69ebd4797f76f54483912b0c57fd061b73c732b2 assets/create/lang/unfinished/de_de.json e1a6b606458028f5c3b4afdc0a9e0cbd22d9e779 assets/create/lang/unfinished/de_de.json
fb1b725ce25e90e95615e6829f3a570c35e84f2d assets/create/lang/unfinished/fr_fr.json 46c139da98fdee00d70a5fd893fc3eb4f03b8a0d assets/create/lang/unfinished/fr_fr.json
3cf685c54663480dc3208b3d9ba8cc1638ebbe62 assets/create/lang/unfinished/it_it.json ac0103512dff6e125cfa0df5c9a55cceef33a1f9 assets/create/lang/unfinished/it_it.json
8c844b9777baad14984784ff957cff2e241f4d07 assets/create/lang/unfinished/ja_jp.json b22f04831c88799fcb69857ba16dbfa9df74aded assets/create/lang/unfinished/ja_jp.json
f351bafc438dcde67979a51753da16f75a9e1a34 assets/create/lang/unfinished/ko_kr.json 8f72c330dbb5eb2b4631ffdb169e2b4a5bd98695 assets/create/lang/unfinished/ko_kr.json
3c143d2b067e5443b1724d1ddb478f3abbf1f9a1 assets/create/lang/unfinished/nl_nl.json f7a3b075daf79ae600435c779a91c91a182771cd assets/create/lang/unfinished/nl_nl.json
e8dff25d88cdbabe91ae784d05e0a5c87fd9b948 assets/create/lang/unfinished/pt_br.json e65a45f531b6ae7a0818503c335366abb7a9ce20 assets/create/lang/unfinished/pt_br.json
411119247ce1bcc941bd3f49fb3a18eac687d65d assets/create/lang/unfinished/ru_ru.json 4251b8d5c5c45a162148776ccada3d7abeeb5bf1 assets/create/lang/unfinished/ru_ru.json
a94df56a2bc8f04661f0b3616963b84046ea4cbb assets/create/lang/unfinished/zh_cn.json c8c10a94bca76ee411246e29dbebba530a7f995c assets/create/lang/unfinished/zh_cn.json
846200eb548d3bfa2e77b41039de159b4b6cfb45 assets/create/models/block/acacia_window.json 846200eb548d3bfa2e77b41039de159b4b6cfb45 assets/create/models/block/acacia_window.json
1930fa3a3c98d53dd19e4ee7f55bc27fd47aa281 assets/create/models/block/acacia_window_pane_noside.json 1930fa3a3c98d53dd19e4ee7f55bc27fd47aa281 assets/create/models/block/acacia_window_pane_noside.json
1763ea2c9b981d187f5031ba608f3d5d3be3986a assets/create/models/block/acacia_window_pane_noside_alt.json 1763ea2c9b981d187f5031ba608f3d5d3be3986a assets/create/models/block/acacia_window_pane_noside_alt.json

View file

@ -652,6 +652,7 @@
"create.contraptions.cart_movement_mode.rotation_locked": "Lock rotation", "create.contraptions.cart_movement_mode.rotation_locked": "Lock rotation",
"create.logistics.filter": "Filter", "create.logistics.filter": "Filter",
"create.logistics.recipe_filter": "Recipe Filter",
"create.logistics.firstFrequency": "Freq. #1", "create.logistics.firstFrequency": "Freq. #1",
"create.logistics.secondFrequency": "Freq. #2", "create.logistics.secondFrequency": "Freq. #2",

View file

@ -1,5 +1,5 @@
{ {
"_": "Missing Localizations: 820", "_": "Missing Localizations: 821",
"_": "->------------------------] Game Elements [------------------------<-", "_": "->------------------------] Game Elements [------------------------<-",
@ -653,6 +653,7 @@
"create.contraptions.cart_movement_mode.rotation_locked": "UNLOCALIZED: Lock rotation", "create.contraptions.cart_movement_mode.rotation_locked": "UNLOCALIZED: Lock rotation",
"create.logistics.filter": "Filter", "create.logistics.filter": "Filter",
"create.logistics.recipe_filter": "UNLOCALIZED: Recipe Filter",
"create.logistics.firstFrequency": "Freq. #1", "create.logistics.firstFrequency": "Freq. #1",
"create.logistics.secondFrequency": "Freq. #2", "create.logistics.secondFrequency": "Freq. #2",

View file

@ -1,5 +1,5 @@
{ {
"_": "Missing Localizations: 424", "_": "Missing Localizations: 425",
"_": "->------------------------] Game Elements [------------------------<-", "_": "->------------------------] Game Elements [------------------------<-",
@ -653,6 +653,7 @@
"create.contraptions.cart_movement_mode.rotation_locked": "UNLOCALIZED: Lock rotation", "create.contraptions.cart_movement_mode.rotation_locked": "UNLOCALIZED: Lock rotation",
"create.logistics.filter": "Filtre", "create.logistics.filter": "Filtre",
"create.logistics.recipe_filter": "UNLOCALIZED: Recipe Filter",
"create.logistics.firstFrequency": "Freq. #1", "create.logistics.firstFrequency": "Freq. #1",
"create.logistics.secondFrequency": "Freq. #2", "create.logistics.secondFrequency": "Freq. #2",

View file

@ -1,5 +1,5 @@
{ {
"_": "Missing Localizations: 408", "_": "Missing Localizations: 409",
"_": "->------------------------] Game Elements [------------------------<-", "_": "->------------------------] Game Elements [------------------------<-",
@ -653,6 +653,7 @@
"create.contraptions.cart_movement_mode.rotation_locked": "UNLOCALIZED: Lock rotation", "create.contraptions.cart_movement_mode.rotation_locked": "UNLOCALIZED: Lock rotation",
"create.logistics.filter": "Filtro", "create.logistics.filter": "Filtro",
"create.logistics.recipe_filter": "UNLOCALIZED: Recipe Filter",
"create.logistics.firstFrequency": "Freq. #1", "create.logistics.firstFrequency": "Freq. #1",
"create.logistics.secondFrequency": "Freq. #2", "create.logistics.secondFrequency": "Freq. #2",

View file

@ -1,5 +1,5 @@
{ {
"_": "Missing Localizations: 403", "_": "Missing Localizations: 404",
"_": "->------------------------] Game Elements [------------------------<-", "_": "->------------------------] Game Elements [------------------------<-",
@ -653,6 +653,7 @@
"create.contraptions.cart_movement_mode.rotation_locked": "UNLOCALIZED: Lock rotation", "create.contraptions.cart_movement_mode.rotation_locked": "UNLOCALIZED: Lock rotation",
"create.logistics.filter": "フィルタ", "create.logistics.filter": "フィルタ",
"create.logistics.recipe_filter": "UNLOCALIZED: Recipe Filter",
"create.logistics.firstFrequency": "Freq. #1", "create.logistics.firstFrequency": "Freq. #1",
"create.logistics.secondFrequency": "Freq. #2", "create.logistics.secondFrequency": "Freq. #2",

View file

@ -1,5 +1,5 @@
{ {
"_": "Missing Localizations: 408", "_": "Missing Localizations: 409",
"_": "->------------------------] Game Elements [------------------------<-", "_": "->------------------------] Game Elements [------------------------<-",
@ -653,6 +653,7 @@
"create.contraptions.cart_movement_mode.rotation_locked": "UNLOCALIZED: Lock rotation", "create.contraptions.cart_movement_mode.rotation_locked": "UNLOCALIZED: Lock rotation",
"create.logistics.filter": "필터", "create.logistics.filter": "필터",
"create.logistics.recipe_filter": "UNLOCALIZED: Recipe Filter",
"create.logistics.firstFrequency": "주파수. #1", "create.logistics.firstFrequency": "주파수. #1",
"create.logistics.secondFrequency": "주파수. #2", "create.logistics.secondFrequency": "주파수. #2",

View file

@ -1,5 +1,5 @@
{ {
"_": "Missing Localizations: 758", "_": "Missing Localizations: 759",
"_": "->------------------------] Game Elements [------------------------<-", "_": "->------------------------] Game Elements [------------------------<-",
@ -653,6 +653,7 @@
"create.contraptions.cart_movement_mode.rotation_locked": "UNLOCALIZED: Lock rotation", "create.contraptions.cart_movement_mode.rotation_locked": "UNLOCALIZED: Lock rotation",
"create.logistics.filter": "Filter", "create.logistics.filter": "Filter",
"create.logistics.recipe_filter": "UNLOCALIZED: Recipe Filter",
"create.logistics.firstFrequency": "Freq. #1", "create.logistics.firstFrequency": "Freq. #1",
"create.logistics.secondFrequency": "Freq. #2", "create.logistics.secondFrequency": "Freq. #2",

View file

@ -1,5 +1,5 @@
{ {
"_": "Missing Localizations: 827", "_": "Missing Localizations: 828",
"_": "->------------------------] Game Elements [------------------------<-", "_": "->------------------------] Game Elements [------------------------<-",
@ -653,6 +653,7 @@
"create.contraptions.cart_movement_mode.rotation_locked": "UNLOCALIZED: Lock rotation", "create.contraptions.cart_movement_mode.rotation_locked": "UNLOCALIZED: Lock rotation",
"create.logistics.filter": "Filtros", "create.logistics.filter": "Filtros",
"create.logistics.recipe_filter": "UNLOCALIZED: Recipe Filter",
"create.logistics.firstFrequency": "UNLOCALIZED: Freq. #1", "create.logistics.firstFrequency": "UNLOCALIZED: Freq. #1",
"create.logistics.secondFrequency": "UNLOCALIZED: Freq. #2", "create.logistics.secondFrequency": "UNLOCALIZED: Freq. #2",

View file

@ -1,5 +1,5 @@
{ {
"_": "Missing Localizations: 821", "_": "Missing Localizations: 822",
"_": "->------------------------] Game Elements [------------------------<-", "_": "->------------------------] Game Elements [------------------------<-",
@ -653,6 +653,7 @@
"create.contraptions.cart_movement_mode.rotation_locked": "UNLOCALIZED: Lock rotation", "create.contraptions.cart_movement_mode.rotation_locked": "UNLOCALIZED: Lock rotation",
"create.logistics.filter": "Фильтр", "create.logistics.filter": "Фильтр",
"create.logistics.recipe_filter": "UNLOCALIZED: Recipe Filter",
"create.logistics.firstFrequency": "Част. #1", "create.logistics.firstFrequency": "Част. #1",
"create.logistics.secondFrequency": "Част. #2", "create.logistics.secondFrequency": "Част. #2",

View file

@ -1,5 +1,5 @@
{ {
"_": "Missing Localizations: 84", "_": "Missing Localizations: 85",
"_": "->------------------------] Game Elements [------------------------<-", "_": "->------------------------] Game Elements [------------------------<-",
@ -653,6 +653,7 @@
"create.contraptions.cart_movement_mode.rotation_locked": "结构方向保持不变", "create.contraptions.cart_movement_mode.rotation_locked": "结构方向保持不变",
"create.logistics.filter": "过滤器", "create.logistics.filter": "过滤器",
"create.logistics.recipe_filter": "UNLOCALIZED: Recipe Filter",
"create.logistics.firstFrequency": "频道. #1", "create.logistics.firstFrequency": "频道. #1",
"create.logistics.secondFrequency": "频道. #2", "create.logistics.secondFrequency": "频道. #2",

View file

@ -116,7 +116,7 @@ public class AllShapes {
BASIN_BLOCK_SHAPE = shape(0, 2, 0, 16, 16, 16).erase(2, 2, 2, 14, 16, 14) BASIN_BLOCK_SHAPE = shape(0, 2, 0, 16, 16, 16).erase(2, 2, 2, 14, 16, 14)
.add(2, 0, 2, 14, 2, 14) .add(2, 0, 2, 14, 2, 14)
.build(), BASIN_COLLISION_SHAPE = .build(), BASIN_COLLISION_SHAPE =
shape(0, 2, 0, 16, 16, 16).erase(2, 5, 2, 14, 16, 14) shape(0, 2, 0, 16, 13, 16).erase(2, 5, 2, 14, 16, 14)
.add(2, 0, 2, 14, 2, 14) .add(2, 0, 2, 14, 2, 14)
.build(), .build(),
HEATER_BLOCK_SHAPE = shape(2, 0, 2, 14, 14, 14).add(0, 0, 0, 16, 4, 16) HEATER_BLOCK_SHAPE = shape(2, 0, 2, 14, 14, 14).add(0, 0, 0, 16, 4, 16)

View file

@ -173,13 +173,10 @@ public class MechanicalMixerTileEntity extends BasinOperatingTileEntity {
@Override @Override
protected <C extends IInventory> boolean matchBasinRecipe(IRecipe<C> recipe) { protected <C extends IInventory> boolean matchBasinRecipe(IRecipe<C> recipe) {
if (recipe == null) if (!super.matchBasinRecipe(recipe))
return false;
NonNullList<Ingredient> ingredients = recipe.getIngredients();
if (!ingredients.stream()
.allMatch(ingredient -> (ingredient.isSimple() || ingredient.getMatchingStacks().length == 1)))
return false; return false;
NonNullList<Ingredient> ingredients = recipe.getIngredients();
List<ItemStack> remainingItems = new ArrayList<>(); List<ItemStack> remainingItems = new ArrayList<>();
itemInputs.forEach(stack -> remainingItems.add(stack.copy())); itemInputs.forEach(stack -> remainingItems.add(stack.copy()));
List<FluidStack> remainingFluids = new ArrayList<>(); List<FluidStack> remainingFluids = new ArrayList<>();

View file

@ -282,14 +282,10 @@ public class MechanicalPressTileEntity extends BasinOperatingTileEntity {
@Override @Override
protected <C extends IInventory> boolean matchBasinRecipe(IRecipe<C> recipe) { protected <C extends IInventory> boolean matchBasinRecipe(IRecipe<C> recipe) {
if (recipe == null) if (!super.matchBasinRecipe(recipe))
return false; return false;
NonNullList<Ingredient> ingredients = recipe.getIngredients(); NonNullList<Ingredient> ingredients = recipe.getIngredients();
if (!ingredients.stream()
.allMatch(Ingredient::isSimple))
return false;
List<ItemStack> remainingItems = new ArrayList<>(); List<ItemStack> remainingItems = new ArrayList<>();
itemInputs.forEach(stack -> remainingItems.add(stack.copy())); itemInputs.forEach(stack -> remainingItems.add(stack.copy()));

View file

@ -74,7 +74,7 @@ public class SawTileEntity extends BlockBreakingKineticTileEntity {
@Override @Override
public void addBehaviours(List<TileEntityBehaviour> behaviours) { public void addBehaviours(List<TileEntityBehaviour> behaviours) {
super.addBehaviours(behaviours); super.addBehaviours(behaviours);
filtering = new FilteringBehaviour(this, new SawFilterSlot()); filtering = new FilteringBehaviour(this, new SawFilterSlot()).forRecipes();
behaviours.add(filtering); behaviours.add(filtering);
behaviours.add(new DirectBeltInputBehaviour(this)); behaviours.add(new DirectBeltInputBehaviour(this));
} }

View file

@ -7,6 +7,8 @@ import com.simibubi.create.content.contraptions.wrench.IWrenchable;
import com.simibubi.create.foundation.advancement.AllTriggers; import com.simibubi.create.foundation.advancement.AllTriggers;
import com.simibubi.create.foundation.block.ITE; import com.simibubi.create.foundation.block.ITE;
import com.simibubi.create.foundation.item.ItemHelper; import com.simibubi.create.foundation.item.ItemHelper;
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
import com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringBehaviour;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
@ -101,15 +103,17 @@ public class BasinBlock extends Block implements ITE<BasinTileEntity>, IWrenchab
} }
@Override @Override
public VoxelShape getCollisionShape(BlockState p_220071_1_, IBlockReader p_220071_2_, BlockPos p_220071_3_, public VoxelShape getCollisionShape(BlockState state, IBlockReader reader, BlockPos pos, ISelectionContext ctx) {
ISelectionContext p_220071_4_) { if (ctx.getEntity() instanceof ItemEntity)
return AllShapes.BASIN_COLLISION_SHAPE; return AllShapes.BASIN_COLLISION_SHAPE;
return getShape(state, reader, pos, ctx);
} }
@Override @Override
public void onReplaced(BlockState state, World worldIn, BlockPos pos, BlockState newState, boolean isMoving) { public void onReplaced(BlockState state, World worldIn, BlockPos pos, BlockState newState, boolean isMoving) {
if (!state.hasTileEntity() || state.getBlock() == newState.getBlock()) if (!state.hasTileEntity() || state.getBlock() == newState.getBlock())
return; return;
TileEntityBehaviour.destroy(worldIn, pos, FilteringBehaviour.TYPE);
withTileEntityDo(worldIn, pos, te -> { withTileEntityDo(worldIn, pos, te -> {
ItemHelper.dropContents(worldIn, pos, te.inputItemInventory); ItemHelper.dropContents(worldIn, pos, te.inputItemInventory);
ItemHelper.dropContents(worldIn, pos, te.outputItemInventory); ItemHelper.dropContents(worldIn, pos, te.outputItemInventory);

View file

@ -210,7 +210,24 @@ public abstract class BasinOperatingTileEntity extends KineticTileEntity {
protected abstract <C extends IInventory> boolean matchStaticFilters(IRecipe<C> recipe); protected abstract <C extends IInventory> boolean matchStaticFilters(IRecipe<C> recipe);
protected abstract <C extends IInventory> boolean matchBasinRecipe(IRecipe<C> recipe); protected <C extends IInventory> boolean matchBasinRecipe(IRecipe<C> recipe) {
if (recipe == null)
return false;
Optional<BasinTileEntity> basin = getBasin();
if (!basin.isPresent())
return false;
BasinTileEntity basinTileEntity = basin.get();
if (!basinTileEntity.getFilter()
.test(recipe.getRecipeOutput()))
return false;
NonNullList<Ingredient> ingredients = recipe.getIngredients();
if (!ingredients.stream()
.allMatch(ingredient -> (ingredient.isSimple() || ingredient.getMatchingStacks().length == 1)))
return false;
return true;
}
protected abstract Object getRecipeCacheKey(); protected abstract Object getRecipeCacheKey();

View file

@ -3,7 +3,7 @@ package com.simibubi.create.content.contraptions.processing;
import java.util.Random; import java.util.Random;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.foundation.tileEntity.renderer.SafeTileEntityRenderer; import com.simibubi.create.foundation.tileEntity.renderer.SmartTileEntityRenderer;
import com.simibubi.create.foundation.utility.VecHelper; import com.simibubi.create.foundation.utility.VecHelper;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
@ -17,7 +17,7 @@ import net.minecraft.util.math.Vec3d;
import net.minecraftforge.items.IItemHandlerModifiable; import net.minecraftforge.items.IItemHandlerModifiable;
import net.minecraftforge.items.ItemStackHandler; import net.minecraftforge.items.ItemStackHandler;
public class BasinRenderer extends SafeTileEntityRenderer<BasinTileEntity> { public class BasinRenderer extends SmartTileEntityRenderer<BasinTileEntity> {
public BasinRenderer(TileEntityRendererDispatcher dispatcher) { public BasinRenderer(TileEntityRendererDispatcher dispatcher) {
super(dispatcher); super(dispatcher);
@ -25,7 +25,9 @@ public class BasinRenderer extends SafeTileEntityRenderer<BasinTileEntity> {
@Override @Override
protected void renderSafe(BasinTileEntity basin, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer, protected void renderSafe(BasinTileEntity basin, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer,
int light, int overlay) { int light, int overlay) {
super.renderSafe(basin, partialTicks, ms, buffer, light, overlay);
ms.push(); ms.push();
BlockPos pos = basin.getPos(); BlockPos pos = basin.getPos();
ms.translate(.5, .2f, .5); ms.translate(.5, .2f, .5);
@ -44,7 +46,9 @@ public class BasinRenderer extends SafeTileEntityRenderer<BasinTileEntity> {
ms.translate(vec.x, vec.y, vec.z); ms.translate(vec.x, vec.y, vec.z);
ms.multiply(new Vector3f((float) vec2.z, (float) vec2.y, 0).getDegreesQuaternion((float) vec2.x * 180)); ms.multiply(new Vector3f((float) vec2.z, (float) vec2.y, 0).getDegreesQuaternion((float) vec2.x * 180));
Minecraft.getInstance().getItemRenderer().renderItem(stack, TransformType.GROUND, light, overlay, ms, buffer); Minecraft.getInstance()
.getItemRenderer()
.renderItem(stack, TransformType.GROUND, light, overlay, ms, buffer);
ms.pop(); ms.pop();
} }
ms.translate(0, 1 / 64f, 0); ms.translate(0, 1 / 64f, 0);

View file

@ -8,8 +8,12 @@ import javax.annotation.Nonnull;
import com.simibubi.create.content.contraptions.fluids.CombinedFluidHandler; import com.simibubi.create.content.contraptions.fluids.CombinedFluidHandler;
import com.simibubi.create.foundation.tileEntity.SmartTileEntity; import com.simibubi.create.foundation.tileEntity.SmartTileEntity;
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour; import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
import com.simibubi.create.foundation.tileEntity.behaviour.ValueBoxTransform;
import com.simibubi.create.foundation.tileEntity.behaviour.belt.DirectBeltInputBehaviour; import com.simibubi.create.foundation.tileEntity.behaviour.belt.DirectBeltInputBehaviour;
import com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringBehaviour;
import com.simibubi.create.foundation.utility.VecHelper;
import net.minecraft.block.BlockState;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.ListNBT; import net.minecraft.nbt.ListNBT;
@ -17,6 +21,9 @@ import net.minecraft.tileentity.ITickableTileEntity;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityType; import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.math.Vec3d;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
@ -30,6 +37,7 @@ import net.minecraftforge.items.wrapper.RecipeWrapper;
public class BasinTileEntity extends SmartTileEntity implements ITickableTileEntity { public class BasinTileEntity extends SmartTileEntity implements ITickableTileEntity {
public boolean contentsChanged; public boolean contentsChanged;
private FilteringBehaviour filtering;
protected ItemStackHandler outputItemInventory = new ItemStackHandler(9) { protected ItemStackHandler outputItemInventory = new ItemStackHandler(9) {
protected void onContentsChanged(int slot) { protected void onContentsChanged(int slot) {
@ -98,6 +106,12 @@ public class BasinTileEntity extends SmartTileEntity implements ITickableTileEnt
} }
@Override
@OnlyIn(Dist.CLIENT)
public double getMaxRenderDistanceSquared() {
return 256;
}
protected LazyOptional<IItemHandlerModifiable> inventory = protected LazyOptional<IItemHandlerModifiable> inventory =
LazyOptional.of(() -> new BasinInventory(inputItemInventory, outputItemInventory)); LazyOptional.of(() -> new BasinInventory(inputItemInventory, outputItemInventory));
@ -115,6 +129,10 @@ public class BasinTileEntity extends SmartTileEntity implements ITickableTileEnt
@Override @Override
public void addBehaviours(List<TileEntityBehaviour> behaviours) { public void addBehaviours(List<TileEntityBehaviour> behaviours) {
behaviours.add(new DirectBeltInputBehaviour(this)); behaviours.add(new DirectBeltInputBehaviour(this));
filtering = new FilteringBehaviour(this, new BasinValueBox()).moveText(new Vec3d(2, -8, 0))
.withCallback(newFilter -> contentsChanged = true)
.forRecipes();
behaviours.add(filtering);
} }
@Override @Override
@ -177,4 +195,23 @@ public class BasinTileEntity extends SmartTileEntity implements ITickableTileEnt
return Optional.empty(); return Optional.empty();
} }
public FilteringBehaviour getFilter() {
return filtering;
}
class BasinValueBox extends ValueBoxTransform.Sided {
@Override
protected Vec3d getSouthLocation() {
return VecHelper.voxelSpace(8, 12, 16);
}
@Override
protected boolean isSideActive(BlockState state, Direction direction) {
return direction.getAxis()
.isHorizontal();
}
}
} }

View file

@ -36,6 +36,7 @@ public class FilteringBehaviour extends TileEntityBehaviour {
int scrollableValue; int scrollableValue;
int ticksUntilScrollPacket; int ticksUntilScrollPacket;
boolean forceClientState; boolean forceClientState;
boolean recipeFilter;
public FilteringBehaviour(SmartTileEntity te, ValueBoxTransform slot) { public FilteringBehaviour(SmartTileEntity te, ValueBoxTransform slot) {
super(te); super(te);
@ -49,6 +50,7 @@ public class FilteringBehaviour extends TileEntityBehaviour {
count = 0; count = 0;
ticksUntilScrollPacket = -1; ticksUntilScrollPacket = -1;
showCountPredicate = () -> showCount; showCountPredicate = () -> showCount;
recipeFilter = false;
} }
@Override @Override
@ -96,6 +98,11 @@ public class FilteringBehaviour extends TileEntityBehaviour {
return this; return this;
} }
public FilteringBehaviour forRecipes() {
recipeFilter = true;
return this;
}
public FilteringBehaviour onlyActiveWhen(Supplier<Boolean> condition) { public FilteringBehaviour onlyActiveWhen(Supplier<Boolean> condition) {
isActive = condition; isActive = condition;
return this; return this;

View file

@ -59,7 +59,8 @@ public class FilteringRenderer {
ItemStack filter = behaviour.getFilter(); ItemStack filter = behaviour.getFilter();
boolean isFilterSlotted = filter.getItem() instanceof FilterItem; boolean isFilterSlotted = filter.getItem() instanceof FilterItem;
boolean showCount = behaviour.isCountVisible(); boolean showCount = behaviour.isCountVisible();
String label = isFilterSlotted ? "" : Lang.translate("logistics.filter"); String label = isFilterSlotted ? ""
: Lang.translate(behaviour.recipeFilter ? "logistics.recipe_filter" : "logistics.filter");
boolean hit = behaviour.slotPositioning.testHit(state, target.getHitVec() boolean hit = behaviour.slotPositioning.testHit(state, target.getHitVec()
.subtract(new Vec3d(pos))); .subtract(new Vec3d(pos)));

View file

@ -135,6 +135,7 @@
"create.contraptions.cart_movement_mode.rotation_locked": "Lock rotation", "create.contraptions.cart_movement_mode.rotation_locked": "Lock rotation",
"create.logistics.filter": "Filter", "create.logistics.filter": "Filter",
"create.logistics.recipe_filter": "Recipe Filter",
"create.logistics.firstFrequency": "Freq. #1", "create.logistics.firstFrequency": "Freq. #1",
"create.logistics.secondFrequency": "Freq. #2", "create.logistics.secondFrequency": "Freq. #2",

View file

@ -7,6 +7,7 @@
"5": "create:block/brass_casing", "5": "create:block/brass_casing",
"6": "create:block/crafter_top", "6": "create:block/crafter_top",
"7": "create:block/crafter_topunderside", "7": "create:block/crafter_topunderside",
"8": "create:block/smooth_dark_log_top",
"particle": "create:block/brass_casing" "particle": "create:block/brass_casing"
}, },
"elements": [ "elements": [
@ -28,7 +29,7 @@
"from": [0, 0, 10], "from": [0, 0, 10],
"to": [16, 16, 16], "to": [16, 16, 16],
"faces": { "faces": {
"north": {"uv": [0, 0, 16, 16], "rotation": 270, "texture": "#5"}, "north": {"uv": [0, 0, 16, 16], "rotation": 270, "texture": "#8"},
"east": {"uv": [0, 10, 16, 16], "rotation": 90, "texture": "#4"}, "east": {"uv": [0, 10, 16, 16], "rotation": 90, "texture": "#4"},
"south": {"uv": [0, 0, 16, 16], "texture": "#6"}, "south": {"uv": [0, 0, 16, 16], "texture": "#6"},
"west": {"uv": [16, 10, 0, 16], "rotation": 270, "texture": "#4"}, "west": {"uv": [16, 10, 0, 16], "rotation": 270, "texture": "#4"},

View file

@ -7,7 +7,8 @@
"5": "create:block/brass_casing", "5": "create:block/brass_casing",
"6": "create:block/crafter_top", "6": "create:block/crafter_top",
"7": "create:block/crafter_topunderside", "7": "create:block/crafter_topunderside",
"particle": "create:block/cogwheel", "8": "create:block/smooth_dark_log_top",
"particle": "create:block/crafter_top",
"1_2": "create:block/cogwheel" "1_2": "create:block/cogwheel"
}, },
"elements": [ "elements": [
@ -33,7 +34,7 @@
"east": {"uv": [0, 10, 16, 16], "texture": "#4"}, "east": {"uv": [0, 10, 16, 16], "texture": "#4"},
"south": {"uv": [0, 10, 16, 16], "texture": "#4"}, "south": {"uv": [0, 10, 16, 16], "texture": "#4"},
"west": {"uv": [0, 10, 16, 16], "texture": "#4"}, "west": {"uv": [0, 10, 16, 16], "texture": "#4"},
"up": {"uv": [0, 0, 16, 16], "texture": "#5"}, "up": {"uv": [0, 0, 16, 16], "texture": "#8"},
"down": {"uv": [0, 0, 16, 16], "texture": "#6"} "down": {"uv": [0, 0, 16, 16], "texture": "#6"}
} }
}, },
@ -82,11 +83,11 @@
"from": [4, 16, 4], "from": [4, 16, 4],
"to": [5, 17, 12], "to": [5, 17, 12],
"faces": { "faces": {
"north": {"uv": [4, 1, 5, 2], "texture": "#5"}, "north": {"uv": [5, 2, 6, 3], "texture": "#5"},
"east": {"uv": [2, 1, 10, 2], "texture": "#5"}, "east": {"uv": [2, 1, 10, 2], "texture": "#5"},
"south": {"uv": [3.5, 1, 4.5, 2], "texture": "#5"}, "south": {"uv": [3, 2, 4, 3], "texture": "#5"},
"west": {"uv": [2, 1, 10, 2], "texture": "#5"}, "west": {"uv": [4, 2, 12, 3], "texture": "#5"},
"up": {"uv": [1, 2, 2, 10], "texture": "#5"} "up": {"uv": [2, 4, 3, 12], "texture": "#5"}
} }
}, },
{ {
@ -94,11 +95,11 @@
"from": [11, 16, 4], "from": [11, 16, 4],
"to": [12, 17, 12], "to": [12, 17, 12],
"faces": { "faces": {
"north": {"uv": [4, 1, 5, 2], "texture": "#5"}, "north": {"uv": [4, 2, 5, 3], "texture": "#5"},
"east": {"uv": [2, 1, 10, 2], "texture": "#5"}, "east": {"uv": [3, 2, 11, 3], "texture": "#5"},
"south": {"uv": [3.5, 1, 4.5, 2], "texture": "#5"}, "south": {"uv": [5, 2, 6, 3], "texture": "#5"},
"west": {"uv": [2, 1, 10, 2], "texture": "#5"}, "west": {"uv": [2, 1, 10, 2], "texture": "#5"},
"up": {"uv": [1, 2, 2, 10], "texture": "#5"} "up": {"uv": [2, 4, 3, 12], "texture": "#5"}
} }
}, },
{ {
@ -106,11 +107,11 @@
"from": [5, 16, 4], "from": [5, 16, 4],
"to": [11, 17, 5], "to": [11, 17, 5],
"faces": { "faces": {
"north": {"uv": [3, 1, 9, 2], "texture": "#5"}, "north": {"uv": [5, 2, 11, 3], "texture": "#5"},
"east": {"uv": [1, 2, 2, 3], "texture": "#5"}, "east": {"uv": [1, 2, 2, 3], "texture": "#5"},
"south": {"uv": [2.5, 1, 8.5, 2], "texture": "#5"}, "south": {"uv": [2.5, 1, 8.5, 2], "texture": "#5"},
"west": {"uv": [1, 2, 2, 3], "texture": "#5"}, "west": {"uv": [1, 2, 2, 3], "texture": "#5"},
"up": {"uv": [2.5, 1, 8.5, 2], "texture": "#5"} "up": {"uv": [4, 2, 10, 3], "texture": "#5"}
} }
}, },
{ {
@ -120,9 +121,9 @@
"faces": { "faces": {
"north": {"uv": [3, 1, 9, 2], "texture": "#5"}, "north": {"uv": [3, 1, 9, 2], "texture": "#5"},
"east": {"uv": [1, 2, 2, 3], "texture": "#5"}, "east": {"uv": [1, 2, 2, 3], "texture": "#5"},
"south": {"uv": [2.5, 1, 8.5, 2], "texture": "#5"}, "south": {"uv": [2, 2, 8, 3], "texture": "#5"},
"west": {"uv": [1, 2, 2, 3], "texture": "#5"}, "west": {"uv": [1, 2, 2, 3], "texture": "#5"},
"up": {"uv": [2.5, 1, 8.5, 2], "texture": "#5"} "up": {"uv": [5, 2, 11, 3], "texture": "#5"}
} }
}, },
{ {

View file

@ -1,59 +1,60 @@
{ {
"__comment": "Model generated using MrCrayfish's Model Creator (https://mrcrayfish.com/tools?id=mc)", "credit": "Made with Blockbench",
"textures": { "textures": {
"gearbox_top": "create:block/gearbox_top", "4": "create:block/mechanical_press_side",
"gearbox": "create:block/gearbox", "gearbox_top": "create:block/gearbox_top",
"mechanical_press_top": "create:block/mechanical_press_top", "particle": "create:block/mechanical_press_side",
"mechanical_press_bottom": "create:block/mechanical_press_bottom", "gearbox": "create:block/gearbox",
"particle": "create:block/gearbox" "mechanical_press_top": "create:block/mechanical_press_top",
}, "mechanical_press_bottom": "create:block/mechanical_press_bottom"
"elements": [ },
{ "elements": [
"name": "Top", {
"from": [ 0, 14, 0 ], "name": "Top",
"to": [ 16, 16, 16 ], "from": [0, 14, 0],
"faces": { "to": [16, 16, 16],
"north": { "texture": "#gearbox", "uv": [ 0, 0, 16, 2 ] }, "faces": {
"east": { "texture": "#gearbox", "uv": [ 0, 0, 16, 2 ] }, "north": {"uv": [0, 0, 16, 2], "texture": "#gearbox"},
"south": { "texture": "#gearbox", "uv": [ 0, 0, 16, 2 ] }, "east": {"uv": [0, 0, 16, 2], "texture": "#4"},
"west": { "texture": "#gearbox", "uv": [ 0, 0, 16, 2 ] }, "south": {"uv": [0, 0, 16, 2], "texture": "#gearbox"},
"up": { "texture": "#mechanical_press_top", "uv": [ 0, 0, 16, 16 ] }, "west": {"uv": [0, 0, 16, 2], "texture": "#4"},
"down": { "texture": "#gearbox", "uv": [ 0, 0, 16, 16 ] } "up": {"uv": [0, 0, 16, 16], "texture": "#mechanical_press_top"},
} "down": {"uv": [0, 0, 16, 16], "texture": "#gearbox"}
}, }
{ },
"name": "Core", {
"from": [ 2, 4, 1 ], "name": "Core",
"to": [ 14, 14, 15 ], "from": [2, 4, 1],
"faces": { "to": [14, 14, 15],
"north": { "texture": "#gearbox", "uv": [ 2, 2, 14, 12 ] }, "faces": {
"south": { "texture": "#gearbox", "uv": [ 2, 2, 14, 12 ] }, "north": {"uv": [2, 2, 14, 12], "texture": "#gearbox"},
"down": { "texture": "#mechanical_press_bottom", "uv": [ 2, 1, 14, 15 ] } "south": {"uv": [2, 2, 14, 12], "texture": "#gearbox"},
} "down": {"uv": [2, 1, 14, 15], "texture": "#mechanical_press_bottom"}
}, }
{ },
"name": "Side", {
"from": [ 0, 2, 0 ], "name": "Side",
"to": [ 2, 14, 16 ], "from": [0, 2, 0],
"faces": { "to": [2, 14, 16],
"north": { "texture": "#gearbox_top", "uv": [ 14, 2, 16, 14 ] }, "faces": {
"east": { "texture": "#gearbox_top", "uv": [ 0, 4, 16, 16 ] }, "north": {"uv": [14, 2, 16, 14], "texture": "#gearbox_top"},
"south": { "texture": "#gearbox_top", "uv": [ 0, 2, 2, 14 ] }, "east": {"uv": [0, 2, 16, 14], "texture": "#4"},
"west": { "texture": "#gearbox_top", "uv": [ 0, 4, 16, 16 ] }, "south": {"uv": [0, 2, 2, 14], "texture": "#gearbox_top"},
"down": { "texture": "#gearbox_top", "uv": [ 0, 0, 2, 16 ] } "west": {"uv": [0, 2, 16, 14], "texture": "#4"},
} "down": {"uv": [0, 0, 2, 16], "texture": "#gearbox_top"}
}, }
{ },
"name": "Side", {
"from": [ 14, 2, 0 ], "name": "Side",
"to": [ 16, 14, 16 ], "from": [14, 2, 0],
"faces": { "to": [16, 14, 16],
"north": { "texture": "#gearbox_top", "uv": [ 0, 2, 2, 14 ] }, "faces": {
"east": { "texture": "#gearbox_top", "uv": [ 0, 4, 16, 16 ] }, "north": {"uv": [0, 2, 2, 14], "texture": "#gearbox_top"},
"south": { "texture": "#gearbox_top", "uv": [ 14, 2, 16, 14 ] }, "east": {"uv": [0, 2, 16, 14], "texture": "#4"},
"west": { "texture": "#gearbox_top", "uv": [ 0, 4, 16, 16 ] }, "south": {"uv": [14, 2, 16, 14], "texture": "#gearbox_top"},
"down": { "texture": "#gearbox_top", "uv": [ 14, 0, 16, 16 ] } "west": {"uv": [0, 2, 16, 14], "texture": "#4"},
} "down": {"uv": [14, 0, 16, 16], "texture": "#gearbox_top"}
} }
] }
]
} }

View file

@ -4,13 +4,14 @@
"textures": { "textures": {
"0": "create:block/axis", "0": "create:block/axis",
"1": "create:block/axis_top", "1": "create:block/axis_top",
"8": "create:block/mechanical_press_side",
"mechanical_press_head": "create:block/mechanical_press_head", "mechanical_press_head": "create:block/mechanical_press_head",
"gearbox_top": "create:block/gearbox_top", "gearbox_top": "create:block/gearbox_top",
"mechanical_press_pole": "create:block/mechanical_press_pole", "mechanical_press_pole": "create:block/mechanical_press_pole",
"gearbox": "create:block/gearbox", "gearbox": "create:block/gearbox",
"mechanical_press_top": "create:block/mechanical_press_top", "mechanical_press_top": "create:block/mechanical_press_top",
"mechanical_press_bottom": "create:block/mechanical_press_bottom", "mechanical_press_bottom": "create:block/mechanical_press_bottom",
"particle": "create:block/axis" "particle": "create:block/mechanical_press_side"
}, },
"elements": [ "elements": [
{ {
@ -19,9 +20,9 @@
"to": [16, 20, 16], "to": [16, 20, 16],
"faces": { "faces": {
"north": {"uv": [0, 0, 16, 2], "texture": "#gearbox"}, "north": {"uv": [0, 0, 16, 2], "texture": "#gearbox"},
"east": {"uv": [0, 0, 16, 2], "texture": "#gearbox"}, "east": {"uv": [0, 0, 16, 2], "texture": "#8"},
"south": {"uv": [0, 0, 16, 2], "texture": "#gearbox"}, "south": {"uv": [0, 0, 16, 2], "texture": "#gearbox"},
"west": {"uv": [0, 0, 16, 2], "texture": "#gearbox"}, "west": {"uv": [0, 0, 16, 2], "texture": "#8"},
"up": {"uv": [0, 0, 16, 16], "rotation": 180, "texture": "#mechanical_press_top"}, "up": {"uv": [0, 0, 16, 16], "rotation": 180, "texture": "#mechanical_press_top"},
"down": {"uv": [0, 0, 16, 16], "rotation": 180, "texture": "#gearbox"} "down": {"uv": [0, 0, 16, 16], "rotation": 180, "texture": "#gearbox"}
} }
@ -42,9 +43,9 @@
"to": [16, 18, 16], "to": [16, 18, 16],
"faces": { "faces": {
"north": {"uv": [0, 2, 2, 14], "texture": "#gearbox_top"}, "north": {"uv": [0, 2, 2, 14], "texture": "#gearbox_top"},
"east": {"uv": [0, 4, 16, 16], "texture": "#gearbox_top"}, "east": {"uv": [0, 2, 16, 14], "texture": "#8"},
"south": {"uv": [14, 2, 16, 14], "texture": "#gearbox_top"}, "south": {"uv": [14, 2, 16, 14], "texture": "#gearbox_top"},
"west": {"uv": [0, 4, 16, 16], "texture": "#gearbox_top"}, "west": {"uv": [0, 2, 16, 14], "texture": "#8"},
"down": {"uv": [0, 0, 2, 16], "rotation": 180, "texture": "#gearbox_top"} "down": {"uv": [0, 0, 2, 16], "rotation": 180, "texture": "#gearbox_top"}
} }
}, },
@ -54,9 +55,9 @@
"to": [2, 18, 16], "to": [2, 18, 16],
"faces": { "faces": {
"north": {"uv": [14, 2, 16, 14], "texture": "#gearbox_top"}, "north": {"uv": [14, 2, 16, 14], "texture": "#gearbox_top"},
"east": {"uv": [0, 4, 16, 16], "texture": "#gearbox_top"}, "east": {"uv": [0, 2, 16, 14], "texture": "#8"},
"south": {"uv": [0, 2, 2, 14], "texture": "#gearbox_top"}, "south": {"uv": [0, 2, 2, 14], "texture": "#gearbox_top"},
"west": {"uv": [0, 4, 16, 16], "texture": "#gearbox_top"}, "west": {"uv": [0, 2, 16, 14], "texture": "#8"},
"down": {"uv": [14, 0, 16, 16], "rotation": 180, "texture": "#gearbox_top"} "down": {"uv": [14, 0, 16, 16], "rotation": 180, "texture": "#gearbox_top"}
} }
}, },

Binary file not shown.

Before

Width:  |  Height:  |  Size: 480 B

After

Width:  |  Height:  |  Size: 495 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 759 B

After

Width:  |  Height:  |  Size: 802 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 462 B

After

Width:  |  Height:  |  Size: 437 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 482 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 528 B

After

Width:  |  Height:  |  Size: 493 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 467 B

After

Width:  |  Height:  |  Size: 462 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 409 B