Addressed multiple ToDo's
This commit is contained in:
parent
c6742982df
commit
e8dbbffa8e
6 changed files with 36 additions and 23 deletions
|
@ -128,13 +128,10 @@ public class BCLFeatureBuilder<FC extends FeatureConfiguration, F extends Featur
|
|||
return modifier(BiomeFilter.biome());
|
||||
}
|
||||
|
||||
// Are these two things required in 1.18.1?
|
||||
// TODO - add information
|
||||
public BCLFeatureBuilder squarePlacement() {
|
||||
return modifier(InSquarePlacement.spread());
|
||||
}
|
||||
|
||||
// TODO - add information
|
||||
public BCLFeatureBuilder heightmap() {
|
||||
return modifier(PlacementUtils.HEIGHTMAP);
|
||||
}
|
||||
|
|
|
@ -118,7 +118,6 @@ public abstract class BaseDoublePlantBlock extends BaseBlockNotFull implements R
|
|||
}
|
||||
|
||||
ItemStack tool = builder.getParameter(LootContextParams.TOOL);
|
||||
//TODO: 1.18.2 Test if shearing still works
|
||||
if (tool != null && BaseShearsItem.isShear(tool) || EnchantmentHelper.getItemEnchantmentLevel(
|
||||
Enchantments.SILK_TOUCH,
|
||||
tool
|
||||
|
|
|
@ -127,7 +127,6 @@ public abstract class BasePlantBlock extends BaseBlockNotFull implements RenderL
|
|||
@Override
|
||||
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
||||
ItemStack tool = builder.getParameter(LootContextParams.TOOL);
|
||||
//TODO: 1.18.2 Test if shearing still works
|
||||
if (tool != null && BaseShearsItem.isShear(tool) || EnchantmentHelper.getItemEnchantmentLevel(
|
||||
Enchantments.SILK_TOUCH,
|
||||
tool
|
||||
|
|
|
@ -77,9 +77,7 @@ public class BaseTerrainBlock extends BaseBlock {
|
|||
Player player,
|
||||
InteractionHand hand,
|
||||
BlockHitResult hit) {
|
||||
//TODO: 1.18.2 check
|
||||
if (pathBlock != null && TagAPI.isToolWithMineableTag(player.getMainHandItem(), NamedMineableTags.SHOVEL)) {
|
||||
//if (pathBlock != null && FabricTagProvider.SHOVELS.contains(player.getMainHandItem().getItem())) {
|
||||
world.playSound(player, pos, SoundEvents.SHOVEL_FLATTEN, SoundSource.BLOCKS, 1.0F, 1.0F);
|
||||
if (!world.isClientSide) {
|
||||
world.setBlockAndUpdate(pos, pathBlock.defaultBlockState());
|
||||
|
|
|
@ -34,6 +34,7 @@ import org.betterx.bclib.util.ItemUtil;
|
|||
import org.betterx.bclib.util.RecipeHelper;
|
||||
|
||||
import java.util.Objects;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class AnvilRecipe implements Recipe<Container>, UnknownReceipBookCategory {
|
||||
public final static String GROUP = "smithing";
|
||||
|
@ -102,41 +103,60 @@ public class AnvilRecipe implements Recipe<Container>, UnknownReceipBookCategory
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(Container craftingInventory, Level world) {
|
||||
public boolean matches(@NotNull Container craftingInventory, @NotNull Level world) {
|
||||
return this.matches(craftingInventory);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack assemble(Container craftingInventory) {
|
||||
public ItemStack assemble(@NotNull Container craftingInventory) {
|
||||
return this.output.copy();
|
||||
}
|
||||
|
||||
public ItemStack getHammer(Container c) {
|
||||
ItemStack h = c.getItem(1);
|
||||
if (!h.isEmpty() && h.is(CommonItemTags.HAMMERS)) return h;
|
||||
h = c.getItem(0);
|
||||
if (!h.isEmpty() && h.is(CommonItemTags.HAMMERS)) return h;
|
||||
return null;
|
||||
}
|
||||
|
||||
public ItemStack getIngredient(Container c) {
|
||||
ItemStack i = c.getItem(0);
|
||||
if (i.is(CommonItemTags.HAMMERS)) i = c.getItem(1);
|
||||
return i;
|
||||
}
|
||||
|
||||
public ItemStack craft(Container craftingInventory, Player player) {
|
||||
if (!player.isCreative()) {
|
||||
if (!checkHammerDurability(craftingInventory, player)) return ItemStack.EMPTY;
|
||||
ItemStack hammer = craftingInventory.getItem(1);
|
||||
ItemStack hammer = getHammer(craftingInventory);
|
||||
if (hammer != null) {
|
||||
hammer.hurtAndBreak(this.damage, player, entity -> entity.broadcastBreakEvent((InteractionHand) null));
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
}
|
||||
return this.assemble(craftingInventory);
|
||||
}
|
||||
|
||||
public boolean checkHammerDurability(Container craftingInventory, Player player) {
|
||||
if (player.isCreative()) return true;
|
||||
ItemStack hammer = craftingInventory.getItem(1);
|
||||
ItemStack hammer = getHammer(craftingInventory);
|
||||
if (hammer != null) {
|
||||
int damage = hammer.getDamageValue() + this.damage;
|
||||
return damage < hammer.getMaxDamage();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean matches(Container craftingInventory) {
|
||||
ItemStack hammer = craftingInventory.getItem(1);
|
||||
//TODO: 1.18.2 Test if hammer still works
|
||||
if (hammer.isEmpty() || !hammer.is(CommonItemTags.HAMMERS)) {
|
||||
ItemStack hammer = getHammer(craftingInventory);
|
||||
if (hammer == null) {
|
||||
return false;
|
||||
}
|
||||
ItemStack material = craftingInventory.getItem(0);
|
||||
ItemStack material = getIngredient(craftingInventory);
|
||||
int materialCount = material.getCount();
|
||||
int level = ((TieredItem) hammer.getItem()).getTier().getLevel();
|
||||
return this.input.test(craftingInventory.getItem(0)) && materialCount >= this.inputCount && level >= this.toolLevel;
|
||||
return this.input.test(getIngredient(craftingInventory)) && materialCount >= this.inputCount && level >= this.toolLevel;
|
||||
}
|
||||
|
||||
public int getDamage() {
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
{
|
||||
"schemaVersion": 1,
|
||||
"id": "bclib",
|
||||
"version": "2.0.0",
|
||||
"version": "${version}",
|
||||
"name": "BCLib",
|
||||
"description": "A library for BetterX team mods",
|
||||
"authors": [
|
||||
"paulevs",
|
||||
"Quiqueck",
|
||||
"paulevs",
|
||||
"Bulldog83"
|
||||
],
|
||||
"contact": {
|
||||
"homepage": "https://www.curseforge.com/minecraft/mc-mods/bclib",
|
||||
"issues": "https://github.com/paulevsGitch/bclib/issues",
|
||||
"sources": "https://github.com/paulevsGitch/bclib"
|
||||
"issues": "https://github.com/quiqueck/bclib/issues",
|
||||
"sources": "https://github.com/quiqueck/bclib"
|
||||
},
|
||||
"license": "MIT",
|
||||
"icon": "assets/bclib/icon.png",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue