Improved Anvil-Level handling

This commit is contained in:
Frank 2022-07-28 19:52:07 +02:00
parent e45eade668
commit 59b4f5fb9a
4 changed files with 46 additions and 20 deletions

View file

@ -85,14 +85,21 @@ public class MetalMaterial {
public final TagKey<Item> alloyingOre; public final TagKey<Item> alloyingOre;
public static MetalMaterial makeNormal(String name, MaterialColor color, Tier material, ArmorMaterial armor) { public static MetalMaterial makeNormal(
String name,
MaterialColor color,
Tier material,
ArmorMaterial armor,
int anvilAndToolLevel
) {
return new MetalMaterial( return new MetalMaterial(
name, name,
true, true,
FabricBlockSettings.copyOf(Blocks.IRON_BLOCK).mapColor(color), FabricBlockSettings.copyOf(Blocks.IRON_BLOCK).mapColor(color),
EndItems.makeEndItemSettings(), EndItems.makeEndItemSettings(),
material, material,
armor armor,
anvilAndToolLevel
); );
} }
@ -102,7 +109,8 @@ public class MetalMaterial {
float hardness, float hardness,
float resistance, float resistance,
Tier material, Tier material,
ArmorMaterial armor ArmorMaterial armor,
int anvilAndToolLevel
) { ) {
return new MetalMaterial( return new MetalMaterial(
name, name,
@ -113,18 +121,26 @@ public class MetalMaterial {
.resistance(resistance), .resistance(resistance),
EndItems.makeEndItemSettings(), EndItems.makeEndItemSettings(),
material, material,
armor armor,
anvilAndToolLevel
); );
} }
public static MetalMaterial makeOreless(String name, MaterialColor color, Tier material, ArmorMaterial armor) { public static MetalMaterial makeOreless(
String name,
MaterialColor color,
Tier material,
ArmorMaterial armor,
int anvilAndToolLevel
) {
return new MetalMaterial( return new MetalMaterial(
name, name,
false, false,
FabricBlockSettings.copyOf(Blocks.IRON_BLOCK).mapColor(color), FabricBlockSettings.copyOf(Blocks.IRON_BLOCK).mapColor(color),
EndItems.makeEndItemSettings(), EndItems.makeEndItemSettings(),
material, material,
armor armor,
anvilAndToolLevel
); );
} }
@ -134,7 +150,8 @@ public class MetalMaterial {
float hardness, float hardness,
float resistance, float resistance,
Tier material, Tier material,
ArmorMaterial armor ArmorMaterial armor,
int anvilAndToolLevel
) { ) {
return new MetalMaterial( return new MetalMaterial(
name, name,
@ -145,7 +162,8 @@ public class MetalMaterial {
.resistance(resistance), .resistance(resistance),
EndItems.makeEndItemSettings(), EndItems.makeEndItemSettings(),
material, material,
armor armor,
anvilAndToolLevel
); );
} }
@ -155,7 +173,8 @@ public class MetalMaterial {
FabricBlockSettings settings, FabricBlockSettings settings,
Properties itemSettings, Properties itemSettings,
Tier material, Tier material,
ArmorMaterial armor ArmorMaterial armor,
int anvilAndToolLevel
) { ) {
BlockBehaviour.Properties lanternProperties = FabricBlockSettings.copyOf(settings) BlockBehaviour.Properties lanternProperties = FabricBlockSettings.copyOf(settings)
.hardness(1) .hardness(1)
@ -219,7 +238,7 @@ public class MetalMaterial {
anvilBlock = EndBlocks.registerBlock( anvilBlock = EndBlocks.registerBlock(
name + "_anvil", name + "_anvil",
new EndAnvilBlock(this, block.defaultMaterialColor(), level) new EndAnvilBlock(this, block.defaultMaterialColor(), anvilAndToolLevel)
); );
if (hasOre) { if (hasOre) {
@ -387,7 +406,7 @@ public class MetalMaterial {
.checkConfig(Configs.RECIPE_CONFIG) .checkConfig(Configs.RECIPE_CONFIG)
.setInput(ingot) .setInput(ingot)
.setOutput(shovelHead) .setOutput(shovelHead)
.setAnvilLevel(level) .setAnvilLevel(anvilAndToolLevel)
.setToolLevel(level) .setToolLevel(level)
.setDamage(level) .setDamage(level)
.build(); .build();
@ -396,7 +415,7 @@ public class MetalMaterial {
.setInput(ingot) .setInput(ingot)
.setInputCount(3) .setInputCount(3)
.setOutput(pickaxeHead) .setOutput(pickaxeHead)
.setAnvilLevel(level) .setAnvilLevel(anvilAndToolLevel)
.setToolLevel(level) .setToolLevel(level)
.setDamage(level) .setDamage(level)
.build(); .build();
@ -405,7 +424,7 @@ public class MetalMaterial {
.setInput(ingot) .setInput(ingot)
.setInputCount(3) .setInputCount(3)
.setOutput(axeHead) .setOutput(axeHead)
.setAnvilLevel(level) .setAnvilLevel(anvilAndToolLevel)
.setToolLevel(level) .setToolLevel(level)
.setDamage(level) .setDamage(level)
.build(); .build();
@ -414,7 +433,7 @@ public class MetalMaterial {
.setInput(ingot) .setInput(ingot)
.setInputCount(2) .setInputCount(2)
.setOutput(hoeHead) .setOutput(hoeHead)
.setAnvilLevel(level) .setAnvilLevel(anvilAndToolLevel)
.setToolLevel(level) .setToolLevel(level)
.setDamage(level) .setDamage(level)
.build(); .build();
@ -422,7 +441,7 @@ public class MetalMaterial {
.checkConfig(Configs.RECIPE_CONFIG) .checkConfig(Configs.RECIPE_CONFIG)
.setInput(ingot) .setInput(ingot)
.setOutput(swordBlade) .setOutput(swordBlade)
.setAnvilLevel(level) .setAnvilLevel(anvilAndToolLevel)
.setToolLevel(level) .setToolLevel(level)
.setDamage(level) .setDamage(level)
.build(); .build();
@ -430,7 +449,7 @@ public class MetalMaterial {
.checkConfig(Configs.RECIPE_CONFIG) .checkConfig(Configs.RECIPE_CONFIG)
.setInput(ingot) .setInput(ingot)
.setOutput(forgedPlate) .setOutput(forgedPlate)
.setAnvilLevel(level) .setAnvilLevel(anvilAndToolLevel)
.setToolLevel(level) .setToolLevel(level)
.setDamage(level) .setDamage(level)
.build(); .build();

View file

@ -5,14 +5,15 @@ import org.betterx.betterend.registry.EndItems;
import net.minecraft.util.LazyLoadedValue; import net.minecraft.util.LazyLoadedValue;
import net.minecraft.world.item.Tier; import net.minecraft.world.item.Tier;
import net.minecraft.world.item.Tiers;
import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.world.item.crafting.Ingredient;
import java.util.function.Supplier; import java.util.function.Supplier;
public enum EndToolMaterial implements Tier { public enum EndToolMaterial implements Tier {
THALLASIUM(2, 320, 7.0F, 1.5F, 12, () -> { THALLASIUM(Tiers.IRON.getLevel(), 320, 7.0F, 1.5F, 12, () -> {
return Ingredient.of(EndBlocks.THALLASIUM.ingot); return Ingredient.of(EndBlocks.THALLASIUM.ingot);
}), TERMINITE(3, 1230, 8.5F, 3.0F, 14, () -> { }), TERMINITE(Tiers.DIAMOND.getLevel(), 1230, 8.5F, 3.0F, 14, () -> {
return Ingredient.of(EndBlocks.TERMINITE.ingot); return Ingredient.of(EndBlocks.TERMINITE.ingot);
}), AETERNIUM(5, 2196, 10.0F, 4.5F, 18, () -> { }), AETERNIUM(5, 2196, 10.0F, 4.5F, 18, () -> {
return Ingredient.of(EndItems.AETERNIUM_INGOT); return Ingredient.of(EndItems.AETERNIUM_INGOT);

View file

@ -6,6 +6,7 @@ import org.betterx.betterend.item.material.EndToolMaterial;
import org.betterx.betterend.registry.EndItems; import org.betterx.betterend.registry.EndItems;
import net.minecraft.world.item.Items; import net.minecraft.world.item.Items;
import net.minecraft.world.item.Tiers;
public class AnvilRecipes { public class AnvilRecipes {
public static void register() { public static void register() {
@ -13,6 +14,7 @@ public class AnvilRecipes {
.checkConfig(Configs.RECIPE_CONFIG) .checkConfig(Configs.RECIPE_CONFIG)
.setInput(Items.ENDER_PEARL) .setInput(Items.ENDER_PEARL)
.setOutput(EndItems.ENDER_DUST) .setOutput(EndItems.ENDER_DUST)
.setAnvilLevel(Tiers.IRON.getLevel())
.setToolLevel(4) .setToolLevel(4)
.setDamage(5) .setDamage(5)
.build(); .build();
@ -20,6 +22,7 @@ public class AnvilRecipes {
.checkConfig(Configs.RECIPE_CONFIG) .checkConfig(Configs.RECIPE_CONFIG)
.setInput(EndItems.ENDER_SHARD) .setInput(EndItems.ENDER_SHARD)
.setOutput(EndItems.ENDER_DUST) .setOutput(EndItems.ENDER_DUST)
.setAnvilLevel(Tiers.IRON.getLevel())
.setToolLevel(0) .setToolLevel(0)
.setDamage(3) .setDamage(3)
.build(); .build();

View file

@ -545,15 +545,18 @@ public class EndBlocks {
"thallasium", "thallasium",
MaterialColor.COLOR_BLUE, MaterialColor.COLOR_BLUE,
EndToolMaterial.THALLASIUM, EndToolMaterial.THALLASIUM,
EndArmorMaterial.THALLASIUM EndArmorMaterial.THALLASIUM,
EndToolMaterial.THALLASIUM.getLevel()
); );
public static final MetalMaterial TERMINITE = MetalMaterial.makeOreless( public static final MetalMaterial TERMINITE = MetalMaterial.makeOreless(
"terminite", "terminite",
MaterialColor.WARPED_WART_BLOCK, MaterialColor.WARPED_WART_BLOCK,
7F, 7F,
9F, 9F,
EndToolMaterial.TERMINITE, EndToolMaterial.TERMINITE,
EndArmorMaterial.TERMINITE EndArmorMaterial.TERMINITE,
EndToolMaterial.TERMINITE.getLevel()
); );
public static final Block AETERNIUM_BLOCK = registerBlock("aeternium_block", new AeterniumBlock()); public static final Block AETERNIUM_BLOCK = registerBlock("aeternium_block", new AeterniumBlock());
public static final Block CHARCOAL_BLOCK = registerBlock("charcoal_block", new CharcoalBlock()); public static final Block CHARCOAL_BLOCK = registerBlock("charcoal_block", new CharcoalBlock());