-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
284 changed files
with
3,262 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 ezTxmMC | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
plugins { | ||
id 'maven-publish' | ||
id 'fabric-loom' version '1.1-SNAPSHOT' | ||
} | ||
|
||
version = project.mod_version | ||
group = project.maven_group | ||
|
||
dependencies { | ||
minecraft "com.mojang:minecraft:${project.minecraft_version}" | ||
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" | ||
|
||
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" | ||
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" | ||
|
||
implementation 'org.json:json:20240303' | ||
} | ||
|
||
processResources { | ||
inputs.property "version", project.version | ||
inputs.property "minecraft_version", project.minecraft_version | ||
inputs.property "loader_version", project.loader_version | ||
filteringCharset "UTF-8" | ||
|
||
filesMatching("fabric.mod.json") { | ||
expand "version": project.version, | ||
"minecraft_version": project.minecraft_version, | ||
"loader_version": project.loader_version | ||
} | ||
} | ||
|
||
def targetJavaVersion = 17 | ||
tasks.withType(JavaCompile).configureEach { | ||
it.options.encoding = "UTF-8" | ||
if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) { | ||
it.options.release = targetJavaVersion | ||
} | ||
} | ||
|
||
java { | ||
def javaVersion = JavaVersion.toVersion(targetJavaVersion) | ||
if (JavaVersion.current() < javaVersion) { | ||
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion) | ||
} | ||
archivesBaseName = project.archives_base_name | ||
|
||
withSourcesJar() | ||
} | ||
|
||
jar { | ||
from("LICENSE") { | ||
rename { "${it}_${project.archivesBaseName}"} | ||
} | ||
} | ||
|
||
publishing { | ||
publications { | ||
mavenJava(MavenPublication) { | ||
from components.java | ||
} | ||
} | ||
|
||
repositories {} | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip | ||
networkTimeout=10000 | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
39 changes: 39 additions & 0 deletions
39
fabric/src/main/java/dev/eztxm/moredefaultarmor/MoreDefaultArmor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package dev.eztxm.moredefaultarmor; | ||
|
||
import dev.eztxm.moredefaultarmor.item.ModItemTabs; | ||
import dev.eztxm.moredefaultarmor.item.ModItems; | ||
import dev.eztxm.moredefaultarmor.util.UpdateChecker; | ||
import net.fabricmc.api.ModInitializer; | ||
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayConnectionEvents; | ||
import net.fabricmc.loader.api.FabricLoader; | ||
import net.fabricmc.loader.api.ModContainer; | ||
import net.minecraft.text.Text; | ||
|
||
import java.util.Optional; | ||
|
||
public class MoreDefaultArmor implements ModInitializer { | ||
public static final String MOD_ID = "moredefaultarmor"; | ||
|
||
private static UpdateChecker updateChecker; | ||
|
||
@Override | ||
public void onInitialize() { | ||
ModItemTabs.registerItemGroups(); | ||
ModItems.registerItems(); | ||
ModItemTabs.setupItemGroups(); | ||
|
||
Optional<ModContainer> modContainer = FabricLoader.getInstance().getModContainer(MOD_ID); | ||
modContainer.ifPresent(container -> { | ||
updateChecker = new UpdateChecker(container.getMetadata().getVersion().getFriendlyString()); | ||
updateChecker.getLatestVersion(); | ||
}); | ||
|
||
ClientPlayConnectionEvents.JOIN.register((handler, sender, client) -> { | ||
if (updateChecker != null && !updateChecker.latestVersion()) { | ||
if (client.player != null) { | ||
client.player.sendMessage(Text.translatable("message.moredefaultarmor.update")); | ||
} | ||
} | ||
}); | ||
} | ||
} |
85 changes: 85 additions & 0 deletions
85
fabric/src/main/java/dev/eztxm/moredefaultarmor/armor/ModArmorTiers.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
package dev.eztxm.moredefaultarmor.armor; | ||
|
||
import dev.eztxm.moredefaultarmor.MoreDefaultArmor; | ||
import dev.eztxm.moredefaultarmor.util.LazyValue; | ||
import dev.eztxm.moredefaultarmor.util.ModMaterial; | ||
import net.minecraft.item.ArmorItem; | ||
import net.minecraft.item.ArmorMaterial; | ||
import net.minecraft.item.Items; | ||
import net.minecraft.recipe.Ingredient; | ||
import net.minecraft.sound.SoundEvent; | ||
import net.minecraft.sound.SoundEvents; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import java.util.function.Supplier; | ||
|
||
public enum ModArmorTiers implements ArmorMaterial { | ||
//overworld | ||
DIRT("dirt", ModMaterial.DIRT, SoundEvents.ITEM_ARMOR_EQUIP_LEATHER, () -> Ingredient.ofItems(Items.DIRT), new int[]{19, 28, 32, 25}), | ||
OAK("oak", ModMaterial.OAK, SoundEvents.ITEM_ARMOR_EQUIP_LEATHER, () -> Ingredient.ofItems(Items.OAK_LOG), new int[]{45, 52, 55, 48}), | ||
COBBLESTONE("cobblestone", ModMaterial.STONE, SoundEvents.ITEM_ARMOR_EQUIP_LEATHER, () -> Ingredient.ofItems(Items.COBBLESTONE), new int[]{79, 84, 81, 68}), | ||
ANDESITE("andesite", ModMaterial.STONE, SoundEvents.ITEM_ARMOR_EQUIP_LEATHER, () -> Ingredient.ofItems(Items.ANDESITE), new int[]{79, 84, 81, 68}), | ||
DIORITE("diorite", ModMaterial.STONE, SoundEvents.ITEM_ARMOR_EQUIP_LEATHER, () -> Ingredient.ofItems(Items.DIORITE), new int[]{79, 84, 81, 68}), | ||
GRANITE("granite", ModMaterial.STONE, SoundEvents.ITEM_ARMOR_EQUIP_LEATHER, () -> Ingredient.ofItems(Items.GRANITE), new int[]{79, 84, 81, 68}), | ||
DEEPSLATE_COBBLE("deepslate_cobble", ModMaterial.STONE, SoundEvents.ITEM_ARMOR_EQUIP_LEATHER, () -> Ingredient.ofItems(Items.COBBLED_DEEPSLATE), new int[]{79, 84, 81, 68}), | ||
|
||
// Nether | ||
NETHERRACK("netherrack", ModMaterial.NETHERRACK, SoundEvents.ITEM_ARMOR_EQUIP_LEATHER, () -> Ingredient.ofItems(Items.NETHERRACK), new int[]{19, 28, 32, 25}), | ||
|
||
// End | ||
END_STONE("end_stone", ModMaterial.END_STONE, SoundEvents.ITEM_ARMOR_EQUIP_LEATHER, () -> Ingredient.ofItems(Items.END_STONE), new int[]{79, 84, 81, 68}); | ||
|
||
private final String name; | ||
private final int[] baseDurability; | ||
private final ModMaterial material; | ||
private final SoundEvent equipSound; | ||
private final LazyValue<Ingredient> repairMaterial; | ||
|
||
ModArmorTiers(String name, ModMaterial material, SoundEvent equipSound, Supplier<Ingredient> repairMaterial, int[] baseDurability) { | ||
this.name = name; | ||
this.material = material; | ||
this.baseDurability = baseDurability; | ||
this.equipSound = equipSound; | ||
this.repairMaterial = new LazyValue<>(repairMaterial); | ||
} | ||
|
||
@Override | ||
public int getDurability(ArmorItem.Type type) { | ||
return baseDurability[type.getEquipmentSlot().getEntitySlotId()]; | ||
} | ||
|
||
@Override | ||
public int getProtection(ArmorItem.Type type) { | ||
return this.material.getProtectionAmounts()[type.getEquipmentSlot().getEntitySlotId()]; | ||
} | ||
|
||
@Override | ||
public int getEnchantability() { | ||
return 0; | ||
} | ||
|
||
@Override | ||
public @NotNull SoundEvent getEquipSound() { | ||
return this.equipSound; | ||
} | ||
|
||
@Override | ||
public @NotNull Ingredient getRepairIngredient() { | ||
return this.repairMaterial.get(); | ||
} | ||
|
||
@Override | ||
public @NotNull String getName() { | ||
return MoreDefaultArmor.MOD_ID + ":" + this.name; | ||
} | ||
|
||
@Override | ||
public float getToughness() { | ||
return this.material.getToughness(); | ||
} | ||
|
||
@Override | ||
public float getKnockbackResistance() { | ||
return this.material.getKnockbackResistance(); | ||
} | ||
} |
85 changes: 85 additions & 0 deletions
85
fabric/src/main/java/dev/eztxm/moredefaultarmor/item/ModItemTabs.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
package dev.eztxm.moredefaultarmor.item; | ||
|
||
import dev.eztxm.moredefaultarmor.MoreDefaultArmor; | ||
import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroup; | ||
import net.minecraft.item.ItemGroup; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.registry.Registries; | ||
import net.minecraft.registry.Registry; | ||
import net.minecraft.registry.RegistryKey; | ||
import net.minecraft.registry.RegistryKeys; | ||
import net.minecraft.text.Text; | ||
import net.minecraft.util.Identifier; | ||
|
||
public class ModItemTabs { | ||
public static RegistryKey<ItemGroup> OVERWORLD_ARMORS_TAB; | ||
public static RegistryKey<ItemGroup> NETHER_ARMORS_TAB; | ||
public static RegistryKey<ItemGroup> END_ARMORS_TAB; | ||
|
||
public static void registerItemGroups() { | ||
OVERWORLD_ARMORS_TAB = registerItemGroup("moredefaultarmor1overworldtab"); | ||
NETHER_ARMORS_TAB = registerItemGroup("moredefaultarmor2nethertab"); | ||
END_ARMORS_TAB = registerItemGroup("moredefaultarmor3endtab"); | ||
} | ||
|
||
public static void setupItemGroups() { | ||
Registry.register(Registries.ITEM_GROUP, OVERWORLD_ARMORS_TAB, FabricItemGroup.builder() | ||
.icon(() -> new ItemStack(ModItems.OAK_CHESTPLATE)) | ||
.displayName(Text.translatable("itemGroup.moredefaultarmor.overworld")) | ||
.entries((displayContext, entries) -> { | ||
entries.add(ModItems.DIRT_HELMET); | ||
entries.add(ModItems.DIRT_CHESTPLATE); | ||
entries.add(ModItems.DIRT_LEGGINGS); | ||
entries.add(ModItems.DIRT_BOOTS); | ||
entries.add(ModItems.OAK_HELMET); | ||
entries.add(ModItems.OAK_CHESTPLATE); | ||
entries.add(ModItems.OAK_LEGGINGS); | ||
entries.add(ModItems.OAK_BOOTS); | ||
entries.add(ModItems.COBBLESTONE_HELMET); | ||
entries.add(ModItems.COBBLESTONE_CHESTPLATE); | ||
entries.add(ModItems.COBBLESTONE_LEGGINGS); | ||
entries.add(ModItems.COBBLESTONE_BOOTS); | ||
entries.add(ModItems.ANDESITE_HELMET); | ||
entries.add(ModItems.ANDESITE_CHESTPLATE); | ||
entries.add(ModItems.ANDESITE_LEGGINGS); | ||
entries.add(ModItems.ANDESITE_BOOTS); | ||
entries.add(ModItems.DIORITE_HELMET); | ||
entries.add(ModItems.DIORITE_CHESTPLATE); | ||
entries.add(ModItems.DIORITE_LEGGINGS); | ||
entries.add(ModItems.DIORITE_BOOTS); | ||
entries.add(ModItems.GRANITE_HELMET); | ||
entries.add(ModItems.GRANITE_CHESTPLATE); | ||
entries.add(ModItems.GRANITE_LEGGINGS); | ||
entries.add(ModItems.GRANITE_BOOTS); | ||
entries.add(ModItems.DEEPSLATE_COBBLE_HELMET); | ||
entries.add(ModItems.DEEPSLATE_COBBLE_CHESTPLATE); | ||
entries.add(ModItems.DEEPSLATE_COBBLE_LEGGINGS); | ||
entries.add(ModItems.DEEPSLATE_COBBLE_BOOTS); | ||
}) | ||
.build()); | ||
Registry.register(Registries.ITEM_GROUP, NETHER_ARMORS_TAB, FabricItemGroup.builder() | ||
.icon(() -> new ItemStack(ModItems.NETHERRACK_CHESTPLATE)) | ||
.displayName(Text.translatable("itemGroup.moredefaultarmor.nether")) | ||
.entries((displayContext, entries) -> { | ||
entries.add(ModItems.NETHERRACK_HELMET); | ||
entries.add(ModItems.NETHERRACK_CHESTPLATE); | ||
entries.add(ModItems.NETHERRACK_LEGGINGS); | ||
entries.add(ModItems.NETHERRACK_BOOTS); | ||
}) | ||
.build()); | ||
Registry.register(Registries.ITEM_GROUP, END_ARMORS_TAB, FabricItemGroup.builder() | ||
.icon(() -> new ItemStack(ModItems.END_STONE_CHESTPLATE)) | ||
.displayName(Text.translatable("itemGroup.moredefaultarmor.end")) | ||
.entries((displayContext, entries) -> { | ||
entries.add(ModItems.END_STONE_HELMET); | ||
entries.add(ModItems.END_STONE_CHESTPLATE); | ||
entries.add(ModItems.END_STONE_LEGGINGS); | ||
entries.add(ModItems.END_STONE_BOOTS); | ||
}) | ||
.build()); | ||
} | ||
|
||
private static RegistryKey<ItemGroup> registerItemGroup(String path) { | ||
return RegistryKey.of(RegistryKeys.ITEM_GROUP, new Identifier(MoreDefaultArmor.MOD_ID, path)); | ||
} | ||
} |
Oops, something went wrong.