Extraordinary item handlers
- Cobwebs and Powdered Snow can now be attached to contraptions - Fixed Storage Drawers not providing correct fill levels to Stockpile Switches - Leaves are now considered transparent by encased fans - Blocks can now be tagged `#create:movable_empty_collider` to support contraption movement even if their collision shape is empty
This commit is contained in:
parent
12065c6b09
commit
cd79de0691
9 changed files with 75 additions and 14 deletions
|
@ -5628,7 +5628,8 @@ ac265a674626e0e832330086fd18fe0be37fc327 data/create/recipes/weathered_copper_ti
|
||||||
5942a571f79c40524bbf408775cf91de4715f2b6 data/create/recipes/weathered_copper_tile_stairs_from_weathered_copper_tiles_stonecutting.json
|
5942a571f79c40524bbf408775cf91de4715f2b6 data/create/recipes/weathered_copper_tile_stairs_from_weathered_copper_tiles_stonecutting.json
|
||||||
2a2700b43614f86d3294726595cb28ed7dca4387 data/create/tags/blocks/brittle.json
|
2a2700b43614f86d3294726595cb28ed7dca4387 data/create/tags/blocks/brittle.json
|
||||||
d99d5c67bdffff60789a19bd51a5c5267c75e0a4 data/create/tags/blocks/casing.json
|
d99d5c67bdffff60789a19bd51a5c5267c75e0a4 data/create/tags/blocks/casing.json
|
||||||
ecdd4e6acda027a01b41d6d2d431f9675cd29b93 data/create/tags/blocks/fan_transparent.json
|
2b4c93e5a752ebf54217594766f30d8d60cb4343 data/create/tags/blocks/fan_transparent.json
|
||||||
|
ee6d2b53d81f2bed492662b6c06f46c4f2b9ef9b data/create/tags/blocks/movable_empty_collider.json
|
||||||
6e5d3b2123fbb00e7f439c091623619502551bca data/create/tags/blocks/non_movable.json
|
6e5d3b2123fbb00e7f439c091623619502551bca data/create/tags/blocks/non_movable.json
|
||||||
10781e8cfcbb3486327aace3aa00e437fb44b331 data/create/tags/blocks/ore_override_stone.json
|
10781e8cfcbb3486327aace3aa00e437fb44b331 data/create/tags/blocks/ore_override_stone.json
|
||||||
760adb521c2e475a6414f97291f46c02d294fa74 data/create/tags/blocks/passive_boiler_heaters.json
|
760adb521c2e475a6414f97291f46c02d294fa74 data/create/tags/blocks/passive_boiler_heaters.json
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
"create:sail_frame",
|
"create:sail_frame",
|
||||||
"minecraft:iron_bars",
|
"minecraft:iron_bars",
|
||||||
"#minecraft:campfires",
|
"#minecraft:campfires",
|
||||||
"#minecraft:fences"
|
"#minecraft:fences",
|
||||||
|
"#minecraft:leaves"
|
||||||
]
|
]
|
||||||
}
|
}
|
|
@ -0,0 +1,8 @@
|
||||||
|
{
|
||||||
|
"replace": false,
|
||||||
|
"values": [
|
||||||
|
"minecraft:cobweb",
|
||||||
|
"minecraft:powder_snow",
|
||||||
|
"#minecraft:fence_gates"
|
||||||
|
]
|
||||||
|
}
|
|
@ -101,6 +101,7 @@ public class AllTags {
|
||||||
CASING,
|
CASING,
|
||||||
FAN_TRANSPARENT,
|
FAN_TRANSPARENT,
|
||||||
NON_MOVABLE,
|
NON_MOVABLE,
|
||||||
|
MOVABLE_EMPTY_COLLIDER,
|
||||||
ORE_OVERRIDE_STONE,
|
ORE_OVERRIDE_STONE,
|
||||||
PASSIVE_BOILER_HEATERS,
|
PASSIVE_BOILER_HEATERS,
|
||||||
SAFE_NBT,
|
SAFE_NBT,
|
||||||
|
|
|
@ -13,7 +13,8 @@ import net.minecraftforge.fml.ModList;
|
||||||
public enum Mods {
|
public enum Mods {
|
||||||
DYNAMICTREES,
|
DYNAMICTREES,
|
||||||
TCONSTRUCT,
|
TCONSTRUCT,
|
||||||
CURIOS;
|
CURIOS,
|
||||||
|
STORAGEDRAWERS;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return a boolean of whether the mod is loaded or not based on mod id
|
* @return a boolean of whether the mod is loaded or not based on mod id
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
package com.simibubi.create.compat.storageDrawers;
|
||||||
|
|
||||||
|
import com.simibubi.create.compat.Mods;
|
||||||
|
import com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringBehaviour;
|
||||||
|
|
||||||
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||||
|
import net.minecraftforge.items.IItemHandler;
|
||||||
|
|
||||||
|
public class StorageDrawers {
|
||||||
|
|
||||||
|
public static boolean isDrawer(BlockEntity tile) {
|
||||||
|
return tile != null && Mods.STORAGEDRAWERS.asId()
|
||||||
|
.equals(tile.getType()
|
||||||
|
.getRegistryName()
|
||||||
|
.getNamespace());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static float getTrueFillLevel(IItemHandler inv, FilteringBehaviour filtering) {
|
||||||
|
float occupied = 0;
|
||||||
|
float totalSpace = 0;
|
||||||
|
|
||||||
|
for (int slot = 1; slot < inv.getSlots(); slot++) {
|
||||||
|
ItemStack stackInSlot = inv.getStackInSlot(slot);
|
||||||
|
int space = inv.getSlotLimit(slot);
|
||||||
|
int count = stackInSlot.getCount();
|
||||||
|
if (space == 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
totalSpace += 1;
|
||||||
|
if (filtering.test(stackInSlot))
|
||||||
|
occupied += count * (1f / space);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (totalSpace == 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return occupied / totalSpace;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -46,7 +46,6 @@ import net.minecraft.world.level.block.Block;
|
||||||
import net.minecraft.world.level.block.DiodeBlock;
|
import net.minecraft.world.level.block.DiodeBlock;
|
||||||
import net.minecraft.world.level.block.DoorBlock;
|
import net.minecraft.world.level.block.DoorBlock;
|
||||||
import net.minecraft.world.level.block.FaceAttachedHorizontalDirectionalBlock;
|
import net.minecraft.world.level.block.FaceAttachedHorizontalDirectionalBlock;
|
||||||
import net.minecraft.world.level.block.FenceGateBlock;
|
|
||||||
import net.minecraft.world.level.block.FlowerPotBlock;
|
import net.minecraft.world.level.block.FlowerPotBlock;
|
||||||
import net.minecraft.world.level.block.GrindstoneBlock;
|
import net.minecraft.world.level.block.GrindstoneBlock;
|
||||||
import net.minecraft.world.level.block.HorizontalDirectionalBlock;
|
import net.minecraft.world.level.block.HorizontalDirectionalBlock;
|
||||||
|
@ -175,15 +174,13 @@ public class BlockMovementChecks {
|
||||||
private static boolean isMovementNecessaryFallback(BlockState state, Level world, BlockPos pos) {
|
private static boolean isMovementNecessaryFallback(BlockState state, Level world, BlockPos pos) {
|
||||||
if (isBrittle(state))
|
if (isBrittle(state))
|
||||||
return true;
|
return true;
|
||||||
if (state.getBlock() instanceof FenceGateBlock)
|
if (!state.getMaterial()
|
||||||
return true;
|
|
||||||
if (state.getMaterial()
|
|
||||||
.isReplaceable())
|
.isReplaceable())
|
||||||
return false;
|
|
||||||
if (state.getCollisionShape(world, pos)
|
|
||||||
.isEmpty())
|
|
||||||
return false;
|
|
||||||
return true;
|
return true;
|
||||||
|
if (!state.getCollisionShape(world, pos)
|
||||||
|
.isEmpty())
|
||||||
|
return true;
|
||||||
|
return AllBlockTags.MOVABLE_EMPTY_COLLIDER.matches(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isMovementAllowedFallback(BlockState state, Level world, BlockPos pos) {
|
private static boolean isMovementAllowedFallback(BlockState state, Level world, BlockPos pos) {
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.simibubi.create.content.logistics.block.redstone;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.simibubi.create.compat.storageDrawers.StorageDrawers;
|
||||||
import com.simibubi.create.content.logistics.block.display.DisplayLinkBlock;
|
import com.simibubi.create.content.logistics.block.display.DisplayLinkBlock;
|
||||||
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;
|
||||||
|
@ -16,6 +17,7 @@ import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.util.Mth;
|
import net.minecraft.util.Mth;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.level.block.Block;
|
import net.minecraft.world.level.block.Block;
|
||||||
|
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
@ -95,10 +97,14 @@ public class StockpileSwitchTileEntity extends SmartTileEntity {
|
||||||
|
|
||||||
BlockPos target = worldPosition.relative(getBlockState().getOptionalValue(StockpileSwitchBlock.FACING)
|
BlockPos target = worldPosition.relative(getBlockState().getOptionalValue(StockpileSwitchBlock.FACING)
|
||||||
.orElse(Direction.NORTH));
|
.orElse(Direction.NORTH));
|
||||||
|
BlockEntity targetTile = level.getBlockEntity(target);
|
||||||
|
|
||||||
if (level.getBlockEntity(target) instanceof StockpileSwitchObservable observable) {
|
if (targetTile instanceof StockpileSwitchObservable observable) {
|
||||||
currentLevel = observable.getPercent() / 100f;
|
currentLevel = observable.getPercent() / 100f;
|
||||||
|
|
||||||
|
} else if (StorageDrawers.isDrawer(targetTile) && observedInventory.hasInventory()) {
|
||||||
|
currentLevel = StorageDrawers.getTrueFillLevel(observedInventory.getInventory(), filtering);
|
||||||
|
|
||||||
} else if (observedInventory.hasInventory() || observedTank.hasInventory()) {
|
} else if (observedInventory.hasInventory() || observedTank.hasInventory()) {
|
||||||
if (observedInventory.hasInventory()) {
|
if (observedInventory.hasInventory()) {
|
||||||
// Item inventory
|
// Item inventory
|
||||||
|
|
|
@ -74,10 +74,15 @@ public class TagGen {
|
||||||
.addTag(BlockTags.BEDS)
|
.addTag(BlockTags.BEDS)
|
||||||
.addTag(BlockTags.DOORS);
|
.addTag(BlockTags.DOORS);
|
||||||
|
|
||||||
|
prov.tag(AllBlockTags.MOVABLE_EMPTY_COLLIDER.tag)
|
||||||
|
.add(Blocks.COBWEB, Blocks.POWDER_SNOW)
|
||||||
|
.addTag(BlockTags.FENCE_GATES);
|
||||||
|
|
||||||
prov.tag(AllBlockTags.FAN_TRANSPARENT.tag)
|
prov.tag(AllBlockTags.FAN_TRANSPARENT.tag)
|
||||||
.add(Blocks.IRON_BARS)
|
.add(Blocks.IRON_BARS)
|
||||||
.addTag(BlockTags.CAMPFIRES)
|
.addTag(BlockTags.CAMPFIRES)
|
||||||
.addTag(BlockTags.FENCES);
|
.addTag(BlockTags.FENCES)
|
||||||
|
.addTag(BlockTags.LEAVES);
|
||||||
|
|
||||||
prov.tag(AllBlockTags.ORE_OVERRIDE_STONE.tag)
|
prov.tag(AllBlockTags.ORE_OVERRIDE_STONE.tag)
|
||||||
.addTag(BlockTags.STONE_ORE_REPLACEABLES);
|
.addTag(BlockTags.STONE_ORE_REPLACEABLES);
|
||||||
|
|
Loading…
Reference in a new issue