mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-15 21:43:43 +01:00
Zapper and cannon now place crops in basic growth state
This commit is contained in:
parent
7fea4a66a0
commit
637dee0919
3 changed files with 28 additions and 1 deletions
|
@ -5,6 +5,7 @@ import java.util.List;
|
||||||
import com.simibubi.create.AllSoundEvents;
|
import com.simibubi.create.AllSoundEvents;
|
||||||
import com.simibubi.create.foundation.item.ItemDescription;
|
import com.simibubi.create.foundation.item.ItemDescription;
|
||||||
import com.simibubi.create.foundation.networking.AllPackets;
|
import com.simibubi.create.foundation.networking.AllPackets;
|
||||||
|
import com.simibubi.create.foundation.utility.BlockHelper;
|
||||||
import com.simibubi.create.foundation.utility.Lang;
|
import com.simibubi.create.foundation.utility.Lang;
|
||||||
|
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
|
@ -147,6 +148,7 @@ public abstract class ZapperItem extends Item {
|
||||||
BlockState stateToUse = Blocks.AIR.getDefaultState();
|
BlockState stateToUse = Blocks.AIR.getDefaultState();
|
||||||
if (nbt.contains("BlockUsed"))
|
if (nbt.contains("BlockUsed"))
|
||||||
stateToUse = NBTUtil.readBlockState(nbt.getCompound("BlockUsed"));
|
stateToUse = NBTUtil.readBlockState(nbt.getCompound("BlockUsed"));
|
||||||
|
stateToUse = BlockHelper.setZeroAge(stateToUse);
|
||||||
|
|
||||||
// Raytrace - Find the target
|
// Raytrace - Find the target
|
||||||
Vec3d start = player.getPositionVec()
|
Vec3d start = player.getPositionVec()
|
||||||
|
|
|
@ -23,6 +23,7 @@ import com.simibubi.create.foundation.item.ItemHelper.ExtractionCountMode;
|
||||||
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.utility.BlockHelper;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.block.Blocks;
|
import net.minecraft.block.Blocks;
|
||||||
import net.minecraft.block.PistonHeadBlock;
|
import net.minecraft.block.PistonHeadBlock;
|
||||||
|
@ -402,7 +403,7 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
|
||||||
.get(printingEntityIndex));
|
.get(printingEntityIndex));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
blockState = blockReader.getBlockState(target);
|
blockState = BlockHelper.setZeroAge(blockReader.getBlockState(target));
|
||||||
requirement = ItemRequirement.of(blockState);
|
requirement = ItemRequirement.of(blockState);
|
||||||
shouldSkip = !shouldPlace(target, blockState);
|
shouldSkip = !shouldPlace(target, blockState);
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,6 +64,30 @@ public class BlockHelper {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static BlockState setZeroAge(BlockState blockState) {
|
||||||
|
if(blockState.has(BlockStateProperties.AGE_0_1))
|
||||||
|
return blockState.with(BlockStateProperties.AGE_0_1, 0);
|
||||||
|
if(blockState.has(BlockStateProperties.AGE_0_2))
|
||||||
|
return blockState.with(BlockStateProperties.AGE_0_2, 0);
|
||||||
|
if(blockState.has(BlockStateProperties.AGE_0_3))
|
||||||
|
return blockState.with(BlockStateProperties.AGE_0_3, 0);
|
||||||
|
if(blockState.has(BlockStateProperties.AGE_0_5))
|
||||||
|
return blockState.with(BlockStateProperties.AGE_0_5, 0);
|
||||||
|
if(blockState.has(BlockStateProperties.AGE_0_7))
|
||||||
|
return blockState.with(BlockStateProperties.AGE_0_7, 0);
|
||||||
|
if(blockState.has(BlockStateProperties.AGE_0_15))
|
||||||
|
return blockState.with(BlockStateProperties.AGE_0_15, 0);
|
||||||
|
if(blockState.has(BlockStateProperties.AGE_0_25))
|
||||||
|
return blockState.with(BlockStateProperties.AGE_0_25, 0);
|
||||||
|
if(blockState.has(BlockStateProperties.HONEY_LEVEL))
|
||||||
|
return blockState.with(BlockStateProperties.HONEY_LEVEL, 0);
|
||||||
|
if(blockState.has(BlockStateProperties.HATCH_0_2))
|
||||||
|
return blockState.with(BlockStateProperties.HATCH_0_2, 0);
|
||||||
|
if(blockState.has(BlockStateProperties.STAGE_0_1))
|
||||||
|
return blockState.with(BlockStateProperties.STAGE_0_1, 0);
|
||||||
|
return blockState;
|
||||||
|
}
|
||||||
|
|
||||||
public static int findAndRemoveInInventory(BlockState block, PlayerEntity player, int amount) {
|
public static int findAndRemoveInInventory(BlockState block, PlayerEntity player, int amount) {
|
||||||
int amountFound = 0;
|
int amountFound = 0;
|
||||||
Item required = getRequiredItem(block).getItem();
|
Item required = getRequiredItem(block).getItem();
|
||||||
|
|
Loading…
Reference in a new issue