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

View file

@ -5,14 +5,15 @@ import org.betterx.betterend.registry.EndItems;
import net.minecraft.util.LazyLoadedValue;
import net.minecraft.world.item.Tier;
import net.minecraft.world.item.Tiers;
import net.minecraft.world.item.crafting.Ingredient;
import java.util.function.Supplier;
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);
}), TERMINITE(3, 1230, 8.5F, 3.0F, 14, () -> {
}), TERMINITE(Tiers.DIAMOND.getLevel(), 1230, 8.5F, 3.0F, 14, () -> {
return Ingredient.of(EndBlocks.TERMINITE.ingot);
}), AETERNIUM(5, 2196, 10.0F, 4.5F, 18, () -> {
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 net.minecraft.world.item.Items;
import net.minecraft.world.item.Tiers;
public class AnvilRecipes {
public static void register() {
@ -13,6 +14,7 @@ public class AnvilRecipes {
.checkConfig(Configs.RECIPE_CONFIG)
.setInput(Items.ENDER_PEARL)
.setOutput(EndItems.ENDER_DUST)
.setAnvilLevel(Tiers.IRON.getLevel())
.setToolLevel(4)
.setDamage(5)
.build();
@ -20,6 +22,7 @@ public class AnvilRecipes {
.checkConfig(Configs.RECIPE_CONFIG)
.setInput(EndItems.ENDER_SHARD)
.setOutput(EndItems.ENDER_DUST)
.setAnvilLevel(Tiers.IRON.getLevel())
.setToolLevel(0)
.setDamage(3)
.build();

View file

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