Skip to content

Commit

Permalink
finished with armour
Browse files Browse the repository at this point in the history
  • Loading branch information
RealYusufIsmail committed Aug 18, 2023
1 parent c0db7bb commit b8e9760
Show file tree
Hide file tree
Showing 11 changed files with 72 additions and 107 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

package io.github.realyusufismail.bentenmod.events;
package io.github.realyusufismail.bentenmod.core.armour;

import io.github.realyusufismail.bentenmod.core.init.ItemInit;
import net.minecraft.world.effect.MobEffectInstance;
Expand All @@ -46,10 +46,8 @@
import net.minecraftforge.common.extensions.IForgeItem;

public class FourArmsArmor extends ArmorItem implements IForgeItem {
public final Abilities abilities = new Abilities();

public FourArmsArmor(ArmorMaterial materialIn, EquipmentSlot slot, Item.Properties builder) {
super(materialIn, slot, builder);
public FourArmsArmor(ArmorMaterial materialIn, ArmorItem.Type type, Item.Properties builder) {
super(materialIn, type, builder);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

package io.github.realyusufismail.bentenmod.events;
package io.github.realyusufismail.bentenmod.core.armour;

import io.github.realyusufismail.bentenmod.core.init.ItemInit;
import net.minecraft.world.effect.MobEffectInstance;
Expand All @@ -46,10 +46,8 @@
import net.minecraftforge.common.extensions.IForgeItem;

public class HeatBlastArmor extends ArmorItem implements IForgeItem {
public final Abilities abilities = new Abilities();

public HeatBlastArmor(ArmorMaterial materialIn, EquipmentSlot slot, Item.Properties builder) {
super(materialIn, slot, builder);
public HeatBlastArmor(ArmorMaterial materialIn, ArmorItem.Type type, Item.Properties builder) {
super(materialIn, type, builder);
}

@Override
Expand All @@ -76,8 +74,6 @@ public void onArmorTick(ItemStack stack, Level world, Player player) {
player.fallDistance = 0.0F;
player.getAbilities().setFlyingSpeed(0.1F);
}


}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

package io.github.realyusufismail.bentenmod.events;
package io.github.realyusufismail.bentenmod.core.armour;

import io.github.realyusufismail.bentenmod.core.init.ItemInit;
import net.minecraft.world.effect.MobEffectInstance;
Expand All @@ -46,8 +46,8 @@

public class JacketArmorItem extends ArmorItem implements IForgeItem {

public JacketArmorItem(ArmorMaterial materialIn, EquipmentSlot slot, Item.Properties builder) {
super(materialIn, slot, builder);
public JacketArmorItem(ArmorMaterial materialIn, ArmorItem.Type type, Item.Properties builder) {
super(materialIn, type, builder);

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

package io.github.realyusufismail.bentenmod.events;
package io.github.realyusufismail.bentenmod.core.armour;

import io.github.realyusufismail.bentenmod.core.init.ItemInit;
import net.minecraft.world.effect.MobEffectInstance;
Expand All @@ -46,10 +46,8 @@

public class LegendaryArmor extends ArmorItem implements IForgeItem {

public LegendaryArmor(ArmorMaterial materialIn, EquipmentSlot slot, Item.Properties builder) {

super(materialIn, slot, builder);

public LegendaryArmor(ArmorMaterial materialIn, ArmorItem.Type type, Item.Properties builder) {
super(materialIn, type, builder);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

package io.github.realyusufismail.bentenmod.events;
package io.github.realyusufismail.bentenmod.core.armour;

import io.github.realyusufismail.bentenmod.core.init.ItemInit;
import net.minecraft.world.effect.MobEffectInstance;
Expand All @@ -46,8 +46,8 @@

public class Xlr8Armor extends ArmorItem implements IForgeItem {

public Xlr8Armor(ArmorMaterial materialIn, EquipmentSlot slot, Item.Properties builder) {
super(materialIn, slot, builder);
public Xlr8Armor(ArmorMaterial materialIn, ArmorItem.Type type, Item.Properties builder) {
super(materialIn, type, builder);

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,9 @@
package io.github.realyusufismail.bentenmod.core.init;

import io.github.realyusufismail.bentenmod.BenTenMod;
import io.github.realyusufismail.bentenmod.core.armour.*;
import io.github.realyusufismail.bentenmod.core.material.CustomArmorMaterial;
import io.github.realyusufismail.bentenmod.core.material.CustomToolMaterial;
import io.github.realyusufismail.bentenmod.events.*;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.item.*;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
Expand Down Expand Up @@ -138,110 +137,114 @@ public class ItemInit {
// knight armour
public static final RegistryObject<Item> HELMET =
ITEMS.register("helmet", () -> new LegendaryArmor(CustomArmorMaterial.ARMOUR,
EquipmentSlot.HEAD, new Item.Properties()));
ArmorItem.Type.HELMET, new Item.Properties()));

public static final RegistryObject<Item> CHESTPLATE =
ITEMS.register("chestplate", () -> new LegendaryArmor(CustomArmorMaterial.ARMOUR,
EquipmentSlot.CHEST, new Item.Properties()));
ArmorItem.Type.CHESTPLATE, new Item.Properties()));

public static final RegistryObject<Item> LEGGINGS =
ITEMS.register("leggings", () -> new LegendaryArmor(CustomArmorMaterial.ARMOUR,
EquipmentSlot.LEGS, new Item.Properties()));
ArmorItem.Type.LEGGINGS, new Item.Properties()));

public static final RegistryObject<Item> BOOTS =
ITEMS.register("boots", () -> new LegendaryArmor(CustomArmorMaterial.ARMOUR,
EquipmentSlot.FEET, new Item.Properties()));
ArmorItem.Type.BOOTS, new Item.Properties()));
// ben ten clothing
public static final RegistryObject<Item> JACKET =
ITEMS.register("jacket", () -> new JacketArmorItem(CustomArmorMaterial.JACKET,
EquipmentSlot.CHEST, new Item.Properties()));
ArmorItem.Type.CHESTPLATE, new Item.Properties()));

// Heatblast armour

public static final RegistryObject<Item> HEATBLAST_HELMET = ITEMS.register("heatblast_helmet",
() -> new HeatBlastArmor(CustomArmorMaterial.HEATBLAST_ARMOUR, EquipmentSlot.HEAD,
() -> new HeatBlastArmor(CustomArmorMaterial.HEATBLAST_ARMOUR, ArmorItem.Type.HELMET,
new Item.Properties().fireResistant().durability(600)));

public static final RegistryObject<Item> HEATBLAST_CHESTPLATE = ITEMS.register(
"heatblast_chestplate", () -> new HeatBlastArmor(CustomArmorMaterial.HEATBLAST_ARMOUR,
EquipmentSlot.CHEST, new Item.Properties().fireResistant().durability(600)));
public static final RegistryObject<Item> HEATBLAST_CHESTPLATE =
ITEMS.register("heatblast_chestplate",
() -> new HeatBlastArmor(CustomArmorMaterial.HEATBLAST_ARMOUR,
ArmorItem.Type.CHESTPLATE,
new Item.Properties().fireResistant().durability(600)));

public static final RegistryObject<Item> HEATBLAST_LEGGINGS = ITEMS.register(
"heatblast_leggings", () -> new HeatBlastArmor(CustomArmorMaterial.HEATBLAST_ARMOUR,
EquipmentSlot.LEGS, new Item.Properties().fireResistant().durability(600)));
public static final RegistryObject<Item> HEATBLAST_LEGGINGS =
ITEMS.register("heatblast_leggings",
() -> new HeatBlastArmor(CustomArmorMaterial.HEATBLAST_ARMOUR,
ArmorItem.Type.LEGGINGS,
new Item.Properties().fireResistant().durability(600)));

public static final RegistryObject<Item> HEATBLAST_BOOTS = ITEMS.register("heatblast_boots",
() -> new HeatBlastArmor(CustomArmorMaterial.HEATBLAST_ARMOUR, EquipmentSlot.FEET,
() -> new HeatBlastArmor(CustomArmorMaterial.HEATBLAST_ARMOUR, ArmorItem.Type.BOOTS,
new Item.Properties().fireResistant().durability(600)));

// xlr8 armour
public static final RegistryObject<Item> XLR8_HELMET =
ITEMS.register("xlr8_helmet", () -> new Xlr8Armor(CustomArmorMaterial.XLR8_ARMOUR,
EquipmentSlot.HEAD, new Item.Properties()));
ArmorItem.Type.HELMET, new Item.Properties()));

public static final RegistryObject<Item> XLR8_CHESTPLATE =
ITEMS.register("xlr8_chestplate", () -> new Xlr8Armor(CustomArmorMaterial.XLR8_ARMOUR,
EquipmentSlot.CHEST, new Item.Properties()));
ArmorItem.Type.CHESTPLATE, new Item.Properties()));

public static final RegistryObject<Item> XLR8_LEGGINGS =
ITEMS.register("xlr8_leggings", () -> new Xlr8Armor(CustomArmorMaterial.XLR8_ARMOUR,
EquipmentSlot.LEGS, new Item.Properties()));
ArmorItem.Type.LEGGINGS, new Item.Properties()));

