From 1f06acb497b0827ebf1faad2b1f6afe20806e6ce Mon Sep 17 00:00:00 2001 From: grimmauld Date: Sat, 5 Sep 2020 21:24:00 +0200 Subject: [PATCH] Change item requirements for block zapper and schematicannon grass path -> grass block farmland -> dirt block --- .../content/schematics/ItemRequirement.java | 16 ++++++---------- .../create/foundation/utility/BlockHelper.java | 5 +++++ 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/simibubi/create/content/schematics/ItemRequirement.java b/src/main/java/com/simibubi/create/content/schematics/ItemRequirement.java index 6220d871c..1d8602b6c 100644 --- a/src/main/java/com/simibubi/create/content/schematics/ItemRequirement.java +++ b/src/main/java/com/simibubi/create/content/schematics/ItemRequirement.java @@ -4,22 +4,14 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import net.minecraft.block.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.block.*; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityType; import net.minecraft.entity.item.ArmorStandEntity; import net.minecraft.entity.item.BoatEntity; import net.minecraft.entity.item.ItemFrameEntity; import net.minecraft.entity.item.minecart.AbstractMinecartEntity; -import net.minecraft.item.BlockItem; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; +import net.minecraft.item.*; import net.minecraft.state.properties.BlockStateProperties; 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()))); if (block instanceof SnowBlock) 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); } diff --git a/src/main/java/com/simibubi/create/foundation/utility/BlockHelper.java b/src/main/java/com/simibubi/create/foundation/utility/BlockHelper.java index c851e0173..9c1abc718 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/BlockHelper.java +++ b/src/main/java/com/simibubi/create/foundation/utility/BlockHelper.java @@ -2,6 +2,7 @@ package com.simibubi.create.foundation.utility; import java.util.function.Consumer; +import net.minecraft.item.Items; import org.apache.commons.lang3.mutable.MutableInt; import net.minecraft.block.Block; @@ -115,6 +116,10 @@ public class BlockHelper { public static ItemStack getRequiredItem(BlockState state) { 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; }