mirror of
https://github.com/Creators-of-Create/Create.git
synced 2025-03-04 14:54:42 +01:00
Fix schematicannons consuming a single item for group items (#7058)
This commit is contained in:
parent
c765b00c77
commit
e065bb386b
1 changed files with 39 additions and 8 deletions
|
@ -1,5 +1,6 @@
|
||||||
package com.simibubi.create.foundation.utility;
|
package com.simibubi.create.foundation.utility;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
@ -45,6 +46,8 @@ import net.minecraft.world.level.block.SlimeBlock;
|
||||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
||||||
|
import net.minecraft.world.level.block.state.properties.BooleanProperty;
|
||||||
|
import net.minecraft.world.level.block.state.properties.IntegerProperty;
|
||||||
import net.minecraft.world.level.block.state.properties.Property;
|
import net.minecraft.world.level.block.state.properties.Property;
|
||||||
import net.minecraft.world.level.block.state.properties.SlabType;
|
import net.minecraft.world.level.block.state.properties.SlabType;
|
||||||
import net.minecraft.world.level.chunk.LevelChunk;
|
import net.minecraft.world.level.chunk.LevelChunk;
|
||||||
|
@ -55,6 +58,24 @@ import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.event.level.BlockEvent;
|
import net.minecraftforge.event.level.BlockEvent;
|
||||||
|
|
||||||
public class BlockHelper {
|
public class BlockHelper {
|
||||||
|
private static final List<IntegerProperty> COUNT_STATES = List.of(
|
||||||
|
BlockStateProperties.EGGS,
|
||||||
|
BlockStateProperties.PICKLES,
|
||||||
|
BlockStateProperties.CANDLES
|
||||||
|
);
|
||||||
|
|
||||||
|
private static final List<Block> VINELIKE_BLOCKS = List.of(
|
||||||
|
Blocks.VINE, Blocks.GLOW_LICHEN
|
||||||
|
);
|
||||||
|
|
||||||
|
private static final List<BooleanProperty> VINELIKE_STATES = List.of(
|
||||||
|
BlockStateProperties.UP,
|
||||||
|
BlockStateProperties.NORTH,
|
||||||
|
BlockStateProperties.EAST,
|
||||||
|
BlockStateProperties.SOUTH,
|
||||||
|
BlockStateProperties.WEST,
|
||||||
|
BlockStateProperties.DOWN
|
||||||
|
);
|
||||||
|
|
||||||
public static BlockState setZeroAge(BlockState blockState) {
|
public static BlockState setZeroAge(BlockState blockState) {
|
||||||
if (blockState.hasProperty(BlockStateProperties.AGE_1))
|
if (blockState.hasProperty(BlockStateProperties.AGE_1))
|
||||||
|
@ -96,11 +117,21 @@ public class BlockHelper {
|
||||||
if (needsTwo)
|
if (needsTwo)
|
||||||
amount *= 2;
|
amount *= 2;
|
||||||
|
|
||||||
if (block.hasProperty(BlockStateProperties.EGGS))
|
for (IntegerProperty property : COUNT_STATES)
|
||||||
amount *= block.getValue(BlockStateProperties.EGGS);
|
if (block.hasProperty(property))
|
||||||
|
amount *= block.getValue(property);
|
||||||
|
|
||||||
if (block.hasProperty(BlockStateProperties.PICKLES))
|
if (VINELIKE_BLOCKS.contains(block.getBlock())) {
|
||||||
amount *= block.getValue(BlockStateProperties.PICKLES);
|
int vineCount = 0;
|
||||||
|
|
||||||
|
for (BooleanProperty vineState : VINELIKE_STATES) {
|
||||||
|
if (block.hasProperty(vineState) && block.getValue(vineState)) {
|
||||||
|
vineCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
amount += vineCount - 1;
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
// Try held Item first
|
// Try held Item first
|
||||||
|
|
Loading…
Add table
Reference in a new issue