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