public static final RegistryObject<Item> XLR8_BOOTS =
ITEMS.register("xlr8_boots", () -> new Xlr8Armor(CustomArmorMaterial.XLR8_ARMOUR,
EquipmentSlot.FEET, new Item.Properties()));
// 4 Arms
ArmorItem.Type.BOOTS, new Item.Properties()));

// 4 Arms
public static final RegistryObject<Item> FOURARMS_HELMET = ITEMS.register("fourarms_helmet",
() -> new FourArmsArmor(CustomArmorMaterial.FOURARMS_ARMOUR, EquipmentSlot.HEAD,
() -> new FourArmsArmor(CustomArmorMaterial.FOURARMS_ARMOUR, ArmorItem.Type.HELMET,
new Item.Properties()));

public static final RegistryObject<Item> FOURARMS_CHESTPLATE = ITEMS.register(
"fourarms_chestplate", () -> new FourArmsArmor(CustomArmorMaterial.FOURARMS_ARMOUR,
EquipmentSlot.CHEST, new Item.Properties()));
ArmorItem.Type.CHESTPLATE, new Item.Properties()));

public static final RegistryObject<Item> FOURARMS_LEGGINGS = ITEMS.register("fourarms_leggings",
() -> new FourArmsArmor(CustomArmorMaterial.FOURARMS_ARMOUR, EquipmentSlot.LEGS,
() -> new FourArmsArmor(CustomArmorMaterial.FOURARMS_ARMOUR, ArmorItem.Type.LEGGINGS,
new Item.Properties()));

public static final RegistryObject<Item> FOURARMS_BOOT = ITEMS.register("fourarms_boot",
() -> new FourArmsArmor(CustomArmorMaterial.FOURARMS_ARMOUR, EquipmentSlot.FEET,
() -> new FourArmsArmor(CustomArmorMaterial.FOURARMS_ARMOUR, ArmorItem.Type.BOOTS,
new Item.Properties()));


// INFINITUM Armour
public static final RegistryObject<Item> INFINITUM_HELMET = ITEMS.register("infinitum_helmet",
() -> new ArmorItem(CustomArmorMaterial.INFINITUM_ARMOUR, EquipmentSlot.HEAD,
() -> new ArmorItem(CustomArmorMaterial.INFINITUM_ARMOUR, ArmorItem.Type.HELMET,
new Item.Properties()));

public static final RegistryObject<Item> INFINITUM_CHESTPLATE = ITEMS
.register("infinitum_chestplate", () -> new ArmorItem(CustomArmorMaterial.INFINITUM_ARMOUR,
EquipmentSlot.CHEST, new Item.Properties()));
ArmorItem.Type.CHESTPLATE, new Item.Properties()));

public static final RegistryObject<Item> INFINITUM_LEGGINGS = ITEMS
.register("infinitum_leggings", () -> new ArmorItem(CustomArmorMaterial.INFINITUM_ARMOUR,
EquipmentSlot.LEGS, new Item.Properties()));
ArmorItem.Type.LEGGINGS, new Item.Properties()));

