1
0
mirror of https://github.com/TechnoVisionDev/Forge-Modding-Tutorial-1.16 synced 2026-03-02 03:40:08 +00:00

Update to Forge 1.16.1

This commit is contained in:
TechnoVisionDev
2020-07-10 20:08:21 -07:00
parent c58d14948e
commit 5441f8d685
6 changed files with 285 additions and 361 deletions

View File

@@ -15,7 +15,7 @@ import java.util.function.Supplier;
public enum ModArmorMaterial implements IArmorMaterial {
RUBY(Tutorial.MOD_ID + ":ruby", 25, new int[] { 2, 5, 6, 2 }, 18,
SoundEvents.ITEM_ARMOR_EQUIP_GENERIC, 0.0F, () -> { return Ingredient.fromItems(RegistryHandler.RUBY.get()); });
SoundEvents.ITEM_ARMOR_EQUIP_GENERIC, 0, () -> { return Ingredient.fromItems(RegistryHandler.RUBY.get()); },0);
private static final int[] MAX_DAMAGE_ARRAY = new int[] { 11, 16, 15, 13 };
private final String name;
@@ -25,9 +25,10 @@ public enum ModArmorMaterial implements IArmorMaterial {
private final SoundEvent soundEvent;
private final float toughness; //Increases Protection, 0.0F=Iron/Gold/Leather, 2.0F=Diamond, 3.0F=Netherite
private final Supplier<Ingredient> repairMaterial;
private final float knockbackResistance; //1.0F=No Knockback, 0.0F=Disabled
ModArmorMaterial(String name, int maxDamageFactor, int[] damageReductionAmountArray, int enchantability,
SoundEvent soundEvent, float toughness, Supplier<Ingredient> repairMaterial) {
SoundEvent soundEvent, float toughness, Supplier<Ingredient> repairMaterial, float knockbackResistance) {
this.name = name;
this.maxDamageFactor = maxDamageFactor;
this.damageReductionAmountArray = damageReductionAmountArray;
@@ -35,6 +36,7 @@ public enum ModArmorMaterial implements IArmorMaterial {
this.soundEvent = soundEvent;
this.toughness = toughness;
this.repairMaterial = repairMaterial;
this.knockbackResistance = knockbackResistance;
}
@Override
@@ -72,4 +74,9 @@ public enum ModArmorMaterial implements IArmorMaterial {
public float getToughness() {
return this.toughness;
}
@Override
public float func_230304_f_() {
return this.knockbackResistance;
}
}

View File

@@ -12,11 +12,12 @@ public class PoisonApple extends Item {
super(new Item.Properties()
.group(Tutorial.TAB)
.food(new Food.Builder()
.hunger(6)
.hunger(4)
.saturation(1.2f)
.effect(new EffectInstance(Effects.NAUSEA, 300, 1), 1)
.effect(new EffectInstance(Effects.POISON, 300, 2), 1)
.effect(new EffectInstance(Effects.HUNGER, 300, 1), 0.8f)
.effect(new EffectInstance(Effects.NAUSEA, 300, 0), 1)
.effect(new EffectInstance(Effects.POISON, 300, 1), 1)
.effect(new EffectInstance(Effects.HUNGER, 300, 0), 0.3f)
.setAlwaysEdible()
.build())
);
}

View File

@@ -17,8 +17,8 @@ import net.minecraftforge.registries.ForgeRegistries;
public class RegistryHandler {
public static final DeferredRegister<Item> ITEMS = new DeferredRegister<>(ForgeRegistries.ITEMS, Tutorial.MOD_ID);
public static final DeferredRegister<Block> BLOCKS = new DeferredRegister<>(ForgeRegistries.BLOCKS, Tutorial.MOD_ID);
public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, Tutorial.MOD_ID);
public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, Tutorial.MOD_ID);
public static void init() {
ITEMS.register(FMLJavaModLoadingContext.get().getModEventBus());
@@ -39,7 +39,7 @@ public class RegistryHandler {
public static final RegistryObject<AxeItem> RUBY_AXE = ITEMS.register("ruby_axe", () ->
new AxeItem(ModItemTier.RUBY, 5, -3.1F, new Item.Properties().group(Tutorial.TAB)));
public static final RegistryObject<HoeItem> RUBY_HOE = ITEMS.register("ruby_hoe", () ->
new HoeItem(ModItemTier.RUBY,-1.0F, new Item.Properties().group(Tutorial.TAB)));
new HoeItem(ModItemTier.RUBY,-3, -1.0F, new Item.Properties().group(Tutorial.TAB)));
// Armor
public static final RegistryObject<ArmorItem> RUBY_HELMET = ITEMS.register("ruby_helmet", () ->