Change item requirements for block zapper and schematicannon

grass path -> grass block
farmland -> dirt block
This commit is contained in:
grimmauld 2020-09-05 21:24:00 +02:00
parent d73ebd0253
commit 1f06acb497
2 changed files with 11 additions and 10 deletions

View file

@ -4,22 +4,14 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import net.minecraft.block.Block; import net.minecraft.block.*;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.SeaPickleBlock;
import net.minecraft.block.SnowBlock;
import net.minecraft.block.TurtleEggBlock;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType; import net.minecraft.entity.EntityType;
import net.minecraft.entity.item.ArmorStandEntity; import net.minecraft.entity.item.ArmorStandEntity;
import net.minecraft.entity.item.BoatEntity; import net.minecraft.entity.item.BoatEntity;
import net.minecraft.entity.item.ItemFrameEntity; import net.minecraft.entity.item.ItemFrameEntity;
import net.minecraft.entity.item.minecart.AbstractMinecartEntity; import net.minecraft.entity.item.minecart.AbstractMinecartEntity;
import net.minecraft.item.BlockItem; import net.minecraft.item.*;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.state.properties.SlabType; import net.minecraft.state.properties.SlabType;
@ -65,6 +57,10 @@ public class ItemRequirement {
return new ItemRequirement(ItemUseType.CONSUME, Arrays.asList(new ItemStack(item, state.get(SeaPickleBlock.PICKLES).intValue()))); return new ItemRequirement(ItemUseType.CONSUME, Arrays.asList(new ItemStack(item, state.get(SeaPickleBlock.PICKLES).intValue())));
if (block instanceof SnowBlock) if (block instanceof SnowBlock)
return new ItemRequirement(ItemUseType.CONSUME, Arrays.asList(new ItemStack(item, state.get(SnowBlock.LAYERS).intValue()))); return new ItemRequirement(ItemUseType.CONSUME, Arrays.asList(new ItemStack(item, state.get(SnowBlock.LAYERS).intValue())));
if (block instanceof GrassPathBlock)
return new ItemRequirement(ItemUseType.CONSUME, Arrays.asList(new ItemStack(Items.GRASS_BLOCK)));
if (block instanceof FarmlandBlock)
return new ItemRequirement(ItemUseType.CONSUME, Arrays.asList(new ItemStack(Items.DIRT)));
return item == Items.AIR ? INVALID : new ItemRequirement(ItemUseType.CONSUME, item); return item == Items.AIR ? INVALID : new ItemRequirement(ItemUseType.CONSUME, item);
} }

View file

@ -2,6 +2,7 @@ package com.simibubi.create.foundation.utility;
import java.util.function.Consumer; import java.util.function.Consumer;
import net.minecraft.item.Items;
import org.apache.commons.lang3.mutable.MutableInt; import org.apache.commons.lang3.mutable.MutableInt;
import net.minecraft.block.Block; import net.minecraft.block.Block;
@ -115,6 +116,10 @@ public class BlockHelper {
public static ItemStack getRequiredItem(BlockState state) { public static ItemStack getRequiredItem(BlockState state) {
ItemStack itemStack = new ItemStack(state.getBlock()); ItemStack itemStack = new ItemStack(state.getBlock());
if (itemStack.getItem() == Items.FARMLAND)
itemStack = new ItemStack(Items.DIRT);
else if (itemStack.getItem() == Items.GRASS_PATH)
itemStack = new ItemStack(Items.GRASS_BLOCK);
return itemStack; return itemStack;
} }