public static final RegistryObject<Item> INFINITUM_BOOTS = ITEMS.register("infinitum_boots",
() -> new ArmorItem(CustomArmorMaterial.INFINITUM_ARMOUR, EquipmentSlot.FEET,
() -> new ArmorItem(CustomArmorMaterial.INFINITUM_ARMOUR, ArmorItem.Type.BOOTS,
new Item.Properties()));
// black diamond armour
public static final RegistryObject<Item> BLACK_DIAMOND_HELMET = ITEMS.register(
"black_diamond_helmet", () -> new ArmorItem(CustomArmorMaterial.BLACK_DIAMOND_ARMOUR,
EquipmentSlot.HEAD, new Item.Properties()));
ArmorItem.Type.HELMET, new Item.Properties()));

public static final RegistryObject<Item> BLACK_DIAMOND_CHESTPLATE =
ITEMS.register("black_diamond_chestplate",
() -> new ArmorItem(CustomArmorMaterial.BLACK_DIAMOND_ARMOUR,
EquipmentSlot.CHEST, new Item.Properties()));
ArmorItem.Type.CHESTPLATE, new Item.Properties()));

public static final RegistryObject<Item> BLACK_DIAMOND_LEGGINGS = ITEMS.register(
"black_diamond_leggings", () -> new ArmorItem(CustomArmorMaterial.BLACK_DIAMOND_ARMOUR,
EquipmentSlot.LEGS, new Item.Properties()));
ArmorItem.Type.LEGGINGS, new Item.Properties()));

