- Got all hammers back
- Added anvil level and recipe input count
This commit is contained in:
parent
7b40047213
commit
68636e2ecd
18 changed files with 176 additions and 85 deletions
|
@ -35,6 +35,10 @@ public class EndAnvilBlock extends AnvilBlock implements BlockPatterned {
|
|||
super.appendProperties(builder);
|
||||
builder.add(DESTRUCTION);
|
||||
}
|
||||
|
||||
public int getCraftingLevel() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDroppedStacks(BlockState state, LootContext.Builder builder) {
|
||||
|
|
|
@ -2,6 +2,7 @@ package ru.betterend.integration.rei;
|
|||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
|
@ -49,10 +50,12 @@ public class REIAnvilCategory implements TransferRecipeCategory<REIAnvilDisplay>
|
|||
int y = startPoint.y;
|
||||
widgets.add(Widgets.createResultSlotBackground(new Point(x + 61, y + 4)));
|
||||
List<List<EntryStack>> inputEntries = display.getInputEntries();
|
||||
List<EntryStack> materials = inputEntries.get(1);
|
||||
materials.forEach(entryStack -> entryStack.setAmount(display.getInputCount()));
|
||||
widgets.add(Widgets.createArrow(new Point(x + 24, y + 3)));
|
||||
widgets.add(Widgets.createLabel(new Point(bounds.x + bounds.width - 5, bounds.y + bounds.height - 12),
|
||||
new TranslatableText("category.rei.damage.amount&dmg", display.getDamage())).noShadow().rightAligned().color(0xFF404040, 0xFFBBBBBB));
|
||||
widgets.add(Widgets.createSlot(new Point(x - 20, y + 3)).entries(inputEntries.get(1)).markInput());
|
||||
widgets.add(Widgets.createSlot(new Point(x - 20, y + 3)).entries(materials).markInput());
|
||||
widgets.add(Widgets.createSlot(new Point(x + 1, y + 3)).entries(inputEntries.get(0)).markInput());
|
||||
widgets.add(Widgets.createSlot(new Point(x + 61, y + 4)).entries(display.getResultingEntries().get(0)).disableBackground().markOutput());
|
||||
return widgets;
|
||||
|
|
|
@ -16,9 +16,9 @@ import ru.betterend.recipe.builders.AnvilRecipe;
|
|||
|
||||
public class REIAnvilDisplay implements TransferRecipeDisplay {
|
||||
|
||||
private AnvilRecipe recipe;
|
||||
private List<List<EntryStack>> input;
|
||||
private List<EntryStack> output;
|
||||
private final AnvilRecipe recipe;
|
||||
private final List<List<EntryStack>> input;
|
||||
private final List<EntryStack> output;
|
||||
|
||||
public REIAnvilDisplay(AnvilRecipe recipe) {
|
||||
this.recipe = recipe;
|
||||
|
@ -29,6 +29,10 @@ public class REIAnvilDisplay implements TransferRecipeDisplay {
|
|||
public int getDamage() {
|
||||
return this.recipe.getDamage();
|
||||
}
|
||||
|
||||
public int getInputCount() {
|
||||
return this.recipe.getInputCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull Optional<Identifier> getRecipeLocation() {
|
||||
|
|
|
@ -2,7 +2,9 @@ package ru.betterend.mixin.common;
|
|||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
|
@ -21,6 +23,7 @@ import net.minecraft.screen.ForgingScreenHandler;
|
|||
import net.minecraft.screen.ScreenHandlerContext;
|
||||
import net.minecraft.screen.ScreenHandlerType;
|
||||
import net.minecraft.tag.BlockTags;
|
||||
import ru.betterend.blocks.basis.EndAnvilBlock;
|
||||
import ru.betterend.interfaces.AnvilScreenHandlerExtended;
|
||||
import ru.betterend.recipe.builders.AnvilRecipe;
|
||||
|
||||
|
@ -48,7 +51,7 @@ public abstract class AnvilScreenHandlerMixin extends ForgingScreenHandler imple
|
|||
@Inject(method = "onTakeOutput", at = @At("HEAD"), cancellable = true)
|
||||
protected void be_onTakeOutput(PlayerEntity player, ItemStack stack, CallbackInfoReturnable<ItemStack> info) {
|
||||
if (be_currentRecipe != null) {
|
||||
this.input.getStack(0).decrement(1);
|
||||
this.input.getStack(0).decrement(be_currentRecipe.getInputCount());
|
||||
stack = be_currentRecipe.craft(input, player);
|
||||
this.onContentChanged(input);
|
||||
this.context.run((world, blockPos) -> {
|
||||
|
@ -75,11 +78,24 @@ public abstract class AnvilScreenHandlerMixin extends ForgingScreenHandler imple
|
|||
RecipeManager recipeManager = this.player.world.getRecipeManager();
|
||||
this.be_recipes = recipeManager.getAllMatches(AnvilRecipe.TYPE, input, player.world);
|
||||
if (be_recipes.size() > 0) {
|
||||
if (be_currentRecipe == null || !be_recipes.contains(be_currentRecipe)) {
|
||||
this.be_currentRecipe = be_recipes.get(0);
|
||||
this.context.run((world, blockPos) -> {
|
||||
int anvilLevel;
|
||||
Block anvilBlock = world.getBlockState(blockPos).getBlock();
|
||||
if (anvilBlock instanceof EndAnvilBlock) {
|
||||
anvilLevel = ((EndAnvilBlock) anvilBlock).getCraftingLevel();
|
||||
} else {
|
||||
anvilLevel = 1;
|
||||
}
|
||||
this.be_recipes = be_recipes.stream().filter(recipe ->
|
||||
anvilLevel >= recipe.getAnvilLevel()).collect(Collectors.toList());
|
||||
});
|
||||
if (be_recipes.size() > 0) {
|
||||
if (be_currentRecipe == null || !be_recipes.contains(be_currentRecipe)) {
|
||||
this.be_currentRecipe = be_recipes.get(0);
|
||||
}
|
||||
this.be_updateResult();
|
||||
info.cancel();
|
||||
}
|
||||
this.be_updateResult();
|
||||
info.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9,50 +9,50 @@ public class AnvilRecipes {
|
|||
AnvilRecipe.Builder.create("ender_pearl_to_dust")
|
||||
.setInput(Items.ENDER_PEARL)
|
||||
.setOutput(EndItems.ENDER_DUST)
|
||||
.setLevel(4)
|
||||
.setToolLevel(4)
|
||||
.setDamage(5)
|
||||
.build();
|
||||
AnvilRecipe.Builder.create("ender_shard_to_dust")
|
||||
.setInput(EndItems.ENDER_SHARD)
|
||||
.setOutput(EndItems.ENDER_DUST)
|
||||
.setLevel(0)
|
||||
.setToolLevel(0)
|
||||
.setDamage(3)
|
||||
.build();
|
||||
|
||||
AnvilRecipe.Builder.create("aeternium_axe_head")
|
||||
.setInput(EndItems.AETERNIUM_INGOT)
|
||||
.setOutput(EndItems.AETERNIUM_AXE_HEAD)
|
||||
.setLevel(4)
|
||||
.setToolLevel(4)
|
||||
.setDamage(6)
|
||||
.build();
|
||||
AnvilRecipe.Builder.create("aeternium_pickaxe_head")
|
||||
.setInput(EndItems.AETERNIUM_INGOT)
|
||||
.setOutput(EndItems.AETERNIUM_PICKAXE_HEAD)
|
||||
.setLevel(4)
|
||||
.setToolLevel(4)
|
||||
.setDamage(6)
|
||||
.build();
|
||||
AnvilRecipe.Builder.create("aeternium_shovel_head")
|
||||
.setInput(EndItems.AETERNIUM_INGOT)
|
||||
.setOutput(EndItems.AETERNIUM_SHOVEL_HEAD)
|
||||
.setLevel(4)
|
||||
.setToolLevel(4)
|
||||
.setDamage(6)
|
||||
.build();
|
||||
AnvilRecipe.Builder.create("aeternium_hoe_head")
|
||||
.setInput(EndItems.AETERNIUM_INGOT)
|
||||
.setOutput(EndItems.AETERNIUM_HOE_HEAD)
|
||||
.setLevel(4)
|
||||
.setToolLevel(4)
|
||||
.setDamage(6)
|
||||
.build();
|
||||
AnvilRecipe.Builder.create("aeternium_hammer_head")
|
||||
.setInput(EndItems.AETERNIUM_INGOT)
|
||||
.setOutput(EndItems.AETERNIUM_HAMMER_HEAD)
|
||||
.setLevel(4)
|
||||
.setToolLevel(4)
|
||||
.setDamage(6)
|
||||
.build();
|
||||
AnvilRecipe.Builder.create("aeternium_sword_blade")
|
||||
.setInput(EndItems.AETERNIUM_INGOT)
|
||||
.setOutput(EndItems.AETERNIUM_SWORD_BLADE)
|
||||
.setLevel(4)
|
||||
.setToolLevel(4)
|
||||
.setDamage(6)
|
||||
.build();
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package ru.betterend.recipe;
|
|||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.potion.PotionUtil;
|
||||
|
@ -163,21 +164,25 @@ public class CraftingRecipes {
|
|||
GridRecipe.make("fiber_string", Items.STRING).setOutputCount(6).setShape("#", "#", "#").addMaterial('#', EndItems.SILK_FIBER).build();
|
||||
|
||||
GridRecipe.make("ender_eye_amber", Items.ENDER_EYE)
|
||||
.setShape("SAS", "APA", "SAS")
|
||||
.addMaterial('S', EndItems.CRYSTAL_SHARDS)
|
||||
.addMaterial('A', EndItems.AMBER_GEM)
|
||||
.addMaterial('P', Items.ENDER_PEARL)
|
||||
.build();
|
||||
.setShape("SAS", "APA", "SAS")
|
||||
.addMaterial('S', EndItems.CRYSTAL_SHARDS)
|
||||
.addMaterial('A', EndItems.AMBER_GEM)
|
||||
.addMaterial('P', Items.ENDER_PEARL)
|
||||
.build();
|
||||
|
||||
GridRecipe.make("iron_chandelier", EndBlocks.IRON_CHANDELIER).setShape("I#I", " # ").addMaterial('#', Items.IRON_INGOT).addMaterial('I', EndItems.LUMECORN_ROD).setGroup("end_metal_chandelier").build();
|
||||
GridRecipe.make("gold_chandelier", EndBlocks.GOLD_CHANDELIER).setShape("I#I", " # ").addMaterial('#', Items.GOLD_INGOT).addMaterial('I', EndItems.LUMECORN_ROD).setGroup("end_metal_chandelier").build();
|
||||
|
||||
GridRecipe.make("missing_tile", EndBlocks.MISSING_TILE)
|
||||
.setOutputCount(4)
|
||||
.setShape("#P", "P#")
|
||||
.addMaterial('#', EndBlocks.VIOLECITE.stone, EndBlocks.VIOLECITE.bricks, EndBlocks.VIOLECITE.tiles)
|
||||
.addMaterial('P', Blocks.PURPUR_BLOCK)
|
||||
.build();
|
||||
.setOutputCount(4)
|
||||
.setShape("#P", "P#")
|
||||
.addMaterial('#', EndBlocks.VIOLECITE.stone, EndBlocks.VIOLECITE.bricks, EndBlocks.VIOLECITE.tiles)
|
||||
.addMaterial('P', Blocks.PURPUR_BLOCK)
|
||||
.build();
|
||||
|
||||
registerHammer("iron", Items.IRON_INGOT, EndItems.IRON_HAMMER);
|
||||
registerHammer("golden", Items.GOLD_INGOT, EndItems.GOLDEN_HAMMER);
|
||||
registerHammer("diamond", Items.DIAMOND, EndItems.DIAMOND_HAMMER);
|
||||
}
|
||||
|
||||
private static void registerLantern(String name, Block lantern, Block slab) {
|
||||
|
@ -197,4 +202,12 @@ public class CraftingRecipes {
|
|||
.setOutputCount(2)
|
||||
.build();
|
||||
}
|
||||
|
||||
private static void registerHammer(String name, Item material, Item result) {
|
||||
GridRecipe.make(name + "_hammer", result)
|
||||
.setShape("I I", "I#I", " # ")
|
||||
.addMaterial('I', material)
|
||||
.addMaterial('#', Items.STICK)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package ru.betterend.recipe;
|
||||
|
||||
import net.minecraft.item.Items;
|
||||
import ru.betterend.recipe.builders.SmithingTableRecipe;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.registry.EndItems;
|
||||
|
@ -43,6 +44,12 @@ public class SmithingRecipes {
|
|||
.setBase(EndItems.AETERNIUM_HAMMER_HEAD)
|
||||
.setAddition(EndItems.LEATHER_WRAPPED_STICK)
|
||||
.build();
|
||||
|
||||
SmithingTableRecipe.create("netherite_hammer")
|
||||
.setResult(EndItems.NETHERITE_HAMMER)
|
||||
.setBase(EndItems.DIAMOND_HAMMER)
|
||||
.setAddition(Items.NETHERITE_INGOT)
|
||||
.build();
|
||||
|
||||
SmithingTableRecipe.create("aeternium_helmet")
|
||||
.setResult(EndItems.AETERNIUM_HELMET)
|
||||
|
|
|
@ -41,13 +41,17 @@ public class AnvilRecipe implements Recipe<Inventory>, BetterEndRecipe {
|
|||
private final Ingredient input;
|
||||
private final ItemStack output;
|
||||
private final int damage;
|
||||
private final int level;
|
||||
private final int toolLevel;
|
||||
private final int anvilLevel;
|
||||
private final int inputCount;
|
||||
|
||||
public AnvilRecipe(Identifier identifier, Ingredient input, ItemStack output, int level, int damage) {
|
||||
public AnvilRecipe(Identifier identifier, Ingredient input, ItemStack output, int inputCount, int toolLevel, int anvilLevel, int damage) {
|
||||
this.id = identifier;
|
||||
this.input = input;
|
||||
this.output = output;
|
||||
this.level = level;
|
||||
this.toolLevel = toolLevel;
|
||||
this.anvilLevel = anvilLevel;
|
||||
this.inputCount = inputCount;
|
||||
this.damage = damage;
|
||||
}
|
||||
|
||||
|
@ -75,9 +79,8 @@ public class AnvilRecipe implements Recipe<Inventory>, BetterEndRecipe {
|
|||
if (!player.isCreative()) {
|
||||
if (!checkHammerDurability(craftingInventory, player)) return ItemStack.EMPTY;
|
||||
ItemStack hammer = craftingInventory.getStack(1);
|
||||
hammer.damage(this.damage, player, entity -> {
|
||||
entity.sendEquipmentBreakStatus(null);
|
||||
});
|
||||
hammer.damage(this.damage, player, entity ->
|
||||
entity.sendEquipmentBreakStatus(null));
|
||||
}
|
||||
return this.craft(craftingInventory);
|
||||
}
|
||||
|
@ -94,20 +97,31 @@ public class AnvilRecipe implements Recipe<Inventory>, BetterEndRecipe {
|
|||
if (hammer.isEmpty() || !EndTags.HAMMERS.contains(hammer.getItem())) {
|
||||
return false;
|
||||
}
|
||||
ItemStack material = craftingInventory.getStack(0);
|
||||
int materialCount = material.getCount();
|
||||
int level = ((ToolItem) hammer.getItem()).getMaterial().getMiningLevel();
|
||||
return level >= this.level && this.input.test(craftingInventory.getStack(0));
|
||||
return this.input.test(craftingInventory.getStack(0)) &&
|
||||
materialCount >= this.inputCount &&
|
||||
level >= this.toolLevel;
|
||||
}
|
||||
|
||||
public int getDamage() {
|
||||
return this.damage;
|
||||
}
|
||||
|
||||
public int getInputCount() {
|
||||
return this.inputCount;
|
||||
}
|
||||
|
||||
public int getAnvilLevel() {
|
||||
return this.anvilLevel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DefaultedList<Ingredient> getPreviewInputs() {
|
||||
DefaultedList<Ingredient> defaultedList = DefaultedList.of();
|
||||
defaultedList.add(Ingredient.ofStacks(EndTags.HAMMERS.values().stream().filter(hammer -> {
|
||||
return ((ToolItem) hammer).getMaterial().getMiningLevel() >= level;
|
||||
}).map(ItemStack::new)));
|
||||
defaultedList.add(Ingredient.ofStacks(EndTags.HAMMERS.values().stream().filter(hammer ->
|
||||
((ToolItem) hammer).getMaterial().getMiningLevel() >= toolLevel).map(ItemStack::new)));
|
||||
defaultedList.add(input);
|
||||
|
||||
return defaultedList;
|
||||
|
@ -139,12 +153,12 @@ public class AnvilRecipe implements Recipe<Inventory>, BetterEndRecipe {
|
|||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
AnvilRecipe that = (AnvilRecipe) o;
|
||||
return damage == that.damage && level == that.level && id.equals(that.id) && input.equals(that.input) && output.equals(that.output);
|
||||
return damage == that.damage && toolLevel == that.toolLevel && id.equals(that.id) && input.equals(that.input) && output.equals(that.output);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id, input, output, damage, level);
|
||||
return Objects.hash(id, input, output, damage, toolLevel);
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
|
@ -158,7 +172,9 @@ public class AnvilRecipe implements Recipe<Inventory>, BetterEndRecipe {
|
|||
INSTANCE.id = id;
|
||||
INSTANCE.input = null;
|
||||
INSTANCE.output = null;
|
||||
INSTANCE.level = 1;
|
||||
INSTANCE.inputCount = 1;
|
||||
INSTANCE.toolLevel = 1;
|
||||
INSTANCE.anvilLevel = 1;
|
||||
INSTANCE.damage = 1;
|
||||
INSTANCE.alright = true;
|
||||
|
||||
|
@ -168,7 +184,9 @@ public class AnvilRecipe implements Recipe<Inventory>, BetterEndRecipe {
|
|||
private Identifier id;
|
||||
private Ingredient input;
|
||||
private ItemStack output;
|
||||
private int level = 1;
|
||||
private int inputCount = 1;
|
||||
private int toolLevel = 1;
|
||||
private int anvilLevel = 1;
|
||||
private int damage = 1;
|
||||
private boolean alright;
|
||||
|
||||
|
@ -189,6 +207,11 @@ public class AnvilRecipe implements Recipe<Inventory>, BetterEndRecipe {
|
|||
this.input = ingredient;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setInputCount(int count) {
|
||||
this.inputCount = count;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setOutput(ItemConvertible output) {
|
||||
return this.setOutput(output, 1);
|
||||
|
@ -200,8 +223,13 @@ public class AnvilRecipe implements Recipe<Inventory>, BetterEndRecipe {
|
|||
return this;
|
||||
}
|
||||
|
||||
public Builder setLevel(int level) {
|
||||
this.level = level;
|
||||
public Builder setToolLevel(int level) {
|
||||
this.toolLevel = level;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setAnvilLevel(int level) {
|
||||
this.anvilLevel = level;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -228,7 +256,7 @@ public class AnvilRecipe implements Recipe<Inventory>, BetterEndRecipe {
|
|||
BetterEnd.LOGGER.debug("Can't add Anvil recipe {}! Ingeredient or output not exists.", id);
|
||||
return;
|
||||
}
|
||||
EndRecipeManager.addRecipe(TYPE, new AnvilRecipe(id, input, output, level, damage));
|
||||
EndRecipeManager.addRecipe(TYPE, new AnvilRecipe(id, input, output, inputCount, toolLevel, anvilLevel, damage));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -242,27 +270,33 @@ public class AnvilRecipe implements Recipe<Inventory>, BetterEndRecipe {
|
|||
if (output == null) {
|
||||
throw new IllegalStateException("Output item does not exists!");
|
||||
}
|
||||
int level = JsonHelper.getInt(json, "level", 1);
|
||||
int inputCount = JsonHelper.getInt(json, "inputCount", 1);
|
||||
int toolLevel = JsonHelper.getInt(json, "toolLevel", 1);
|
||||
int anvilLevel = JsonHelper.getInt(json, "anvilLevel", 1);
|
||||
int damage = JsonHelper.getInt(json, "damage", 1);
|
||||
|
||||
return new AnvilRecipe(id, input, output, level, damage);
|
||||
return new AnvilRecipe(id, input, output, inputCount, toolLevel, anvilLevel, damage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AnvilRecipe read(Identifier id, PacketByteBuf packetBuffer) {
|
||||
Ingredient input = Ingredient.fromPacket(packetBuffer);
|
||||
ItemStack output = packetBuffer.readItemStack();
|
||||
int level = packetBuffer.readVarInt();
|
||||
int inputCount = packetBuffer.readVarInt();
|
||||
int toolLevel = packetBuffer.readVarInt();
|
||||
int anvilLevel = packetBuffer.readVarInt();
|
||||
int damage = packetBuffer.readVarInt();
|
||||
|
||||
return new AnvilRecipe(id, input, output, level, damage);
|
||||
return new AnvilRecipe(id, input, output, inputCount, toolLevel, anvilLevel, damage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(PacketByteBuf packetBuffer, AnvilRecipe recipe) {
|
||||
recipe.input.write(packetBuffer);
|
||||
packetBuffer.writeItemStack(recipe.output);
|
||||
packetBuffer.writeVarInt(recipe.level);
|
||||
packetBuffer.writeVarInt(recipe.inputCount);
|
||||
packetBuffer.writeVarInt(recipe.toolLevel);
|
||||
packetBuffer.writeVarInt(recipe.anvilLevel);
|
||||
packetBuffer.writeVarInt(recipe.damage);
|
||||
}
|
||||
|
||||
|
|
|
@ -13,18 +13,8 @@ import net.minecraft.entity.SpawnReason;
|
|||
import net.minecraft.entity.effect.StatusEffectInstance;
|
||||
import net.minecraft.entity.effect.StatusEffects;
|
||||
import net.minecraft.fluid.Fluids;
|
||||
import net.minecraft.item.ArmorItem;
|
||||
import net.minecraft.item.FishBucketItem;
|
||||
import net.minecraft.item.FoodComponent;
|
||||
import net.minecraft.item.FoodComponents;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.item.Item.Settings;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.item.ShovelItem;
|
||||
import net.minecraft.item.SpawnEggItem;
|
||||
import net.minecraft.item.SwordItem;
|
||||
import net.minecraft.item.ToolItem;
|
||||
import net.minecraft.tag.Tag;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.Rarity;
|
||||
|
@ -100,6 +90,12 @@ public class EndItems {
|
|||
public final static Item AETERNIUM_HAMMER_HEAD = registerItem("aeternium_hammer_head");
|
||||
public final static Item AETERNIUM_SWORD_BLADE = registerItem("aeternium_sword_blade");
|
||||
public final static Item AETERNIUM_SWORD_HANDLE = registerItem("aeternium_sword_handle");
|
||||
|
||||
// Hammers //
|
||||
public static final ToolItem IRON_HAMMER = registerTool("iron_hammer", new EndHammerItem(ToolMaterials.IRON, 5.0F, -3.2F, 0.2D, makeItemSettings()));
|
||||
public static final ToolItem GOLDEN_HAMMER = registerTool("golden_hammer", new EndHammerItem(ToolMaterials.GOLD, 4.5F, -3.4F, 0.3D, makeItemSettings()));
|
||||
public static final ToolItem DIAMOND_HAMMER = registerTool("diamond_hammer", new EndHammerItem(ToolMaterials.DIAMOND, 5.5F, -3.1F, 0.2D, makeItemSettings()));
|
||||
public static final ToolItem NETHERITE_HAMMER = registerTool("netherite_hammer", new EndHammerItem(ToolMaterials.NETHERITE, 5.0F, -3.0F, 0.2D, makeItemSettings().fireproof()));
|
||||
|
||||
// Food //
|
||||
public final static Item SHADOW_BERRY_RAW = registerFood("shadow_berry_raw", 4, 0.5F);
|
||||
|
|
|
@ -1,14 +1,9 @@
|
|||
package ru.betterend.registry;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import net.fabricmc.fabric.api.tag.TagRegistry;
|
||||
import net.fabricmc.fabric.impl.tool.attribute.ToolManagerImpl;
|
||||
import net.fabricmc.fabric.impl.tool.attribute.handlers.ModdedToolsVanillaBlocksToolHandler;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.LeavesBlock;
|
||||
import net.minecraft.block.Material;
|
||||
|
@ -28,10 +23,11 @@ import ru.betterend.blocks.EndTerrainBlock;
|
|||
import ru.betterend.blocks.basis.PedestalBlock;
|
||||
import ru.betterend.blocks.basis.SimpleLeavesBlock;
|
||||
import ru.betterend.blocks.basis.VineBlock;
|
||||
import ru.betterend.item.EndHammerItem;
|
||||
import ru.betterend.mixin.common.ComposterBlockAccessor;
|
||||
import ru.betterend.util.TagHelper;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class EndTags {
|
||||
// Block Tags
|
||||
public static final Tag.Identified<Block> BOOKSHELVES = makeCommonBlockTag("bookshelves");
|
||||
|
@ -98,14 +94,18 @@ public class EndTags {
|
|||
|
||||
TagHelper.addTag(GEN_TERRAIN, EndBlocks.ENDER_ORE, EndBlocks.FLAVOLITE.stone, EndBlocks.VIOLECITE.stone, EndBlocks.SULPHURIC_ROCK.stone, EndBlocks.BRIMSTONE);
|
||||
TagHelper.addTag(END_GROUND, EndBlocks.SULPHURIC_ROCK.stone, EndBlocks.BRIMSTONE);
|
||||
|
||||
List<Item> hammers = Lists.newArrayList();
|
||||
EndItems.getModItems().forEach((item) -> {
|
||||
if (item instanceof EndHammerItem) {
|
||||
hammers.add(item);
|
||||
}
|
||||
});
|
||||
ToolManagerImpl.tag(HAMMERS).register(new ModdedToolsVanillaBlocksToolHandler(hammers));
|
||||
|
||||
ToolManagerImpl.tag(HAMMERS).register(new ModdedToolsVanillaBlocksToolHandler(
|
||||
Arrays.asList(
|
||||
EndItems.IRON_HAMMER,
|
||||
EndItems.GOLDEN_HAMMER,
|
||||
EndItems.DIAMOND_HAMMER,
|
||||
EndItems.NETHERITE_HAMMER,
|
||||
EndItems.AETERNIUM_HAMMER,
|
||||
EndBlocks.THALLASIUM.hammer,
|
||||
EndBlocks.TERMINITE.hammer
|
||||
)
|
||||
));
|
||||
}
|
||||
|
||||
public static void addSurfaceBlock(Block block) {
|
||||
|
@ -123,17 +123,7 @@ public class EndTags {
|
|||
TagHelper.addTag(END_GROUND, surface);
|
||||
}
|
||||
});
|
||||
END_STONES.values().forEach((block) -> {
|
||||
addSurfaceBlock(block);
|
||||
});
|
||||
}
|
||||
|
||||
public static boolean validGenBlock(BlockState block) {
|
||||
return block.isIn(END_GROUND) || block.isIn(GEN_TERRAIN);
|
||||
}
|
||||
|
||||
public static Tag<Item> registerItemTag(String name) {
|
||||
return TagRegistry.item(BetterEnd.makeID(name));
|
||||
END_STONES.values().forEach(EndTags::addSurfaceBlock);
|
||||
}
|
||||
|
||||
public static Tag<Item> registerFabricItemTag(String name) {
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "minecraft:item/handheld",
|
||||
"textures": {
|
||||
"layer0": "betterend:item/diamond_hammer"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "minecraft:item/handheld",
|
||||
"textures": {
|
||||
"layer0": "betterend:item/golden_hammer"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "minecraft:item/handheld",
|
||||
"textures": {
|
||||
"layer0": "betterend:item/iron_hammer"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "minecraft:item/handheld",
|
||||
"textures": {
|
||||
"layer0": "betterend:item/netherite_hammer"
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 279 B |
Binary file not shown.
After Width: | Height: | Size: 316 B |
Binary file not shown.
After Width: | Height: | Size: 225 B |
Binary file not shown.
After Width: | Height: | Size: 230 B |
Loading…
Add table
Add a link
Reference in a new issue