Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8a83aa0ceb | |||
| 1decadbdd1 | |||
| d583b5c706 |
+2
-2
@@ -134,9 +134,9 @@ dependencies {
|
||||
// localRuntime "mezz.jei:jei-${mc_version}-neoforge:${jei_version}"
|
||||
|
||||
// compile against the JEI API but do not include it at runtime
|
||||
compileOnly("mezz.jei:jei-${minecraft_version}-neoforge-api:${jei_version}")
|
||||
// compileOnly("mezz.jei:jei-${minecraft_version}-neoforge-api:${jei_version}")
|
||||
// at runtime, use the full JEI jar for NeoForge
|
||||
runtimeOnly("mezz.jei:jei-${minecraft_version}-neoforge:${jei_version}")
|
||||
// runtimeOnly("mezz.jei:jei-${minecraft_version}-neoforge:${jei_version}")
|
||||
|
||||
// Example mod dependency using a mod jar from ./libs with a flat dir repository
|
||||
// This maps to ./libs/coolmod-${mc_version}-${coolmod_version}.jar
|
||||
|
||||
+6
-6
@@ -7,20 +7,20 @@ org.gradle.configuration-cache=true
|
||||
|
||||
#read more on this at https://github.com/neoforged/ModDevGradle?tab=readme-ov-file#better-minecraft-parameter-names--javadoc-parchment
|
||||
# you can also find the latest versions at: https://parchmentmc.org/docs/getting-started
|
||||
parchment_minecraft_version=1.21.1
|
||||
parchment_mappings_version=2024.11.17
|
||||
parchment_minecraft_version=1.21.3
|
||||
parchment_mappings_version=2024.12.07
|
||||
# Environment Properties
|
||||
# You can find the latest versions here: https://projects.neoforged.net/neoforged/neoforge
|
||||
# The Minecraft version must agree with the Neo version to get a valid artifact
|
||||
minecraft_version=1.21.1
|
||||
minecraft_version=1.21.3
|
||||
# The Minecraft version range can use any release version of Minecraft as bounds.
|
||||
# Snapshots, pre-releases, and release candidates are not guaranteed to sort properly
|
||||
# as they do not follow standard versioning conventions.
|
||||
minecraft_version_range=[1.21.1]
|
||||
minecraft_version_range=[1.21.3, 1.21.4)
|
||||
# The Neo version must agree with the Minecraft version to get a valid artifact
|
||||
neo_version=21.1.148
|
||||
neo_version=21.3.95
|
||||
# The Neo version range can use any version of Neo as bounds
|
||||
neo_version_range=[21.1.148,)
|
||||
neo_version_range=[21.3.95,)
|
||||
# The loader version range can only use the major version of FML as bounds
|
||||
loader_version_range=[1,)
|
||||
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package net.krituximon.stalinium;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.item.Item;
|
||||
@@ -41,7 +43,7 @@ public class Config
|
||||
public static boolean logDirtBlock;
|
||||
public static int magicNumber;
|
||||
public static String magicNumberIntroduction;
|
||||
public static Set<Item> items;
|
||||
public static Set<Optional<Holder.Reference<Item>>> items;
|
||||
|
||||
private static boolean validateItemName(final Object obj)
|
||||
{
|
||||
|
||||
@@ -46,9 +46,9 @@ public class StaliniumCacheBlock extends BaseEntityBlock {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ItemInteractionResult useItemOn(ItemStack stack, BlockState state, Level level,
|
||||
BlockPos pos, Player player, InteractionHand hand,
|
||||
BlockHitResult hit) {
|
||||
protected InteractionResult useItemOn(ItemStack stack, BlockState state, Level level,
|
||||
BlockPos pos, Player player, InteractionHand hand,
|
||||
BlockHitResult hit) {
|
||||
if (!level.isClientSide() && player instanceof ServerPlayer sp) {
|
||||
var container = StaliniumCacheBlockEntity.getPartyInventory(sp);
|
||||
sp.openMenu(new SimpleMenuProvider(
|
||||
@@ -56,7 +56,7 @@ public class StaliniumCacheBlock extends BaseEntityBlock {
|
||||
Component.translatable("container.stalinium.cache")
|
||||
), pos);
|
||||
}
|
||||
return ItemInteractionResult.sidedSuccess(level.isClientSide());
|
||||
return InteractionResult.SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.ItemInteractionResult;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.SimpleMenuProvider;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
@@ -54,8 +54,8 @@ public class StaliniumPressBlock extends BaseEntityBlock {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ItemInteractionResult useItemOn(ItemStack pStack, BlockState pState, Level pLevel, BlockPos pPos,
|
||||
Player pPlayer, InteractionHand pHand, BlockHitResult pHitResult) {
|
||||
protected InteractionResult useItemOn(ItemStack pStack, BlockState pState, Level pLevel, BlockPos pPos,
|
||||
Player pPlayer, InteractionHand pHand, BlockHitResult pHitResult) {
|
||||
if (!pLevel.isClientSide()) {
|
||||
BlockEntity entity = pLevel.getBlockEntity(pPos);
|
||||
if (entity instanceof StaliniumPressBlockEntity staliniumPressBlockEntity) {
|
||||
@@ -64,7 +64,7 @@ public class StaliniumPressBlock extends BaseEntityBlock {
|
||||
throw new IllegalStateException("Our Container provider is missing!");
|
||||
}
|
||||
}
|
||||
return ItemInteractionResult.sidedSuccess(pLevel.isClientSide());
|
||||
return InteractionResult.SUCCESS;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -16,15 +16,15 @@ public class ModBlockEntities {
|
||||
|
||||
|
||||
public static final Supplier<BlockEntityType<StaliniumPressBlockEntity>> STALINIUM_PRESS_BE =
|
||||
BLOCK_ENTITIES.register("stalinium_press_be", () -> BlockEntityType.Builder.of(
|
||||
StaliniumPressBlockEntity::new, ModBlocks.STALINIUM_PRESS.get()).build(null));
|
||||
BLOCK_ENTITIES.register("stalinium_press_be", () -> new BlockEntityType<>(
|
||||
StaliniumPressBlockEntity::new, ModBlocks.STALINIUM_PRESS.get()));
|
||||
|
||||
public static final Supplier<BlockEntityType<StaliniumCacheBlockEntity>> STALINIUM_CACHE_BE =
|
||||
BLOCK_ENTITIES.register("stalinium_cache", () ->
|
||||
BlockEntityType.Builder.of(
|
||||
new BlockEntityType<>(
|
||||
StaliniumCacheBlockEntity::new,
|
||||
ModBlocks.STALINIUM_CACHE.get()
|
||||
).build(null)
|
||||
)
|
||||
);
|
||||
|
||||
public static void register(IEventBus eventBus) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package net.krituximon.stalinium.compat;
|
||||
/*package net.krituximon.stalinium.compat;
|
||||
|
||||
import mezz.jei.api.IModPlugin;
|
||||
import mezz.jei.api.JeiPlugin;
|
||||
@@ -52,3 +52,4 @@ public class JEIStaliniumPlugin implements IModPlugin {
|
||||
StaliniumPressRecipeCategory.TYPE);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package net.krituximon.stalinium.compat;
|
||||
/*package net.krituximon.stalinium.compat;
|
||||
|
||||
import mezz.jei.api.constants.VanillaTypes;
|
||||
import mezz.jei.api.gui.builder.IRecipeLayoutBuilder;
|
||||
@@ -89,3 +89,5 @@ public class StaliniumPressRecipeCategory implements IRecipeCategory<StaliniumPr
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
@@ -26,7 +26,7 @@ public class DataGenerators {
|
||||
CompletableFuture<HolderLookup.Provider> lookupProvider = event.getLookupProvider();
|
||||
|
||||
generator.addProvider(event.includeServer(), new LootTableProvider(packOutput, Collections.emptySet(), List.of(new LootTableProvider.SubProviderEntry(ModBlockLootTableProvider::new, LootContextParamSets.BLOCK)), lookupProvider));
|
||||
generator.addProvider(event.includeServer(), new ModRecipeProvider(packOutput, lookupProvider));
|
||||
generator.addProvider(event.includeServer(), new ModRecipeProvider.Runner(packOutput, lookupProvider));
|
||||
|
||||
BlockTagsProvider blockTagsProvider = new ModBlockTagProvider(packOutput, lookupProvider, existingFileHelper);
|
||||
generator.addProvider(event.includeServer(), blockTagsProvider);
|
||||
|
||||
@@ -19,57 +19,73 @@ import net.minecraft.world.item.crafting.Ingredient;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
public class ModRecipeProvider extends RecipeProvider implements IConditionBuilder {
|
||||
public ModRecipeProvider(PackOutput output, CompletableFuture<HolderLookup.Provider> registries) {
|
||||
super(output, registries);
|
||||
public ModRecipeProvider(HolderLookup.Provider provider, RecipeOutput recipeOutput) {
|
||||
super(provider, recipeOutput);
|
||||
}
|
||||
|
||||
public static class Runner extends RecipeProvider.Runner {
|
||||
public Runner(PackOutput packOutput, CompletableFuture<HolderLookup.Provider> provider) {
|
||||
super(packOutput, provider);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RecipeProvider createRecipeProvider(HolderLookup.Provider provider, RecipeOutput recipeOutput) {
|
||||
return new ModRecipeProvider(provider, recipeOutput);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Stalinium Recipes";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void buildRecipes(RecipeOutput recipeOutput) {
|
||||
ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModBlocks.STALINIUM_BLOCK.get())
|
||||
protected void buildRecipes() {
|
||||
shaped(RecipeCategory.MISC, ModBlocks.STALINIUM_BLOCK.get())
|
||||
.pattern("BBB")
|
||||
.pattern("BBB")
|
||||
.pattern("BBB")
|
||||
.define('B', ModItems.STALINIUM_INGOT.get())
|
||||
.unlockedBy("has_stalinium", has(ModItems.STALINIUM_INGOT)).save(recipeOutput);
|
||||
.unlockedBy("has_stalinium", has(ModItems.STALINIUM_INGOT)).save(output);
|
||||
|
||||
ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModItems.SOVIET_ANTHEM_MUSIC_DISC.get())
|
||||
shaped(RecipeCategory.MISC, ModItems.SOVIET_ANTHEM_MUSIC_DISC.get())
|
||||
.pattern("BBB")
|
||||
.pattern("BSB")
|
||||
.pattern("BBB")
|
||||
.define('B', ModItems.STALINIUM_INGOT.get())
|
||||
.define('S', Items.GOLD_BLOCK)
|
||||
.unlockedBy("has_stalinium", has(ModItems.STALINIUM_INGOT)).save(recipeOutput);
|
||||
.unlockedBy("has_stalinium", has(ModItems.STALINIUM_INGOT)).save(output);
|
||||
|
||||
ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, ModItems.STALINIUM_INGOT.get(), 9)
|
||||
shapeless(RecipeCategory.MISC, ModItems.STALINIUM_INGOT.get(), 9)
|
||||
.requires(ModBlocks.STALINIUM_BLOCK)
|
||||
.unlockedBy("has_stalinium_block", has(ModBlocks.STALINIUM_BLOCK)).save(recipeOutput);
|
||||
.unlockedBy("has_stalinium_block", has(ModBlocks.STALINIUM_BLOCK)).save(output);
|
||||
|
||||
ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModBlocks.STALINIUM_PRESS.get())
|
||||
shaped(RecipeCategory.MISC, ModBlocks.STALINIUM_PRESS.get())
|
||||
.pattern("INI")
|
||||
.pattern("NSN")
|
||||
.pattern("INI")
|
||||
.define('I', Items.NETHERITE_INGOT)
|
||||
.define('N', ModItems.STALINIUM_NUGGET.get())
|
||||
.define('S', Items.NETHER_STAR)
|
||||
.unlockedBy("has_nugget", has(ModItems.STALINIUM_NUGGET)).save(recipeOutput);
|
||||
.unlockedBy("has_nugget", has(ModItems.STALINIUM_NUGGET)).save(output);
|
||||
|
||||
ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModBlocks.STALINIUM_CACHE.get())
|
||||
shaped(RecipeCategory.MISC, ModBlocks.STALINIUM_CACHE.get())
|
||||
.pattern("ISI")
|
||||
.pattern("SES")
|
||||
.pattern("SIS")
|
||||
.define('I', Items.IRON_BLOCK)
|
||||
.define('E', Items.ENDER_CHEST)
|
||||
.define('S', ModItems.STALINIUM_INGOT.get())
|
||||
.unlockedBy("has_nugget", has(ModItems.STALINIUM_NUGGET)).save(recipeOutput);
|
||||
.unlockedBy("has_nugget", has(ModItems.STALINIUM_NUGGET)).save(output);
|
||||
|
||||
ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModItems.STALINIUM_SMITHING_TEMPLATE.get(), 4)
|
||||
shaped(RecipeCategory.MISC, ModItems.STALINIUM_SMITHING_TEMPLATE.get(), 4)
|
||||
.pattern("NNN")
|
||||
.pattern("NIN")
|
||||
.pattern("NSN")
|
||||
.define('I', ModItems.STALINIUM_INGOT)
|
||||
.define('N', ModItems.STALINIUM_NUGGET.get())
|
||||
.define('S', Items.IRON_BLOCK)
|
||||
.unlockedBy("has_nugget", has(ModItems.STALINIUM_NUGGET)).save(recipeOutput);
|
||||
.unlockedBy("has_nugget", has(ModItems.STALINIUM_NUGGET)).save(output);
|
||||
|
||||
SmithingTransformRecipeBuilder.smithing(
|
||||
Ingredient.of(ModItems.STALINIUM_SMITHING_TEMPLATE.get()),
|
||||
@@ -79,8 +95,7 @@ public class ModRecipeProvider extends RecipeProvider implements IConditionBuild
|
||||
ModItems.STALINIUM_SWORD.get()
|
||||
)
|
||||
.unlocks("has_netherite", has(Items.NETHERITE_SWORD))
|
||||
.save(recipeOutput,
|
||||
ResourceLocation.fromNamespaceAndPath(Stalinium.MODID, "smithing/stalinium_sword"));
|
||||
.save(output, "smithing/stalinium_sword");
|
||||
|
||||
SmithingTransformRecipeBuilder.smithing(
|
||||
Ingredient.of(ModItems.STALINIUM_SMITHING_TEMPLATE.get()),
|
||||
@@ -90,8 +105,7 @@ public class ModRecipeProvider extends RecipeProvider implements IConditionBuild
|
||||
ModItems.STALINIUM_PICKAXE.get()
|
||||
)
|
||||
.unlocks("has_netherite", has(Items.NETHERITE_PICKAXE))
|
||||
.save(recipeOutput,
|
||||
ResourceLocation.fromNamespaceAndPath(Stalinium.MODID, "smithing/stalinium_pickaxe"));
|
||||
.save(output, "smithing/stalinium_pickaxe");
|
||||
|
||||
SmithingTransformRecipeBuilder.smithing(
|
||||
Ingredient.of(ModItems.STALINIUM_SMITHING_TEMPLATE.get()),
|
||||
@@ -101,8 +115,7 @@ public class ModRecipeProvider extends RecipeProvider implements IConditionBuild
|
||||
ModItems.STALINIUM_AXE.get()
|
||||
)
|
||||
.unlocks("has_netherite", has(Items.NETHERITE_AXE))
|
||||
.save(recipeOutput,
|
||||
ResourceLocation.fromNamespaceAndPath(Stalinium.MODID, "smithing/stalinium_axe"));
|
||||
.save(output, "smithing/stalinium_axe");
|
||||
|
||||
SmithingTransformRecipeBuilder.smithing(
|
||||
Ingredient.of(ModItems.STALINIUM_SMITHING_TEMPLATE.get()),
|
||||
@@ -112,8 +125,7 @@ public class ModRecipeProvider extends RecipeProvider implements IConditionBuild
|
||||
ModItems.STALINIUM_SHOVEL.get()
|
||||
)
|
||||
.unlocks("has_netherite", has(Items.NETHERITE_SHOVEL))
|
||||
.save(recipeOutput,
|
||||
ResourceLocation.fromNamespaceAndPath(Stalinium.MODID, "smithing/stalinium_shovel"));
|
||||
.save(output, "smithing/stalinium_shovel");
|
||||
|
||||
SmithingTransformRecipeBuilder.smithing(
|
||||
Ingredient.of(ModItems.STALINIUM_SMITHING_TEMPLATE.get()),
|
||||
@@ -123,8 +135,7 @@ public class ModRecipeProvider extends RecipeProvider implements IConditionBuild
|
||||
ModItems.STALINIUM_HOE.get()
|
||||
)
|
||||
.unlocks("has_netherite", has(Items.NETHERITE_HOE))
|
||||
.save(recipeOutput,
|
||||
ResourceLocation.fromNamespaceAndPath(Stalinium.MODID, "smithing/stalinium_hoe"));
|
||||
.save(output, "smithing/stalinium_hoe");
|
||||
|
||||
SmithingTransformRecipeBuilder.smithing(
|
||||
Ingredient.of(ModItems.STALINIUM_SMITHING_TEMPLATE.get()),
|
||||
@@ -134,8 +145,7 @@ public class ModRecipeProvider extends RecipeProvider implements IConditionBuild
|
||||
ModItems.STALINIUM_HELMET.get()
|
||||
)
|
||||
.unlocks("has_netherite", has(Items.NETHERITE_HELMET))
|
||||
.save(recipeOutput,
|
||||
ResourceLocation.fromNamespaceAndPath(Stalinium.MODID, "smithing/stalinium_helmet"));
|
||||
.save(output, "smithing/stalinium_helmet");
|
||||
|
||||
SmithingTransformRecipeBuilder.smithing(
|
||||
Ingredient.of(ModItems.STALINIUM_SMITHING_TEMPLATE.get()),
|
||||
@@ -145,8 +155,7 @@ public class ModRecipeProvider extends RecipeProvider implements IConditionBuild
|
||||
ModItems.STALINIUM_CHESTPLATE.get()
|
||||
)
|
||||
.unlocks("has_netherite", has(Items.NETHERITE_CHESTPLATE))
|
||||
.save(recipeOutput,
|
||||
ResourceLocation.fromNamespaceAndPath(Stalinium.MODID, "smithing/stalinium_chestplate"));
|
||||
.save(output, "smithing/stalinium_chestplate");
|
||||
|
||||
SmithingTransformRecipeBuilder.smithing(
|
||||
Ingredient.of(ModItems.STALINIUM_SMITHING_TEMPLATE.get()),
|
||||
@@ -156,8 +165,7 @@ public class ModRecipeProvider extends RecipeProvider implements IConditionBuild
|
||||
ModItems.STALINIUM_LEGGINGS.get()
|
||||
)
|
||||
.unlocks("has_netherite", has(Items.NETHERITE_LEGGINGS))
|
||||
.save(recipeOutput,
|
||||
ResourceLocation.fromNamespaceAndPath(Stalinium.MODID, "smithing/stalinium_leggings"));
|
||||
.save(output, "smithing/stalinium_leggings");
|
||||
|
||||
SmithingTransformRecipeBuilder.smithing(
|
||||
Ingredient.of(ModItems.STALINIUM_SMITHING_TEMPLATE.get()),
|
||||
@@ -167,8 +175,7 @@ public class ModRecipeProvider extends RecipeProvider implements IConditionBuild
|
||||
ModItems.STALINIUM_BOOTS.get()
|
||||
)
|
||||
.unlocks("has_netherite", has(Items.NETHERITE_BOOTS))
|
||||
.save(recipeOutput,
|
||||
ResourceLocation.fromNamespaceAndPath(Stalinium.MODID, "smithing/stalinium_boots"));
|
||||
.save(output, "smithing/stalinium_boots");
|
||||
|
||||
SmithingTransformRecipeBuilder.smithing(
|
||||
Ingredient.of(ModItems.STALINIUM_SMITHING_TEMPLATE.get()),
|
||||
@@ -178,7 +185,6 @@ public class ModRecipeProvider extends RecipeProvider implements IConditionBuild
|
||||
ModItems.STALINIUM_MACE.get()
|
||||
)
|
||||
.unlocks("has_netherite", has(Items.NETHERITE_BOOTS))
|
||||
.save(recipeOutput,
|
||||
ResourceLocation.fromNamespaceAndPath(Stalinium.MODID, "smithing/stalinium_mace"));
|
||||
.save(output, "smithing/stalinium_mace");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -240,9 +240,9 @@ public class ComradeHandler {
|
||||
Optional<Party> opt = findPartyOf(a);
|
||||
if (opt.isPresent() && opt.get().isMember(b)) {
|
||||
event.setCanceled(true);
|
||||
src.sendSystemMessage(Component.literal(
|
||||
((Player) src).displayClientMessage(Component.literal(
|
||||
"§cYou cannot hurt your comrade “" + victim.getName().getString() + "”!"
|
||||
));
|
||||
), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package net.krituximon.stalinium.item;
|
||||
|
||||
import net.krituximon.stalinium.Stalinium;
|
||||
import net.krituximon.stalinium.util.ModTags;
|
||||
import net.minecraft.Util;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.Registry;
|
||||
@@ -9,39 +10,23 @@ import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.world.item.ArmorItem;
|
||||
import net.minecraft.world.item.ArmorMaterial;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.crafting.Ingredient;
|
||||
import net.minecraft.world.item.equipment.ArmorMaterial;
|
||||
import net.minecraft.world.item.equipment.ArmorType;
|
||||
|
||||
import java.util.EnumMap;
|
||||
import java.util.List;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class ModArmorMaterials {
|
||||
public static final Holder<ArmorMaterial> STALINIUM_ARMOR_MATERIAL = register("stalinium",
|
||||
Util.make(new EnumMap<>(ArmorItem.Type.class), attribute -> {
|
||||
attribute.put(ArmorItem.Type.BOOTS, 6);
|
||||
attribute.put(ArmorItem.Type.LEGGINGS, 8);
|
||||
attribute.put(ArmorItem.Type.CHESTPLATE, 10);
|
||||
attribute.put(ArmorItem.Type.HELMET, 6);
|
||||
attribute.put(ArmorItem.Type.BODY, 12);
|
||||
}), 25, 3.5f, 0.15f, () -> ModItems.STALINIUM_INGOT.get());
|
||||
|
||||
|
||||
private static Holder<ArmorMaterial> register(String name, EnumMap<ArmorItem.Type, Integer> typeProtection,
|
||||
int enchantability, float toughness, float knockbackResistance,
|
||||
Supplier<Item> ingredientItem) {
|
||||
ResourceLocation location = ResourceLocation.fromNamespaceAndPath(Stalinium.MODID, name);
|
||||
Holder<SoundEvent> equipSound = SoundEvents.ARMOR_EQUIP_NETHERITE;
|
||||
Supplier<Ingredient> ingredient = () -> Ingredient.of(ingredientItem.get());
|
||||
List<ArmorMaterial.Layer> layers = List.of(new ArmorMaterial.Layer(location));
|
||||
|
||||
EnumMap<ArmorItem.Type, Integer> typeMap = new EnumMap<>(ArmorItem.Type.class);
|
||||
for (ArmorItem.Type type : ArmorItem.Type.values()) {
|
||||
typeMap.put(type, typeProtection.get(type));
|
||||
}
|
||||
|
||||
return Registry.registerForHolder(BuiltInRegistries.ARMOR_MATERIAL, location,
|
||||
new ArmorMaterial(typeProtection, enchantability, equipSound, ingredient, layers, toughness, knockbackResistance));
|
||||
}
|
||||
public static final ArmorMaterial STALINIUM_ARMOR_MATERIAL = new ArmorMaterial(8096,
|
||||
Util.make(new EnumMap<>(ArmorType.class), attribute -> {
|
||||
attribute.put(ArmorType.BOOTS, 6);
|
||||
attribute.put(ArmorType.LEGGINGS, 8);
|
||||
attribute.put(ArmorType.CHESTPLATE, 10);
|
||||
attribute.put(ArmorType.HELMET, 6);
|
||||
attribute.put(ArmorType.BODY, 12);
|
||||
}), 25, SoundEvents.ARMOR_EQUIP_NETHERITE, 3.5f, 0.15f,
|
||||
ModTags.Items.STALINIUM_REPAIRABLE, ResourceLocation.fromNamespaceAndPath(Stalinium.MODID, "stalinium"));
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import net.minecraft.world.item.component.ItemAttributeModifiers;
|
||||
import net.minecraft.world.entity.EquipmentSlot;
|
||||
import net.minecraft.world.entity.ai.attributes.AttributeModifier;
|
||||
import net.minecraft.world.entity.ai.attributes.Attributes;
|
||||
import net.minecraft.world.item.equipment.ArmorType;
|
||||
import net.neoforged.bus.api.IEventBus;
|
||||
import net.neoforged.neoforge.registries.DeferredItem;
|
||||
import net.neoforged.neoforge.registries.DeferredRegister;
|
||||
@@ -17,63 +18,58 @@ import net.neoforged.neoforge.registries.DeferredRegister;
|
||||
public class ModItems {
|
||||
public static final DeferredRegister.Items ITEMS = DeferredRegister.createItems(Stalinium.MODID);
|
||||
|
||||
public static final DeferredItem<Item> STALINIUM_INGOT = ITEMS.register("stalinium_ingot",
|
||||
() -> new Item(new Item.Properties()));
|
||||
public static final DeferredItem<Item> STALINIUM_INGOT = ITEMS.registerItem("stalinium_ingot",
|
||||
Item::new);
|
||||
|
||||
public static final DeferredItem<Item> STALINIUM_NUGGET = ITEMS.register("stalinium_nugget",
|
||||
() -> new Item(new Item.Properties()));
|
||||
public static final DeferredItem<Item> STALINIUM_NUGGET = ITEMS.registerItem("stalinium_nugget",
|
||||
Item::new);
|
||||
|
||||
public static final DeferredItem<Item> SOVIET_ANTHEM_MUSIC_DISC = ITEMS.register("soviet_anthem_music_disc",
|
||||
() -> new Item(new Item.Properties().jukeboxPlayable(ModSounds.SOVIET_ANTHEM_KEY).stacksTo(1)));
|
||||
public static final DeferredItem<Item> SOVIET_ANTHEM_MUSIC_DISC = ITEMS.registerItem("soviet_anthem_music_disc",
|
||||
Item::new, new Item.Properties().jukeboxPlayable(ModSounds.SOVIET_ANTHEM_KEY).stacksTo(1));
|
||||
|
||||
public static final DeferredItem<SwordItem> STALINIUM_SWORD = ITEMS.register("stalinium_sword",
|
||||
() -> new StaliniumSwordItem(ModTiers.STALINIUM, new Item.Properties()
|
||||
public static final DeferredItem<SwordItem> STALINIUM_SWORD = ITEMS.registerItem("stalinium_sword",
|
||||
(properties) -> new StaliniumSwordItem(ModTiers.STALINIUM, 3f, -2.4f, properties
|
||||
.component(DataComponents.UNBREAKABLE, new Unbreakable(true))));
|
||||
|
||||
public static final DeferredItem<AxeItem> STALINIUM_AXE = ITEMS.registerItem("stalinium_axe",
|
||||
(properties) -> new StaliniumAxeItem(ModTiers.STALINIUM, 5f, -3.0f, properties
|
||||
.component(DataComponents.UNBREAKABLE, new Unbreakable(true))));
|
||||
|
||||
public static final DeferredItem<PickaxeItem> STALINIUM_PICKAXE = ITEMS.registerItem("stalinium_pickaxe",
|
||||
(properties) -> new StaliniumPickaxeItem(ModTiers.STALINIUM, 1.0f, -2.8f, properties
|
||||
.component(DataComponents.UNBREAKABLE, new Unbreakable(true))));
|
||||
|
||||
public static final DeferredItem<ShovelItem> STALINIUM_SHOVEL = ITEMS.registerItem("stalinium_shovel",
|
||||
(properties) -> new StaliniumShovelItem(ModTiers.STALINIUM, 1.5f, -3.0f, properties
|
||||
.component(DataComponents.UNBREAKABLE, new Unbreakable(true))));
|
||||
|
||||
public static final DeferredItem<HoeItem> STALINIUM_HOE = ITEMS.registerItem("stalinium_hoe",
|
||||
(properties) -> new StaliniumHoeItem(ModTiers.STALINIUM, 1.0f, -3.0f, properties
|
||||
.component(DataComponents.UNBREAKABLE, new Unbreakable(true))));
|
||||
|
||||
public static final DeferredItem<ArmorItem> STALINIUM_HELMET = ITEMS.registerItem("stalinium_helmet",
|
||||
(properties) -> new StaliniumHelmetItem(ModArmorMaterials.STALINIUM_ARMOR_MATERIAL, ArmorType.HELMET,
|
||||
properties.component(DataComponents.UNBREAKABLE, new Unbreakable(true)).stacksTo(1)));
|
||||
|
||||
public static final DeferredItem<ArmorItem> STALINIUM_CHESTPLATE = ITEMS.registerItem("stalinium_chestplate",
|
||||
(properties) -> new StaliniumChestplateLeggingsItem(ModArmorMaterials.STALINIUM_ARMOR_MATERIAL, ArmorType.CHESTPLATE,
|
||||
properties.component(DataComponents.UNBREAKABLE, new Unbreakable(true)).stacksTo(1)));
|
||||
|
||||
public static final DeferredItem<ArmorItem> STALINIUM_LEGGINGS = ITEMS.registerItem("stalinium_leggings",
|
||||
(properties) -> new StaliniumChestplateLeggingsItem(ModArmorMaterials.STALINIUM_ARMOR_MATERIAL, ArmorType.LEGGINGS,
|
||||
properties.component(DataComponents.UNBREAKABLE, new Unbreakable(true)).stacksTo(1)));
|
||||
|
||||
public static final DeferredItem<ArmorItem> STALINIUM_BOOTS = ITEMS.registerItem("stalinium_boots",
|
||||
(properties) -> new StaliniumBootsItem(ModArmorMaterials.STALINIUM_ARMOR_MATERIAL, ArmorType.BOOTS,
|
||||
properties.component(DataComponents.UNBREAKABLE, new Unbreakable(true)).stacksTo(1)));
|
||||
|
||||
public static final DeferredItem<MaceItem> STALINIUM_MACE = ITEMS.registerItem("stalinium_mace",
|
||||
StaliniumMaceItem::new, new Item.Properties()
|
||||
.component(DataComponents.UNBREAKABLE, new Unbreakable(true))
|
||||
.attributes(SwordItem.createAttributes(ModTiers.STALINIUM, 3f, -2.4f))));
|
||||
.attributes(StaliniumMaceItem.createAttributes()));
|
||||
|
||||
public static final DeferredItem<AxeItem> STALINIUM_AXE = ITEMS.register("stalinium_axe",
|
||||
() -> new StaliniumAxeItem(ModTiers.STALINIUM, new Item.Properties()
|
||||
.component(DataComponents.UNBREAKABLE, new Unbreakable(true))
|
||||
.attributes(AxeItem.createAttributes(ModTiers.STALINIUM, 5f, -3.0f))));
|
||||
|
||||
public static final DeferredItem<PickaxeItem> STALINIUM_PICKAXE = ITEMS.register("stalinium_pickaxe",
|
||||
() -> new StaliniumPickaxeItem(ModTiers.STALINIUM, new Item.Properties()
|
||||
.component(DataComponents.UNBREAKABLE, new Unbreakable(true))
|
||||
.attributes(PickaxeItem.createAttributes(ModTiers.STALINIUM, 1.0f, -2.8f))));
|
||||
|
||||
public static final DeferredItem<ShovelItem> STALINIUM_SHOVEL = ITEMS.register("stalinium_shovel",
|
||||
() -> new StaliniumShovelItem(ModTiers.STALINIUM, new Item.Properties()
|
||||
.component(DataComponents.UNBREAKABLE, new Unbreakable(true))
|
||||
.attributes(ShovelItem.createAttributes(ModTiers.STALINIUM, 1.5f, -3.0f))));
|
||||
|
||||
public static final DeferredItem<HoeItem> STALINIUM_HOE = ITEMS.register("stalinium_hoe",
|
||||
() -> new StaliniumHoeItem(ModTiers.STALINIUM, new Item.Properties()
|
||||
.component(DataComponents.UNBREAKABLE, new Unbreakable(true))
|
||||
.attributes(HoeItem.createAttributes(ModTiers.STALINIUM, 1.0f, -3.0f))));
|
||||
|
||||
public static final DeferredItem<ArmorItem> STALINIUM_HELMET = ITEMS.register("stalinium_helmet",
|
||||
() -> new StaliniumHelmetItem(ModArmorMaterials.STALINIUM_ARMOR_MATERIAL, ArmorItem.Type.HELMET,
|
||||
new Item.Properties().component(DataComponents.UNBREAKABLE, new Unbreakable(true)).stacksTo(1)));
|
||||
|
||||
public static final DeferredItem<ArmorItem> STALINIUM_CHESTPLATE = ITEMS.register("stalinium_chestplate",
|
||||
() -> new StaliniumChestplateLeggingsItem(ModArmorMaterials.STALINIUM_ARMOR_MATERIAL, ArmorItem.Type.CHESTPLATE,
|
||||
new Item.Properties().component(DataComponents.UNBREAKABLE, new Unbreakable(true)).stacksTo(1)));
|
||||
|
||||
public static final DeferredItem<ArmorItem> STALINIUM_LEGGINGS = ITEMS.register("stalinium_leggings",
|
||||
() -> new StaliniumChestplateLeggingsItem(ModArmorMaterials.STALINIUM_ARMOR_MATERIAL, ArmorItem.Type.LEGGINGS,
|
||||
new Item.Properties().component(DataComponents.UNBREAKABLE, new Unbreakable(true)).stacksTo(1)));
|
||||
|
||||
public static final DeferredItem<ArmorItem> STALINIUM_BOOTS = ITEMS.register("stalinium_boots",
|
||||
() -> new StaliniumBootsItem(ModArmorMaterials.STALINIUM_ARMOR_MATERIAL, ArmorItem.Type.BOOTS,
|
||||
new Item.Properties().component(DataComponents.UNBREAKABLE, new Unbreakable(true)).stacksTo(1)));
|
||||
|
||||
public static final DeferredItem<MaceItem> STALINIUM_MACE = ITEMS.register("stalinium_mace",
|
||||
() -> new StaliniumMaceItem(new Item.Properties()
|
||||
.component(DataComponents.UNBREAKABLE, new Unbreakable(true))
|
||||
.attributes(StaliniumMaceItem.createAttributes())));
|
||||
|
||||
public static final DeferredItem<Item> STALINIUM_SMITHING_TEMPLATE = ITEMS.register("stalinium_smithing_template",
|
||||
() -> new Item(new Item.Properties()));
|
||||
public static final DeferredItem<Item> STALINIUM_SMITHING_TEMPLATE = ITEMS.registerItem("stalinium_smithing_template",
|
||||
Item::new);
|
||||
|
||||
public static void register(IEventBus eventBus) {
|
||||
ITEMS.register(eventBus);
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
package net.krituximon.stalinium.item;
|
||||
|
||||
import net.krituximon.stalinium.util.ModTags;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
import net.minecraft.world.item.Tier;
|
||||
import net.minecraft.world.item.ToolMaterial;
|
||||
import net.minecraft.world.item.crafting.Ingredient;
|
||||
import net.neoforged.neoforge.common.SimpleTier;
|
||||
|
||||
public class ModTiers {
|
||||
public static final Tier STALINIUM = new SimpleTier(BlockTags.INCORRECT_FOR_NETHERITE_TOOL, 4096, 11f, 6f, 25, () -> Ingredient.of(ModItems.STALINIUM_INGOT.get(), ModItems.STALINIUM_NUGGET.get()));
|
||||
public static final ToolMaterial STALINIUM = new ToolMaterial(BlockTags.INCORRECT_FOR_NETHERITE_TOOL, 4096,
|
||||
11f, 6f, 25, ModTags.Items.STALINIUM_REPAIRABLE);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.google.common.collect.ImmutableMap;
|
||||
import net.krituximon.stalinium.event.ComradeHandler;
|
||||
import net.krituximon.stalinium.item.ModArmorMaterials;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.component.DataComponents;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.effect.MobEffectInstance;
|
||||
@@ -11,8 +12,10 @@ import net.minecraft.world.effect.MobEffects;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.ArmorItem;
|
||||
import net.minecraft.world.item.ArmorMaterial;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.equipment.ArmorMaterial;
|
||||
import net.minecraft.world.item.equipment.ArmorType;
|
||||
import net.minecraft.world.item.equipment.Equippable;
|
||||
import net.minecraft.world.level.Level;
|
||||
|
||||
import java.util.List;
|
||||
@@ -21,13 +24,13 @@ import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
public class ModArmorItem extends ArmorItem {
|
||||
private static final Map<Holder<ArmorMaterial>, List<MobEffectInstance>> MATERIAL_TO_EFFECT_MAP =
|
||||
new ImmutableMap.Builder<Holder<ArmorMaterial>, List<MobEffectInstance>>()
|
||||
private static final Map<ArmorMaterial, List<MobEffectInstance>> MATERIAL_TO_EFFECT_MAP =
|
||||
new ImmutableMap.Builder<ArmorMaterial, List<MobEffectInstance>>()
|
||||
.put(ModArmorMaterials.STALINIUM_ARMOR_MATERIAL,
|
||||
List.of(new MobEffectInstance(MobEffects.HEALTH_BOOST, 100, 0, false, false)))
|
||||
.build();
|
||||
|
||||
public ModArmorItem(Holder<ArmorMaterial> material, Type type, Properties properties) {
|
||||
public ModArmorItem(ArmorMaterial material, ArmorType type, Properties properties) {
|
||||
super(material, type, properties);
|
||||
}
|
||||
|
||||
@@ -44,7 +47,7 @@ public class ModArmorItem extends ArmorItem {
|
||||
|
||||
private void evaluateArmorEffects(Player player) {
|
||||
for (var entry : MATERIAL_TO_EFFECT_MAP.entrySet()) {
|
||||
Holder<ArmorMaterial> mat = entry.getKey();
|
||||
ArmorMaterial mat = entry.getKey();
|
||||
List<MobEffectInstance> effects = entry.getValue();
|
||||
if (!hasPlayerCorrectArmorOn(mat, player)) continue;
|
||||
addEffectToPlayer(player, effects);
|
||||
@@ -77,14 +80,21 @@ public class ModArmorItem extends ArmorItem {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean hasPlayerCorrectArmorOn(Holder<ArmorMaterial> mat, Player player) {
|
||||
private boolean hasPlayerCorrectArmorOn(ArmorMaterial mapArmorMaterial, Player player) {
|
||||
for (ItemStack armorStack : player.getArmorSlots()) {
|
||||
if (!(armorStack.getItem() instanceof ArmorItem ai)
|
||||
|| ai.getMaterial() != mat) {
|
||||
if (!(armorStack.getItem() instanceof ArmorItem)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
Equippable equippableComponentBoots = player.getInventory().getArmor(0).get(DataComponents.EQUIPPABLE);
|
||||
Equippable equippableComponentLeggings = player.getInventory().getArmor(1).get(DataComponents.EQUIPPABLE);
|
||||
Equippable equippableComponentChestplate = player.getInventory().getArmor(2).get(DataComponents.EQUIPPABLE);
|
||||
Equippable equippableComponentHelmet = player.getInventory().getArmor(3).get(DataComponents.EQUIPPABLE);
|
||||
|
||||
return equippableComponentBoots.model().equals(mapArmorMaterial.modelId()) &&
|
||||
equippableComponentLeggings.model().equals(mapArmorMaterial.modelId()) &&
|
||||
equippableComponentChestplate.model().equals(mapArmorMaterial.modelId()) &&
|
||||
equippableComponentHelmet.model().equals(mapArmorMaterial.modelId());
|
||||
}
|
||||
|
||||
private boolean hasFullSuitOfArmorOn(Player player) {
|
||||
|
||||
@@ -13,7 +13,7 @@ import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.AxeItem;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Tier;
|
||||
import net.minecraft.world.item.ToolMaterial;
|
||||
import net.minecraft.world.item.TooltipFlag;
|
||||
import net.minecraft.world.item.context.UseOnContext;
|
||||
import net.minecraft.world.level.Level;
|
||||
@@ -29,8 +29,8 @@ import net.minecraft.tags.BlockTags;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class StaliniumAxeItem extends AxeItem {
|
||||
public StaliniumAxeItem(Tier tier, Properties properties) {
|
||||
super(tier, properties);
|
||||
public StaliniumAxeItem(ToolMaterial tier, float attackDamage, float attackSpeed, Properties properties) {
|
||||
super(tier, attackDamage, attackSpeed, properties);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -10,9 +10,10 @@ import net.minecraft.world.effect.MobEffects;
|
||||
import net.minecraft.world.entity.EquipmentSlot;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.ArmorMaterial;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.TooltipFlag;
|
||||
import net.minecraft.world.item.equipment.ArmorMaterial;
|
||||
import net.minecraft.world.item.equipment.ArmorType;
|
||||
import net.minecraft.world.level.Level;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -26,7 +27,7 @@ public class StaliniumBootsItem extends ModArmorItem {
|
||||
private static final double RADIUS = 5.0;
|
||||
private static final Map<UUID, Integer> sprintTicks = new ConcurrentHashMap<>();
|
||||
|
||||
public StaliniumBootsItem(Holder<ArmorMaterial> material, Type slot, Properties props) {
|
||||
public StaliniumBootsItem(ArmorMaterial material, ArmorType slot, Properties props) {
|
||||
super(material, slot, props);
|
||||
}
|
||||
|
||||
|
||||
+15
-12
@@ -5,6 +5,7 @@ import net.krituximon.stalinium.event.ComradeHandler;
|
||||
import net.krituximon.stalinium.item.ModArmorMaterials;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.component.DataComponents;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.effect.MobEffectInstance;
|
||||
@@ -13,23 +14,25 @@ import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EquipmentSlot;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.ArmorItem;
|
||||
import net.minecraft.world.item.ArmorMaterial;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.TooltipFlag;
|
||||
import net.minecraft.world.item.equipment.ArmorMaterial;
|
||||
import net.minecraft.world.item.equipment.ArmorType;
|
||||
import net.minecraft.world.item.equipment.Equippable;
|
||||
import net.minecraft.world.level.Level;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
public class StaliniumChestplateLeggingsItem extends ModArmorItem {
|
||||
private static final Map<Holder<ArmorMaterial>, List<MobEffectInstance>> MATERIAL_TO_EFFECT_MAP =
|
||||
(new ImmutableMap.Builder<Holder<ArmorMaterial>, List<MobEffectInstance>>())
|
||||
private static final Map<ArmorMaterial, List<MobEffectInstance>> MATERIAL_TO_EFFECT_MAP =
|
||||
(new ImmutableMap.Builder<ArmorMaterial, List<MobEffectInstance>>())
|
||||
.put(ModArmorMaterials.STALINIUM_ARMOR_MATERIAL,
|
||||
List.of(new MobEffectInstance(MobEffects.DAMAGE_RESISTANCE, 100, 0, false, false)))
|
||||
.build();
|
||||
|
||||
public StaliniumChestplateLeggingsItem(Holder<ArmorMaterial> material,
|
||||
Type type,
|
||||
public StaliniumChestplateLeggingsItem(ArmorMaterial material,
|
||||
ArmorType type,
|
||||
Properties properties) {
|
||||
super(material, type, properties);
|
||||
}
|
||||
@@ -48,9 +51,9 @@ public class StaliniumChestplateLeggingsItem extends ModArmorItem {
|
||||
}
|
||||
|
||||
private void evaluateArmorEffects(Player player) {
|
||||
for (Map.Entry<Holder<ArmorMaterial>, List<MobEffectInstance>> entry
|
||||
for (Map.Entry<ArmorMaterial, List<MobEffectInstance>> entry
|
||||
: MATERIAL_TO_EFFECT_MAP.entrySet()) {
|
||||
Holder<ArmorMaterial> mapArmorMaterial = entry.getKey();
|
||||
ArmorMaterial mapArmorMaterial = entry.getKey();
|
||||
List<MobEffectInstance> mapEffect = entry.getValue();
|
||||
if (hasPlayerCorrectArmorOn(mapArmorMaterial, player)) {
|
||||
addEffectToPlayer(player, mapEffect);
|
||||
@@ -94,7 +97,7 @@ public class StaliniumChestplateLeggingsItem extends ModArmorItem {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean hasPlayerCorrectArmorOn(Holder<ArmorMaterial> mapArmorMaterial,
|
||||
private boolean hasPlayerCorrectArmorOn(ArmorMaterial mapArmorMaterial,
|
||||
Player player) {
|
||||
ItemStack leggingsStack = player.getInventory().getArmor(1);
|
||||
ItemStack chestplateStack = player.getInventory().getArmor(2);
|
||||
@@ -102,10 +105,10 @@ public class StaliniumChestplateLeggingsItem extends ModArmorItem {
|
||||
if (leggingsStack.isEmpty() || chestplateStack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
ArmorItem leggingsItem = (ArmorItem) leggingsStack.getItem();
|
||||
ArmorItem chestplateItem = (ArmorItem) chestplateStack.getItem();
|
||||
return leggingsItem.getMaterial() == mapArmorMaterial
|
||||
&& chestplateItem.getMaterial() == mapArmorMaterial;
|
||||
Equippable equippableComponentLeggings = player.getInventory().getArmor(1).get(DataComponents.EQUIPPABLE);
|
||||
Equippable equippableComponentChestplate = player.getInventory().getArmor(2).get(DataComponents.EQUIPPABLE);
|
||||
return equippableComponentLeggings.model().equals(mapArmorMaterial.modelId()) &&
|
||||
equippableComponentChestplate.model().equals(mapArmorMaterial.modelId());
|
||||
}
|
||||
|
||||
private boolean hasChestAndLeggingsOn(Player player) {
|
||||
|
||||
@@ -7,11 +7,12 @@ import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.world.entity.EquipmentSlot;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.ArmorMaterial;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.effect.MobEffectInstance;
|
||||
import net.minecraft.world.effect.MobEffects;
|
||||
import net.minecraft.world.item.TooltipFlag;
|
||||
import net.minecraft.world.item.equipment.ArmorMaterial;
|
||||
import net.minecraft.world.item.equipment.ArmorType;
|
||||
import net.neoforged.bus.api.SubscribeEvent;
|
||||
import net.neoforged.fml.common.EventBusSubscriber;
|
||||
import net.neoforged.neoforge.event.entity.player.AttackEntityEvent;
|
||||
@@ -19,7 +20,7 @@ import net.neoforged.neoforge.event.entity.player.AttackEntityEvent;
|
||||
import java.util.List;
|
||||
|
||||
public class StaliniumHelmetItem extends ModArmorItem {
|
||||
public StaliniumHelmetItem(Holder<ArmorMaterial> material, Type slot, Properties props) {
|
||||
public StaliniumHelmetItem(ArmorMaterial material, ArmorType slot, Properties props) {
|
||||
super(material, slot, props);
|
||||
}
|
||||
@EventBusSubscriber(modid = Stalinium.MODID)
|
||||
|
||||
@@ -10,7 +10,7 @@ import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.HoeItem;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Tier;
|
||||
import net.minecraft.world.item.ToolMaterial;
|
||||
import net.minecraft.world.item.TooltipFlag;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
@@ -23,8 +23,8 @@ import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
public class StaliniumHoeItem extends HoeItem {
|
||||
public StaliniumHoeItem(Tier tier, Properties props) {
|
||||
super(tier, props);
|
||||
public StaliniumHoeItem(ToolMaterial tier, float attackDamage, float attackSpeed, Properties props) {
|
||||
super(tier, attackDamage, attackSpeed, props);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -9,6 +9,7 @@ import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.InteractionResultHolder;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
@@ -56,7 +57,7 @@ public class StaliniumMaceItem extends MaceItem {
|
||||
}
|
||||
|
||||
@Override
|
||||
public InteractionResultHolder<ItemStack> use(Level level, Player player, InteractionHand usedHand) {
|
||||
public InteractionResult use(Level level, Player player, InteractionHand usedHand) {
|
||||
if (!level.isClientSide && player.isCrouching()) {
|
||||
smash(player);
|
||||
} else if (!level.isClientSide && !player.isCrouching()) {
|
||||
@@ -76,10 +77,10 @@ public class StaliniumMaceItem extends MaceItem {
|
||||
level.playSound(null, player.getX(), player.getY(), player.getZ(),
|
||||
SoundEvents.BREEZE_CHARGE, SoundSource.PLAYERS, 1.0F, 1.0F);
|
||||
|
||||
player.getCooldowns().addCooldown(this, 15);
|
||||
player.getCooldowns().addCooldown(ModItems.STALINIUM_MACE.get(), 20);
|
||||
}
|
||||
|
||||
return InteractionResultHolder.success(player.getItemInHand(usedHand));
|
||||
return InteractionResult.SUCCESS;
|
||||
}
|
||||
|
||||
public static void smash(Player player) {
|
||||
|
||||
@@ -11,7 +11,7 @@ import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.PickaxeItem;
|
||||
import net.minecraft.world.item.Tier;
|
||||
import net.minecraft.world.item.ToolMaterial;
|
||||
import net.minecraft.world.item.TooltipFlag;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
@@ -22,8 +22,8 @@ import java.util.*;
|
||||
import java.util.UUID;
|
||||
|
||||
public class StaliniumPickaxeItem extends PickaxeItem {
|
||||
public StaliniumPickaxeItem(Tier tier, Properties properties) {
|
||||
super(tier, properties);
|
||||
public StaliniumPickaxeItem(ToolMaterial tier, float attackDamage, float attackSpeed, Properties properties) {
|
||||
super(tier, attackDamage, attackSpeed, properties);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -12,7 +12,7 @@ import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.ShovelItem;
|
||||
import net.minecraft.world.item.Tier;
|
||||
import net.minecraft.world.item.ToolMaterial;
|
||||
import net.minecraft.world.item.TooltipFlag;
|
||||
import net.minecraft.world.item.context.UseOnContext;
|
||||
import net.minecraft.world.level.Level;
|
||||
@@ -25,8 +25,8 @@ import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
public class StaliniumShovelItem extends ShovelItem {
|
||||
public StaliniumShovelItem(Tier tier, Properties properties) {
|
||||
super(tier, properties);
|
||||
public StaliniumShovelItem(ToolMaterial tier, float attackDamage, float attackSpeed, Properties properties) {
|
||||
super(tier, attackDamage, attackSpeed, properties);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -10,6 +10,7 @@ import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.InteractionResultHolder;
|
||||
import net.minecraft.world.effect.MobEffect;
|
||||
import net.minecraft.world.effect.MobEffectInstance;
|
||||
@@ -34,8 +35,8 @@ public class StaliniumSwordItem extends SwordItem {
|
||||
private static final int AMP = 0;
|
||||
private static final int COOLDOWN = 30 * 20;
|
||||
|
||||
public StaliniumSwordItem(Tier tier, Properties props) {
|
||||
super(tier, props);
|
||||
public StaliniumSwordItem(ToolMaterial tier, float attackDamage, float attackSpeed, Properties props) {
|
||||
super(tier, attackDamage, attackSpeed, props);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -70,12 +71,12 @@ public class StaliniumSwordItem extends SwordItem {
|
||||
}
|
||||
|
||||
@Override
|
||||
public InteractionResultHolder<ItemStack> use(Level world,
|
||||
Player player,
|
||||
InteractionHand hand) {
|
||||
public InteractionResult use(Level world,
|
||||
Player player,
|
||||
InteractionHand hand) {
|
||||
ItemStack stack = player.getItemInHand(hand);
|
||||
if (player.getCooldowns().isOnCooldown(this)) {
|
||||
return InteractionResultHolder.fail(stack);
|
||||
return InteractionResult.FAIL;
|
||||
}
|
||||
if (!world.isClientSide) {
|
||||
Holder<MobEffect> chargeHolder = world
|
||||
@@ -118,7 +119,7 @@ public class StaliniumSwordItem extends SwordItem {
|
||||
}
|
||||
player.startUsingItem(hand);
|
||||
player.swing(hand, true);
|
||||
return InteractionResultHolder.sidedSuccess(stack, world.isClientSide);
|
||||
return InteractionResult.SUCCESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -15,10 +15,10 @@ public class ModPotions {
|
||||
DeferredRegister.create(BuiltInRegistries.POTION, Stalinium.MODID);
|
||||
|
||||
public static final Holder<Potion> VODKA = POTIONS.register("vodka",
|
||||
() -> new Potion(new MobEffectInstance(MobEffects.CONFUSION, 1200, 0)));
|
||||
() -> new Potion("vodka", new MobEffectInstance(MobEffects.CONFUSION, 1200, 0)));
|
||||
|
||||
public static final Holder<Potion> WEAPONS_GRADE_VODKA = POTIONS.register("weapons_grade_vodka",
|
||||
() -> new Potion(new MobEffectInstance(ModEffects.STALINIUM_CHARGE, 1200, 2)));
|
||||
() -> new Potion("weapons_grade_vodka", new MobEffectInstance(ModEffects.STALINIUM_CHARGE, 1200, 2)));
|
||||
|
||||
public static void register(IEventBus eventBus) {
|
||||
POTIONS.register(eventBus);
|
||||
|
||||
@@ -20,5 +20,6 @@ public class ModTags {
|
||||
return ItemTags.create(ResourceLocation.fromNamespaceAndPath("c", name));
|
||||
}
|
||||
public static final TagKey<Item> STALINIUM = commonTag("ingots/stalinium");
|
||||
public static final TagKey<Item> STALINIUM_REPAIRABLE = commonTag("stalinium_repairable");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user