public static final RegistryObject<Item> BLACK_DIAMOND_BOOTS = ITEMS.register(
"black_diamond_boots", () -> new ArmorItem(CustomArmorMaterial.BLACK_DIAMOND_ARMOUR,
EquipmentSlot.FEET, new Item.Properties()));
ArmorItem.Type.BOOTS, new Item.Properties()));
// Food
public static final RegistryObject<Item> OMNITRIX_APPLE = ITEMS.register("omnitrix_apple",
() -> new Item(new Item.Properties().food(FoodInit.OMNITRIX_APPLE)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,30 @@

import io.github.realyusufismail.bentenmod.BenTenMod;
import io.github.realyusufismail.bentenmod.core.blocks.bententable.OmnitrixCrafterMenu;
import net.minecraft.world.flag.FeatureFlagSet;
import net.minecraft.world.flag.FeatureFlags;
import net.minecraft.world.inventory.AbstractContainerMenu;
import net.minecraft.world.inventory.MenuType;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegistryObject;

import javax.annotation.Nullable;

public class MenuTypeInit {
public static final DeferredRegister<MenuType<?>> MENUS =
DeferredRegister.create(ForgeRegistries.MENU_TYPES, BenTenMod.MOD_ID);

public static final RegistryObject<MenuType<OmnitrixCrafterMenu>> OmnitrixCrafterMenuType =
register("omnitrix_crafter", OmnitrixCrafterMenu::new);
register("omnitrix_crafter", OmnitrixCrafterMenu::new, null);

private static <T extends AbstractContainerMenu> RegistryObject<MenuType<T>> register(
String name, MenuType.MenuSupplier<T> pFactory) {
return MENUS.register(name, () -> new MenuType<>(pFactory));
String name, MenuType.MenuSupplier<T> pFactory,
@Nullable FeatureFlagSet pFeatureFlags) {
if (pFeatureFlags == null) {
pFeatureFlags = FeatureFlags.REGISTRY.allFlags();
}
FeatureFlagSet finalPFeatureFlags = pFeatureFlags;
return MENUS.register(name, () -> new MenuType<>(pFactory, finalPFeatureFlags));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public static void registerCreativeTab(CreativeModeTabEvent.Register event) {
}

private static void createCreativeTabBuilder(CreativeModeTab.Builder builder) {
builder.displayItems((set, out, unknownMagicBoolean) -> {
builder.displayItems((itemDisplayParameters, out) -> {
ItemInit.ITEMS.getEntries()
.stream()
.map(item -> item.get().asItem())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.item.ArmorItem;
import net.minecraft.world.item.ArmorMaterial;
import net.minecraft.world.item.crafting.Ingredient;
import net.minecraftforge.api.distmarker.Dist;
Expand Down Expand Up @@ -86,14 +87,18 @@ public enum CustomArmorMaterial implements ArmorMaterial {
this.repairIngredient = repairIngredient.get();
}

public int getDefenseForSlot(EquipmentSlot slot) {
return this.armorVal[slot.getIndex()];
}

@Override
public int getDurabilityForSlot(EquipmentSlot slot) {
return this.armorVal[slot.getIndex()];
public int getDurabilityForType(ArmorItem.Type pType) {
return durabilityMultiplier * armorVal[pType.getSlot().ordinal()];
}

public int getDefenseForSlot(EquipmentSlot slot) {
return this.armorVal[slot.getIndex()];
@Override
public int getDefenseForType(ArmorItem.Type pType) {
return armorVal[pType.getSlot().ordinal()];
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,6 @@ protected void onHitEntity(EntityHitResult result) {
}
}

@Override
public boolean canBeCollidedWith() {
return false;
}

@Override
public Packet<ClientGamePacketListener> getAddEntityPacket() {
return NetworkHooks.getEntitySpawningPacket(this);
Expand Down

This file was deleted.

0 comments on commit b8e9760

Please sign in to comment.