diff --git a/build.gradle b/build.gradle index 123be683e..2212c1ea4 100644 --- a/build.gradle +++ b/build.gradle @@ -78,6 +78,7 @@ processResources { filesMatching('META-INF/mods.toml') { expand project.properties } + outputs.upToDateWhen { false } } dependencies { diff --git a/gradle.properties b/gradle.properties index b7bc068da..8a796c2af 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,6 +6,6 @@ versions_minecraft=1.18.2 versions_minecraft_range=[1.18.2,1.19) versions_forge=40.2.0 versions_forge_range=[40.2.0,) -versions_mod=1.7.7 -versions_mlib=4.3.2 -versions_mlib_range=[4.3.2,5.0.0) \ No newline at end of file +versions_mod=1.8.0 +versions_mlib=5.0.0 +versions_mlib_range=[5.0.0,6.0.0) diff --git a/libs/majrusz-library-1.18.2-4.3.2.jar b/libs/majrusz-library-1.18.2-4.3.2.jar deleted file mode 100644 index 640edda36..000000000 Binary files a/libs/majrusz-library-1.18.2-4.3.2.jar and /dev/null differ diff --git a/libs/majrusz-library-1.18.2-5.0.0.jar b/libs/majrusz-library-1.18.2-5.0.0.jar new file mode 100644 index 000000000..598047775 Binary files /dev/null and b/libs/majrusz-library-1.18.2-5.0.0.jar differ diff --git a/src/main/java/com/majruszsdifficulty/GameDataSaver.java b/src/main/java/com/majruszsdifficulty/GameDataSaver.java index 95dbbb176..55dcb6541 100644 --- a/src/main/java/com/majruszsdifficulty/GameDataSaver.java +++ b/src/main/java/com/majruszsdifficulty/GameDataSaver.java @@ -1,10 +1,11 @@ package com.majruszsdifficulty; -import com.majruszsdifficulty.gamestage.handlers.GameStageIncreaser; import com.majruszsdifficulty.gamestage.GameStage; +import com.majruszsdifficulty.gamestage.handlers.GameStageIncreaser; import com.majruszsdifficulty.treasurebags.TreasureBagProgressManager; import com.majruszsdifficulty.undeadarmy.Config; import com.majruszsdifficulty.undeadarmy.UndeadArmyManager; +import com.mlib.data.SerializableHelper; import com.mlib.data.SerializableStructure; import net.minecraft.nbt.CompoundTag; import net.minecraft.server.level.ServerLevel; @@ -27,9 +28,7 @@ public GameDataSaver( ServerLevel overworld, CompoundTag tag ) { @Override public CompoundTag save( CompoundTag tag ) { - this.data.write( tag ); - - return tag; + return SerializableHelper.write( ()->this.data, tag ); } public UndeadArmyManager getUndeadArmyManager() { @@ -41,18 +40,19 @@ public TreasureBagProgressManager getTreasureBagProgressManager() { } public static class Data extends SerializableStructure { - final UndeadArmyManager undeadArmyManager; - final TreasureBagProgressManager treasureBagProgressManager; + UndeadArmyManager undeadArmyManager; + TreasureBagProgressManager treasureBagProgressManager; public Data( ServerLevel overworld ) { super( "MajruszsDifficulty" ); - this.undeadArmyManager = new UndeadArmyManager( overworld, Registries.ANNOTATION_HANDLER.getInstance( Config.class ) ); + Config config = Registries.HELPER.findInstance( Config.class ).orElseThrow(); + this.undeadArmyManager = new UndeadArmyManager( overworld, config ); this.treasureBagProgressManager = new TreasureBagProgressManager(); - this.define( "GameStage", GameStage::getCurrentStage, gameStage->GameStage.changeStage( gameStage, null ), GameStage::values ); - this.define( "UndeadArmy", ()->this.undeadArmyManager ); - this.define( "TreasureBags", ()->this.treasureBagProgressManager ); + this.defineEnum( "GameStage", GameStage::getCurrentStage, gameStage->GameStage.changeStage( gameStage, null ), GameStage::values ); + this.defineCustom( "UndeadArmy", ()->this.undeadArmyManager, x->this.undeadArmyManager = x, ()->new UndeadArmyManager( overworld, config ) ); + this.defineCustom( "TreasureBags", ()->this.treasureBagProgressManager, x->this.treasureBagProgressManager = x, TreasureBagProgressManager::new ); } } } diff --git a/src/main/java/com/majruszsdifficulty/MajruszsDifficulty.java b/src/main/java/com/majruszsdifficulty/MajruszsDifficulty.java index 0815b4880..9d08f4798 100644 --- a/src/main/java/com/majruszsdifficulty/MajruszsDifficulty.java +++ b/src/main/java/com/majruszsdifficulty/MajruszsDifficulty.java @@ -1,16 +1,13 @@ package com.majruszsdifficulty; -import com.mlib.config.ConfigHandler; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.config.ModConfig; /** Main modification class. */ @Mod( MajruszsDifficulty.MOD_ID ) public class MajruszsDifficulty { public static final String MOD_ID = "majruszsdifficulty"; public static final String NAME = "Majrusz's Progressive Difficulty"; - public static final ConfigHandler SERVER_CONFIG = new ConfigHandler( ModConfig.Type.SERVER ); public MajruszsDifficulty() { com.majruszsdifficulty.Registries.initialize(); diff --git a/src/main/java/com/majruszsdifficulty/MajruszsHelper.java b/src/main/java/com/majruszsdifficulty/MajruszsHelper.java deleted file mode 100644 index f0c82c7e7..000000000 --- a/src/main/java/com/majruszsdifficulty/MajruszsHelper.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.majruszsdifficulty; - -import net.minecraft.ChatFormatting; -import net.minecraft.network.chat.*; -import net.minecraft.network.chat.MutableComponent; -import net.minecraft.world.item.TooltipFlag; - -import java.util.List; - -@Deprecated( forRemoval = true ) -public class MajruszsHelper { - public static void addTranslatableText( List< Component > tooltip, String translationKey ) { - tooltip.add( new TranslatableComponent( translationKey ).withStyle( ChatFormatting.GRAY ) ); - } - - public static void addTranslatableTexts( List< Component > tooltip, String... translationKeys ) { - for( String translationKey : translationKeys ) - addTranslatableText( tooltip, translationKey ); - } - - /** Adds tooltip to list if advanced tooltips are enabled. */ - public static void addAdvancedTranslatableText( List< Component > tooltip, TooltipFlag flag, String translationKey ) { - if( flag.isAdvanced() ) - addTranslatableText( tooltip, translationKey ); - } - - /** Adds multiple tooltips to list if advanced tooltips are enabled. */ - public static void addAdvancedTranslatableTexts( List< Component > tooltip, TooltipFlag flag, String... translationKeys ) { - if( flag.isAdvanced() ) - for( String translationKey : translationKeys ) - addAdvancedTranslatableText( tooltip, flag, translationKey ); - } - - /** Returns formatted text with information that item is disabled. */ - public static MutableComponent getDisabledItemComponent() { - return new TranslatableComponent( "majruszsdifficulty.items.disabled_tooltip" ).withStyle( ChatFormatting.RED, ChatFormatting.BOLD ); - } -} diff --git a/src/main/java/com/majruszsdifficulty/PacketHandler.java b/src/main/java/com/majruszsdifficulty/PacketHandler.java deleted file mode 100644 index ddfa7afca..000000000 --- a/src/main/java/com/majruszsdifficulty/PacketHandler.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.majruszsdifficulty; - -import com.majruszsdifficulty.effects.BleedingEffect; -import com.majruszsdifficulty.entities.CerberusEntity; -import com.majruszsdifficulty.entities.CursedArmorEntity; -import com.majruszsdifficulty.entities.TankEntity; -import com.majruszsdifficulty.treasurebags.data.LootProgressData; -import com.mlib.data.SerializableStructure; -import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; -import net.minecraftforge.network.NetworkRegistry; -import net.minecraftforge.network.simple.SimpleChannel; - -/** Handling connection between server and client. */ -public class PacketHandler { - private static final String PROTOCOL_VERSION = "1"; - public static SimpleChannel CHANNEL; - - public static void registerPacket( final FMLCommonSetupEvent event ) { - CHANNEL = NetworkRegistry.newSimpleChannel( Registries.getLocation( "main" ), ()->PROTOCOL_VERSION, PROTOCOL_VERSION::equals, PROTOCOL_VERSION::equals ); - SerializableStructure.register( CHANNEL, 0, TankEntity.SkillMessage.class, TankEntity.SkillMessage::new ); - SerializableStructure.register( CHANNEL, 1, CursedArmorEntity.AssembleMessage.class, CursedArmorEntity.AssembleMessage::new ); - SerializableStructure.register( CHANNEL, 2, LootProgressData.class, LootProgressData::new ); - SerializableStructure.register( CHANNEL, 3, BleedingEffect.BloodMessage.class, BleedingEffect.BloodMessage::new ); - SerializableStructure.register( CHANNEL, 4, CerberusEntity.SkillMessage.class, CerberusEntity.SkillMessage::new ); - SerializableStructure.register( CHANNEL, 5, CerberusEntity.TargetMessage.class, CerberusEntity.TargetMessage::new ); - } -} diff --git a/src/main/java/com/majruszsdifficulty/Registries.java b/src/main/java/com/majruszsdifficulty/Registries.java index 464c4bc37..5e5e8e31e 100644 --- a/src/main/java/com/majruszsdifficulty/Registries.java +++ b/src/main/java/com/majruszsdifficulty/Registries.java @@ -5,22 +5,24 @@ import com.majruszsdifficulty.blocks.InfestedEndStone; import com.majruszsdifficulty.effects.BleedingEffect; import com.majruszsdifficulty.effects.BleedingImmunityEffect; +import com.majruszsdifficulty.effects.GlassRegenerationEffect; import com.majruszsdifficulty.entities.*; +import com.majruszsdifficulty.features.bleeding.ArmorBleeding; +import com.majruszsdifficulty.features.bleeding.ToolsBleeding; import com.majruszsdifficulty.items.*; import com.majruszsdifficulty.loot.CurseRandomlyFunction; import com.majruszsdifficulty.treasurebags.TreasureBagManager; import com.majruszsdifficulty.treasurebags.TreasureBagProgressManager; -import com.majruszsdifficulty.triggers.BandageTrigger; +import com.majruszsdifficulty.treasurebags.data.LootProgressData; import com.majruszsdifficulty.triggers.GameStageTrigger; import com.majruszsdifficulty.triggers.TreasureBagTrigger; import com.majruszsdifficulty.undeadarmy.UndeadArmyManager; import com.majruszsdifficulty.world.WorldGenHelper; import com.mlib.Utility; -import com.mlib.annotations.AnnotationHandler; import com.mlib.items.CreativeModeTabHelper; -import com.mlib.gamemodifiers.ModConfigs; -import com.mlib.registries.RegistryHelper; -import com.mlib.triggers.BasicTrigger; +import com.mlib.config.ConfigHandler; +import com.mlib.contexts.base.ModConfigs; +import com.mlib.modhelper.ModHelper; import net.minecraft.advancements.CriteriaTriggers; import net.minecraft.client.model.geom.ModelLayerLocation; import net.minecraft.client.renderer.RenderType; @@ -59,7 +61,7 @@ import net.minecraftforge.event.entity.EntityAttributeCreationEvent; import net.minecraftforge.event.world.WorldEvent; import net.minecraftforge.eventbus.api.IEventBus; -import net.minecraftforge.fml.ModLoadingContext; +import net.minecraftforge.fml.config.ModConfig; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; @@ -71,20 +73,22 @@ import java.util.function.Supplier; import java.util.stream.Stream; -import static com.majruszsdifficulty.MajruszsDifficulty.MOD_ID; -import static com.majruszsdifficulty.MajruszsDifficulty.SERVER_CONFIG; import static net.minecraft.core.Registry.LOOT_FUNCTION_REGISTRY; import static net.minecraft.core.Registry.LOOT_FUNCTION_TYPE; public class Registries { - private static final RegistryHelper HELPER = new RegistryHelper( MajruszsDifficulty.MOD_ID ); + public static final ModHelper HELPER = ModHelper.create( MajruszsDifficulty.MOD_ID ); + + // Configs + public static final ConfigHandler SERVER_CONFIG = HELPER.createConfig( ModConfig.Type.SERVER ); static { - ModConfigs.init( SERVER_CONFIG, Groups.DEFAULT ).name( "GameModifiers" ); + ModConfigs.init( SERVER_CONFIG, Groups.DEFAULT ).name( "Features" ); ModConfigs.init( SERVER_CONFIG, Groups.UNDEAD_ARMY ).name( "UndeadArmy" ); ModConfigs.init( SERVER_CONFIG, Groups.GAME_STAGE ).name( "GameStage" ); ModConfigs.init( SERVER_CONFIG, Groups.TREASURE_BAG ).name( "TreasureBag" ); ModConfigs.init( SERVER_CONFIG, Groups.MOBS ).name( "Mobs" ); + ModConfigs.init( SERVER_CONFIG, Groups.BLEEDING ).name( "Bleeding" ); } // Groups @@ -104,7 +108,7 @@ public class Registries { public static final RegistryObject< EntityType< TankEntity > > TANK = ENTITY_TYPES.register( "tank", TankEntity.createSupplier() ); public static final RegistryObject< EntityType< CursedArmorEntity > > CURSED_ARMOR = ENTITY_TYPES.register( "cursed_armor", CursedArmorEntity.createSupplier() ); public static final RegistryObject< EntityType< CerberusEntity > > CERBERUS = ENTITY_TYPES.register( "cerberus", CerberusEntity.createSupplier() ); - public static final RegistryObject< EntityType< BlackWidowEntity > > BLACK_WIDOW = ENTITY_TYPES.register( "black_widow", BlackWidowEntity.createSupplier() ); + public static final RegistryObject< EntityType< GiantEntity > > GIANT = ENTITY_TYPES.register( "giant", GiantEntity.createSupplier() ); // Items public static final RegistryObject< BandageItem > BANDAGE = ITEMS.register( "bandage", BandageItem::new ); @@ -131,7 +135,7 @@ public class Registries { public static final RegistryObject< EnderPouchItem > ENDER_POUCH = ITEMS.register( "ender_pouch", EnderPouchItem::new ); public static final RegistryObject< WitherSwordItem > WITHER_SWORD = ITEMS.register( "wither_sword", WitherSwordItem::new ); public static final RegistryObject< RecallPotionItem > RECALL_POTION = ITEMS.register( "recall_potion", RecallPotionItem::new ); - public static final RegistryObject< BadOmenPotionItem > BAD_OMEN_POTION = ITEMS.register( "bad_omen_potion", BadOmenPotionItem::new ); + public static final RegistryObject< EvokerFangScrollItem > EVOKER_FANG_SCROLL = ITEMS.register( "evoker_fang_scroll", EvokerFangScrollItem::new ); public static final RegistryObject< SoulJarItem > SOUL_JAR = ITEMS.register( "soul_jar", SoulJarItem::new ); // Potions @@ -158,7 +162,7 @@ public class Registries { public static final RegistryObject< SpawnEggItem > TANK_SPAWN_EGG = ITEMS.register( "tank_spawn_egg", createEggSupplier( TANK, 0xc1c1c1, 0x949494 ) ); public static final RegistryObject< SpawnEggItem > CURSED_ARMOR_SPAWN_EGG = ITEMS.register( "cursed_armor_spawn_egg", createEggSupplier( CURSED_ARMOR, 0x808080, 0xe1e1e1 ) ); public static final RegistryObject< SpawnEggItem > CERBERUS_SPAWN_EGG = ITEMS.register( "cerberus_spawn_egg", createEggSupplier( CERBERUS, 0x212121, 0xe0e0e0 ) ); - public static final RegistryObject< SpawnEggItem > BLACK_WIDOW_SPAWN_EGG = ITEMS.register( "black_widow_spawn_egg", createEggSupplier( BLACK_WIDOW, 0x212121, 0xe12121 ) ); + public static final RegistryObject< SpawnEggItem > GIANT_SPAWN_EGG = ITEMS.register( "giant_spawn_egg", createEggSupplier( GIANT, 0x00afaf, 0x799c65 ) ); static Supplier< SpawnEggItem > createEggSupplier( Supplier< ? extends EntityType< ? extends Mob > > type, int backgroundColor, int highlightColor @@ -180,6 +184,7 @@ static Supplier< SpawnEggItem > createEggSupplier( Supplier< ? extends EntityTyp // Effects public static final RegistryObject< BleedingEffect > BLEEDING = MOB_EFFECTS.register( "bleeding", BleedingEffect::new ); public static final RegistryObject< BleedingImmunityEffect > BLEEDING_IMMUNITY = MOB_EFFECTS.register( "bleeding_immunity", BleedingImmunityEffect::new ); + public static final RegistryObject< GlassRegenerationEffect > GLASS_REGENERATION = MOB_EFFECTS.register( "glass_regeneration", GlassRegenerationEffect::new ); // Damage Sources public static final DamageSource BLEEDING_SOURCE = new DamageSource( "bleeding" ).bypassArmor(); @@ -194,8 +199,6 @@ static Supplier< SpawnEggItem > createEggSupplier( Supplier< ? extends EntityTyp // Triggers public static final GameStageTrigger GAME_STATE_TRIGGER = CriteriaTriggers.register( new GameStageTrigger() ); public static final TreasureBagTrigger TREASURE_BAG_TRIGGER = CriteriaTriggers.register( new TreasureBagTrigger() ); - public static final BandageTrigger BANDAGE_TRIGGER = CriteriaTriggers.register( new BandageTrigger() ); - public static final BasicTrigger BASIC_TRIGGER = HELPER.registerBasicTrigger(); // Sounds public static final RegistryObject< SoundEvent > UNDEAD_ARMY_APPROACHING = register( "undead_army.approaching" ); @@ -208,8 +211,17 @@ static RegistryObject< SoundEvent > register( String name ) { // Loot Functions public static final RegistryObject< LootItemFunctionType > CURSE_RANDOMLY = LOOT_FUNCTIONS.register( "curse_randomly", CurseRandomlyFunction::newType ); - // Game Modifiers - public static final AnnotationHandler ANNOTATION_HANDLER = new AnnotationHandler( MajruszsDifficulty.MOD_ID ); + // Network + static { + HELPER.createMessage( TankEntity.SkillMessage.class, TankEntity.SkillMessage::new ); + HELPER.createMessage( CursedArmorEntity.AssembleMessage.class, CursedArmorEntity.AssembleMessage::new ); + HELPER.createMessage( LootProgressData.class, LootProgressData::new ); + HELPER.createMessage( BleedingEffect.BloodMessage.class, BleedingEffect.BloodMessage::new ); + HELPER.createMessage( CerberusEntity.SkillMessage.class, CerberusEntity.SkillMessage::new ); + HELPER.createMessage( ToolsBleeding.ToolsDef.class, ToolsBleeding.ToolsDef::new ); + HELPER.createMessage( ArmorBleeding.ArmorsDef.class, ArmorBleeding.ArmorsDef::new ); + HELPER.createMessage( CursedArmorEntity.LocationsDef.class, CursedArmorEntity.LocationsDef::new ); + } // Configured Feature public static final RegistryObject< ConfiguredFeature< ?, ? > > ENDERIUM_ORE_SMALL_CONFIGURED = CONFIGURED_FEATURES.register( "enderium_ore_small", ()->WorldGenHelper.getEndConfigured( ENDERIUM_SHARD_ORE, 2, 0.99f ) ); @@ -250,20 +262,16 @@ public static RenderType getEyesRenderType( String register ) { } public static void initialize() { - FMLJavaModLoadingContext loadingContext = FMLJavaModLoadingContext.get(); - final IEventBus modEventBus = loadingContext.getModEventBus(); - - HELPER.registerAll(); + final IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus(); modEventBus.addListener( Registries::setup ); modEventBus.addListener( Registries::setupClient ); modEventBus.addListener( Registries::setupEntities ); - modEventBus.addListener( PacketHandler::registerPacket ); IEventBus forgeEventBus = MinecraftForge.EVENT_BUS; forgeEventBus.addListener( Registries::onLoadingLevel ); forgeEventBus.addListener( Registries::onSavingLevel ); - SERVER_CONFIG.register( ModLoadingContext.get() ); + HELPER.register(); } private static void setupClient( final FMLClientSetupEvent event ) { @@ -273,18 +281,18 @@ private static void setupClient( final FMLClientSetupEvent event ) { public static void setupEntities( EntityAttributeCreationEvent event ) { event.put( CREEPERLING.get(), CreeperlingEntity.getAttributeMap() ); event.put( TANK.get(), TankEntity.getAttributeMap() ); - event.put( BLACK_WIDOW.get(), BlackWidowEntity.getAttributeMap() ); event.put( CURSED_ARMOR.get(), CursedArmorEntity.getAttributeMap() ); event.put( CERBERUS.get(), CerberusEntity.getAttributeMap() ); + event.put( GIANT.get(), GiantEntity.getAttributeMap() ); } private static void setup( final FMLCommonSetupEvent event ) { // FORGE: use SpawnPlacementRegisterEvent to register and modify spawn placements SpawnPlacements.register( CREEPERLING.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, CreeperlingEntity::checkMobSpawnRules ); SpawnPlacements.register( TANK.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, TankEntity::checkMonsterSpawnRules ); - SpawnPlacements.register( BLACK_WIDOW.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, BlackWidowEntity::checkMonsterSpawnRules ); SpawnPlacements.register( CURSED_ARMOR.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, CursedArmorEntity::checkMonsterSpawnRules ); - SpawnPlacements.register( CERBERUS.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, CursedArmorEntity::checkMonsterSpawnRules ); + SpawnPlacements.register( CERBERUS.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, CerberusEntity::checkMonsterSpawnRules ); + SpawnPlacements.register( GIANT.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, GiantEntity::checkMonsterSpawnRules ); event.enqueueWork( ()->{ addPotionRecipe( ()->Potions.WATER, CERBERUS_FANG, ()->Potions.MUNDANE ); @@ -349,5 +357,6 @@ public static class Groups { public static final String GAME_STAGE = Registries.getLocationString( "game_stage" ); public static final String TREASURE_BAG = Registries.getLocationString( "treasure_bag" ); public static final String MOBS = Registries.getLocationString( "mobs" ); + public static final String BLEEDING = Registries.getLocationString( "bleeding" ); } } diff --git a/src/main/java/com/majruszsdifficulty/RegistriesClient.java b/src/main/java/com/majruszsdifficulty/RegistriesClient.java index d31b8cf49..234674ff4 100644 --- a/src/main/java/com/majruszsdifficulty/RegistriesClient.java +++ b/src/main/java/com/majruszsdifficulty/RegistriesClient.java @@ -2,8 +2,12 @@ import com.majruszsdifficulty.gui.BleedingGui; import com.majruszsdifficulty.items.EndShardLocatorItem; +import com.majruszsdifficulty.items.SoulJarItem; import com.majruszsdifficulty.models.*; +import com.majruszsdifficulty.particles.BloodParticle; import com.majruszsdifficulty.renderers.*; +import net.minecraft.client.Minecraft; +import net.minecraft.client.color.item.ItemColor; import net.minecraft.client.model.geom.LayerDefinitions; import net.minecraft.client.model.geom.builders.CubeDeformation; import net.minecraft.client.model.geom.builders.LayerDefinition; @@ -13,28 +17,45 @@ import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.client.ForgeHooksClient; +import net.minecraftforge.client.event.ColorHandlerEvent; +import net.minecraftforge.client.event.ParticleFactoryRegisterEvent; import net.minecraftforge.client.gui.OverlayRegistry; +import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.minecraftforge.fml.common.Mod; @Deprecated( forRemoval = true ) @OnlyIn( Dist.CLIENT ) +@Mod.EventBusSubscriber( modid = MajruszsDifficulty.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT ) public class RegistriesClient { public static void setup() { ForgeHooksClient.registerLayerDefinition( CreeperlingRenderer.LAYER, ()->CreeperlingModel.createBodyLayer( CubeDeformation.NONE ) ); ForgeHooksClient.registerLayerDefinition( TankRenderer.LAYER, ()->TankModel.createBodyLayer( CubeDeformation.NONE ) ); - ForgeHooksClient.registerLayerDefinition( BlackWidowRenderer.LAYER, BlackWidowModel::createBodyLayer ); ForgeHooksClient.registerLayerDefinition( CursedArmorRenderer.INNER_ARMOR_LAYER, ()->LayerDefinition.create( CursedArmorModel.createMesh( LayerDefinitions.INNER_ARMOR_DEFORMATION, 0.0f ), 64, 32 ) ); ForgeHooksClient.registerLayerDefinition( CursedArmorRenderer.OUTER_ARMOR_LAYER, ()->LayerDefinition.create( CursedArmorModel.createMesh( LayerDefinitions.OUTER_ARMOR_DEFORMATION, 0.0f ), 64, 32 ) ); ForgeHooksClient.registerLayerDefinition( CursedArmorRenderer.MAIN_LAYER, ()->LayerDefinition.create( CursedArmorModel.createMesh( CubeDeformation.NONE, 0.0f ), 64, 64 ) ); ForgeHooksClient.registerLayerDefinition( CerberusRenderer.LAYER, CerberusModel::createBodyLayer ); + ForgeHooksClient.registerLayerDefinition( GiantRenderer.LAYER, ()->LayerDefinition.create( GiantModel.createMesh( CubeDeformation.NONE, 0.0f ), 64, 64 ) ); EntityRenderers.register( Registries.CREEPERLING.get(), CreeperlingRenderer::new ); EntityRenderers.register( Registries.TANK.get(), TankRenderer::new ); - EntityRenderers.register( Registries.BLACK_WIDOW.get(), BlackWidowRenderer::new ); EntityRenderers.register( Registries.CURSED_ARMOR.get(), CursedArmorRenderer::new ); EntityRenderers.register( Registries.CERBERUS.get(), CerberusRenderer::new ); + EntityRenderers.register( Registries.GIANT.get(), GiantRenderer::new ); ItemProperties.register( Registries.ENDERIUM_SHARD_LOCATOR.get(), new ResourceLocation( "shard_distance" ), EndShardLocatorItem::calculateDistanceToEndShard ); OverlayRegistry.registerOverlayBottom( "bleeding", new BleedingGui.Overlay() ); } + + @OnlyIn( Dist.CLIENT ) + @SubscribeEvent + public static void registerParticles( ParticleFactoryRegisterEvent event ) { + Minecraft.getInstance().particleEngine.register( Registries.BLOOD.get(), BloodParticle.Factory::new ); + } + + @OnlyIn( Dist.CLIENT ) + @SubscribeEvent + public static void registerItemColors( ColorHandlerEvent.Item event ) { + event.getItemColors().register( new SoulJarItem.ItemColor(), Registries.SOUL_JAR.get() ); + } } diff --git a/src/main/java/com/majruszsdifficulty/blocks/EndShardOre.java b/src/main/java/com/majruszsdifficulty/blocks/EndShardOre.java index 764240acf..7961db02d 100644 --- a/src/main/java/com/majruszsdifficulty/blocks/EndShardOre.java +++ b/src/main/java/com/majruszsdifficulty/blocks/EndShardOre.java @@ -32,7 +32,7 @@ public int getExpDrop( BlockState state, net.minecraft.world.level.LevelReader r public static class EndShardOreItem extends BlockItem { public EndShardOreItem() { - super( Registries.ENDERIUM_SHARD_ORE.get(), new Properties().stacksTo( 64 ) ); + super( Registries.ENDERIUM_SHARD_ORE.get(), new Properties().tab( Registries.ITEM_GROUP ).stacksTo( 64 ) ); } } } diff --git a/src/main/java/com/majruszsdifficulty/blocks/EnderiumBlock.java b/src/main/java/com/majruszsdifficulty/blocks/EnderiumBlock.java index 703024441..e50058644 100644 --- a/src/main/java/com/majruszsdifficulty/blocks/EnderiumBlock.java +++ b/src/main/java/com/majruszsdifficulty/blocks/EnderiumBlock.java @@ -15,7 +15,7 @@ public EnderiumBlock() { public static class EndBlockItem extends BlockItem { public EndBlockItem() { - super( Registries.ENDERIUM_BLOCK.get(), new Properties().stacksTo( 64 ).rarity( Rarity.UNCOMMON ) ); + super( Registries.ENDERIUM_BLOCK.get(), new Properties().tab( Registries.ITEM_GROUP ).stacksTo( 64 ).rarity( Rarity.UNCOMMON ) ); } } } diff --git a/src/main/java/com/majruszsdifficulty/blocks/InfestedEndStone.java b/src/main/java/com/majruszsdifficulty/blocks/InfestedEndStone.java index 5b565b6f2..0422435cd 100644 --- a/src/main/java/com/majruszsdifficulty/blocks/InfestedEndStone.java +++ b/src/main/java/com/majruszsdifficulty/blocks/InfestedEndStone.java @@ -51,7 +51,7 @@ private void spawnEndermite( ServerLevel world, BlockPos position ) { public static class InfestedEndStoneItem extends BlockItem { public InfestedEndStoneItem() { - super( Registries.INFESTED_END_STONE.get(), ( new Properties() ).stacksTo( 64 ) ); + super( Registries.INFESTED_END_STONE.get(), ( new Properties() ).tab( Registries.ITEM_GROUP ).stacksTo( 64 ) ); } } } diff --git a/src/main/java/com/majruszsdifficulty/commands/SummonMobGroupCommand.java b/src/main/java/com/majruszsdifficulty/commands/SummonMobGroupCommand.java new file mode 100644 index 000000000..1d4c7e3ee --- /dev/null +++ b/src/main/java/com/majruszsdifficulty/commands/SummonMobGroupCommand.java @@ -0,0 +1,62 @@ +package com.majruszsdifficulty.commands; + +import com.majruszsdifficulty.Registries; +import com.majruszsdifficulty.config.MobGroupConfig; +import com.majruszsdifficulty.features.groups.PiglinsInGroup; +import com.majruszsdifficulty.features.groups.SkeletonsInGroup; +import com.majruszsdifficulty.features.groups.ZombiesInGroup; +import com.majruszsdifficulty.undeadarmy.UndeadArmyPatrol; +import com.mlib.modhelper.AutoInstance; +import com.mlib.commands.Command; +import com.mlib.commands.CommandData; +import com.mlib.entities.EntityHelper; +import com.mojang.brigadier.exceptions.CommandSyntaxException; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.MobSpawnType; +import net.minecraft.world.entity.PathfinderMob; + +import java.util.function.Supplier; + +@AutoInstance +public class SummonMobGroupCommand extends Command { + public SummonMobGroupCommand() { + this.newBuilder() + .literal( "summongroup" ) + .enumeration( GroupType.class ) + .hasPermission( 4 ) + .execute( this::handle ); + } + + private int handle( CommandData data ) throws CommandSyntaxException { + Entity entity = this.getOptionalEntityOrPlayer( data ); + if( entity.level instanceof ServerLevel level ) { + GroupType groupType = this.getEnumeration( data, GroupType.class ); + PathfinderMob mob = EntityHelper.createSpawner( groupType.entityType, level ) + .position( entity.position() ) + .mobSpawnType( MobSpawnType.COMMAND ) + .spawn(); + if( mob != null ) { + Registries.HELPER.findInstance( groupType.clazz ).ifPresent( instance->instance.get().spawn( mob ) ); + } + } + + return 0; + } + + enum GroupType { + ZOMBIE( EntityType.ZOMBIE, ZombiesInGroup.class ), + SKELETONS( EntityType.SKELETON, SkeletonsInGroup.class ), + PIGLINS( EntityType.PIGLIN, PiglinsInGroup.class ), + UNDEAD_ARMY( EntityType.SKELETON, UndeadArmyPatrol.class ); + + final EntityType< ? extends PathfinderMob > entityType; + final Class< ? extends Supplier< MobGroupConfig > > clazz; + + GroupType( EntityType< ? extends PathfinderMob > entityType, Class< ? extends Supplier< MobGroupConfig > > clazz ) { + this.entityType = entityType; + this.clazz = clazz; + } + } +} diff --git a/src/main/java/com/majruszsdifficulty/gamemodifiers/configs/BleedingConfig.java b/src/main/java/com/majruszsdifficulty/config/BleedingConfig.java similarity index 79% rename from src/main/java/com/majruszsdifficulty/gamemodifiers/configs/BleedingConfig.java rename to src/main/java/com/majruszsdifficulty/config/BleedingConfig.java index 269ca0a26..283d4839e 100644 --- a/src/main/java/com/majruszsdifficulty/gamemodifiers/configs/BleedingConfig.java +++ b/src/main/java/com/majruszsdifficulty/config/BleedingConfig.java @@ -1,10 +1,10 @@ -package com.majruszsdifficulty.gamemodifiers.configs; +package com.majruszsdifficulty.config; import com.majruszsdifficulty.gamestage.GameStage; import com.majruszsdifficulty.Registries; import com.majruszsdifficulty.effects.BleedingEffect; import com.mlib.mobeffects.MobEffectHelper; -import com.mlib.gamemodifiers.contexts.OnDamaged; +import com.mlib.contexts.OnDamaged; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.LivingEntity; @@ -32,13 +32,13 @@ public boolean apply( OnDamaged.Data data ) { return false; if( target instanceof ServerPlayer targetPlayer ) { - Registries.BASIC_TRIGGER.trigger( targetPlayer, "bleeding_received" ); + Registries.HELPER.triggerAchievement( targetPlayer, "bleeding_received" ); if( data.source.equals( DamageSource.CACTUS ) ) { - Registries.BASIC_TRIGGER.trigger( targetPlayer, "cactus_bleeding" ); + Registries.HELPER.triggerAchievement( targetPlayer, "cactus_bleeding" ); } } if( attacker instanceof ServerPlayer attackerPlayer ) { - Registries.BASIC_TRIGGER.trigger( attackerPlayer, "bleeding_inflicted" ); + Registries.HELPER.triggerAchievement( attackerPlayer, "bleeding_inflicted" ); } return true; diff --git a/src/main/java/com/majruszsdifficulty/gamemodifiers/configs/MobGroupConfig.java b/src/main/java/com/majruszsdifficulty/config/MobGroupConfig.java similarity index 65% rename from src/main/java/com/majruszsdifficulty/gamemodifiers/configs/MobGroupConfig.java rename to src/main/java/com/majruszsdifficulty/config/MobGroupConfig.java index eb4fc1cd8..93293a2cd 100644 --- a/src/main/java/com/majruszsdifficulty/gamemodifiers/configs/MobGroupConfig.java +++ b/src/main/java/com/majruszsdifficulty/config/MobGroupConfig.java @@ -1,4 +1,4 @@ -package com.majruszsdifficulty.gamemodifiers.configs; +package com.majruszsdifficulty.config; import com.majruszsdifficulty.goals.FollowGroupLeaderGoal; import com.majruszsdifficulty.goals.TargetAsLeaderGoal; @@ -7,15 +7,22 @@ import com.mlib.config.IntegerConfig; import com.mlib.entities.EntityHelper; import com.mlib.items.ItemHelper; +import com.mlib.levels.LevelHelper; import com.mlib.loot.LootHelper; +import com.mlib.math.AnyPos; import com.mlib.math.Range; +import net.minecraft.core.BlockPos; import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.entity.*; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.entity.PathfinderMob; +import net.minecraft.world.level.Level; import net.minecraft.world.phys.Vec3; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.Optional; import java.util.function.Supplier; public class MobGroupConfig extends ConfigGroup { @@ -37,29 +44,27 @@ public MobGroupConfig( Supplier< EntityType< ? extends PathfinderMob > > mob, Ra this.leaderSet = leaderSet; this.sidekickSet = sidekickSet; - this.addConfig( this.min.name( "min_count" ).comment( "Minimum amount of mobs to spawn (leader is not considered)." ) ); - this.addConfig( this.max.name( "max_count" ).comment( "Maximum amount of mobs to spawn (leader is not considered)." ) ); + this.addConfig( this.min.name( "min_count" ).comment( "Minimum amount of extra mobs to spawn." ) ); + this.addConfig( this.max.name( "max_count" ).comment( "Maximum amount of extra mobs to spawn." ) ); } public List< PathfinderMob > spawn( PathfinderMob leader ) { int sidekickAmount = Random.nextInt( this.getMinCount(), this.getMaxCount() + 1 ); - Vec3 spawnPosition = leader.position(); - List< PathfinderMob > sidekicks = new ArrayList<>(); - for( int sidekickIdx = 0; sidekickIdx < sidekickAmount; sidekickIdx++ ) { - PathfinderMob sidekick = EntityHelper.spawn( this.getMob(), leader.level, mob->{ - this.addSidekickGoals( mob, leader ); - this.markAsSidekick( mob ); - this.applyArmorSet( this.sidekickSet, mob ); - this.randomizePosition( mob, spawnPosition ); - } ); + for( int idx = 0; idx < sidekickAmount; idx++ ) { + PathfinderMob sidekick = EntityHelper.createSpawner( this.getMob(), leader.level ) + .position( this.getRandomizedPosition( leader.level, leader.position() ) ) + .spawn(); if( sidekick != null ) { + this.addSidekickGoals( sidekick, leader ); + this.markAsSidekick( sidekick ); + this.applyArmorSet( sidekick, this.sidekickSet ); sidekicks.add( sidekick ); } } this.markAsLeader( leader ); - this.applyArmorSet( this.leaderSet, leader ); + this.applyArmorSet( leader, this.leaderSet ); return sidekicks; } @@ -89,9 +94,10 @@ private void markAsLeader( PathfinderMob leader ) { leader.getPersistentData().putBoolean( LEADER_TAG, true ); } - private void applyArmorSet( ResourceLocation location, PathfinderMob mob ) { - if( location == null ) + private void applyArmorSet( PathfinderMob mob, ResourceLocation location ) { + if( location == null ) { return; + } LootHelper.getLootTable( location ) .getRandomItems( LootHelper.toGiftContext( mob ) ) @@ -101,7 +107,15 @@ private void applyArmorSet( ResourceLocation location, PathfinderMob mob ) { .forEach( slot->mob.setDropChance( slot, 0.05f ) ); } - private void randomizePosition( PathfinderMob sidekick, Vec3 position ) { - sidekick.setPos( position.x + Random.nextInt( -3, 4 ), position.y + 0.5, position.z + Random.nextInt( -3, 4 ) ); + private Vec3 getRandomizedPosition( Level level, Vec3 position ) { + for( int idx = 0; idx < 3; ++idx ) { + Vec3 newPosition = AnyPos.from( position ).add( Random.nextInt( -3, 4 ), 0.0, Random.nextInt( -3, 4 ) ).vec3(); + Optional< BlockPos > spawnPoint = LevelHelper.findBlockPosOnGround( level, newPosition.x, new Range<>( newPosition.y - 3, newPosition.y + 3 ), newPosition.z ); + if( spawnPoint.isPresent() ) { + return AnyPos.from( spawnPoint.get() ).add( 0.5, 0.0, 0.5 ).vec3(); + } + } + + return position; } } diff --git a/src/main/java/com/majruszsdifficulty/gamemodifiers/configs/ProgressiveEffectConfig.java b/src/main/java/com/majruszsdifficulty/config/ProgressiveEffectConfig.java similarity index 94% rename from src/main/java/com/majruszsdifficulty/gamemodifiers/configs/ProgressiveEffectConfig.java rename to src/main/java/com/majruszsdifficulty/config/ProgressiveEffectConfig.java index 9a8727a88..7a518846c 100644 --- a/src/main/java/com/majruszsdifficulty/gamemodifiers/configs/ProgressiveEffectConfig.java +++ b/src/main/java/com/majruszsdifficulty/config/ProgressiveEffectConfig.java @@ -1,8 +1,6 @@ -package com.majruszsdifficulty.gamemodifiers.configs; +package com.majruszsdifficulty.config; import com.majruszsdifficulty.gamestage.GameStage; -import com.majruszsdifficulty.config.GameStageDoubleConfig; -import com.majruszsdifficulty.config.GameStageIntegerConfig; import com.mlib.Utility; import com.mlib.config.ConfigGroup; import com.mlib.config.DoubleConfig; diff --git a/src/main/java/com/majruszsdifficulty/gamemodifiers/configs/StageProgressConfig.java b/src/main/java/com/majruszsdifficulty/config/StageProgressConfig.java similarity index 95% rename from src/main/java/com/majruszsdifficulty/gamemodifiers/configs/StageProgressConfig.java rename to src/main/java/com/majruszsdifficulty/config/StageProgressConfig.java index b6fd5b5cf..037ae90d1 100644 --- a/src/main/java/com/majruszsdifficulty/gamemodifiers/configs/StageProgressConfig.java +++ b/src/main/java/com/majruszsdifficulty/config/StageProgressConfig.java @@ -1,4 +1,4 @@ -package com.majruszsdifficulty.gamemodifiers.configs; +package com.majruszsdifficulty.config; import com.mlib.config.ConfigGroup; import com.mlib.config.StringListConfig; diff --git a/src/main/java/com/majruszsdifficulty/gamemodifiers/configs/TreasureBagConfig.java b/src/main/java/com/majruszsdifficulty/config/TreasureBagConfig.java similarity index 89% rename from src/main/java/com/majruszsdifficulty/gamemodifiers/configs/TreasureBagConfig.java rename to src/main/java/com/majruszsdifficulty/config/TreasureBagConfig.java index 948699b03..3dd8cc116 100644 --- a/src/main/java/com/majruszsdifficulty/gamemodifiers/configs/TreasureBagConfig.java +++ b/src/main/java/com/majruszsdifficulty/config/TreasureBagConfig.java @@ -1,4 +1,4 @@ -package com.majruszsdifficulty.gamemodifiers.configs; +package com.majruszsdifficulty.config; import com.mlib.config.BooleanConfig; import com.mlib.config.ConfigGroup; diff --git a/src/main/java/com/majruszsdifficulty/gamemodifiers/contexts/OnBleedingCheck.java b/src/main/java/com/majruszsdifficulty/contexts/OnBleedingCheck.java similarity index 75% rename from src/main/java/com/majruszsdifficulty/gamemodifiers/contexts/OnBleedingCheck.java rename to src/main/java/com/majruszsdifficulty/contexts/OnBleedingCheck.java index 7bc25fa2a..2f3d426ce 100644 --- a/src/main/java/com/majruszsdifficulty/gamemodifiers/contexts/OnBleedingCheck.java +++ b/src/main/java/com/majruszsdifficulty/contexts/OnBleedingCheck.java @@ -1,8 +1,8 @@ -package com.majruszsdifficulty.gamemodifiers.contexts; +package com.majruszsdifficulty.contexts; -import com.mlib.gamemodifiers.Context; -import com.mlib.gamemodifiers.Contexts; -import com.mlib.gamemodifiers.contexts.OnDamaged; +import com.mlib.contexts.base.Context; +import com.mlib.contexts.base.Contexts; +import com.mlib.contexts.OnDamaged; import net.minecraftforge.event.entity.living.LivingHurtEvent; import java.util.function.Consumer; @@ -27,6 +27,10 @@ public void trigger() { this.isTriggered = true; } + public void cancel() { + this.isTriggered = false; + } + public boolean isEffectTriggered() { return this.isTriggered; } diff --git a/src/main/java/com/majruszsdifficulty/contexts/OnBleedingTooltip.java b/src/main/java/com/majruszsdifficulty/contexts/OnBleedingTooltip.java new file mode 100644 index 000000000..8b3b2f2a9 --- /dev/null +++ b/src/main/java/com/majruszsdifficulty/contexts/OnBleedingTooltip.java @@ -0,0 +1,47 @@ +package com.majruszsdifficulty.contexts; + +import com.mlib.contexts.base.Context; +import com.mlib.contexts.base.Contexts; +import com.mlib.contexts.OnItemAttributeTooltip; +import com.mlib.text.TextHelper; +import net.minecraft.ChatFormatting; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.item.ItemStack; + +import java.util.function.Consumer; + +public class OnBleedingTooltip { + public static Context< Data > listen( Consumer< Data > consumer ) { + return Contexts.get( Data.class ).add( consumer ); + } + + public static Data dispatch( ItemStack itemStack, int amplifier ) { + return Contexts.get( Data.class ).dispatch( new Data( itemStack, amplifier ) ); + } + + public static class Data extends OnItemAttributeTooltip.Data { + final int amplifier; + + public Data( ItemStack itemStack, int amplifier ) { + super( itemStack ); + + this.amplifier = amplifier; + } + + public void addItem( double chance ) { + this.add( EquipmentSlot.MAINHAND, new TranslatableComponent( "effect.majruszsdifficulty.bleeding.item_tooltip", TextHelper.percent( ( float )chance ), TextHelper.toRoman( this.amplifier + 1 ) ) + .withStyle( ChatFormatting.DARK_GREEN ) ); + } + + public void addArmor( EquipmentSlot slot, double chanceMultiplier ) { + this.add( slot, new TranslatableComponent( "effect.majruszsdifficulty.bleeding.armor_tooltip", TextHelper.minPrecision( chanceMultiplier ) ) + .withStyle( ChatFormatting.BLUE ) ); + } + + public void addAll( OnItemAttributeTooltip.Data data ) { + this.components.forEach( ( slot, components )->components.forEach( component->data.add( slot, component ) ) ); + } + } +} diff --git a/src/main/java/com/majruszsdifficulty/gamemodifiers/contexts/OnGameStageChange.java b/src/main/java/com/majruszsdifficulty/contexts/OnGameStageChange.java similarity index 87% rename from src/main/java/com/majruszsdifficulty/gamemodifiers/contexts/OnGameStageChange.java rename to src/main/java/com/majruszsdifficulty/contexts/OnGameStageChange.java index 60fdaaa78..a63d50984 100644 --- a/src/main/java/com/majruszsdifficulty/gamemodifiers/contexts/OnGameStageChange.java +++ b/src/main/java/com/majruszsdifficulty/contexts/OnGameStageChange.java @@ -1,8 +1,8 @@ -package com.majruszsdifficulty.gamemodifiers.contexts; +package com.majruszsdifficulty.contexts; import com.majruszsdifficulty.gamestage.GameStage; -import com.mlib.gamemodifiers.Context; -import com.mlib.gamemodifiers.Contexts; +import com.mlib.contexts.base.Context; +import com.mlib.contexts.base.Contexts; import net.minecraft.server.MinecraftServer; import org.jetbrains.annotations.Nullable; diff --git a/src/main/java/com/majruszsdifficulty/gamemodifiers/contexts/OnSoulJarMultiplier.java b/src/main/java/com/majruszsdifficulty/contexts/OnSoulJarMultiplier.java similarity index 84% rename from src/main/java/com/majruszsdifficulty/gamemodifiers/contexts/OnSoulJarMultiplier.java rename to src/main/java/com/majruszsdifficulty/contexts/OnSoulJarMultiplier.java index 39abdffcd..327019962 100644 --- a/src/main/java/com/majruszsdifficulty/gamemodifiers/contexts/OnSoulJarMultiplier.java +++ b/src/main/java/com/majruszsdifficulty/contexts/OnSoulJarMultiplier.java @@ -1,8 +1,8 @@ -package com.majruszsdifficulty.gamemodifiers.contexts; +package com.majruszsdifficulty.contexts; -import com.mlib.gamemodifiers.Context; -import com.mlib.gamemodifiers.Contexts; -import com.mlib.gamemodifiers.data.ILevelData; +import com.mlib.contexts.base.Context; +import com.mlib.contexts.base.Contexts; +import com.mlib.contexts.data.ILevelData; import net.minecraft.world.entity.Entity; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; diff --git a/src/main/java/com/majruszsdifficulty/gamemodifiers/contexts/OnTreasureBagOpened.java b/src/main/java/com/majruszsdifficulty/contexts/OnTreasureBagOpened.java similarity index 85% rename from src/main/java/com/majruszsdifficulty/gamemodifiers/contexts/OnTreasureBagOpened.java rename to src/main/java/com/majruszsdifficulty/contexts/OnTreasureBagOpened.java index 47cde0482..3ec4c6e9d 100644 --- a/src/main/java/com/majruszsdifficulty/gamemodifiers/contexts/OnTreasureBagOpened.java +++ b/src/main/java/com/majruszsdifficulty/contexts/OnTreasureBagOpened.java @@ -1,9 +1,9 @@ -package com.majruszsdifficulty.gamemodifiers.contexts; +package com.majruszsdifficulty.contexts; import com.majruszsdifficulty.items.TreasureBagItem; -import com.mlib.gamemodifiers.Context; -import com.mlib.gamemodifiers.Contexts; -import com.mlib.gamemodifiers.data.ILevelData; +import com.mlib.contexts.base.Context; +import com.mlib.contexts.base.Contexts; +import com.mlib.contexts.data.ILevelData; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; diff --git a/src/main/java/com/majruszsdifficulty/gamemodifiers/CustomConditions.java b/src/main/java/com/majruszsdifficulty/contexts/base/CustomConditions.java similarity index 87% rename from src/main/java/com/majruszsdifficulty/gamemodifiers/CustomConditions.java rename to src/main/java/com/majruszsdifficulty/contexts/base/CustomConditions.java index 90bf26f5a..e762c30bd 100644 --- a/src/main/java/com/majruszsdifficulty/gamemodifiers/CustomConditions.java +++ b/src/main/java/com/majruszsdifficulty/contexts/base/CustomConditions.java @@ -1,10 +1,10 @@ -package com.majruszsdifficulty.gamemodifiers; +package com.majruszsdifficulty.contexts.base; import com.majruszsdifficulty.gamestage.GameStage; import com.majruszsdifficulty.Registries; import com.mlib.config.StringListConfig; -import com.mlib.gamemodifiers.Condition; -import com.mlib.gamemodifiers.Priority; +import com.mlib.contexts.base.Condition; +import com.mlib.contexts.base.Priority; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.PathfinderMob; @@ -12,8 +12,8 @@ import java.util.function.Predicate; import java.util.stream.Stream; -import static com.majruszsdifficulty.gamemodifiers.configs.MobGroupConfig.LEADER_TAG; -import static com.majruszsdifficulty.gamemodifiers.configs.MobGroupConfig.SIDEKICK_TAG; +import static com.majruszsdifficulty.config.MobGroupConfig.LEADER_TAG; +import static com.majruszsdifficulty.config.MobGroupConfig.SIDEKICK_TAG; public class CustomConditions { public static < DataType > Condition< DataType > gameStage( GameStage... defaultGameStages ) { diff --git a/src/main/java/com/majruszsdifficulty/effects/BleedingEffect.java b/src/main/java/com/majruszsdifficulty/effects/BleedingEffect.java index 6f709ed38..6c87e7b96 100644 --- a/src/main/java/com/majruszsdifficulty/effects/BleedingEffect.java +++ b/src/main/java/com/majruszsdifficulty/effects/BleedingEffect.java @@ -1,27 +1,23 @@ package com.majruszsdifficulty.effects; -import com.majruszsdifficulty.PacketHandler; import com.majruszsdifficulty.Registries; -import com.majruszsdifficulty.gamemodifiers.configs.BleedingConfig; -import com.majruszsdifficulty.gamemodifiers.contexts.OnBleedingCheck; +import com.majruszsdifficulty.config.BleedingConfig; +import com.majruszsdifficulty.contexts.OnBleedingCheck; +import com.majruszsdifficulty.contexts.OnBleedingTooltip; import com.majruszsdifficulty.gui.BleedingGui; -import com.mlib.EquipmentSlots; import com.mlib.Random; import com.mlib.Utility; -import com.mlib.annotations.AutoInstance; +import com.mlib.modhelper.AutoInstance; import com.mlib.config.BooleanConfig; import com.mlib.config.ConfigGroup; -import com.mlib.config.DoubleConfig; import com.mlib.config.StringListConfig; import com.mlib.data.SerializableStructure; import com.mlib.effects.ParticleHandler; import com.mlib.entities.EntityHelper; -import com.mlib.gamemodifiers.Condition; -import com.mlib.gamemodifiers.ModConfigs; -import com.mlib.gamemodifiers.contexts.*; +import com.mlib.contexts.base.Condition; +import com.mlib.contexts.base.ModConfigs; +import com.mlib.contexts.*; import com.mlib.mobeffects.MobEffectHelper; -import com.mlib.text.TextHelper; -import net.minecraft.ChatFormatting; import net.minecraft.client.Minecraft; import net.minecraft.network.chat.*; import net.minecraft.server.level.ServerLevel; @@ -30,10 +26,7 @@ import net.minecraft.world.effect.MobEffect; import net.minecraft.world.effect.MobEffectCategory; import net.minecraft.world.entity.Entity; -import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.ai.attributes.Attributes; -import net.minecraft.world.item.ArmorItem; import net.minecraft.world.item.ItemStack; import net.minecraft.world.phys.Vec3; import net.minecraftforge.api.distmarker.Dist; @@ -50,18 +43,6 @@ import java.util.function.Supplier; public class BleedingEffect extends MobEffect { - static Supplier< Boolean > IS_ENABLED = ()->true; - static Supplier< Integer > GET_AMPLIFIER = ()->0; - static Function< EquipmentSlot, Float > GET_ARMOR_MULTIPLIER = slot->1.0f; - - public static boolean isEnabled() { - return IS_ENABLED.get(); - } - - public static int getAmplifier() { - return GET_AMPLIFIER.get(); - } - public BleedingEffect() { super( MobEffectCategory.HARMFUL, 0xffdd5555 ); } @@ -83,10 +64,10 @@ public List< ItemStack > getCurativeItems() { } /** Bleeding damage source that stores information about the causer of bleeding. (required for converting villager to zombie villager etc.) */ - public static class EntityBleedingDamageSource extends DamageSource { + public static class DamageSource extends net.minecraft.world.damagesource.DamageSource { @Nullable protected final Entity damageSourceEntity; - public EntityBleedingDamageSource( @Nullable Entity damageSourceEntity ) { + public DamageSource( @Nullable Entity damageSourceEntity ) { super( Registries.BLEEDING_SOURCE.msgId ); this.damageSourceEntity = damageSourceEntity; @@ -120,16 +101,19 @@ public MobEffectInstance( int duration, int amplifier, boolean ambient, @Nullabl @AutoInstance public static class Bleeding { static final ParticleHandler PARTICLES = new ParticleHandler( Registries.BLOOD, ()->new Vec3( 0.2, 0.5, 0.2 ), ParticleHandler.speed( 0.075f ) ); - static final String ATTRIBUTE_ID = "effect.majruszsdifficulty.bleeding.armor_tooltip"; static final int BLOOD_TICK_COOLDOWN = Utility.secondsToTicks( 4.0 ); + final BooleanConfig availability = Condition.DefaultConfigs.excludable( true ); final StringListConfig immuneMobs = new StringListConfig( "minecraft:skeleton_horse", "minecraft:zombie_horse" ); final BleedingConfig effect = new BleedingConfig(); final HashMap< Integer, Integer > entityTicks = new HashMap<>(); public Bleeding() { - ConfigGroup group = ModConfigs.registerSubgroup( Registries.Groups.DEFAULT ) - .name( "Bleeding" ) - .comment( "Common config for all Bleeding effects." ); + ConfigGroup group = ModConfigs.getGroup( Registries.Groups.BLEEDING ) + .addConfig( this.availability ) + .addConfig( this.immuneMobs + .name( "immune_mobs" ) + .comment( "Specifies which mobs should not be affected by Bleeding (all undead mobs are immune by default)." ) + ).addConfig( this.effect ); OnEntityTick.listen( this::spawnParticles ) .addCondition( Condition.isServer() ) @@ -148,47 +132,33 @@ public Bleeding() { .insertTo( group ); OnEffectApplicable.listen( this::cancelEffect ) - .addCondition( Condition.predicate( data->!BleedingEffect.isEnabled() ) ) + .addCondition( Condition.predicate( data->this.availability.isDisabled() ) ) .addCondition( Condition.predicate( data->data.effect.equals( Registries.BLEEDING_IMMUNITY.get() ) ) ) .insertTo( group ); - var excludable = Condition.< OnDamaged.Data > excludable(); - IS_ENABLED = ()->( ( BooleanConfig )excludable.getConfigs().get( 0 ) ).isEnabled(); // TODO: refactor - var armorChance = Condition.< OnDamaged.Data > armorDependentChance( 0.8, 0.6, 0.7, 0.9, data->data.target ); - GET_ARMOR_MULTIPLIER = slot->( ( DoubleConfig )( ( ConfigGroup )armorChance.getConfigs().get( 0 ) ).getConfigs() - .get( 3 - slot.getIndex() ) - ).asFloat(); // TODO: refactor OnDamaged.listen( this::applyBleeding ) .addCondition( Condition.isServer() ) - .addCondition( excludable ) - .addCondition( armorChance ) + .addCondition( Condition.predicate( data->this.availability.isEnabled() ) ) .addCondition( Condition.predicate( this::isNotImmune ) ) .addCondition( OnDamaged.dealtAnyDamage() ) - .addConfig( this.immuneMobs - .name( "immune_mobs" ) - .comment( "Specifies which mobs should not be affected by Bleeding (all undead mobs are immune by default)." ) - ).addConfig( this.effect ) .insertTo( group ); - OnItemAttributeTooltip.listen( this::addChanceTooltip ) - .addCondition( Condition.predicate( data->data.item instanceof ArmorItem ) ) - .addCondition( Condition.predicate( data->BleedingEffect.isEnabled() ) ) + OnItemAttributeTooltip.listen( this::addCustomTooltip ) + .addCondition( Condition.predicate( data->this.availability.isEnabled() ) ) .insertTo( group ); - - GET_AMPLIFIER = this.effect::getAmplifier; } private void spawnParticles( OnEntityTick.Data data ) { int amplifier = MobEffectHelper.getAmplifier( data.entity, Registries.BLEEDING.get() ); float walkDistanceDelta = EntityHelper.getWalkDistanceDelta( data.entity ); - this.spawnParticles( data.getServerLevel(), data.entity, Random.roundRandomly( 1.0 + ( 15.0 + amplifier ) * walkDistanceDelta ) ); + this.spawnParticles( data.getServerLevel(), data.entity, Random.round( 1.0 + ( 15.0 + amplifier ) * walkDistanceDelta ) ); } private void tick( OnEntityTick.Data data ) { LivingEntity entity = data.entity; int amplifier = MobEffectHelper.getAmplifier( entity, Registries.BLEEDING.get() ); - int extraDuration = Random.roundRandomly( 0.3 * ( amplifier + 2 ) * ( 7.26 * EntityHelper.getWalkDistanceDelta( entity ) + 1 ) ); + int extraDuration = Random.round( 0.3 * ( amplifier + 2 ) * ( 7.26 * EntityHelper.getWalkDistanceDelta( entity ) + 1 ) ); int duration = this.entityTicks.getOrDefault( entity.getId(), 0 ) + extraDuration; if( duration >= BLOOD_TICK_COOLDOWN ) { this.dealDamage( entity ); @@ -201,13 +171,13 @@ private void tick( OnEntityTick.Data data ) { private void dealDamage( LivingEntity entity ) { if( entity.getEffect( Registries.BLEEDING.get() ) instanceof MobEffectInstance effectInstance ) { Vec3 motion = entity.getDeltaMovement(); - entity.hurt( new EntityBleedingDamageSource( effectInstance.damageSourceEntity ), 1.0f ); + entity.hurt( new DamageSource( effectInstance.damageSourceEntity ), 1.0f ); entity.setDeltaMovement( motion ); // sets previous motion to avoid any knockback from bleeding } else { entity.hurt( Registries.BLEEDING_SOURCE, 1.0f ); } if( entity instanceof ServerPlayer player ) { - PacketHandler.CHANNEL.send( PacketDistributor.PLAYER.with( ()->player ), new BloodMessage( player ) ); + Registries.HELPER.sendMessage( PacketDistributor.PLAYER.with( ()->player ), new BloodMessage( player ) ); } this.entityTicks.put( entity.getId(), 0 ); @@ -228,7 +198,7 @@ private void cancelEffect( OnEffectApplicable.Data data ) { private void applyBleeding( OnDamaged.Data data ) { OnBleedingCheck.Data bleedingData = OnBleedingCheck.dispatch( data.event ); - if( bleedingData.isEffectTriggered() && this.effect.apply( data ) ) { + if( bleedingData.dealtAnyDamage() && bleedingData.isEffectTriggered() && this.effect.apply( data ) ) { this.dealDamage( data.target ); } } @@ -237,14 +207,8 @@ private boolean isNotImmune( OnDamaged.Data data ) { return !this.immuneMobs.contains( Utility.getRegistryString( data.target ) ); } - private void addChanceTooltip( OnItemAttributeTooltip.Data data ) { - for( EquipmentSlot slot : EquipmentSlots.ARMOR ) { - if( !data.itemStack.getAttributeModifiers( slot ).containsKey( Attributes.ARMOR ) ) - continue; - - String multiplier = TextHelper.minPrecision( GET_ARMOR_MULTIPLIER.apply( slot ) ); - data.add( slot, new TranslatableComponent( ATTRIBUTE_ID, multiplier ).withStyle( ChatFormatting.BLUE ) ); - } + private void addCustomTooltip( OnItemAttributeTooltip.Data data ) { + OnBleedingTooltip.dispatch( data.itemStack, this.effect.getAmplifier() ).addAll( data ); } } @@ -252,7 +216,7 @@ public static class BloodMessage extends SerializableStructure { int entityId; public BloodMessage() { - this.define( null, ()->this.entityId, x->this.entityId = x ); + this.defineInteger( "id", ()->this.entityId, x->this.entityId = x ); } public BloodMessage( Entity entity ) { diff --git a/src/main/java/com/majruszsdifficulty/effects/BleedingImmunityEffect.java b/src/main/java/com/majruszsdifficulty/effects/BleedingImmunityEffect.java index fafd87697..29686a992 100644 --- a/src/main/java/com/majruszsdifficulty/effects/BleedingImmunityEffect.java +++ b/src/main/java/com/majruszsdifficulty/effects/BleedingImmunityEffect.java @@ -1,11 +1,9 @@ package com.majruszsdifficulty.effects; import com.majruszsdifficulty.Registries; -import com.mlib.annotations.AutoInstance; -import com.mlib.config.ConfigGroup; -import com.mlib.gamemodifiers.Condition; -import com.mlib.gamemodifiers.ModConfigs; -import com.mlib.gamemodifiers.contexts.OnEffectApplicable; +import com.mlib.modhelper.AutoInstance; +import com.mlib.contexts.base.Condition; +import com.mlib.contexts.OnEffectApplicable; import net.minecraft.world.effect.MobEffect; import net.minecraft.world.effect.MobEffectCategory; import net.minecraft.world.entity.Entity; @@ -37,14 +35,9 @@ public boolean isDurationEffectTick( int duration, int amplifier ) { @AutoInstance public static class BleedingImmunity { public BleedingImmunity() { - ConfigGroup group = ModConfigs.registerSubgroup( Registries.Groups.DEFAULT ) - .name( "BleedingImmunity" ) - .comment( "Config for Bleeding Immunity effect." ); - OnEffectApplicable.listen( this::cancelBleeding ) .addCondition( Condition.hasEffect( Registries.BLEEDING_IMMUNITY, data->data.entity ) ) - .addCondition( Condition.predicate( data->data.effect.equals( Registries.BLEEDING.get() ) ) ) - .insertTo( group ); + .addCondition( Condition.predicate( data->data.effect.equals( Registries.BLEEDING.get() ) ) ); } private void cancelBleeding( OnEffectApplicable.Data data ) { diff --git a/src/main/java/com/majruszsdifficulty/effects/GlassRegenerationEffect.java b/src/main/java/com/majruszsdifficulty/effects/GlassRegenerationEffect.java new file mode 100644 index 000000000..ef769c74f --- /dev/null +++ b/src/main/java/com/majruszsdifficulty/effects/GlassRegenerationEffect.java @@ -0,0 +1,51 @@ +package com.majruszsdifficulty.effects; + +import com.majruszsdifficulty.Registries; +import com.mlib.Utility; +import com.mlib.modhelper.AutoInstance; +import com.mlib.contexts.base.Condition; +import com.mlib.contexts.OnDamaged; +import net.minecraft.world.effect.MobEffect; +import net.minecraft.world.effect.MobEffectCategory; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.LivingEntity; + +import javax.annotation.Nullable; + +public class GlassRegenerationEffect extends MobEffect { + public GlassRegenerationEffect() { + super( MobEffectCategory.BENEFICIAL, 0xffcd5cab ); + } + + @Override + public void applyEffectTick( LivingEntity entity, int amplifier ) { + if( entity.getHealth() < entity.getMaxHealth() ) { + entity.heal( 1.0f ); + } + } + + @Override + public void applyInstantenousEffect( @Nullable Entity source, @Nullable Entity indirectSource, LivingEntity entity, int amplifier, double health ) { + this.applyEffectTick( entity, amplifier ); + } + + @Override + public boolean isDurationEffectTick( int duration, int amplifier ) { + int cooldown = Utility.secondsToTicks( 8.0 ) >> amplifier; + + return cooldown <= 0 || duration % cooldown == 0; + } + + @AutoInstance + public static class GlassRegeneration { + public GlassRegeneration() { + OnDamaged.listen( this::removeEffect ) + .addCondition( Condition.hasEffect( Registries.GLASS_REGENERATION, data->data.target ) ) + .addCondition( OnDamaged.dealtAnyDamage() ); + } + + private void removeEffect( OnDamaged.Data data ) { + data.target.removeEffect( Registries.GLASS_REGENERATION.get() ); + } + } +} diff --git a/src/main/java/com/majruszsdifficulty/entities/BlackWidowEntity.java b/src/main/java/com/majruszsdifficulty/entities/BlackWidowEntity.java deleted file mode 100644 index 959f68683..000000000 --- a/src/main/java/com/majruszsdifficulty/entities/BlackWidowEntity.java +++ /dev/null @@ -1,108 +0,0 @@ -package com.majruszsdifficulty.entities; - -import com.majruszsdifficulty.Registries; -import com.mlib.Random; -import com.mlib.annotations.AutoInstance; -import com.mlib.config.ConfigGroup; -import com.mlib.config.DoubleConfig; -import com.mlib.effects.SoundHandler; -import com.mlib.gamemodifiers.Condition; -import com.mlib.gamemodifiers.ModConfigs; -import com.mlib.gamemodifiers.contexts.OnEntityTick; -import com.mlib.gamemodifiers.contexts.OnItemTooltip; -import com.mlib.math.Range; -import net.minecraft.ChatFormatting; -import net.minecraft.network.chat.*; -import net.minecraft.sounds.SoundEvent; -import net.minecraft.world.entity.*; -import net.minecraft.world.entity.ai.attributes.AttributeSupplier; -import net.minecraft.world.entity.ai.attributes.Attributes; -import net.minecraft.world.entity.monster.Monster; -import net.minecraft.world.entity.monster.Spider; -import net.minecraft.world.entity.player.Player; -import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.Blocks; - -import java.util.function.Supplier; - -public class BlackWidowEntity extends Spider { - public static Supplier< EntityType< BlackWidowEntity > > createSupplier() { - return ()->EntityType.Builder.of( BlackWidowEntity::new, MobCategory.MONSTER ) - .sized( 0.7f, 0.35f ) - .build( "black_widow" ); - } - - public static AttributeSupplier getAttributeMap() { - return Monster.createMobAttributes() - .add( Attributes.MAX_HEALTH, 12.0 ) - .add( Attributes.MOVEMENT_SPEED, 0.3 ) - .add( Attributes.ATTACK_DAMAGE, 4.0 ) - .build(); - } - - public BlackWidowEntity( EntityType< ? extends BlackWidowEntity > type, Level world ) { - super( type, world ); - } - - @Override - public int getExperienceReward( Player player ) { - return Random.nextInt( 3 ); - } - - @Override - public void playSound( SoundEvent sound, float volume, float pitch ) { - if( this.isSilent() ) { - return; - } - float randomizedVolume = SoundHandler.randomized( volume * 0.6f ).get(); - float randomizedPitch = SoundHandler.randomized( pitch * 1.4f ).get(); - - this.level.playSound( null, this.getX(), this.getY(), this.getZ(), sound, this.getSoundSource(), randomizedVolume, randomizedPitch ); - } - - @Override - protected float getStandingEyeHeight( Pose pose, EntityDimensions dimensions ) { - return 0.2f; - } - - @AutoInstance - public static class WebAbility { - final DoubleConfig delay = new DoubleConfig( 30.0, new Range<>( 5.0, 600.0 ) ); - - public WebAbility() { - ConfigGroup group = ModConfigs.registerSubgroup( Registries.Groups.DEFAULT ) - .name( "BlackWidowWebAbility" ) - .comment( "Black Widow spawns the web when in combat." ); - - OnEntityTick.listen( this::spawnWeb ) - .addCondition( Condition.isServer() ) - .addCondition( Condition.excludable() ) - .addCondition( Condition.predicate( data->data.entity instanceof BlackWidowEntity ) ) - .addCondition( Condition.predicate( this::ticksHavePassed ) ) - .addConfig( this.delay.name( "delay" ).comment( "Duration between creating a new web (in seconds)." ) ) - .insertTo( group ); - } - - private void spawnWeb( OnEntityTick.Data data ) { - data.getServerLevel().setBlock( data.entity.blockPosition(), Blocks.COBWEB.defaultBlockState(), 3 ); - } - - private boolean ticksHavePassed( OnEntityTick.Data data ) { - return data.entity.tickCount % this.delay.asTicks() == 0; - } - } - - @Deprecated - @AutoInstance - public static class TempTooltip { - public TempTooltip() { - OnItemTooltip.listen( this::addTooltip ) - .addCondition( Condition.predicate( data->data.itemStack.getItem().equals( Registries.BLACK_WIDOW_SPAWN_EGG.get() ) ) ); - } - - private void addTooltip( OnItemTooltip.Data data ) { - data.tooltip.add( new TextComponent( "This mob is not finished yet, coming soon in the next major update!" ) - .withStyle( ChatFormatting.RED ) ); - } - } -} diff --git a/src/main/java/com/majruszsdifficulty/entities/CerberusEntity.java b/src/main/java/com/majruszsdifficulty/entities/CerberusEntity.java index 04b0dcea6..65d7366f1 100644 --- a/src/main/java/com/majruszsdifficulty/entities/CerberusEntity.java +++ b/src/main/java/com/majruszsdifficulty/entities/CerberusEntity.java @@ -1,27 +1,23 @@ package com.majruszsdifficulty.entities; -import com.majruszsdifficulty.PacketHandler; import com.majruszsdifficulty.Registries; -import com.majruszsdifficulty.undeadarmy.UndeadArmyManager; import com.mlib.Random; import com.mlib.Utility; -import com.mlib.annotations.AutoInstance; +import com.mlib.modhelper.AutoInstance; import com.mlib.config.ConfigGroup; import com.mlib.config.EffectConfig; -import com.mlib.data.SerializableStructure; import com.mlib.effects.ParticleHandler; import com.mlib.effects.SoundHandler; import com.mlib.entities.CustomSkills; import com.mlib.entities.EntityHelper; import com.mlib.entities.ICustomSkillProvider; -import com.mlib.gamemodifiers.Condition; -import com.mlib.gamemodifiers.ModConfigs; -import com.mlib.gamemodifiers.contexts.OnDamaged; -import com.mlib.gamemodifiers.contexts.OnEffectApplicable; -import com.mlib.gamemodifiers.contexts.OnEntityTick; +import com.mlib.contexts.base.Condition; +import com.mlib.contexts.base.ModConfigs; +import com.mlib.contexts.OnDamaged; +import com.mlib.contexts.OnEffectApplicable; +import com.mlib.contexts.OnEntityTick; import com.mlib.goals.CustomMeleeGoal; import com.mlib.math.AnyPos; -import net.minecraft.client.Minecraft; import net.minecraft.core.BlockPos; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; @@ -45,27 +41,23 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.Vec3; import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.common.ForgeMod; import net.minecraftforge.eventbus.api.Event; -import net.minecraftforge.network.NetworkEvent; -import net.minecraftforge.network.PacketDistributor; import java.util.List; import java.util.function.Supplier; public class CerberusEntity extends Monster implements ICustomSkillProvider< CerberusEntity.Skills > { - static final String GROUP_ID = "Cerberus"; + static final String GROUP_ID = Registries.getLocationString( "cerberus" ); static { ModConfigs.init( Registries.Groups.MOBS, GROUP_ID ).name( "Cerberus" ); } public final Skills skills = new Skills( this ); - public boolean hasTarget = false; public static Supplier< EntityType< CerberusEntity > > createSupplier() { - return ()->EntityType.Builder.of( CerberusEntity::new, MobCategory.MONSTER ).sized( 1.0f, 1.99f ).build( "cerberus" ); + return ()->EntityType.Builder.of( CerberusEntity::new, MobCategory.MONSTER ).sized( 1.2f, 1.75f ).build( "cerberus" ); } public static AttributeSupplier getAttributeMap() { @@ -75,12 +67,14 @@ public static AttributeSupplier getAttributeMap() { .add( Attributes.ATTACK_DAMAGE, 8.0 ) .add( Attributes.FOLLOW_RANGE, 30.0 ) .add( Attributes.KNOCKBACK_RESISTANCE, 0.5 ) - .add( ForgeMod.STEP_HEIGHT_ADDITION.get(), 1.0 ) + .add( ForgeMod.STEP_HEIGHT_ADDITION.get(), 0.5 ) .build(); } public CerberusEntity( EntityType< ? extends CerberusEntity > type, Level world ) { super( type, world ); + + this.maxUpStep = 1.0f; } @Override @@ -114,11 +108,6 @@ public void tick() { super.tick(); this.skills.tick(); - boolean hasTarget = this.getTarget() != null; - if( hasTarget != this.hasTarget && !this.level.isClientSide ) { - this.hasTarget = hasTarget; - PacketHandler.CHANNEL.send( PacketDistributor.DIMENSION.with( ()->this.level.dimension() ), new TargetMessage( this ) ); - } if( this.isSunBurnTick() ) { this.setSecondsOnFire( 8 ); } @@ -126,7 +115,7 @@ public void tick() { @Override protected void registerGoals() { - this.goalSelector.addGoal( 1, new CustomMeleeGoal<>( this, 1.5, false ) ); + this.goalSelector.addGoal( 1, new CustomMeleeGoal<>( this, 1.5, true ) ); this.goalSelector.addGoal( 7, new WaterAvoidingRandomStrollGoal( this, 1.0 ) ); this.goalSelector.addGoal( 8, new LookAtPlayerGoal( this, Player.class, 8.0f, 1.0f ) ); this.goalSelector.addGoal( 8, new RandomLookAroundGoal( this ) ); @@ -143,7 +132,7 @@ protected SoundEvent getAmbientSound() { @Override protected float getStandingEyeHeight( Pose poseIn, EntityDimensions sizeIn ) { - return 1.8f; + return 1.6f; } @Override @@ -162,17 +151,15 @@ protected void playStepSound( BlockPos blockPos, BlockState blockState ) { } private boolean isValidTarget( LivingEntity entity ) { - UndeadArmyManager undeadArmyManager = Registries.getUndeadArmyManager(); - - return !undeadArmyManager.isPartOfUndeadArmy( this ) - || !undeadArmyManager.isPartOfUndeadArmy( entity ) && undeadArmyManager.findNearestUndeadArmy( entity.blockPosition() ) != null; + return !entity.getMobType().equals( MobType.UNDEAD ) + && !Registries.getUndeadArmyManager().isPartOfUndeadArmy( entity ); } public static class Skills extends CustomSkills< SkillType > { int fireballCooldownLeft = 0; public Skills( PathfinderMob mob ) { - super( mob, PacketHandler.CHANNEL, SkillMessage::new ); + super( mob, Registries.HELPER.getNetworkChannel(), SkillMessage::new ); } @Override @@ -183,9 +170,6 @@ public boolean tryToStart( LivingEntity entity, double distanceSquared ) { double distance = Math.sqrt( distanceSquared ); if( distance < 3.5 && this.mob.canAttack( entity, TargetingConditions.DEFAULT ) ) { Vec3 position = this.getAttackPosition( this.mob.position(), entity.position() ); - if( distance > 2.0 ) { - this.pushMobTowards( entity ); - } this.start( SkillType.BITE, Utility.secondsToTicks( 0.7 ) ) .onTick( 2, ()->this.mob.playSound( SoundEvents.WOLF_AMBIENT, 0.5f, 0.85f ) ) .onTick( 3, ()->this.mob.playSound( SoundEvents.WOLF_AMBIENT, 0.5f, 0.7f ) ) @@ -213,11 +197,6 @@ public void tick() { this.fireballCooldownLeft = Math.max( this.fireballCooldownLeft - 1, 0 ); } - private void pushMobTowards( LivingEntity entity ) { - Vec3 direction = AnyPos.from( entity.position() ).sub( this.mob.position() ).norm().mul( 0.9 ).add( 0.0, 0.1, 0.0 ).vec3(); - this.mob.push( direction.x, direction.y, direction.z ); - } - private void hurtAllEntitiesInRange( ServerLevel level, Vec3 position ) { List< LivingEntity > entities = EntityHelper.getEntitiesInSphere( LivingEntity.class, level, position, 2.5, entity->!entity.is( this.mob ) ); for( LivingEntity entity : entities ) { @@ -238,7 +217,7 @@ private Vec3 getAttackPosition( Vec3 pos1, Vec3 pos2 ) { private void spawnFireballTowards( LivingEntity target ) { Vec3 offset = AnyPos.from( target.position() ).sub( this.mob.position() ).vec3(); for( double angle : new double[]{ -30.0, 0.0, 30.0 } ) { - Vec3 power = AnyPos.from( offset ).mul( Random.getRandomVector( 0.8, 1.2, 0.8, 1.2, 0.8, 1.2 ) ).vec3(); + Vec3 power = AnyPos.from( offset ).mul( Random.nextVector( 0.8, 1.2, 0.8, 1.2, 0.8, 1.2 ) ).vec3(); double cos = Math.cos( Math.toRadians( angle ) ), sin = Math.sin( Math.toRadians( angle ) ); Vec3 normalized = AnyPos.from( offset ).norm().vec3(); normalized = new Vec3( cos * normalized.x - sin * normalized.z, normalized.y, sin * normalized.x + cos * normalized.z ); @@ -264,31 +243,6 @@ public SkillMessage() { } } - public static class TargetMessage extends SerializableStructure { - int entityId; - boolean hasTarget = false; - - public TargetMessage( CerberusEntity cerberus ) { - this(); - - this.entityId = cerberus.getId(); - this.hasTarget = cerberus.hasTarget; - } - - public TargetMessage() { - this.define( null, ()->this.entityId, x->this.entityId = x ); - this.define( null, ()->this.hasTarget, x->this.hasTarget = x ); - } - - @OnlyIn( Dist.CLIENT ) - public void onClient( NetworkEvent.Context context ) { - Level level = Minecraft.getInstance().level; - if( level != null && level.getEntity( this.entityId ) instanceof CerberusEntity cerberus ) { - cerberus.hasTarget = this.hasTarget; - } - } - } - @AutoInstance public static class WitherAttack { final EffectConfig wither = new EffectConfig( MobEffects.WITHER, 1, 10.0 ); diff --git a/src/main/java/com/majruszsdifficulty/entities/CreeperlingEntity.java b/src/main/java/com/majruszsdifficulty/entities/CreeperlingEntity.java index 1c0520481..49d8f711d 100644 --- a/src/main/java/com/majruszsdifficulty/entities/CreeperlingEntity.java +++ b/src/main/java/com/majruszsdifficulty/entities/CreeperlingEntity.java @@ -1,11 +1,11 @@ package com.majruszsdifficulty.entities; import com.majruszsdifficulty.Registries; -import com.mlib.annotations.AutoInstance; +import com.mlib.modhelper.AutoInstance; import com.mlib.config.ConfigGroup; -import com.mlib.gamemodifiers.Condition; -import com.mlib.gamemodifiers.ModConfigs; -import com.mlib.gamemodifiers.contexts.OnExplosionDetonate; +import com.mlib.contexts.base.Condition; +import com.mlib.contexts.base.ModConfigs; +import com.mlib.contexts.OnExplosionDetonate; import net.minecraft.world.entity.*; import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; diff --git a/src/main/java/com/majruszsdifficulty/entities/CursedArmorEntity.java b/src/main/java/com/majruszsdifficulty/entities/CursedArmorEntity.java index bb3a49f05..77b4c62a3 100644 --- a/src/main/java/com/majruszsdifficulty/entities/CursedArmorEntity.java +++ b/src/main/java/com/majruszsdifficulty/entities/CursedArmorEntity.java @@ -1,25 +1,24 @@ package com.majruszsdifficulty.entities; -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.majruszsdifficulty.PacketHandler; import com.majruszsdifficulty.Registries; import com.mlib.Random; import com.mlib.Utility; -import com.mlib.annotations.AutoInstance; +import com.mlib.modhelper.AutoInstance; import com.mlib.blocks.BlockHelper; import com.mlib.config.ConfigGroup; import com.mlib.config.DoubleConfig; import com.mlib.config.StringConfig; +import com.mlib.data.JsonListener; +import com.mlib.data.SerializableList; import com.mlib.data.SerializableStructure; import com.mlib.effects.ParticleHandler; import com.mlib.effects.SoundHandler; import com.mlib.entities.EntityHelper; -import com.mlib.gamemodifiers.Condition; -import com.mlib.gamemodifiers.Context; -import com.mlib.gamemodifiers.ModConfigs; -import com.mlib.gamemodifiers.contexts.*; +import com.mlib.contexts.base.Condition; +import com.mlib.contexts.base.Context; +import com.mlib.contexts.base.ModConfigs; +import com.mlib.contexts.*; +import com.mlib.loot.LootHelper; import com.mlib.math.AnyPos; import com.mlib.math.Range; import com.mlib.text.TextHelper; @@ -33,7 +32,10 @@ import net.minecraft.server.level.ServerPlayer; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundSource; -import net.minecraft.world.entity.*; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.entity.MobCategory; import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.ai.goal.LookAtPlayerGoal; @@ -58,16 +60,16 @@ import net.minecraftforge.network.PacketDistributor; import net.minecraftforge.registries.ForgeRegistries; +import java.util.ArrayList; import java.util.Arrays; -import java.util.HashMap; import java.util.List; -import java.util.Map; +import java.util.Optional; import java.util.function.Consumer; import java.util.function.Function; import java.util.function.Supplier; public class CursedArmorEntity extends Monster { - public static final String GROUP_ID = "CursedArmor"; + public static final String GROUP_ID = Registries.getLocationString( "cursed_armor" ); public static final int ASSEMBLE_DURATION = Utility.secondsToTicks( 2.5 ); boolean areGoalsRegistered = false; SoundHandler assembleSound = null; @@ -124,12 +126,12 @@ public void startAssembling( float yRot ) { this.setYHeadRot( yRot ); this.setYBodyRot( yRot ); if( this.level instanceof ServerLevel ) { - Time.nextTick( ()->PacketHandler.CHANNEL.send( PacketDistributor.DIMENSION.with( ()->this.level.dimension() ), new AssembleMessage( this, yRot ) ) ); + Time.nextTick( ()->Registries.HELPER.sendMessage( PacketDistributor.DIMENSION.with( ()->this.level.dimension() ), new AssembleMessage( this, yRot ) ) ); } } public void setAssembleSound( SoundEvent soundEvent ) { - this.assembleSound = new SoundHandler( soundEvent, SoundSource.HOSTILE, SoundHandler.randomized( 1.2f ) ); + this.assembleSound = new SoundHandler( soundEvent, SoundSource.HOSTILE, SoundHandler.randomized( 2.0f ) ); } public boolean isAssembling() { @@ -160,36 +162,31 @@ private void tryToPlaySfx() { if( this.assembleTicksLeft == ASSEMBLE_DURATION ) { SoundHandler.ENCHANT.play( level, this.position() ); - } else if( this.assembleTicksLeft == ASSEMBLE_DURATION - 75 ) { + } else if( this.assembleTicksLeft == ASSEMBLE_DURATION - 35 ) { this.assembleSound.play( level, this.position() ); } } @AutoInstance public static class Spawn { - static final String MAIN_TAG = "cursed_armor"; - static final String LOOT_TABLE_TAG = "loot"; - static final String SOUND_TAG = "sound"; - static final String CHANCE_TAG = "chance"; - static final Map< ResourceLocation, Data > DATA_MAP = new HashMap<>(); - final DoubleConfig dropChance = new DoubleConfig( 0.1, Range.CHANCE ); + final DoubleConfig dropChance = new DoubleConfig( 0.2, Range.CHANCE ); final StringConfig name = new StringConfig( "Freshah" ); + final JsonListener.Holder< LocationsDef > locationsDef; public Spawn() { + this.locationsDef = JsonListener.add( "custom", Registries.getLocation( "cursed_armor_locations" ), LocationsDef.class, LocationsDef::new ) + .syncWithClients( Registries.HELPER ); + ConfigGroup group = ModConfigs.registerSubgroup( GROUP_ID ); OnLoot.listen( this::spawnCursedArmor ) .addCondition( Condition.isServer() ) .addCondition( OnLoot.hasOrigin() ) .addCondition( Condition.predicate( data->BlockHelper.getBlockEntity( data.getLevel(), data.origin ) instanceof ChestBlockEntity ) ) - .addCondition( Condition.predicate( this::hasLootDefined ) ) + .addCondition( this.isLootDefined() ) .addConfig( this.dropChance.name( "drop_chance" ).comment( "Chance for each equipped item to drop when killed." ) ) .insertTo( group ); - OnLootTableCustomLoad.listen( this::loadCursedArmorLoot ) - .addCondition( Condition.predicate( data->data.jsonObject.has( MAIN_TAG ) ) ) - .insertTo( group ); - OnSpawned.listen( this::setCustomName ) .name( "CustomName" ) .comment( "Makes some Cursed Armors have a custom name." ) @@ -214,17 +211,22 @@ public Spawn() { OnPreDamaged.listen( OnPreDamaged.CANCEL ) .addCondition( Condition.predicate( data->data.target instanceof CursedArmorEntity cursedArmor && cursedArmor.isAssembling() ) ) .insertTo( group ); + + OnItemTooltip.listen( this::addSpawnInfo ) + .addCondition( Condition.predicate( data->data.itemStack.getItem().equals( Registries.CURSED_ARMOR_SPAWN_EGG.get() ) ) ); } private void spawnCursedArmor( OnLoot.Data data ) { - CursedArmorEntity cursedArmor = EntityHelper.spawn( Registries.CURSED_ARMOR, data.getLevel(), this.getSpawnPosition( data ) ); + CursedArmorEntity cursedArmor = EntityHelper.createSpawner( Registries.CURSED_ARMOR, data.getLevel() ) + .position( this.getSpawnPosition( data ) ) + .spawn(); if( cursedArmor != null ) { float yRot = BlockHelper.getBlockState( data.getLevel(), data.origin ) .getValue( ChestBlock.FACING ) .toYRot(); cursedArmor.startAssembling( yRot ); - this.equipSet( DATA_MAP.get( data.context.getQueriedLootTableId() ), cursedArmor, data.origin ); + this.equipSet( this.locationsDef.get().find( data.context.getQueriedLootTableId() ).orElseThrow(), cursedArmor, data.origin ); if( data.entity instanceof ServerPlayer player ) { Time.nextTick( player::closeContainer ); } @@ -243,51 +245,41 @@ private Vec3 getSpawnPosition( OnLoot.Data data ) { } } - private void loadCursedArmorLoot( OnLootTableCustomLoad.Data data ) { - JsonObject object = data.jsonObject.get( MAIN_TAG ).getAsJsonObject(); - ResourceLocation sound = new ResourceLocation( object.has( SOUND_TAG ) ? object.get( SOUND_TAG ) - .getAsString() : "item.armor.equip_generic" ); - double chance = object.has( CHANCE_TAG ) ? object.get( CHANCE_TAG ).getAsDouble() : 1.0; - JsonElement ids = object.get( LOOT_TABLE_TAG ); - if( ids.isJsonArray() ) { - JsonArray array = ids.getAsJsonArray(); - array.forEach( id->DATA_MAP.put( new ResourceLocation( id.getAsString() ), new Data( data.table, sound, chance ) ) ); - } else { - DATA_MAP.put( new ResourceLocation( ids.getAsString() ), new Data( data.table, sound, chance ) ); - } - } - - private boolean hasLootDefined( OnLoot.Data data ) { - ResourceLocation lootTableId = data.context.getQueriedLootTableId(); + private Condition< OnLoot.Data > isLootDefined() { + return Condition.predicate( data->{ + Optional< LocationDef > locationDef = this.locationsDef.get().find( data.context.getQueriedLootTableId() ); - return DATA_MAP.containsKey( lootTableId ) && Random.tryChance( DATA_MAP.get( lootTableId ).chance ); + return locationDef.isPresent() && Random.tryChance( locationDef.get().chance ); + } ); } private void setCustomName( OnSpawned.Data data ) { - data.target.setCustomName( this.name.asLiteral() ); + data.target.setCustomName( new TextComponent( this.name.get() ) ); } private void giveRandomArmor( OnSpawned.Data data ) { CursedArmorEntity cursedArmor = ( CursedArmorEntity )data.target; - if( cursedArmor.getArmorCoverPercentage() > 0.0f ) + if( cursedArmor.getArmorCoverPercentage() > 0.0f ) { return; + } - this.equipSet( Random.nextRandom( DATA_MAP ).getValue(), cursedArmor, cursedArmor.position() ); + this.equipSet( this.locationsDef.get().getRandom(), cursedArmor, cursedArmor.position() ); } - private void equipSet( Data data, CursedArmorEntity cursedArmor, Vec3 position ) { + private void equipSet( LocationDef locationDef, CursedArmorEntity cursedArmor, Vec3 position ) { LootContext lootContext = new LootContext.Builder( ( ServerLevel )cursedArmor.level ) .withParameter( LootContextParams.ORIGIN, position ) .withParameter( LootContextParams.THIS_ENTITY, cursedArmor ) .create( LootContextParamSets.GIFT ); - data.lootTable.getRandomItems( lootContext ) + LootHelper.getLootTable( locationDef.loot ) + .getRandomItems( lootContext ) .forEach( cursedArmor::equipItemIfPossible ); Arrays.stream( EquipmentSlot.values() ) .forEach( slot->cursedArmor.setDropChance( slot, this.dropChance.asFloat() ) ); - cursedArmor.setAssembleSound( ForgeRegistries.SOUND_EVENTS.getValue( data.sound ) ); + cursedArmor.setAssembleSound( ForgeRegistries.SOUND_EVENTS.getValue( locationDef.sound ) ); } private void startAssembling( OnSpawned.Data data ) { @@ -295,7 +287,23 @@ private void startAssembling( OnSpawned.Data data ) { cursedArmor.startAssembling( 0.0f ); } - private record Data( LootTable lootTable, ResourceLocation sound, double chance ) {} + private void addSpawnInfo( OnItemTooltip.Data data ) { + List< Component > components = data.tooltip; + components.add( new TranslatableComponent( "item.majruszsdifficulty.cursed_armor_spawn_egg.locations" ) + .withStyle( ChatFormatting.GRAY ) ); + + this.locationsDef.get().locationDefs.forEach( locationDef->{ + String chance = TextHelper.percent( locationDef.chance ); + locationDef.chests.forEach( chestId->{ + components.add( new TextComponent( " - " ) + .append( new TextComponent( chestId.toString() ) ) + .append( new TextComponent( " " ) ) + .append( new TextComponent( chance ).withStyle( ChatFormatting.DARK_GRAY ) ) + .withStyle( ChatFormatting.GRAY ) + ); + } ); + } ); + } } @AutoInstance @@ -332,37 +340,13 @@ private void spawnParticles( OnEntityTick.Data data, Vec3 emitterOffset, double } } - @AutoInstance - public static class TooltipUpdater { - public TooltipUpdater() { - OnItemTooltip.listen( this::addSpawnInfo ) - .addCondition( Condition.predicate( data->data.itemStack.getItem().equals( Registries.CURSED_ARMOR_SPAWN_EGG.get() ) ) ); - } - - private void addSpawnInfo( OnItemTooltip.Data data ) { - List< Component > components = data.tooltip; - components.add( new TranslatableComponent( "item.majruszsdifficulty.cursed_armor_spawn_egg.locations" ) - .withStyle( ChatFormatting.GRAY ) ); - - Spawn.DATA_MAP.forEach( ( location, spawnData )->{ - String chance = TextHelper.percent( ( float )spawnData.chance ); - components.add( new TextComponent( " - " ) - .append( new TextComponent( location.toString() ) ) - .append( new TextComponent( " " ) ) - .append( new TextComponent( chance ).withStyle( ChatFormatting.DARK_GRAY ) ) - .withStyle( ChatFormatting.GRAY ) - ); - } ); - } - } - public static class AssembleMessage extends SerializableStructure { int entityId; float yRot; public AssembleMessage() { - this.define( null, ()->this.entityId, x->this.entityId = x ); - this.define( null, ()->this.yRot, x->this.yRot = x ); + this.defineInteger( "id", ()->this.entityId, x->this.entityId = x ); + this.defineFloat( "rot", ()->this.yRot, x->this.yRot = x ); } public AssembleMessage( Entity entity, float yRot ) { @@ -381,4 +365,42 @@ public void onClient( NetworkEvent.Context context ) { } } } + + public static class LocationsDef extends SerializableList { + List< LocationDef > locationDefs = new ArrayList<>(); + + public LocationsDef() { + this.defineCustom( ()->this.locationDefs, x->this.locationDefs = x, LocationDef::new ); + } + + public Optional< LocationDef > find( ResourceLocation chestId ) { + return this.locationDefs.stream() + .filter( locationDef -> locationDef.chests.stream().anyMatch( chestId::equals ) ) + .findFirst(); + } + + public LocationDef getRandom() { + return Random.next( this.locationDefs ); + } + + @Override + @OnlyIn( Dist.CLIENT ) + public void onClient( NetworkEvent.Context context ) { + Registries.HELPER.findInstance( Spawn.class ).ifPresent( instance->instance.locationsDef.onSync( this ) ); + } + } + + public static class LocationDef extends SerializableStructure { + ResourceLocation loot; + List< ResourceLocation > chests; + ResourceLocation sound = new ResourceLocation( "item.armor.equip_generic" ); + float chance = 0.0f; + + public LocationDef() { + this.defineLocation( "loot", ()->this.loot, x->this.loot = x ); + this.defineLocation( "chests", ()->this.chests, x->this.chests = x ); + this.defineLocation( "sound", ()->this.sound, x->this.sound = x ); + this.defineFloat( "chance", ()->this.chance, x->this.chance = x ); + } + } } diff --git a/src/main/java/com/majruszsdifficulty/entities/GiantEntity.java b/src/main/java/com/majruszsdifficulty/entities/GiantEntity.java new file mode 100644 index 000000000..fd8fa47e0 --- /dev/null +++ b/src/main/java/com/majruszsdifficulty/entities/GiantEntity.java @@ -0,0 +1,177 @@ +package com.majruszsdifficulty.entities; + +import com.mlib.Random; +import com.mlib.effects.SoundHandler; +import com.mlib.entities.EntityHelper; +import com.mlib.time.TimeHelper; +import net.minecraft.core.BlockPos; +import net.minecraft.sounds.SoundEvent; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.world.entity.*; +import net.minecraft.world.entity.ai.attributes.AttributeSupplier; +import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.goal.LookAtPlayerGoal; +import net.minecraft.world.entity.ai.goal.MeleeAttackGoal; +import net.minecraft.world.entity.ai.goal.RandomLookAroundGoal; +import net.minecraft.world.entity.ai.goal.WaterAvoidingRandomStrollGoal; +import net.minecraft.world.entity.ai.goal.target.HurtByTargetGoal; +import net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal; +import net.minecraft.world.entity.animal.IronGolem; +import net.minecraft.world.entity.monster.Monster; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.LeavesBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.pathfinder.BlockPathTypes; +import net.minecraft.world.phys.Vec3; +import net.minecraftforge.common.ForgeMod; + +import java.util.function.Supplier; + +public class GiantEntity extends Monster { + public static Supplier< EntityType< GiantEntity > > createSupplier() { + return ()->EntityType.Builder.of( GiantEntity::new, MobCategory.MONSTER ).sized( 3.0f, 10.0f ).build( "giant" ); + } + + public static AttributeSupplier getAttributeMap() { + return Monster.createMobAttributes() + .add( Attributes.MAX_HEALTH, 200.0 ) + .add( Attributes.MOVEMENT_SPEED, 0.3 ) + .add( Attributes.ATTACK_DAMAGE, 10.0 ) + .add( Attributes.FOLLOW_RANGE, 30.0 ) + .add( Attributes.KNOCKBACK_RESISTANCE, 1.0 ) + .add( ForgeMod.STEP_HEIGHT_ADDITION.get(), 2.0 ) + .build(); + } + + public GiantEntity( EntityType< ? extends GiantEntity > type, Level world ) { + super( type, world ); + + this.maxUpStep = 3.0f; + this.setPathfindingMalus( BlockPathTypes.LEAVES, 0.0f ); + } + + @Override + public void tick() { + super.tick(); + + if( this.isSunBurnTick() ) { + this.setSecondsOnFire( 8 ); + } + if( TimeHelper.hasServerSecondsPassed( 0.5 ) ) { + EntityHelper.destroyBlocks( this, this.getBoundingBox().inflate( 0.6 ), ( blockPos, blockState )->{ + return blockState.getBlock() instanceof LeavesBlock; + } ); + EntityHelper.destroyBlocks( this, this.getBoundingBox(), ( blockPos, blockState )->{ + return blockState.getCollisionShape( this.level, blockPos ).isEmpty(); + } ); + } + } + + @Override + public int getExperienceReward( Player p_34322_ ) { + return Random.nextInt( 40, 60 ); + } + + @Override + public MobType getMobType() { + return MobType.UNDEAD; + } + + @Override + public void playSound( SoundEvent sound, float volume, float pitch ) { + if( !this.isSilent() ) { + float randomizedVolume = SoundHandler.randomized( volume * 1.25f ).get(); + float randomizedPitch = SoundHandler.randomized( pitch, 0.7f, 0.85f ).get(); + + this.level.playSound( null, this.getX(), this.getY(), this.getZ(), sound, this.getSoundSource(), randomizedVolume, randomizedPitch ); + } + } + + @Override + protected void registerGoals() { + this.goalSelector.addGoal( 2, new GiantAttackGoal( this, 1.0, true ) ); + this.goalSelector.addGoal( 7, new WaterAvoidingRandomStrollGoal( this, 1.0 ) ); + this.goalSelector.addGoal( 8, new LookAtPlayerGoal( this, Player.class, 8.0f ) ); + this.goalSelector.addGoal( 8, new RandomLookAroundGoal( this ) ); + + this.targetSelector.addGoal( 1, new HurtByTargetGoal( this ) ); + this.targetSelector.addGoal( 2, new NearestAttackableTargetGoal<>( this, Player.class, true ) ); + this.targetSelector.addGoal( 3, new NearestAttackableTargetGoal<>( this, IronGolem.class, true ) ); + } + + @Override + protected SoundEvent getAmbientSound() { + return SoundEvents.ZOMBIE_AMBIENT; + } + + @Override + protected float getStandingEyeHeight( Pose poseIn, EntityDimensions sizeIn ) { + return 8.5f; + } + + @Override + protected SoundEvent getHurtSound( DamageSource damageSource ) { + return SoundEvents.ZOMBIE_HURT; + } + + @Override + protected SoundEvent getDeathSound() { + return SoundEvents.ZOMBIE_DEATH; + } + + @Override + protected void playStepSound( BlockPos blockPos, BlockState blockState ) { + this.playSound( SoundEvents.ZOMBIE_STEP, 0.15f, 1.0f ); + } + + public static class GiantAttackGoal extends MeleeAttackGoal { + private final GiantEntity giant; + private int raiseArmTicks; + + public GiantAttackGoal( GiantEntity giant, double speedModifier, boolean followingTargetEvenIfNotSeen ) { + super( giant, speedModifier, followingTargetEvenIfNotSeen ); + + this.giant = giant; + } + + @Override + public void start() { + super.start(); + + this.raiseArmTicks = 0; + } + + @Override + public void stop() { + super.stop(); + + this.giant.setAggressive( false ); + } + + @Override + public void tick() { + super.tick(); + + ++this.raiseArmTicks; + this.giant.setAggressive( this.raiseArmTicks >= 5 && this.getTicksUntilNextAttack() < this.getAttackInterval() / 2 ); + } + + @Override + protected double getAttackReachSqr( LivingEntity target ) { + return 2.0 * this.mob.getBbWidth() * this.mob.getBbWidth() + target.getBbWidth(); + } + + @Override + protected void checkAndPerformAttack( LivingEntity target, double distance ) { + if( distance <= this.getAttackReachSqr( target ) && this.getTicksUntilNextAttack() <= 0 ) { + this.resetAttackCooldown(); + this.mob.swing( InteractionHand.MAIN_HAND ); + this.mob.doHurtTarget( target ); + target.setDeltaMovement( target.getDeltaMovement().add( new Vec3( 0.0, 0.5, 0.0 ) ) ); + } + } + } +} diff --git a/src/main/java/com/majruszsdifficulty/entities/TankEntity.java b/src/main/java/com/majruszsdifficulty/entities/TankEntity.java index d6a57b1cf..c916cb4c1 100644 --- a/src/main/java/com/majruszsdifficulty/entities/TankEntity.java +++ b/src/main/java/com/majruszsdifficulty/entities/TankEntity.java @@ -1,6 +1,6 @@ package com.majruszsdifficulty.entities; -import com.majruszsdifficulty.PacketHandler; +import com.majruszsdifficulty.Registries; import com.mlib.Random; import com.mlib.Utility; import com.mlib.effects.SoundHandler; @@ -33,6 +33,7 @@ import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.Vec3; +import net.minecraftforge.common.ForgeMod; import java.util.List; import java.util.Optional; @@ -54,11 +55,14 @@ public static AttributeSupplier getAttributeMap() { .add( Attributes.FOLLOW_RANGE, 30.0 ) .add( Attributes.ATTACK_KNOCKBACK, 3.5 ) .add( Attributes.KNOCKBACK_RESISTANCE, 0.75 ) + .add( ForgeMod.STEP_HEIGHT_ADDITION.get(), 0.5 ) .build(); } - public TankEntity( EntityType< ? extends TankEntity > type, Level world ) { - super( type, world ); + public TankEntity( EntityType< ? extends TankEntity > type, Level level ) { + super( type, level ); + + this.maxUpStep = 1.0f; } @Override @@ -136,7 +140,7 @@ public void tick() { public static class Skills extends CustomSkills< SkillType > { public Skills( PathfinderMob mob ) { - super( mob, PacketHandler.CHANNEL, SkillMessage::new ); + super( mob, Registries.HELPER.getNetworkChannel(), SkillMessage::new ); } @Override diff --git a/src/main/java/com/majruszsdifficulty/events/TreasureBagOpenedEvent.java b/src/main/java/com/majruszsdifficulty/events/TreasureBagOpenedEvent.java deleted file mode 100644 index e77923a64..000000000 --- a/src/main/java/com/majruszsdifficulty/events/TreasureBagOpenedEvent.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.majruszsdifficulty.events; - -import com.majruszsdifficulty.items.TreasureBagItem; -import net.minecraft.world.entity.player.Player; -import net.minecraft.world.item.ItemStack; -import net.minecraftforge.event.entity.player.PlayerEvent; -import net.minecraftforge.fml.event.IModBusEvent; - -import java.util.List; - -/** Event called when the player opens any treasure bag. */ -@Deprecated( since = "1.7.0 use OnTreasureBagOpened instead" ) -public class TreasureBagOpenedEvent extends PlayerEvent implements IModBusEvent { - public final TreasureBagItem treasureBagItem; - public final List< ItemStack > generatedLoot; - - public TreasureBagOpenedEvent( Player player, TreasureBagItem item, List< ItemStack > generatedLoot ) { - super( player ); - this.treasureBagItem = item; - this.generatedLoot = generatedLoot; - } -} diff --git a/src/main/java/com/majruszsdifficulty/gamemodifiers/list/BlockIllusionerFromJoiningRaids.java b/src/main/java/com/majruszsdifficulty/features/BlockIllusionerFromJoiningRaids.java similarity index 76% rename from src/main/java/com/majruszsdifficulty/gamemodifiers/list/BlockIllusionerFromJoiningRaids.java rename to src/main/java/com/majruszsdifficulty/features/BlockIllusionerFromJoiningRaids.java index dbcc37538..400f40ecf 100644 --- a/src/main/java/com/majruszsdifficulty/gamemodifiers/list/BlockIllusionerFromJoiningRaids.java +++ b/src/main/java/com/majruszsdifficulty/features/BlockIllusionerFromJoiningRaids.java @@ -1,11 +1,11 @@ -package com.majruszsdifficulty.gamemodifiers.list; +package com.majruszsdifficulty.features; import com.majruszsdifficulty.Registries; -import com.mlib.annotations.AutoInstance; +import com.mlib.modhelper.AutoInstance; import com.mlib.config.ConfigGroup; -import com.mlib.gamemodifiers.Condition; -import com.mlib.gamemodifiers.ModConfigs; -import com.mlib.gamemodifiers.contexts.OnSpawned; +import com.mlib.contexts.base.Condition; +import com.mlib.contexts.base.ModConfigs; +import com.mlib.contexts.OnSpawned; import net.minecraft.world.entity.monster.Illusioner; @AutoInstance diff --git a/src/main/java/com/majruszsdifficulty/gamemodifiers/list/CreeperChainReaction.java b/src/main/java/com/majruszsdifficulty/features/CreeperChainReaction.java similarity index 75% rename from src/main/java/com/majruszsdifficulty/gamemodifiers/list/CreeperChainReaction.java rename to src/main/java/com/majruszsdifficulty/features/CreeperChainReaction.java index 2afa880f4..efa88b908 100644 --- a/src/main/java/com/majruszsdifficulty/gamemodifiers/list/CreeperChainReaction.java +++ b/src/main/java/com/majruszsdifficulty/features/CreeperChainReaction.java @@ -1,13 +1,13 @@ -package com.majruszsdifficulty.gamemodifiers.list; +package com.majruszsdifficulty.features; import com.majruszsdifficulty.gamestage.GameStage; import com.majruszsdifficulty.Registries; -import com.majruszsdifficulty.gamemodifiers.CustomConditions; -import com.mlib.annotations.AutoInstance; +import com.majruszsdifficulty.contexts.base.CustomConditions; +import com.mlib.modhelper.AutoInstance; import com.mlib.config.ConfigGroup; -import com.mlib.gamemodifiers.Condition; -import com.mlib.gamemodifiers.ModConfigs; -import com.mlib.gamemodifiers.contexts.OnDamaged; +import com.mlib.contexts.base.Condition; +import com.mlib.contexts.base.ModConfigs; +import com.mlib.contexts.OnDamaged; import net.minecraft.world.entity.monster.Creeper; @AutoInstance diff --git a/src/main/java/com/majruszsdifficulty/gamemodifiers/list/CreeperExplodeBehindWall.java b/src/main/java/com/majruszsdifficulty/features/CreeperExplodeBehindWall.java similarity index 78% rename from src/main/java/com/majruszsdifficulty/gamemodifiers/list/CreeperExplodeBehindWall.java rename to src/main/java/com/majruszsdifficulty/features/CreeperExplodeBehindWall.java index 7d92a785e..e9f9d9fff 100644 --- a/src/main/java/com/majruszsdifficulty/gamemodifiers/list/CreeperExplodeBehindWall.java +++ b/src/main/java/com/majruszsdifficulty/features/CreeperExplodeBehindWall.java @@ -1,14 +1,14 @@ -package com.majruszsdifficulty.gamemodifiers.list; +package com.majruszsdifficulty.features; import com.majruszsdifficulty.gamestage.GameStage; import com.majruszsdifficulty.Registries; -import com.majruszsdifficulty.gamemodifiers.CustomConditions; +import com.majruszsdifficulty.contexts.base.CustomConditions; import com.majruszsdifficulty.goals.CreeperExplodeWallsGoal; -import com.mlib.annotations.AutoInstance; +import com.mlib.modhelper.AutoInstance; import com.mlib.config.ConfigGroup; -import com.mlib.gamemodifiers.Condition; -import com.mlib.gamemodifiers.ModConfigs; -import com.mlib.gamemodifiers.contexts.OnSpawned; +import com.mlib.contexts.base.Condition; +import com.mlib.contexts.base.ModConfigs; +import com.mlib.contexts.OnSpawned; import net.minecraft.world.entity.monster.Creeper; @AutoInstance diff --git a/src/main/java/com/majruszsdifficulty/gamemodifiers/list/CreeperExplosionImmunity.java b/src/main/java/com/majruszsdifficulty/features/CreeperExplosionImmunity.java similarity index 80% rename from src/main/java/com/majruszsdifficulty/gamemodifiers/list/CreeperExplosionImmunity.java rename to src/main/java/com/majruszsdifficulty/features/CreeperExplosionImmunity.java index 208b8a7b5..d11aa02ab 100644 --- a/src/main/java/com/majruszsdifficulty/gamemodifiers/list/CreeperExplosionImmunity.java +++ b/src/main/java/com/majruszsdifficulty/features/CreeperExplosionImmunity.java @@ -1,14 +1,14 @@ -package com.majruszsdifficulty.gamemodifiers.list; +package com.majruszsdifficulty.features; import com.majruszsdifficulty.gamestage.GameStage; import com.majruszsdifficulty.Registries; -import com.majruszsdifficulty.gamemodifiers.CustomConditions; -import com.mlib.annotations.AutoInstance; +import com.majruszsdifficulty.contexts.base.CustomConditions; +import com.mlib.modhelper.AutoInstance; import com.mlib.config.ConfigGroup; import com.mlib.config.DoubleConfig; -import com.mlib.gamemodifiers.Condition; -import com.mlib.gamemodifiers.ModConfigs; -import com.mlib.gamemodifiers.contexts.OnDamaged; +import com.mlib.contexts.base.Condition; +import com.mlib.contexts.base.ModConfigs; +import com.mlib.contexts.OnDamaged; import com.mlib.math.Range; import net.minecraft.world.entity.monster.Creeper; diff --git a/src/main/java/com/majruszsdifficulty/gamemodifiers/list/CreeperSpawnCharged.java b/src/main/java/com/majruszsdifficulty/features/CreeperSpawnCharged.java similarity index 81% rename from src/main/java/com/majruszsdifficulty/gamemodifiers/list/CreeperSpawnCharged.java rename to src/main/java/com/majruszsdifficulty/features/CreeperSpawnCharged.java index 94cc56d64..fc0ca069d 100644 --- a/src/main/java/com/majruszsdifficulty/gamemodifiers/list/CreeperSpawnCharged.java +++ b/src/main/java/com/majruszsdifficulty/features/CreeperSpawnCharged.java @@ -1,13 +1,13 @@ -package com.majruszsdifficulty.gamemodifiers.list; +package com.majruszsdifficulty.features; import com.majruszsdifficulty.gamestage.GameStage; import com.majruszsdifficulty.Registries; -import com.majruszsdifficulty.gamemodifiers.CustomConditions; -import com.mlib.annotations.AutoInstance; +import com.majruszsdifficulty.contexts.base.CustomConditions; +import com.mlib.modhelper.AutoInstance; import com.mlib.config.ConfigGroup; -import com.mlib.gamemodifiers.Condition; -import com.mlib.gamemodifiers.ModConfigs; -import com.mlib.gamemodifiers.contexts.OnSpawned; +import com.mlib.contexts.base.Condition; +import com.mlib.contexts.base.ModConfigs; +import com.mlib.contexts.OnSpawned; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LightningBolt; import net.minecraft.world.entity.monster.Creeper; diff --git a/src/main/java/com/majruszsdifficulty/gamemodifiers/list/CreeperSpawnDebuffed.java b/src/main/java/com/majruszsdifficulty/features/CreeperSpawnDebuffed.java similarity index 81% rename from src/main/java/com/majruszsdifficulty/gamemodifiers/list/CreeperSpawnDebuffed.java rename to src/main/java/com/majruszsdifficulty/features/CreeperSpawnDebuffed.java index 825e2525d..2c2f109e8 100644 --- a/src/main/java/com/majruszsdifficulty/gamemodifiers/list/CreeperSpawnDebuffed.java +++ b/src/main/java/com/majruszsdifficulty/features/CreeperSpawnDebuffed.java @@ -1,15 +1,15 @@ -package com.majruszsdifficulty.gamemodifiers.list; +package com.majruszsdifficulty.features; import com.majruszsdifficulty.gamestage.GameStage; import com.majruszsdifficulty.Registries; -import com.majruszsdifficulty.gamemodifiers.CustomConditions; +import com.majruszsdifficulty.contexts.base.CustomConditions; import com.mlib.Random; -import com.mlib.annotations.AutoInstance; +import com.mlib.modhelper.AutoInstance; import com.mlib.config.ConfigGroup; import com.mlib.config.EffectConfig; -import com.mlib.gamemodifiers.Condition; -import com.mlib.gamemodifiers.ModConfigs; -import com.mlib.gamemodifiers.contexts.OnSpawned; +import com.mlib.contexts.base.Condition; +import com.mlib.contexts.base.ModConfigs; +import com.mlib.contexts.OnSpawned; import net.minecraft.world.effect.MobEffects; import net.minecraft.world.entity.monster.Creeper; @@ -42,6 +42,6 @@ public CreeperSpawnDebuffed() { } private void applyRandomEffect( OnSpawned.Data data ) { - Random.nextRandom( this.effects ).apply( data.target ); + Random.next( this.effects ).apply( data.target ); } } diff --git a/src/main/java/com/majruszsdifficulty/gamemodifiers/list/CreeperSplitIntoCreeperlings.java b/src/main/java/com/majruszsdifficulty/features/CreeperSplitIntoCreeperlings.java similarity index 84% rename from src/main/java/com/majruszsdifficulty/gamemodifiers/list/CreeperSplitIntoCreeperlings.java rename to src/main/java/com/majruszsdifficulty/features/CreeperSplitIntoCreeperlings.java index b597acf12..0caf51b64 100644 --- a/src/main/java/com/majruszsdifficulty/gamemodifiers/list/CreeperSplitIntoCreeperlings.java +++ b/src/main/java/com/majruszsdifficulty/features/CreeperSplitIntoCreeperlings.java @@ -1,17 +1,17 @@ -package com.majruszsdifficulty.gamemodifiers.list; +package com.majruszsdifficulty.features; import com.majruszsdifficulty.gamestage.GameStage; import com.majruszsdifficulty.Registries; import com.majruszsdifficulty.config.GameStageIntegerConfig; import com.majruszsdifficulty.entities.CreeperlingEntity; -import com.majruszsdifficulty.gamemodifiers.CustomConditions; +import com.majruszsdifficulty.contexts.base.CustomConditions; import com.mlib.Random; -import com.mlib.annotations.AutoInstance; +import com.mlib.modhelper.AutoInstance; import com.mlib.config.ConfigGroup; -import com.mlib.gamemodifiers.Condition; -import com.mlib.gamemodifiers.ModConfigs; -import com.mlib.gamemodifiers.contexts.OnDeath; -import com.mlib.gamemodifiers.contexts.OnExplosionDetonate; +import com.mlib.contexts.base.Condition; +import com.mlib.contexts.base.ModConfigs; +import com.mlib.contexts.OnDeath; +import com.mlib.contexts.OnExplosionDetonate; import com.mlib.math.Range; import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; @@ -35,7 +35,7 @@ public CreeperSplitIntoCreeperlings() { OnExplosionDetonate.listen( this::spawnCreeperlings ) .addCondition( CustomConditions.gameStageAtLeast( GameStage.NORMAL ) ) - .addCondition( Condition.chanceCRD( 0.666, false ) ) + .addCondition( Condition.chanceCRD( 0.666, true ) ) .addCondition( Condition.excludable() ) .addCondition( Condition.predicate( data->data.explosion.getExploder() instanceof Creeper && !( data.explosion.getExploder() instanceof CreeperlingEntity ) ) ) .addConfig( this.creeperlingsAmount.name( "MaxCreeperlings" ).comment( "Maximum amount of Creeperlings to spawn." ) ) @@ -59,7 +59,7 @@ private void spawnCreeperlings( OnExplosionDetonate.Data data ) { assert creeper != null && level != null; for( int i = 0; i < creeperlingsAmount; ++i ) { - BlockPos position = creeper.blockPosition().offset( Random.getRandomVector( -2, 2, -1, 1, -2, 2 ).vec3i() ); + BlockPos position = creeper.blockPosition().offset( Random.nextVector( -2, 2, -1, 1, -2, 2 ).vec3i() ); CreeperlingEntity creeperling = Registries.CREEPERLING.get() .spawn( level, ( CompoundTag )null, null, null, position, MobSpawnType.SPAWNER, true, true ); if( creeperling != null ) @@ -80,6 +80,6 @@ private void giveAdvancement( OnDeath.Data data ) { } private void giveAdvancement( ServerPlayer player ) { - Registries.BASIC_TRIGGER.trigger( player, "encountered_creeperling" ); + Registries.HELPER.triggerAchievement( player, "encountered_creeperling" ); } } diff --git a/src/main/java/com/majruszsdifficulty/gamemodifiers/list/DoubleLoot.java b/src/main/java/com/majruszsdifficulty/features/DoubleLoot.java similarity index 81% rename from src/main/java/com/majruszsdifficulty/gamemodifiers/list/DoubleLoot.java rename to src/main/java/com/majruszsdifficulty/features/DoubleLoot.java index 512ec278c..b1e49f77d 100644 --- a/src/main/java/com/majruszsdifficulty/gamemodifiers/list/DoubleLoot.java +++ b/src/main/java/com/majruszsdifficulty/features/DoubleLoot.java @@ -1,17 +1,17 @@ -package com.majruszsdifficulty.gamemodifiers.list; +package com.majruszsdifficulty.features; -import com.majruszsdifficulty.gamestage.GameStage; import com.majruszsdifficulty.Registries; -import com.majruszsdifficulty.gamemodifiers.CustomConditions; +import com.majruszsdifficulty.contexts.base.CustomConditions; +import com.majruszsdifficulty.gamestage.GameStage; import com.mlib.Utility; -import com.mlib.annotations.AutoInstance; +import com.mlib.modhelper.AutoInstance; import com.mlib.config.ConfigGroup; import com.mlib.config.StringListConfig; import com.mlib.effects.ParticleHandler; -import com.mlib.gamemodifiers.Condition; -import com.mlib.gamemodifiers.Context; -import com.mlib.gamemodifiers.ModConfigs; -import com.mlib.gamemodifiers.contexts.OnLoot; +import com.mlib.contexts.base.Condition; +import com.mlib.contexts.base.Context; +import com.mlib.contexts.base.ModConfigs; +import com.mlib.contexts.OnLoot; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.world.item.ItemStack; import net.minecraft.world.phys.Vec3; @@ -20,10 +20,9 @@ import java.util.List; import java.util.function.Consumer; -@Deprecated( forRemoval = true ) @AutoInstance public class DoubleLoot { - static final ParticleHandler AWARD = new ParticleHandler( ParticleTypes.HAPPY_VILLAGER, ()->new Vec3( 0.5, 1, 0.5 ), ()->0.1f ); + static final ParticleHandler AWARD = new ParticleHandler( ParticleTypes.HAPPY_VILLAGER, ()->new Vec3( 0.25, 0.5, 0.25 ), ()->0.1f ); final StringListConfig forbiddenItems = new StringListConfig( "minecraft:nether_star", "minecraft:totem_of_undying" ); public DoubleLoot() { @@ -37,12 +36,12 @@ public DoubleLoot() { .comment( "Determines the chance on Normal Mode." ) .insertTo( group ); - OnDoubleLoot.listen( this::doubleLoot, 0.2, GameStage.EXPERT ) + OnDoubleLoot.listen( this::doubleLoot, 0.1, GameStage.EXPERT ) .name( "ExpertMode" ) .comment( "Determines the chance on Expert Mode." ) .insertTo( group ); - OnDoubleLoot.listen( this::doubleLoot, 0.4, GameStage.MASTER ) + OnDoubleLoot.listen( this::doubleLoot, 0.2, GameStage.MASTER ) .name( "MasterMode" ) .comment( "Determines the chance on Master Mode." ) .insertTo( group ); @@ -51,7 +50,7 @@ public DoubleLoot() { private void doubleLoot( OnLoot.Data data ) { assert data.entity != null && data.lastDamagePlayer != null; - boolean doubledAtLeastOneItem = replaceLoot( data.generatedLoot ); + boolean doubledAtLeastOneItem = this.replaceLoot( data.generatedLoot ); if( doubledAtLeastOneItem && data.getServerLevel() != null ) { AWARD.spawn( data.getServerLevel(), data.entity.position().add( 0.0, 0.5, 0.0 ), 12 ); } diff --git a/src/main/java/com/majruszsdifficulty/gamemodifiers/list/DrownedLightningAttack.java b/src/main/java/com/majruszsdifficulty/features/DrownedLightningAttack.java similarity index 84% rename from src/main/java/com/majruszsdifficulty/gamemodifiers/list/DrownedLightningAttack.java rename to src/main/java/com/majruszsdifficulty/features/DrownedLightningAttack.java index ca453ffe8..099acd028 100644 --- a/src/main/java/com/majruszsdifficulty/gamemodifiers/list/DrownedLightningAttack.java +++ b/src/main/java/com/majruszsdifficulty/features/DrownedLightningAttack.java @@ -1,13 +1,13 @@ -package com.majruszsdifficulty.gamemodifiers.list; +package com.majruszsdifficulty.features; import com.majruszsdifficulty.gamestage.GameStage; import com.majruszsdifficulty.Registries; -import com.majruszsdifficulty.gamemodifiers.CustomConditions; -import com.mlib.annotations.AutoInstance; +import com.majruszsdifficulty.contexts.base.CustomConditions; +import com.mlib.modhelper.AutoInstance; import com.mlib.config.ConfigGroup; -import com.mlib.gamemodifiers.Condition; -import com.mlib.gamemodifiers.ModConfigs; -import com.mlib.gamemodifiers.contexts.OnDamaged; +import com.mlib.contexts.base.Condition; +import com.mlib.contexts.base.ModConfigs; +import com.mlib.contexts.OnDamaged; import com.mlib.levels.LevelHelper; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LightningBolt; diff --git a/src/main/java/com/majruszsdifficulty/gamemodifiers/list/EndermanTeleportAttack.java b/src/main/java/com/majruszsdifficulty/features/EndermanTeleportAttack.java similarity index 74% rename from src/main/java/com/majruszsdifficulty/gamemodifiers/list/EndermanTeleportAttack.java rename to src/main/java/com/majruszsdifficulty/features/EndermanTeleportAttack.java index 7a813f12a..a1bcb318e 100644 --- a/src/main/java/com/majruszsdifficulty/gamemodifiers/list/EndermanTeleportAttack.java +++ b/src/main/java/com/majruszsdifficulty/features/EndermanTeleportAttack.java @@ -1,13 +1,13 @@ -package com.majruszsdifficulty.gamemodifiers.list; +package com.majruszsdifficulty.features; import com.majruszsdifficulty.gamestage.GameStage; import com.majruszsdifficulty.Registries; -import com.majruszsdifficulty.gamemodifiers.CustomConditions; -import com.mlib.annotations.AutoInstance; +import com.majruszsdifficulty.contexts.base.CustomConditions; +import com.mlib.modhelper.AutoInstance; import com.mlib.config.ConfigGroup; -import com.mlib.gamemodifiers.Condition; -import com.mlib.gamemodifiers.ModConfigs; -import com.mlib.gamemodifiers.contexts.OnDamaged; +import com.mlib.contexts.base.Condition; +import com.mlib.contexts.base.ModConfigs; +import com.mlib.contexts.OnDamaged; import com.mlib.levels.LevelHelper; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.LivingEntity; @@ -32,8 +32,8 @@ public EndermanTeleportAttack() { private void teleportPlayerRandomly( OnDamaged.Data data ) { LivingEntity target = data.target; - if( LevelHelper.teleportNearby( target, data.getServerLevel(), 10.0 ) && target instanceof ServerPlayer player ) { - Registries.BASIC_TRIGGER.trigger( player, "enderman_teleport_attack" ); + if( LevelHelper.teleportNearby( target, data.getServerLevel(), 6.0 ) && target instanceof ServerPlayer player ) { + Registries.HELPER.triggerAchievement( player, "enderman_teleport_attack" ); } } } diff --git a/src/main/java/com/majruszsdifficulty/gamemodifiers/list/EvokerWithTotem.java b/src/main/java/com/majruszsdifficulty/features/EvokerWithTotem.java similarity index 80% rename from src/main/java/com/majruszsdifficulty/gamemodifiers/list/EvokerWithTotem.java rename to src/main/java/com/majruszsdifficulty/features/EvokerWithTotem.java index 8b6738579..f9eeb7d9a 100644 --- a/src/main/java/com/majruszsdifficulty/gamemodifiers/list/EvokerWithTotem.java +++ b/src/main/java/com/majruszsdifficulty/features/EvokerWithTotem.java @@ -1,13 +1,13 @@ -package com.majruszsdifficulty.gamemodifiers.list; +package com.majruszsdifficulty.features; import com.majruszsdifficulty.gamestage.GameStage; import com.majruszsdifficulty.Registries; -import com.majruszsdifficulty.gamemodifiers.CustomConditions; -import com.mlib.annotations.AutoInstance; +import com.majruszsdifficulty.contexts.base.CustomConditions; +import com.mlib.modhelper.AutoInstance; import com.mlib.config.ConfigGroup; -import com.mlib.gamemodifiers.Condition; -import com.mlib.gamemodifiers.ModConfigs; -import com.mlib.gamemodifiers.contexts.OnSpawned; +import com.mlib.contexts.base.Condition; +import com.mlib.contexts.base.ModConfigs; +import com.mlib.contexts.OnSpawned; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.monster.Evoker; import net.minecraft.world.item.ItemStack; diff --git a/src/main/java/com/majruszsdifficulty/gamemodifiers/list/ExperienceBonus.java b/src/main/java/com/majruszsdifficulty/features/ExperienceBonus.java similarity index 72% rename from src/main/java/com/majruszsdifficulty/gamemodifiers/list/ExperienceBonus.java rename to src/main/java/com/majruszsdifficulty/features/ExperienceBonus.java index cfa9b2cee..5359b77de 100644 --- a/src/main/java/com/majruszsdifficulty/gamemodifiers/list/ExperienceBonus.java +++ b/src/main/java/com/majruszsdifficulty/features/ExperienceBonus.java @@ -1,13 +1,13 @@ -package com.majruszsdifficulty.gamemodifiers.list; +package com.majruszsdifficulty.features; import com.majruszsdifficulty.Registries; import com.majruszsdifficulty.config.GameStageDoubleConfig; import com.mlib.Random; -import com.mlib.annotations.AutoInstance; +import com.mlib.modhelper.AutoInstance; import com.mlib.config.ConfigGroup; -import com.mlib.gamemodifiers.Condition; -import com.mlib.gamemodifiers.ModConfigs; -import com.mlib.gamemodifiers.contexts.OnPickupXp; +import com.mlib.contexts.base.Condition; +import com.mlib.contexts.base.ModConfigs; +import com.mlib.contexts.OnPickupXp; import com.mlib.math.Range; @AutoInstance @@ -27,6 +27,6 @@ public ExperienceBonus() { private void giveExtraExperience( OnPickupXp.Data data ) { double experience = data.event.getOrb().getValue(); - data.player.giveExperiencePoints( Random.roundRandomly( this.bonusMultiplier.getCurrentGameStageValue() * experience ) ); + data.player.giveExperiencePoints( Random.round( this.bonusMultiplier.getCurrentGameStageValue() * experience ) ); } } diff --git a/src/main/java/com/majruszsdifficulty/gamemodifiers/list/JockeySpawn.java b/src/main/java/com/majruszsdifficulty/features/JockeySpawn.java similarity index 72% rename from src/main/java/com/majruszsdifficulty/gamemodifiers/list/JockeySpawn.java rename to src/main/java/com/majruszsdifficulty/features/JockeySpawn.java index 5b61ecb9b..bf49c4abb 100644 --- a/src/main/java/com/majruszsdifficulty/gamemodifiers/list/JockeySpawn.java +++ b/src/main/java/com/majruszsdifficulty/features/JockeySpawn.java @@ -1,14 +1,14 @@ -package com.majruszsdifficulty.gamemodifiers.list; +package com.majruszsdifficulty.features; import com.majruszsdifficulty.gamestage.GameStage; import com.majruszsdifficulty.Registries; -import com.majruszsdifficulty.gamemodifiers.CustomConditions; -import com.mlib.annotations.AutoInstance; +import com.majruszsdifficulty.contexts.base.CustomConditions; +import com.mlib.modhelper.AutoInstance; import com.mlib.config.ConfigGroup; import com.mlib.entities.EntityHelper; -import com.mlib.gamemodifiers.Condition; -import com.mlib.gamemodifiers.ModConfigs; -import com.mlib.gamemodifiers.contexts.OnSpawned; +import com.mlib.contexts.base.Condition; +import com.mlib.contexts.base.ModConfigs; +import com.mlib.contexts.OnSpawned; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.monster.Skeleton; import net.minecraft.world.entity.monster.Spider; @@ -31,7 +31,7 @@ public JockeySpawn() { } private void spawnSkeletonOnSpider( OnSpawned.Data data ) { - Skeleton skeleton = EntityHelper.spawn( EntityType.SKELETON, data.getServerLevel(), data.target.position() ); + Skeleton skeleton = EntityHelper.createSpawner( EntityType.SKELETON, data.getServerLevel() ).position( data.target.position() ).spawn(); if( skeleton != null ) { skeleton.startRiding( data.target ); } diff --git a/src/main/java/com/majruszsdifficulty/gamemodifiers/list/MobsSpawnStronger.java b/src/main/java/com/majruszsdifficulty/features/MobsSpawnStronger.java similarity index 90% rename from src/main/java/com/majruszsdifficulty/gamemodifiers/list/MobsSpawnStronger.java rename to src/main/java/com/majruszsdifficulty/features/MobsSpawnStronger.java index 13ee4f667..da5ca0fc4 100644 --- a/src/main/java/com/majruszsdifficulty/gamemodifiers/list/MobsSpawnStronger.java +++ b/src/main/java/com/majruszsdifficulty/features/MobsSpawnStronger.java @@ -1,15 +1,15 @@ -package com.majruszsdifficulty.gamemodifiers.list; +package com.majruszsdifficulty.features; import com.majruszsdifficulty.Registries; import com.majruszsdifficulty.config.GameStageDoubleConfig; import com.mlib.Utility; -import com.mlib.annotations.AutoInstance; +import com.mlib.modhelper.AutoInstance; import com.mlib.attributes.AttributeHandler; import com.mlib.config.ConfigGroup; import com.mlib.config.StringListConfig; -import com.mlib.gamemodifiers.Condition; -import com.mlib.gamemodifiers.ModConfigs; -import com.mlib.gamemodifiers.contexts.OnSpawned; +import com.mlib.contexts.base.Condition; +import com.mlib.contexts.base.ModConfigs; +import com.mlib.contexts.OnSpawned; import com.mlib.math.Range; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.LivingEntity; @@ -21,9 +21,9 @@ public class MobsSpawnStronger { static final AttributeHandler MAX_HEALTH_ATTRIBUTE = new AttributeHandler( "ba9de909-4a9e-43da-9d14-fbcbc2403316", "ProgressiveDifficultyHealthBonus", Attributes.MAX_HEALTH, AttributeModifier.Operation.MULTIPLY_BASE ); static final AttributeHandler DAMAGE_ATTRIBUTE = new AttributeHandler( "053d92c8-ccb5-4b95-9add-c31aca144177", "ProgressiveDifficultyDamageBonus", Attributes.ATTACK_DAMAGE, AttributeModifier.Operation.MULTIPLY_BASE ); - final GameStageDoubleConfig healthBonus = new GameStageDoubleConfig( 0.0, 0.15, 0.3, new Range<>( 0.0, 10.0 ) ); - final GameStageDoubleConfig damageBonus = new GameStageDoubleConfig( 0.0, 0.15, 0.3, new Range<>( 0.0, 10.0 ) ); - final GameStageDoubleConfig nightMultiplier = new GameStageDoubleConfig( 2.0, 2.0, 2.0, new Range<>( 1.0, 10.0 ) ); + final GameStageDoubleConfig healthBonus = new GameStageDoubleConfig( 0.0, 0.1, 0.2, new Range<>( 0.0, 10.0 ) ); + final GameStageDoubleConfig damageBonus = new GameStageDoubleConfig( 0.0, 0.1, 0.2, new Range<>( 0.0, 10.0 ) ); + final GameStageDoubleConfig nightMultiplier = new GameStageDoubleConfig( 1.5, 1.5, 1.5, new Range<>( 1.0, 10.0 ) ); final StringListConfig excludedMobs = new StringListConfig(); final StringListConfig excludedDimensions = new StringListConfig(); diff --git a/src/main/java/com/majruszsdifficulty/gamemodifiers/list/PhantomLevitationAttack.java b/src/main/java/com/majruszsdifficulty/features/PhantomLevitationAttack.java similarity index 76% rename from src/main/java/com/majruszsdifficulty/gamemodifiers/list/PhantomLevitationAttack.java rename to src/main/java/com/majruszsdifficulty/features/PhantomLevitationAttack.java index 9eb95a6f7..e9ac8f726 100644 --- a/src/main/java/com/majruszsdifficulty/gamemodifiers/list/PhantomLevitationAttack.java +++ b/src/main/java/com/majruszsdifficulty/features/PhantomLevitationAttack.java @@ -1,14 +1,14 @@ -package com.majruszsdifficulty.gamemodifiers.list; +package com.majruszsdifficulty.features; import com.majruszsdifficulty.gamestage.GameStage; import com.majruszsdifficulty.Registries; -import com.majruszsdifficulty.gamemodifiers.CustomConditions; -import com.majruszsdifficulty.gamemodifiers.configs.ProgressiveEffectConfig; -import com.mlib.annotations.AutoInstance; +import com.majruszsdifficulty.contexts.base.CustomConditions; +import com.majruszsdifficulty.config.ProgressiveEffectConfig; +import com.mlib.modhelper.AutoInstance; import com.mlib.config.ConfigGroup; -import com.mlib.gamemodifiers.Condition; -import com.mlib.gamemodifiers.ModConfigs; -import com.mlib.gamemodifiers.contexts.OnDamaged; +import com.mlib.contexts.base.Condition; +import com.mlib.contexts.base.ModConfigs; +import com.mlib.contexts.OnDamaged; import net.minecraft.world.effect.MobEffects; import net.minecraft.world.entity.monster.Phantom; diff --git a/src/main/java/com/majruszsdifficulty/gamemodifiers/list/PowerfulExplosions.java b/src/main/java/com/majruszsdifficulty/features/PowerfulExplosions.java similarity index 88% rename from src/main/java/com/majruszsdifficulty/gamemodifiers/list/PowerfulExplosions.java rename to src/main/java/com/majruszsdifficulty/features/PowerfulExplosions.java index ee501fd23..25112526c 100644 --- a/src/main/java/com/majruszsdifficulty/gamemodifiers/list/PowerfulExplosions.java +++ b/src/main/java/com/majruszsdifficulty/features/PowerfulExplosions.java @@ -1,13 +1,13 @@ -package com.majruszsdifficulty.gamemodifiers.list; +package com.majruszsdifficulty.features; import com.majruszsdifficulty.Registries; import com.mlib.Random; -import com.mlib.annotations.AutoInstance; +import com.mlib.modhelper.AutoInstance; import com.mlib.config.ConfigGroup; import com.mlib.config.DoubleConfig; -import com.mlib.gamemodifiers.Condition; -import com.mlib.gamemodifiers.ModConfigs; -import com.mlib.gamemodifiers.contexts.OnExplosionStart; +import com.mlib.contexts.base.Condition; +import com.mlib.contexts.base.ModConfigs; +import com.mlib.contexts.OnExplosionStart; import com.mlib.levels.LevelHelper; import com.mlib.math.AnyPos; import com.mlib.math.Range; diff --git a/src/main/java/com/majruszsdifficulty/gamemodifiers/list/ShulkerBlindnessAttack.java b/src/main/java/com/majruszsdifficulty/features/ShulkerBlindnessAttack.java similarity index 74% rename from src/main/java/com/majruszsdifficulty/gamemodifiers/list/ShulkerBlindnessAttack.java rename to src/main/java/com/majruszsdifficulty/features/ShulkerBlindnessAttack.java index 9a79f1a0e..a5e52a832 100644 --- a/src/main/java/com/majruszsdifficulty/gamemodifiers/list/ShulkerBlindnessAttack.java +++ b/src/main/java/com/majruszsdifficulty/features/ShulkerBlindnessAttack.java @@ -1,14 +1,14 @@ -package com.majruszsdifficulty.gamemodifiers.list; +package com.majruszsdifficulty.features; import com.majruszsdifficulty.gamestage.GameStage; import com.majruszsdifficulty.Registries; -import com.majruszsdifficulty.gamemodifiers.CustomConditions; -import com.majruszsdifficulty.gamemodifiers.configs.ProgressiveEffectConfig; -import com.mlib.annotations.AutoInstance; +import com.majruszsdifficulty.contexts.base.CustomConditions; +import com.majruszsdifficulty.config.ProgressiveEffectConfig; +import com.mlib.modhelper.AutoInstance; import com.mlib.config.ConfigGroup; -import com.mlib.gamemodifiers.Condition; -import com.mlib.gamemodifiers.ModConfigs; -import com.mlib.gamemodifiers.contexts.OnDamaged; +import com.mlib.contexts.base.Condition; +import com.mlib.contexts.base.ModConfigs; +import com.mlib.contexts.OnDamaged; import net.minecraft.world.effect.MobEffects; import net.minecraft.world.entity.monster.Shulker; diff --git a/src/main/java/com/majruszsdifficulty/gamemodifiers/list/SlimeSlownessAttack.java b/src/main/java/com/majruszsdifficulty/features/SlimeSlownessAttack.java similarity index 75% rename from src/main/java/com/majruszsdifficulty/gamemodifiers/list/SlimeSlownessAttack.java rename to src/main/java/com/majruszsdifficulty/features/SlimeSlownessAttack.java index 575be0951..2a700d69d 100644 --- a/src/main/java/com/majruszsdifficulty/gamemodifiers/list/SlimeSlownessAttack.java +++ b/src/main/java/com/majruszsdifficulty/features/SlimeSlownessAttack.java @@ -1,14 +1,14 @@ -package com.majruszsdifficulty.gamemodifiers.list; +package com.majruszsdifficulty.features; import com.majruszsdifficulty.gamestage.GameStage; import com.majruszsdifficulty.Registries; -import com.majruszsdifficulty.gamemodifiers.CustomConditions; -import com.majruszsdifficulty.gamemodifiers.configs.ProgressiveEffectConfig; -import com.mlib.annotations.AutoInstance; +import com.majruszsdifficulty.contexts.base.CustomConditions; +import com.majruszsdifficulty.config.ProgressiveEffectConfig; +import com.mlib.modhelper.AutoInstance; import com.mlib.config.ConfigGroup; -import com.mlib.gamemodifiers.Condition; -import com.mlib.gamemodifiers.ModConfigs; -import com.mlib.gamemodifiers.contexts.OnDamaged; +import com.mlib.contexts.base.Condition; +import com.mlib.contexts.base.ModConfigs; +import com.mlib.contexts.OnDamaged; import net.minecraft.world.effect.MobEffects; import net.minecraft.world.entity.monster.Slime; diff --git a/src/main/java/com/majruszsdifficulty/features/SpawnBlocker.java b/src/main/java/com/majruszsdifficulty/features/SpawnBlocker.java new file mode 100644 index 000000000..c942538a7 --- /dev/null +++ b/src/main/java/com/majruszsdifficulty/features/SpawnBlocker.java @@ -0,0 +1,44 @@ +package com.majruszsdifficulty.features; + +import com.majruszsdifficulty.Registries; +import com.majruszsdifficulty.config.GameStageStringListConfig; +import com.mlib.Utility; +import com.mlib.config.ConfigGroup; +import com.mlib.contexts.OnCheckSpawn; +import com.mlib.contexts.OnSpawned; +import com.mlib.contexts.base.Condition; +import com.mlib.contexts.base.ModConfigs; +import com.mlib.modhelper.AutoInstance; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.MobSpawnType; + +@AutoInstance +public class SpawnBlocker { + final GameStageStringListConfig forbiddenEntities = new GameStageStringListConfig( new String[]{ + "minecraft:illusioner", + "majruszsdifficulty:tank", + "majruszsdifficulty:cerberus" + }, new String[]{ "majruszsdifficulty:cerberus" }, new String[]{} ); + + public SpawnBlocker() { + ConfigGroup group = ModConfigs.registerSubgroup( Registries.Groups.DEFAULT ) + .name( "SpawnBlocker" ) + .comment( "Makes mobs unable to spawn when given game stage is active (it only affects natural spawns)." ) + .addConfig( this.forbiddenEntities ); + + OnCheckSpawn.listen( OnCheckSpawn.CANCEL ) + .addCondition( Condition.predicate( data->data.getSpawnType() == MobSpawnType.NATURAL ) ) + .addCondition( Condition.predicate( data->this.isBlocked( data.mob ) ) ) + .insertTo( group ); + + OnSpawned.listen( OnSpawned.CANCEL ) + .addCondition( OnSpawned.isNotLoadedFromDisk() ) + .addCondition( Condition.predicate( data->data.getSpawnType() == MobSpawnType.NATURAL ) ) + .addCondition( Condition.predicate( data->this.isBlocked( data.target ) ) ) + .insertTo( group ); + } + + private boolean isBlocked( Entity entity ) { + return this.forbiddenEntities.getCurrentGameStageValue().contains( Utility.getRegistryString( entity.getType() ) ); + } +} diff --git a/src/main/java/com/majruszsdifficulty/features/SpawnKillerBunny.java b/src/main/java/com/majruszsdifficulty/features/SpawnKillerBunny.java new file mode 100644 index 000000000..9770580ab --- /dev/null +++ b/src/main/java/com/majruszsdifficulty/features/SpawnKillerBunny.java @@ -0,0 +1,33 @@ +package com.majruszsdifficulty.features; + +import com.majruszsdifficulty.Registries; +import com.majruszsdifficulty.contexts.base.CustomConditions; +import com.majruszsdifficulty.gamestage.GameStage; +import com.mlib.modhelper.AutoInstance; +import com.mlib.config.ConfigGroup; +import com.mlib.contexts.base.Condition; +import com.mlib.contexts.base.ModConfigs; +import com.mlib.contexts.OnSpawned; +import net.minecraft.world.entity.animal.Rabbit; + +@AutoInstance +public class SpawnKillerBunny { + public SpawnKillerBunny() { + ConfigGroup group = ModConfigs.registerSubgroup( Registries.Groups.DEFAULT ) + .name( "SpawnKillerBunny" ) + .comment( "Replaces rabbits with the Killer Bunny variant." ); + + OnSpawned.listenSafe( this::transformToKillerBunny ) + .addCondition( CustomConditions.gameStageAtLeast( GameStage.EXPERT ) ) + .addCondition( Condition.chanceCRD( 0.1, true ) ) + .addCondition( Condition.isServer() ) + .addCondition( Condition.excludable() ) + .addCondition( Condition.predicate( data->data.target instanceof Rabbit rabbit && !rabbit.isBaby() ) ) + .insertTo( group ); + } + + private void transformToKillerBunny( OnSpawned.Data data ) { + Rabbit rabbit = ( Rabbit )data.target; + rabbit.setRabbitType( Rabbit.TYPE_EVIL ); + } +} diff --git a/src/main/java/com/majruszsdifficulty/gamemodifiers/list/SpawnPlayerZombie.java b/src/main/java/com/majruszsdifficulty/features/SpawnPlayerZombie.java similarity index 90% rename from src/main/java/com/majruszsdifficulty/gamemodifiers/list/SpawnPlayerZombie.java rename to src/main/java/com/majruszsdifficulty/features/SpawnPlayerZombie.java index 2355dcea3..2fc1ccbe4 100644 --- a/src/main/java/com/majruszsdifficulty/gamemodifiers/list/SpawnPlayerZombie.java +++ b/src/main/java/com/majruszsdifficulty/features/SpawnPlayerZombie.java @@ -1,15 +1,15 @@ -package com.majruszsdifficulty.gamemodifiers.list; +package com.majruszsdifficulty.features; import com.majruszsdifficulty.gamestage.GameStage; import com.majruszsdifficulty.Registries; -import com.majruszsdifficulty.gamemodifiers.CustomConditions; +import com.majruszsdifficulty.contexts.base.CustomConditions; import com.mlib.Random; -import com.mlib.annotations.AutoInstance; +import com.mlib.modhelper.AutoInstance; import com.mlib.config.ConfigGroup; import com.mlib.config.DoubleConfig; -import com.mlib.gamemodifiers.Condition; -import com.mlib.gamemodifiers.ModConfigs; -import com.mlib.gamemodifiers.contexts.OnDeath; +import com.mlib.contexts.base.Condition; +import com.mlib.contexts.base.ModConfigs; +import com.mlib.contexts.OnDeath; import com.mlib.math.Range; import net.minecraft.nbt.CompoundTag; import net.minecraft.server.level.ServerPlayer; @@ -73,7 +73,7 @@ private void spawnZombie( OnDeath.Data data ) { } private void giveAdvancement( OnDeath.Data data ) { - Registries.BASIC_TRIGGER.trigger( ( ServerPlayer )data.attacker, "kill_yourself" ); + Registries.HELPER.triggerAchievement( ( ServerPlayer )data.attacker, "kill_yourself" ); } private static ItemStack getHead( Player player ) { diff --git a/src/main/java/com/majruszsdifficulty/features/SpawnRateIncreaser.java b/src/main/java/com/majruszsdifficulty/features/SpawnRateIncreaser.java new file mode 100644 index 000000000..d6ec57fa9 --- /dev/null +++ b/src/main/java/com/majruszsdifficulty/features/SpawnRateIncreaser.java @@ -0,0 +1,36 @@ +package com.majruszsdifficulty.features; + +import com.majruszsdifficulty.Registries; +import com.majruszsdifficulty.config.GameStageDoubleConfig; +import com.mlib.modhelper.AutoInstance; +import com.mlib.contexts.base.ModConfigs; +import com.mlib.contexts.OnMobSpawnLimit; +import com.mlib.contexts.OnMobSpawnRate; +import com.mlib.math.Range; +import net.minecraft.world.entity.MobCategory; + +@AutoInstance +public class SpawnRateIncreaser { + final GameStageDoubleConfig spawnRateMultiplier = new GameStageDoubleConfig( 1.0, 1.1, 1.2, new Range<>( 0.0, 10.0 ) ); + + public SpawnRateIncreaser() { + ModConfigs.registerSubgroup( Registries.Groups.DEFAULT ) + .name( "SpawnRate" ) + .comment( "Increases spawn rate depending on current game stage." ) + .addConfig( this.spawnRateMultiplier ); + + OnMobSpawnRate.listen( this::increaseSpawnRate ) + .addCondition( OnMobSpawnRate.is( MobCategory.MONSTER ) ); + + OnMobSpawnLimit.listen( this::increaseSpawnLimit ) + .addCondition( OnMobSpawnLimit.is( MobCategory.MONSTER ) ); + } + + private void increaseSpawnRate( OnMobSpawnRate.Data data ) { + data.value *= this.spawnRateMultiplier.getCurrentGameStageValue(); + } + + private void increaseSpawnLimit( OnMobSpawnLimit.Data data ) { + data.value *= this.spawnRateMultiplier.getCurrentGameStageValue(); + } +} diff --git a/src/main/java/com/majruszsdifficulty/gamemodifiers/list/SpiderPoisonAttack.java b/src/main/java/com/majruszsdifficulty/features/SpiderPoisonAttack.java similarity index 76% rename from src/main/java/com/majruszsdifficulty/gamemodifiers/list/SpiderPoisonAttack.java rename to src/main/java/com/majruszsdifficulty/features/SpiderPoisonAttack.java index cf30dcb43..b6590486f 100644 --- a/src/main/java/com/majruszsdifficulty/gamemodifiers/list/SpiderPoisonAttack.java +++ b/src/main/java/com/majruszsdifficulty/features/SpiderPoisonAttack.java @@ -1,14 +1,14 @@ -package com.majruszsdifficulty.gamemodifiers.list; +package com.majruszsdifficulty.features; import com.majruszsdifficulty.gamestage.GameStage; import com.majruszsdifficulty.Registries; -import com.majruszsdifficulty.gamemodifiers.CustomConditions; -import com.majruszsdifficulty.gamemodifiers.configs.ProgressiveEffectConfig; -import com.mlib.annotations.AutoInstance; +import com.majruszsdifficulty.contexts.base.CustomConditions; +import com.majruszsdifficulty.config.ProgressiveEffectConfig; +import com.mlib.modhelper.AutoInstance; import com.mlib.config.ConfigGroup; -import com.mlib.gamemodifiers.Condition; -import com.mlib.gamemodifiers.ModConfigs; -import com.mlib.gamemodifiers.contexts.OnDamaged; +import com.mlib.contexts.base.Condition; +import com.mlib.contexts.base.ModConfigs; +import com.mlib.contexts.OnDamaged; import net.minecraft.world.effect.MobEffects; import net.minecraft.world.entity.monster.Spider; diff --git a/src/main/java/com/majruszsdifficulty/features/bleeding/ArmorBleeding.java b/src/main/java/com/majruszsdifficulty/features/bleeding/ArmorBleeding.java new file mode 100644 index 000000000..65e492e44 --- /dev/null +++ b/src/main/java/com/majruszsdifficulty/features/bleeding/ArmorBleeding.java @@ -0,0 +1,109 @@ +package com.majruszsdifficulty.features.bleeding; + +import com.majruszsdifficulty.Registries; +import com.majruszsdifficulty.contexts.OnBleedingCheck; +import com.majruszsdifficulty.contexts.OnBleedingTooltip; +import com.mlib.EquipmentSlots; +import com.mlib.Random; +import com.mlib.Utility; +import com.mlib.modhelper.AutoInstance; +import com.mlib.config.BooleanConfig; +import com.mlib.config.ConfigGroup; +import com.mlib.data.JsonListener; +import com.mlib.data.SerializableList; +import com.mlib.data.SerializableStructure; +import com.mlib.contexts.base.Condition; +import com.mlib.contexts.base.ModConfigs; +import com.mlib.contexts.base.Priority; +import com.mlib.text.RegexString; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.item.ItemStack; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraftforge.network.NetworkEvent; + +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; +import java.util.function.Supplier; + +@AutoInstance +public class ArmorBleeding { + final BooleanConfig availability; + final JsonListener.Holder< ArmorsDef > armorsDef; + + public ArmorBleeding() { + this.availability = Condition.DefaultConfigs.excludable( true ); + this.armorsDef = JsonListener.add( "custom", Registries.getLocation( "bleeding_armor" ), ArmorsDef.class, ArmorsDef::new ) + .syncWithClients( Registries.HELPER ); + + ConfigGroup group = ModConfigs.registerSubgroup( Registries.Groups.BLEEDING ) + .name( "Armor" ) + .comment( "Reduces Bleeding chance for each armor piece equipped (configurable via data pack)." ); + + OnBleedingCheck.listen( OnBleedingCheck.Data::cancel ) + .priority( Priority.LOWEST ) + .addCondition( Condition.excludable( this.availability ) ) + .addCondition( Condition.predicate( OnBleedingCheck.Data::isEffectTriggered ) ) + .addCondition( ArmorBleeding.tryItemChance( this.armorsDef ) ) + .insertTo( group ); + + OnBleedingTooltip.listen( this::addTooltip ) + .addCondition( Condition.predicate( data->this.availability.isEnabled() ) ) + .addCondition( Condition.predicate( data->this.armorsDef.get().find( data.itemStack ).isPresent() ) ) + .insertTo( group ); + } + + private void addTooltip( OnBleedingTooltip.Data data ) { + data.addArmor( LivingEntity.getEquipmentSlotForItem( data.itemStack ), this.armorsDef.get().find( data.itemStack ).orElseThrow().chanceMultiplier ); + } + + public static class ArmorsDef extends SerializableList { + public List< ArmorDef > armorDefs = new ArrayList<>(); + + public ArmorsDef() { + this.defineCustom( ()->this.armorDefs, x->this.armorDefs = x, ArmorDef::new ); + } + + public Optional< ArmorDef > find( ItemStack itemStack ) { + return this.armorDefs.stream() + .filter( armorDef->armorDef.matches( itemStack ) ) + .findFirst(); + } + + @Override + @OnlyIn( Dist.CLIENT ) + public void onClient( NetworkEvent.Context context ) { + Registries.HELPER.findInstance( ArmorBleeding.class ).ifPresent( instance->instance.armorsDef.onSync( this ) ); + } + } + + public static class ArmorDef extends SerializableStructure { + public RegexString id = new RegexString(); + public float chanceMultiplier; + + public ArmorDef() { + this.defineString( "id", this.id::get, this.id::set ); + this.defineFloat( "chance_multiplier", ()->this.chanceMultiplier, x->this.chanceMultiplier = x ); + } + + public boolean matches( ItemStack itemStack ) { + return this.id.matches( Utility.getRegistryString( itemStack.getItem() ) ); + } + } + + private static Condition< OnBleedingCheck.Data > tryItemChance( Supplier< ArmorsDef > toolsDef ) { + return Condition.predicate( data->{ + double chanceMultiplier = 1.0; + for( EquipmentSlot slot : EquipmentSlots.ARMOR ) { + Optional< ArmorDef > armorDef = toolsDef.get().find( data.target.getItemBySlot( slot ) ); + if( armorDef.isPresent() ) { + chanceMultiplier *= armorDef.get().chanceMultiplier; + } + } + + return Random.tryChance( 1.0 - chanceMultiplier ); + } ); + } +} diff --git a/src/main/java/com/majruszsdifficulty/features/bleeding/ArrowBleeding.java b/src/main/java/com/majruszsdifficulty/features/bleeding/ArrowBleeding.java new file mode 100644 index 000000000..9044fd4a4 --- /dev/null +++ b/src/main/java/com/majruszsdifficulty/features/bleeding/ArrowBleeding.java @@ -0,0 +1,44 @@ +package com.majruszsdifficulty.features.bleeding; + +import com.majruszsdifficulty.Registries; +import com.majruszsdifficulty.contexts.OnBleedingCheck; +import com.majruszsdifficulty.contexts.OnBleedingTooltip; +import com.mlib.modhelper.AutoInstance; +import com.mlib.config.BooleanConfig; +import com.mlib.config.ConfigGroup; +import com.mlib.config.DoubleConfig; +import com.mlib.contexts.base.Condition; +import com.mlib.contexts.base.ModConfigs; +import net.minecraft.world.entity.projectile.Arrow; +import net.minecraft.world.item.ProjectileWeaponItem; + +@AutoInstance +public class ArrowBleeding { + final BooleanConfig availability; + final DoubleConfig chance; + + public ArrowBleeding() { + this.availability = Condition.DefaultConfigs.excludable( true ); + this.chance = Condition.DefaultConfigs.chance( 0.333 ); + + ConfigGroup group = ModConfigs.registerSubgroup( Registries.Groups.BLEEDING ) + .name( "Arrow" ) + .comment( "Arrows may inflict bleeding." ); + + OnBleedingCheck.listen( OnBleedingCheck.Data::trigger ) + .addCondition( Condition.chanceCRD( this.chance, false ) ) + .addCondition( Condition.excludable( this.availability ) ) + .addCondition( Condition.isLivingBeing( data->data.target ) ) + .addCondition( Condition.predicate( data->data.source.getDirectEntity() instanceof Arrow ) ) + .insertTo( group ); + + OnBleedingTooltip.listen( this::addTooltip ) + .addCondition( Condition.predicate( data->this.availability.isEnabled() ) ) + .addCondition( Condition.predicate( data->data.itemStack.getItem() instanceof ProjectileWeaponItem ) ) + .insertTo( group ); + } + + private void addTooltip( OnBleedingTooltip.Data data ) { + data.addItem( this.chance.getOrDefault() ); + } +} diff --git a/src/main/java/com/majruszsdifficulty/features/bleeding/BiteBleeding.java b/src/main/java/com/majruszsdifficulty/features/bleeding/BiteBleeding.java new file mode 100644 index 000000000..238ea4dea --- /dev/null +++ b/src/main/java/com/majruszsdifficulty/features/bleeding/BiteBleeding.java @@ -0,0 +1,36 @@ +package com.majruszsdifficulty.features.bleeding; + +import com.majruszsdifficulty.Registries; +import com.majruszsdifficulty.contexts.OnBleedingCheck; +import com.mlib.modhelper.AutoInstance; +import com.mlib.config.ConfigGroup; +import com.mlib.contexts.base.Condition; +import com.mlib.contexts.base.ModConfigs; +import net.minecraft.world.entity.animal.Animal; +import net.minecraft.world.entity.animal.horse.Llama; +import net.minecraft.world.entity.monster.Spider; +import net.minecraft.world.entity.monster.Zombie; + +@AutoInstance +public class BiteBleeding { + public BiteBleeding() { + ConfigGroup group = ModConfigs.registerSubgroup( Registries.Groups.BLEEDING ) + .name( "Bite" ) + .comment( "Wolves, zombies, spiders, and animals from other mods may inflict bleeding." ); + + OnBleedingCheck.listen( OnBleedingCheck.Data::trigger ) + .addCondition( Condition.chanceCRD( 0.5, false ) ) + .addCondition( Condition.excludable() ) + .addCondition( Condition.isLivingBeing( data->data.target ) ) + .addCondition( Condition.predicate( OnBleedingCheck.Data::isDirect ) ) + .addCondition( BiteBleeding.canBite() ) + .insertTo( group ); + } + + private static Condition< OnBleedingCheck.Data > canBite() { + return Condition.predicate( data->{ + return ( data.attacker instanceof Animal || data.attacker instanceof Zombie || data.attacker instanceof Spider ) + && !( data.attacker instanceof Llama ); + } ); + } +} diff --git a/src/main/java/com/majruszsdifficulty/features/bleeding/CactusBleeding.java b/src/main/java/com/majruszsdifficulty/features/bleeding/CactusBleeding.java new file mode 100644 index 000000000..3a57f22a3 --- /dev/null +++ b/src/main/java/com/majruszsdifficulty/features/bleeding/CactusBleeding.java @@ -0,0 +1,26 @@ +package com.majruszsdifficulty.features.bleeding; + +import com.majruszsdifficulty.Registries; +import com.majruszsdifficulty.contexts.OnBleedingCheck; +import com.mlib.modhelper.AutoInstance; +import com.mlib.config.ConfigGroup; +import com.mlib.contexts.base.Condition; +import com.mlib.contexts.base.ModConfigs; +import net.minecraft.world.damagesource.DamageSource; + +@AutoInstance +public class CactusBleeding { + public CactusBleeding() { + ConfigGroup group = ModConfigs.registerSubgroup( Registries.Groups.BLEEDING ) + .name( "Cactus" ) + .comment( "Touching cactus may inflict bleeding." ); + + OnBleedingCheck.listen( OnBleedingCheck.Data::trigger ) + .addCondition( Condition.chanceCRD( 0.5, false ) ) + .addCondition( Condition.excludable() ) + .addCondition( Condition.isLivingBeing( data->data.target ) ) + .addCondition( Condition.predicate( data->data.source.equals( DamageSource.CACTUS ) ) ) + .addCondition( Condition.predicate( OnBleedingCheck.Data::isDirect ) ) + .insertTo( group ); + } +} diff --git a/src/main/java/com/majruszsdifficulty/features/bleeding/ToolsBleeding.java b/src/main/java/com/majruszsdifficulty/features/bleeding/ToolsBleeding.java new file mode 100644 index 000000000..be3d524ad --- /dev/null +++ b/src/main/java/com/majruszsdifficulty/features/bleeding/ToolsBleeding.java @@ -0,0 +1,130 @@ +package com.majruszsdifficulty.features.bleeding; + +import com.majruszsdifficulty.Registries; +import com.majruszsdifficulty.contexts.OnBleedingCheck; +import com.majruszsdifficulty.contexts.OnBleedingTooltip; +import com.mlib.Random; +import com.mlib.Utility; +import com.mlib.modhelper.AutoInstance; +import com.mlib.config.BooleanConfig; +import com.mlib.config.ConfigGroup; +import com.mlib.data.JsonListener; +import com.mlib.data.SerializableList; +import com.mlib.data.SerializableStructure; +import com.mlib.contexts.base.Condition; +import com.mlib.contexts.base.ModConfigs; +import com.mlib.items.ItemHelper; +import com.mlib.text.RegexString; +import net.minecraft.world.item.ItemStack; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraftforge.network.NetworkEvent; + +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; +import java.util.function.Supplier; + +@AutoInstance +public class ToolsBleeding { + final BooleanConfig availability; + final JsonListener.Holder< ToolsDef > toolsDef; + + public ToolsBleeding() { + this.availability = Condition.DefaultConfigs.excludable( true ); + this.toolsDef = JsonListener.add( "custom", Registries.getLocation( "bleeding_tools" ), ToolsDef.class, ToolsDef::new ) + .syncWithClients( Registries.HELPER ); + + ConfigGroup group = ModConfigs.registerSubgroup( Registries.Groups.BLEEDING ) + .name( "Tools" ) + .comment( "Various items may inflict bleeding (configurable via data pack)." ); + + OnBleedingCheck.listen( OnBleedingCheck.Data::trigger ) + .addCondition( Condition.excludable( this.availability ) ) + .addCondition( Condition.isLivingBeing( data->data.target ) ) + .addCondition( Condition.predicate( OnBleedingCheck.Data::isDirect ) ) + .addCondition( ToolsBleeding.tryItemChance( this.toolsDef ) ) + .insertTo( group ); + + OnBleedingTooltip.listen( this::addTooltip ) + .addCondition( Condition.predicate( data->this.availability.isEnabled() ) ) + .addCondition( Condition.predicate( data->this.toolsDef.get().find( data.itemStack ).isPresent() ) ) + .insertTo( group ); + } + + private void addTooltip( OnBleedingTooltip.Data data ) { + data.addItem( this.toolsDef.get().find( data.itemStack ).orElseThrow().getChance( data.itemStack ) ); + } + + public static class ToolsDef extends SerializableList { + public List< ToolDef > toolDefs = new ArrayList<>(); + + public ToolsDef() { + this.defineCustom( ()->this.toolDefs, x->this.toolDefs = x, ToolDef::new ); + } + + public Optional< ToolDef > find( ItemStack itemStack ) { + return this.toolDefs.stream() + .filter( toolDef->toolDef.matches( itemStack ) ) + .findFirst(); + } + + @Override + @OnlyIn( Dist.CLIENT ) + public void onClient( NetworkEvent.Context context ) { + Registries.HELPER.findInstance( ToolsBleeding.class ).ifPresent( instance->instance.toolsDef.onSync( this ) ); + } + } + + public static class ToolDef extends SerializableStructure { + public RegexString id = new RegexString(); + public float chance; + public List< EnchantmentDef > enchantmentDefs = new ArrayList<>(); + + public ToolDef() { + this.defineString( "id", this.id::get, this.id::set ); + this.defineFloat( "chance", ()->this.chance, x->this.chance = x ); + this.defineCustom( "enchantments", ()->this.enchantmentDefs, x->this.enchantmentDefs = x, EnchantmentDef::new ); + } + + public float getChance( ItemStack itemStack ) { + return this.chance + ItemHelper.getEnchantmentsInfo( itemStack ).enchantments.stream().map( this::getExtraChance ).reduce( 0.0f, Float::sum ); + } + + public boolean matches( ItemStack itemStack ) { + return this.id.matches( Utility.getRegistryString( itemStack.getItem() ) ); + } + + private float getExtraChance( ItemHelper.EnchantmentInfo enchantmentInfo ) { + for( EnchantmentDef enchantmentDef : this.enchantmentDefs ) { + if( enchantmentDef.id.matches( enchantmentInfo.id ) ) { + return enchantmentInfo.level * enchantmentDef.chance; + } + } + + return 0.0f; + } + } + + public static class EnchantmentDef extends SerializableStructure { + public RegexString id = new RegexString(); + public float chance; + + public EnchantmentDef() { + this.defineString( "id", this.id::get, this.id::set ); + this.defineFloat( "extra_chance", ()->this.chance, x->this.chance = x ); + } + } + + private static Condition< OnBleedingCheck.Data > tryItemChance( Supplier< ToolsDef > toolsDef ) { + return Condition.predicate( data->{ + if( data.attacker == null ) { + return false; + } + + ItemStack itemStack = data.attacker.getMainHandItem(); + Optional< ToolDef > toolDef = toolsDef.get().find( itemStack ); + return toolDef.isPresent() && Random.tryChance( toolDef.get().getChance( itemStack ) ); + } ); + } +} diff --git a/src/main/java/com/majruszsdifficulty/gamemodifiers/list/groups/PiglinsInGroup.java b/src/main/java/com/majruszsdifficulty/features/groups/PiglinsInGroup.java similarity index 73% rename from src/main/java/com/majruszsdifficulty/gamemodifiers/list/groups/PiglinsInGroup.java rename to src/main/java/com/majruszsdifficulty/features/groups/PiglinsInGroup.java index e27f662c8..b532f2a13 100644 --- a/src/main/java/com/majruszsdifficulty/gamemodifiers/list/groups/PiglinsInGroup.java +++ b/src/main/java/com/majruszsdifficulty/features/groups/PiglinsInGroup.java @@ -1,21 +1,23 @@ -package com.majruszsdifficulty.gamemodifiers.list.groups; +package com.majruszsdifficulty.features.groups; import com.majruszsdifficulty.gamestage.GameStage; import com.majruszsdifficulty.Registries; -import com.majruszsdifficulty.gamemodifiers.CustomConditions; -import com.majruszsdifficulty.gamemodifiers.configs.MobGroupConfig; -import com.mlib.annotations.AutoInstance; +import com.majruszsdifficulty.contexts.base.CustomConditions; +import com.majruszsdifficulty.config.MobGroupConfig; +import com.mlib.modhelper.AutoInstance; import com.mlib.config.ConfigGroup; -import com.mlib.gamemodifiers.Condition; -import com.mlib.gamemodifiers.ModConfigs; -import com.mlib.gamemodifiers.contexts.OnSpawned; +import com.mlib.contexts.base.Condition; +import com.mlib.contexts.base.ModConfigs; +import com.mlib.contexts.OnSpawned; import com.mlib.math.Range; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.PathfinderMob; import net.minecraft.world.entity.monster.piglin.Piglin; +import java.util.function.Supplier; + @AutoInstance -public class PiglinsInGroup { +public class PiglinsInGroup implements Supplier< MobGroupConfig > { final MobGroupConfig mobGroups = new MobGroupConfig( ()->EntityType.PIGLIN, new Range<>( 1, 3 ), @@ -40,6 +42,11 @@ public PiglinsInGroup() { .insertTo( group ); } + @Override + public MobGroupConfig get() { + return this.mobGroups; + } + private void spawnGroup( OnSpawned.Data data ) { this.mobGroups.spawn( ( PathfinderMob )data.target ); } diff --git a/src/main/java/com/majruszsdifficulty/gamemodifiers/list/groups/SkeletonsInGroup.java b/src/main/java/com/majruszsdifficulty/features/groups/SkeletonsInGroup.java similarity index 71% rename from src/main/java/com/majruszsdifficulty/gamemodifiers/list/groups/SkeletonsInGroup.java rename to src/main/java/com/majruszsdifficulty/features/groups/SkeletonsInGroup.java index a5c1498f3..8d6f4160d 100644 --- a/src/main/java/com/majruszsdifficulty/gamemodifiers/list/groups/SkeletonsInGroup.java +++ b/src/main/java/com/majruszsdifficulty/features/groups/SkeletonsInGroup.java @@ -1,21 +1,23 @@ -package com.majruszsdifficulty.gamemodifiers.list.groups; +package com.majruszsdifficulty.features.groups; import com.majruszsdifficulty.gamestage.GameStage; import com.majruszsdifficulty.Registries; -import com.majruszsdifficulty.gamemodifiers.CustomConditions; -import com.majruszsdifficulty.gamemodifiers.configs.MobGroupConfig; -import com.mlib.annotations.AutoInstance; +import com.majruszsdifficulty.contexts.base.CustomConditions; +import com.majruszsdifficulty.config.MobGroupConfig; +import com.mlib.modhelper.AutoInstance; import com.mlib.config.ConfigGroup; -import com.mlib.gamemodifiers.Condition; -import com.mlib.gamemodifiers.ModConfigs; -import com.mlib.gamemodifiers.contexts.OnSpawned; +import com.mlib.contexts.base.Condition; +import com.mlib.contexts.base.ModConfigs; +import com.mlib.contexts.OnSpawned; import com.mlib.math.Range; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.PathfinderMob; import net.minecraft.world.entity.monster.Skeleton; +import java.util.function.Supplier; + @AutoInstance -public class SkeletonsInGroup { +public class SkeletonsInGroup implements Supplier< MobGroupConfig > { final MobGroupConfig mobGroups = new MobGroupConfig( ()->EntityType.SKELETON, new Range<>( 1, 3 ), @@ -30,7 +32,7 @@ public SkeletonsInGroup() { OnSpawned.listenSafe( this::spawnGroup ) .addCondition( CustomConditions.gameStageAtLeast( GameStage.EXPERT ) ) - .addCondition( Condition.chanceCRD( 0.25, true ) ) + .addCondition( Condition.chanceCRD( 0.1, true ) ) .addCondition( CustomConditions.isNotPartOfGroup( data->data.target ) ) .addCondition( CustomConditions.isNotPartOfUndeadArmy( data->data.target ) ) .addCondition( Condition.excludable() ) @@ -41,6 +43,11 @@ public SkeletonsInGroup() { .insertTo( group ); } + @Override + public MobGroupConfig get() { + return this.mobGroups; + } + private void spawnGroup( OnSpawned.Data data ) { this.mobGroups.spawn( ( PathfinderMob )data.target ); } diff --git a/src/main/java/com/majruszsdifficulty/gamemodifiers/list/groups/ZombiesInGroup.java b/src/main/java/com/majruszsdifficulty/features/groups/ZombiesInGroup.java similarity index 76% rename from src/main/java/com/majruszsdifficulty/gamemodifiers/list/groups/ZombiesInGroup.java rename to src/main/java/com/majruszsdifficulty/features/groups/ZombiesInGroup.java index 17ee5d539..69793624a 100644 --- a/src/main/java/com/majruszsdifficulty/gamemodifiers/list/groups/ZombiesInGroup.java +++ b/src/main/java/com/majruszsdifficulty/features/groups/ZombiesInGroup.java @@ -1,22 +1,24 @@ -package com.majruszsdifficulty.gamemodifiers.list.groups; +package com.majruszsdifficulty.features.groups; import com.majruszsdifficulty.gamestage.GameStage; import com.majruszsdifficulty.Registries; -import com.majruszsdifficulty.gamemodifiers.CustomConditions; -import com.majruszsdifficulty.gamemodifiers.configs.MobGroupConfig; -import com.mlib.annotations.AutoInstance; +import com.majruszsdifficulty.contexts.base.CustomConditions; +import com.majruszsdifficulty.config.MobGroupConfig; +import com.mlib.modhelper.AutoInstance; import com.mlib.config.ConfigGroup; -import com.mlib.gamemodifiers.Condition; -import com.mlib.gamemodifiers.ModConfigs; -import com.mlib.gamemodifiers.contexts.OnSpawned; +import com.mlib.contexts.base.Condition; +import com.mlib.contexts.base.ModConfigs; +import com.mlib.contexts.OnSpawned; import com.mlib.levels.LevelHelper; import com.mlib.math.Range; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.PathfinderMob; import net.minecraft.world.entity.monster.Zombie; +import java.util.function.Supplier; + @AutoInstance -public class ZombiesInGroup { +public class ZombiesInGroup implements Supplier< MobGroupConfig > { final MobGroupConfig mobGroups = new MobGroupConfig( ()->EntityType.ZOMBIE, new Range<>( 1, 3 ), @@ -43,6 +45,11 @@ public ZombiesInGroup() { .insertTo( group ); } + @Override + public MobGroupConfig get() { + return this.mobGroups; + } + private void spawnGroup( OnSpawned.Data data ) { this.mobGroups.spawn( ( PathfinderMob )data.target ); } diff --git a/src/main/java/com/majruszsdifficulty/gamemodifiers/list/BiteBleeding.java b/src/main/java/com/majruszsdifficulty/gamemodifiers/list/BiteBleeding.java deleted file mode 100644 index 3f6e52512..000000000 --- a/src/main/java/com/majruszsdifficulty/gamemodifiers/list/BiteBleeding.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.majruszsdifficulty.gamemodifiers.list; - -import com.majruszsdifficulty.gamestage.GameStage; -import com.majruszsdifficulty.Registries; -import com.majruszsdifficulty.gamemodifiers.CustomConditions; -import com.majruszsdifficulty.gamemodifiers.contexts.OnBleedingCheck; -import com.mlib.annotations.AutoInstance; -import com.mlib.config.ConfigGroup; -import com.mlib.gamemodifiers.Condition; -import com.mlib.gamemodifiers.ModConfigs; -import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.animal.Animal; -import net.minecraft.world.entity.animal.horse.Llama; -import net.minecraft.world.entity.monster.Spider; -import net.minecraft.world.entity.monster.Zombie; - -import javax.annotation.Nullable; - -@AutoInstance -public class BiteBleeding { - public BiteBleeding() { - ConfigGroup group = ModConfigs.registerSubgroup( Registries.Groups.DEFAULT ) - .name( "BiteBleeding" ) - .comment( "Animals (wolfs and from other mods), zombies and spiders may inflict bleeding." ); - - OnBleedingCheck.listen( OnBleedingCheck.Data::trigger ) - .addCondition( CustomConditions.gameStageAtLeast( GameStage.NORMAL ) ) - .addCondition( Condition.chanceCRD( 0.5, false ) ) - .addCondition( Condition.excludable() ) - .addCondition( Condition.isLivingBeing( data->data.target ) ) - .addCondition( Condition.predicate( data->canBite( data.attacker ) ) ) - .addCondition( Condition.predicate( data->data.source.getDirectEntity() == data.attacker ) ) - .insertTo( group ); - } - - private static boolean canBite( @Nullable LivingEntity attacker ) { - return ( attacker instanceof Animal || attacker instanceof Zombie || attacker instanceof Spider ) && !( attacker instanceof Llama ); - } -} diff --git a/src/main/java/com/majruszsdifficulty/gamemodifiers/list/CactusBleeding.java b/src/main/java/com/majruszsdifficulty/gamemodifiers/list/CactusBleeding.java deleted file mode 100644 index 45a850a17..000000000 --- a/src/main/java/com/majruszsdifficulty/gamemodifiers/list/CactusBleeding.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.majruszsdifficulty.gamemodifiers.list; - -import com.majruszsdifficulty.gamestage.GameStage; -import com.majruszsdifficulty.Registries; -import com.majruszsdifficulty.gamemodifiers.CustomConditions; -import com.majruszsdifficulty.gamemodifiers.contexts.OnBleedingCheck; -import com.mlib.annotations.AutoInstance; -import com.mlib.config.ConfigGroup; -import com.mlib.gamemodifiers.Condition; -import com.mlib.gamemodifiers.ModConfigs; -import net.minecraft.world.damagesource.DamageSource; - -@AutoInstance -public class CactusBleeding { - public CactusBleeding() { - ConfigGroup group = ModConfigs.registerSubgroup( Registries.Groups.DEFAULT ) - .name( "CactusBleeding" ) - .comment( "Cactus damage may inflict bleeding." ); - - OnBleedingCheck.listen( OnBleedingCheck.Data::trigger ) - .addCondition( CustomConditions.gameStageAtLeast( GameStage.NORMAL ) ) - .addCondition( Condition.chanceCRD( 0.5, false ) ) - .addCondition( Condition.excludable() ) - .addCondition( Condition.isLivingBeing( data->data.target ) ) - .addCondition( Condition.predicate( data->data.source.equals( DamageSource.CACTUS ) ) ) - .addCondition( Condition.predicate( data->data.source.getDirectEntity() == data.attacker ) ) - .insertTo( group ); - } -} diff --git a/src/main/java/com/majruszsdifficulty/gamemodifiers/list/DrownDebuffs.java b/src/main/java/com/majruszsdifficulty/gamemodifiers/list/DrownDebuffs.java deleted file mode 100644 index ddd187305..000000000 --- a/src/main/java/com/majruszsdifficulty/gamemodifiers/list/DrownDebuffs.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.majruszsdifficulty.gamemodifiers.list; - -import com.majruszsdifficulty.gamestage.GameStage; -import com.majruszsdifficulty.Registries; -import com.majruszsdifficulty.gamemodifiers.CustomConditions; -import com.majruszsdifficulty.gamemodifiers.configs.ProgressiveEffectConfig; -import com.mlib.annotations.AutoInstance; -import com.mlib.config.ConfigGroup; -import com.mlib.gamemodifiers.Condition; -import com.mlib.gamemodifiers.ModConfigs; -import com.mlib.gamemodifiers.contexts.OnDamaged; -import net.minecraft.world.damagesource.DamageSource; -import net.minecraft.world.effect.MobEffects; - -@AutoInstance -public class DrownDebuffs { - final ProgressiveEffectConfig nausea = new ProgressiveEffectConfig( MobEffects.CONFUSION, new GameStage.Integer( 0 ), new GameStage.Double( 2.0 ) ).stackable( 60.0 ); - final ProgressiveEffectConfig weakness = new ProgressiveEffectConfig( MobEffects.WEAKNESS, new GameStage.Integer( 0 ), new GameStage.Double( 10.0 ) ).stackable( 60.0 ); - - public DrownDebuffs() { - ConfigGroup group = ModConfigs.registerSubgroup( Registries.Groups.DEFAULT ) - .name( "DrownDebuffs" ) - .comment( "Inflicts several debuffs when taking drown damage (these debuffs stack)." ); - - OnDamaged.listen( this::applyDebuffs ) - .addCondition( CustomConditions.gameStageAtLeast( GameStage.NORMAL ) ) - .addCondition( Condition.chanceCRD( 1.0, false ) ) - .addCondition( Condition.excludable() ) - .addCondition( Condition.predicate( data->data.source.equals( DamageSource.DROWN ) ) ) - .addConfig( this.nausea.name( "Nausea" ) ) - .addConfig( this.weakness.name( "Weakness" ) ) - .insertTo( group ); - } - - private void applyDebuffs( OnDamaged.Data data ) { - this.nausea.apply( data.target ); - this.weakness.apply( data.target ); - } -} diff --git a/src/main/java/com/majruszsdifficulty/gamemodifiers/list/FallDebuffs.java b/src/main/java/com/majruszsdifficulty/gamemodifiers/list/FallDebuffs.java deleted file mode 100644 index 0e9911682..000000000 --- a/src/main/java/com/majruszsdifficulty/gamemodifiers/list/FallDebuffs.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.majruszsdifficulty.gamemodifiers.list; - -import com.majruszsdifficulty.gamestage.GameStage; -import com.majruszsdifficulty.Registries; -import com.majruszsdifficulty.gamemodifiers.CustomConditions; -import com.majruszsdifficulty.gamemodifiers.configs.ProgressiveEffectConfig; -import com.mlib.annotations.AutoInstance; -import com.mlib.config.ConfigGroup; -import com.mlib.entities.EntityHelper; -import com.mlib.gamemodifiers.Condition; -import com.mlib.gamemodifiers.ModConfigs; -import com.mlib.gamemodifiers.contexts.OnDamaged; -import net.minecraft.world.damagesource.DamageSource; -import net.minecraft.world.effect.MobEffects; - -@AutoInstance -public class FallDebuffs { - final ProgressiveEffectConfig nausea = new ProgressiveEffectConfig( MobEffects.CONFUSION, new GameStage.Integer( 0 ), new GameStage.Double( 8.0 ) ); - final ProgressiveEffectConfig slowness = new ProgressiveEffectConfig( MobEffects.MOVEMENT_SLOWDOWN, new GameStage.Integer( 0 ), new GameStage.Double( 6.0 ) ); - - public FallDebuffs() { - ConfigGroup group = ModConfigs.registerSubgroup( Registries.Groups.DEFAULT ) - .name( "FallDebuffs" ) - .comment( "Inflicts several debuffs when taking fall damage." ); - - OnDamaged.listen( this::applyDebuffs ) - .addCondition( CustomConditions.gameStageAtLeast( GameStage.NORMAL ) ) - .addCondition( Condition.chanceCRD( 1.0, false ) ) - .addCondition( Condition.excludable() ) - .addCondition( Condition.predicate( data->data.source.equals( DamageSource.FALL ) && data.event.getAmount() > 2.0f ) ) - .addCondition( Condition.predicate( data->EntityHelper.isHuman( data.target ) ) ) - .addConfig( this.nausea.name( "Nausea" ) ) - .addConfig( this.slowness.name( "Slowness" ) ) - .insertTo( group ); - } - - private void applyDebuffs( OnDamaged.Data data ) { - this.nausea.apply( data.target ); - this.slowness.apply( data.target ); - } -} diff --git a/src/main/java/com/majruszsdifficulty/gamemodifiers/list/SharpToolsBleeding.java b/src/main/java/com/majruszsdifficulty/gamemodifiers/list/SharpToolsBleeding.java deleted file mode 100644 index 7148f589b..000000000 --- a/src/main/java/com/majruszsdifficulty/gamemodifiers/list/SharpToolsBleeding.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.majruszsdifficulty.gamemodifiers.list; - -import com.majruszsdifficulty.gamestage.GameStage; -import com.majruszsdifficulty.Registries; -import com.majruszsdifficulty.effects.BleedingEffect; -import com.majruszsdifficulty.gamemodifiers.CustomConditions; -import com.majruszsdifficulty.gamemodifiers.contexts.OnBleedingCheck; -import com.mlib.annotations.AutoInstance; -import com.mlib.config.BooleanConfig; -import com.mlib.config.ConfigGroup; -import com.mlib.config.DoubleConfig; -import com.mlib.gamemodifiers.Condition; -import com.mlib.gamemodifiers.ModConfigs; -import com.mlib.gamemodifiers.contexts.OnItemAttributeTooltip; -import com.mlib.items.ItemHelper; -import com.mlib.text.TextHelper; -import net.minecraft.ChatFormatting; -import net.minecraft.network.chat.*; -import net.minecraft.world.entity.EquipmentSlot; -import net.minecraft.world.item.ShearsItem; -import net.minecraft.world.item.TieredItem; -import net.minecraft.world.item.TridentItem; - -import java.util.function.Supplier; - -@AutoInstance -public class SharpToolsBleeding { - static final String ATTRIBUTE_ID = "effect.majruszsdifficulty.bleeding.item_tooltip"; - static Supplier< Boolean > IS_ENABLED = ()->false; - static Supplier< Float > GET_CHANCE = ()->0.0f; - - public SharpToolsBleeding() { - ConfigGroup group = ModConfigs.registerSubgroup( Registries.Groups.DEFAULT ) - .name( "SharpToolsBleeding" ) - .comment( "All sharp items (tools, shears etc.) may inflict bleeding." ); - - var chance = Condition.< OnBleedingCheck.Data > chanceCRD( 0.25, false ); - GET_CHANCE = ()->( ( DoubleConfig )chance.getConfigs().get( 0 ) ).asFloat(); // TODO: refactor - var excludable = Condition.< OnBleedingCheck.Data > excludable(); - IS_ENABLED = ()->( ( BooleanConfig )excludable.getConfigs().get( 0 ) ).isEnabled() && BleedingEffect.isEnabled(); // TODO: refactor - OnBleedingCheck.listen( OnBleedingCheck.Data::trigger ) - .addCondition( CustomConditions.gameStageAtLeast( GameStage.NORMAL ) ) - .addCondition( chance ) - .addCondition( excludable ) - .addCondition( Condition.isLivingBeing( data->data.target ) ) - .addCondition( Condition.predicate( data->ItemHelper.hasInMainHand( data.attacker, TieredItem.class, TridentItem.class, ShearsItem.class ) ) ) - .addCondition( Condition.predicate( data->data.source.getDirectEntity() == data.attacker ) ) - .insertTo( group ); - - OnItemAttributeTooltip.listen( this::addTooltip ) - .addCondition( Condition.predicate( data->data.item instanceof TieredItem || data.item instanceof TridentItem || data.item instanceof ShearsItem ) ) - .addCondition( Condition.predicate( IS_ENABLED ) ) - .insertTo( group ); - } - - private void addTooltip( OnItemAttributeTooltip.Data data ) { - String chance = TextHelper.percent( GET_CHANCE.get() ); - String amplifier = TextHelper.toRoman( BleedingEffect.getAmplifier() + 1 ); - data.add( EquipmentSlot.MAINHAND, new TranslatableComponent( ATTRIBUTE_ID, chance, amplifier ) - .withStyle( ChatFormatting.DARK_GREEN ) ); - } -} diff --git a/src/main/java/com/majruszsdifficulty/gamemodifiers/list/SpawnBlocker.java b/src/main/java/com/majruszsdifficulty/gamemodifiers/list/SpawnBlocker.java deleted file mode 100644 index 3ad64ab01..000000000 --- a/src/main/java/com/majruszsdifficulty/gamemodifiers/list/SpawnBlocker.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.majruszsdifficulty.gamemodifiers.list; - -import com.majruszsdifficulty.Registries; -import com.majruszsdifficulty.config.GameStageStringListConfig; -import com.mlib.Utility; -import com.mlib.annotations.AutoInstance; -import com.mlib.config.ConfigGroup; -import com.mlib.gamemodifiers.Condition; -import com.mlib.gamemodifiers.ModConfigs; -import com.mlib.gamemodifiers.contexts.OnCheckSpawn; -import net.minecraft.world.entity.Entity; - -@AutoInstance -public class SpawnBlocker { - final GameStageStringListConfig forbiddenEntities = new GameStageStringListConfig( new String[]{ - "minecraft:illusioner", - "majruszsdifficulty:tank" - }, new String[]{}, new String[]{} ); - - public SpawnBlocker() { - ConfigGroup group = ModConfigs.registerSubgroup( Registries.Groups.DEFAULT ) - .name( "SpawnBlocker" ) - .comment( "Blocks certain mobs from spawning when given game stage is active." ); - - OnCheckSpawn.listen( OnCheckSpawn.CANCEL ) - .addCondition( Condition.predicate( data->this.isForbidden( data.mob ) ) ) - .addConfig( this.forbiddenEntities ) - .insertTo( group ); - } - - private boolean isForbidden( Entity entity ) { - return this.forbiddenEntities.getCurrentGameStageValue().contains( Utility.getRegistryString( entity.getType() ) ); - } -} diff --git a/src/main/java/com/majruszsdifficulty/gamemodifiers/list/ThrowableWeaponsBleeding.java b/src/main/java/com/majruszsdifficulty/gamemodifiers/list/ThrowableWeaponsBleeding.java deleted file mode 100644 index a8bf30f54..000000000 --- a/src/main/java/com/majruszsdifficulty/gamemodifiers/list/ThrowableWeaponsBleeding.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.majruszsdifficulty.gamemodifiers.list; - -import com.majruszsdifficulty.gamestage.GameStage; -import com.majruszsdifficulty.Registries; -import com.majruszsdifficulty.gamemodifiers.CustomConditions; -import com.majruszsdifficulty.gamemodifiers.contexts.OnBleedingCheck; -import com.mlib.annotations.AutoInstance; -import com.mlib.config.ConfigGroup; -import com.mlib.gamemodifiers.Condition; -import com.mlib.gamemodifiers.ModConfigs; -import net.minecraft.world.entity.projectile.Arrow; -import net.minecraft.world.entity.projectile.ThrownTrident; - -@AutoInstance -public class ThrowableWeaponsBleeding { - public ThrowableWeaponsBleeding() { - ConfigGroup group = ModConfigs.registerSubgroup( Registries.Groups.DEFAULT ) - .name( "ThrowableWeaponsBleeding" ) - .comment( "All throwable sharp items (arrows, trident etc.) may inflict bleeding." ); - - OnBleedingCheck.listen( OnBleedingCheck.Data::trigger ) - .addCondition( CustomConditions.gameStageAtLeast( GameStage.NORMAL ) ) - .addCondition( Condition.chanceCRD( 0.4, false ) ) - .addCondition( Condition.excludable() ) - .addCondition( Condition.isLivingBeing( data->data.target ) ) - .addCondition( Condition.predicate( data->data.source.getDirectEntity() instanceof Arrow || data.source.getDirectEntity() instanceof ThrownTrident ) ) - .insertTo( group ); - } -} diff --git a/src/main/java/com/majruszsdifficulty/gamemodifiers/list/TurnSkeletonIntoWitherSkeleton.java b/src/main/java/com/majruszsdifficulty/gamemodifiers/list/TurnSkeletonIntoWitherSkeleton.java deleted file mode 100644 index ccdd7912a..000000000 --- a/src/main/java/com/majruszsdifficulty/gamemodifiers/list/TurnSkeletonIntoWitherSkeleton.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.majruszsdifficulty.gamemodifiers.list; - -import com.majruszsdifficulty.gamestage.GameStage; -import com.majruszsdifficulty.Registries; -import com.majruszsdifficulty.gamemodifiers.CustomConditions; -import com.majruszsdifficulty.items.WitherSwordItem; -import com.mlib.annotations.AutoInstance; -import com.mlib.config.ConfigGroup; -import com.mlib.effects.ParticleHandler; -import com.mlib.gamemodifiers.Condition; -import com.mlib.gamemodifiers.ModConfigs; -import com.mlib.gamemodifiers.contexts.OnDamaged; -import com.mlib.gamemodifiers.contexts.OnDeath; -import com.mlib.time.Time; -import net.minecraft.core.BlockPos; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.MobSpawnType; -import net.minecraft.world.entity.monster.Skeleton; -import net.minecraft.world.phys.Vec3; - -// TODO: move to WitherSwordItem -@AutoInstance -public class TurnSkeletonIntoWitherSkeleton { - static final String WITHER_TAG = "MajruszsDifficultyWitherTag"; - - public TurnSkeletonIntoWitherSkeleton() { - ConfigGroup group = ModConfigs.registerSubgroup( Registries.Groups.DEFAULT ) - .name( "TurnSkeletonIntoWitherSkeleton" ) - .comment( "If the Skeleton dies from Wither Sword it will respawn as Wither Skeleton in a few seconds." ); - - OnDamaged.listen( this::applyWitherTag ) - .addCondition( Condition.predicate( data->data.attacker != null ) ) - .addCondition( Condition.predicate( data->data.attacker.getMainHandItem().getItem() instanceof WitherSwordItem ) ) - .addCondition( Condition.predicate( data->data.target instanceof Skeleton ) ) - .insertTo( group ); - - OnDeath.listen( this::spawnWitherSkeleton ) - .addCondition( Condition.isServer() ) - .addCondition( CustomConditions.gameStageAtLeast( GameStage.MASTER ) ) - .addCondition( Condition.chanceCRD( 0.5, true ) ) - .addCondition( Condition.excludable() ) - .addCondition( Condition.predicate( this::hasWitherTag ) ) - .insertTo( group ); - } - - private void applyWitherTag( OnDamaged.Data data ) { - data.target.getPersistentData().putBoolean( WITHER_TAG, true ); - } - - private void spawnWitherSkeleton( OnDeath.Data data ) { - ServerLevel level = data.getServerLevel(); - Time.slider( 7.0, slider->{ - Vec3 position = data.target.position().add( 0.0, 1.0, 0.0 ); - if( slider.getTicksLeft() % 5 == 0 ) { - ParticleHandler.SOUL.spawn( level, position, ( int )( slider.getRatio() * 10 ), ParticleHandler.offset( slider.getRatio() ) ); - } - if( slider.getTicksLeft() == 2 ) { - ParticleHandler.SOUL.spawn( level, position, 100, ParticleHandler.offset( 0.5f ) ); - ParticleHandler.SOUL.spawn( level, position, 100, ParticleHandler.offset( 1.0f ) ); - } - if( slider.isFinished() ) { - EntityType.WITHER_SKELETON.spawn( level, ( CompoundTag )null, null, null, new BlockPos( data.target.position() ), MobSpawnType.EVENT, true, true ); - } - } ); - } - - private boolean hasWitherTag( OnDeath.Data data ) { - return data.target.getPersistentData().getBoolean( WITHER_TAG ); - } -} diff --git a/src/main/java/com/majruszsdifficulty/gamestage/GameStage.java b/src/main/java/com/majruszsdifficulty/gamestage/GameStage.java index b7eefd3e8..f06d2dc5b 100644 --- a/src/main/java/com/majruszsdifficulty/gamestage/GameStage.java +++ b/src/main/java/com/majruszsdifficulty/gamestage/GameStage.java @@ -1,6 +1,6 @@ package com.majruszsdifficulty.gamestage; -import com.majruszsdifficulty.gamemodifiers.contexts.OnGameStageChange; +import com.majruszsdifficulty.contexts.OnGameStageChange; import net.minecraft.ChatFormatting; import net.minecraft.network.chat.*; import net.minecraft.network.chat.MutableComponent; diff --git a/src/main/java/com/majruszsdifficulty/gamestage/commands/ClampedRegionalDifficultyGetCommand.java b/src/main/java/com/majruszsdifficulty/gamestage/commands/ClampedRegionalDifficultyGetCommand.java index 70976acf5..13091bcee 100644 --- a/src/main/java/com/majruszsdifficulty/gamestage/commands/ClampedRegionalDifficultyGetCommand.java +++ b/src/main/java/com/majruszsdifficulty/gamestage/commands/ClampedRegionalDifficultyGetCommand.java @@ -1,7 +1,7 @@ package com.majruszsdifficulty.gamestage.commands; import com.majruszsdifficulty.gamestage.GameStage; -import com.mlib.annotations.AutoInstance; +import com.mlib.modhelper.AutoInstance; import com.mlib.commands.Command; import com.mlib.commands.CommandData; import com.mlib.levels.LevelHelper; diff --git a/src/main/java/com/majruszsdifficulty/gamestage/commands/GameStageChangeCommand.java b/src/main/java/com/majruszsdifficulty/gamestage/commands/GameStageChangeCommand.java index 5bd5725a5..dd19e671f 100644 --- a/src/main/java/com/majruszsdifficulty/gamestage/commands/GameStageChangeCommand.java +++ b/src/main/java/com/majruszsdifficulty/gamestage/commands/GameStageChangeCommand.java @@ -1,7 +1,7 @@ package com.majruszsdifficulty.gamestage.commands; import com.majruszsdifficulty.gamestage.GameStage; -import com.mlib.annotations.AutoInstance; +import com.mlib.modhelper.AutoInstance; import com.mlib.commands.Command; import com.mlib.commands.CommandData; import net.minecraft.network.chat.Component; diff --git a/src/main/java/com/majruszsdifficulty/gamestage/commands/GameStageGetCommand.java b/src/main/java/com/majruszsdifficulty/gamestage/commands/GameStageGetCommand.java index f0fb1943b..3747feda9 100644 --- a/src/main/java/com/majruszsdifficulty/gamestage/commands/GameStageGetCommand.java +++ b/src/main/java/com/majruszsdifficulty/gamestage/commands/GameStageGetCommand.java @@ -1,7 +1,7 @@ package com.majruszsdifficulty.gamestage.commands; import com.majruszsdifficulty.gamestage.GameStage; -import com.mlib.annotations.AutoInstance; +import com.mlib.modhelper.AutoInstance; import com.mlib.commands.Command; import com.mlib.commands.CommandData; import net.minecraft.network.chat.Component; diff --git a/src/main/java/com/majruszsdifficulty/gamestage/handlers/AdvancementProvider.java b/src/main/java/com/majruszsdifficulty/gamestage/handlers/AdvancementProvider.java index f5677a093..ae20a79c8 100644 --- a/src/main/java/com/majruszsdifficulty/gamestage/handlers/AdvancementProvider.java +++ b/src/main/java/com/majruszsdifficulty/gamestage/handlers/AdvancementProvider.java @@ -1,9 +1,9 @@ package com.majruszsdifficulty.gamestage.handlers; import com.majruszsdifficulty.Registries; -import com.majruszsdifficulty.gamemodifiers.contexts.OnGameStageChange; -import com.mlib.annotations.AutoInstance; -import com.mlib.gamemodifiers.Condition; +import com.majruszsdifficulty.contexts.OnGameStageChange; +import com.mlib.modhelper.AutoInstance; +import com.mlib.contexts.base.Condition; @AutoInstance public class AdvancementProvider { diff --git a/src/main/java/com/majruszsdifficulty/gamestage/handlers/ChatMessageSender.java b/src/main/java/com/majruszsdifficulty/gamestage/handlers/ChatMessageSender.java index cb88f18de..bb566d18f 100644 --- a/src/main/java/com/majruszsdifficulty/gamestage/handlers/ChatMessageSender.java +++ b/src/main/java/com/majruszsdifficulty/gamestage/handlers/ChatMessageSender.java @@ -1,12 +1,13 @@ package com.majruszsdifficulty.gamestage.handlers; import com.majruszsdifficulty.Registries; -import com.majruszsdifficulty.gamemodifiers.contexts.OnGameStageChange; +import com.majruszsdifficulty.contexts.OnGameStageChange; import com.majruszsdifficulty.gamestage.GameStage; -import com.mlib.annotations.AutoInstance; +import com.mlib.modhelper.AutoInstance; import com.mlib.data.JsonListener; +import com.mlib.data.SerializableList; import com.mlib.data.SerializableStructure; -import com.mlib.gamemodifiers.Condition; +import com.mlib.contexts.base.Condition; import net.minecraft.ChatFormatting; import net.minecraft.network.chat.MutableComponent; import net.minecraft.network.chat.TranslatableComponent; @@ -21,7 +22,7 @@ public class ChatMessageSender { final Supplier< Messages > messages; public ChatMessageSender() { - this.messages = JsonListener.add( "game_stages", Registries.getLocation( "messages" ), Messages.class, Messages::new ); + this.messages = JsonListener.add( "custom", Registries.getLocation( "game_stage_messages" ), Messages.class, Messages::new ); OnGameStageChange.listen( this::sendMessage ) .addCondition( Condition.predicate( data->!data.isLoadedFromDisk() ) ) @@ -41,11 +42,11 @@ private void sendMessage( OnGameStageChange.Data data ) { } ); } - static class Messages extends SerializableStructure { + static class Messages extends SerializableList { List< Message > messages = new ArrayList<>(); public Messages() { - this.define( null, ()->this.messages, x->this.messages = x, Message::new ); + this.defineCustom( ()->this.messages, x->this.messages = x, Message::new ); } public Stream< Message > stream() { @@ -59,9 +60,9 @@ static class Message extends SerializableStructure { ChatFormatting chatFormatting = null; public Message() { - this.define( "id", ()->this.id, x->this.id = x ); - this.define( "game_stage", ()->this.gameStage, x->this.gameStage = x, GameStage::values ); - this.define( "style", ()->this.chatFormatting, x->this.chatFormatting = x, ChatFormatting::values ); + this.defineString( "id", ()->this.id, x->this.id = x ); + this.defineEnum( "game_stage", ()->this.gameStage, x->this.gameStage = x, GameStage::values ); + this.defineEnum( "style", ()->this.chatFormatting, x->this.chatFormatting = x, ChatFormatting::values ); } } } diff --git a/src/main/java/com/majruszsdifficulty/gamestage/handlers/ClampedRegionalDifficultyIncreaser.java b/src/main/java/com/majruszsdifficulty/gamestage/handlers/ClampedRegionalDifficultyIncreaser.java index 12dfb0f6a..fffd46bc5 100644 --- a/src/main/java/com/majruszsdifficulty/gamestage/handlers/ClampedRegionalDifficultyIncreaser.java +++ b/src/main/java/com/majruszsdifficulty/gamestage/handlers/ClampedRegionalDifficultyIncreaser.java @@ -2,10 +2,10 @@ import com.majruszsdifficulty.Registries; import com.majruszsdifficulty.config.GameStageDoubleConfig; -import com.mlib.annotations.AutoInstance; +import com.mlib.modhelper.AutoInstance; import com.mlib.config.ConfigGroup; -import com.mlib.gamemodifiers.ModConfigs; -import com.mlib.gamemodifiers.contexts.OnClampedRegionalDifficultyGet; +import com.mlib.contexts.base.ModConfigs; +import com.mlib.contexts.OnClampedRegionalDifficultyGet; import com.mlib.math.Range; @AutoInstance diff --git a/src/main/java/com/majruszsdifficulty/gamestage/handlers/GameStageIncreaser.java b/src/main/java/com/majruszsdifficulty/gamestage/handlers/GameStageIncreaser.java index 24788095d..b4d59d426 100644 --- a/src/main/java/com/majruszsdifficulty/gamestage/handlers/GameStageIncreaser.java +++ b/src/main/java/com/majruszsdifficulty/gamestage/handlers/GameStageIncreaser.java @@ -1,24 +1,22 @@ package com.majruszsdifficulty.gamestage.handlers; import com.majruszsdifficulty.Registries; -import com.majruszsdifficulty.gamemodifiers.configs.StageProgressConfig; +import com.majruszsdifficulty.config.StageProgressConfig; import com.majruszsdifficulty.gamestage.GameStage; -import com.mlib.annotations.AutoInstance; -import com.mlib.config.BooleanConfig; +import com.mlib.modhelper.AutoInstance; import com.mlib.config.ConfigGroup; import com.mlib.config.EnumConfig; -import com.mlib.gamemodifiers.Condition; -import com.mlib.gamemodifiers.ModConfigs; -import com.mlib.gamemodifiers.contexts.OnDeath; -import com.mlib.gamemodifiers.contexts.OnDimensionChanged; +import com.mlib.contexts.base.Condition; +import com.mlib.contexts.base.ModConfigs; +import com.mlib.contexts.OnDeath; +import com.mlib.contexts.OnDimensionChanged; import net.minecraft.world.entity.EntityType; @AutoInstance public class GameStageIncreaser { static final EnumConfig< GameStage > DEFAULT_GAME_STAGE = new EnumConfig<>( GameStage.NORMAL ); - final StageProgressConfig expertMode = new StageProgressConfig( "none", "minecraft:the_nether" ); - final StageProgressConfig masterMode = new StageProgressConfig( "minecraft:ender_dragon", "none" ); - final BooleanConfig enteringAnyDimensionStartsExpertMode = new BooleanConfig( true ); + final StageProgressConfig expertMode = new StageProgressConfig( "", "{regex}.*" ); + final StageProgressConfig masterMode = new StageProgressConfig( "minecraft:ender_dragon", "" ); public static GameStage getDefaultGameStage() { return DEFAULT_GAME_STAGE.get(); @@ -27,15 +25,12 @@ public static GameStage getDefaultGameStage() { public GameStageIncreaser() { ConfigGroup group = ModConfigs.registerSubgroup( Registries.Groups.GAME_STAGE ) .addConfig( DEFAULT_GAME_STAGE.name( "default_mode" ).comment( "Game stage set at the beginning of a new world." ) ) - .addConfig( this.enteringAnyDimensionStartsExpertMode - .name( "any_dimension_expert" ) - .comment( "Determines whether any dimension should start Expert Mode (useful for integration with other mods)." ) - ).addConfig( this.expertMode.name( "ExpertMode" ).comment( "Determines what starts the Expert Mode." ) ) + .addConfig( this.expertMode.name( "ExpertMode" ).comment( "Determines what starts the Expert Mode." ) ) .addConfig( this.masterMode.name( "MasterMode" ).comment( "Determines what starts the Master Mode." ) ); OnDimensionChanged.listen( this::startExpertMode ) .addCondition( Condition.predicate( data->GameStage.getCurrentStage() == GameStage.NORMAL ) ) - .addCondition( Condition.predicate( data->this.expertMode.dimensionTriggersChange( data.to.location() ) || this.enteringAnyDimensionStartsExpertMode.isEnabled() ) ) + .addCondition( Condition.predicate( data->this.expertMode.dimensionTriggersChange( data.to.location() ) ) ) .insertTo( group ); OnDimensionChanged.listen( this::startMasterMode ) diff --git a/src/main/java/com/majruszsdifficulty/goals/UndeadArmyForgiveTeammateGoal.java b/src/main/java/com/majruszsdifficulty/goals/UndeadArmyForgiveTeammateGoal.java index 1d1001c0e..97ef1f542 100644 --- a/src/main/java/com/majruszsdifficulty/goals/UndeadArmyForgiveTeammateGoal.java +++ b/src/main/java/com/majruszsdifficulty/goals/UndeadArmyForgiveTeammateGoal.java @@ -4,8 +4,8 @@ import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.PathfinderMob; import net.minecraft.world.entity.ai.goal.Goal; +import net.minecraft.world.entity.ai.goal.target.HurtByTargetGoal; -/** Removes mob's target when both the mob and the target are from the Undead Army. */ public class UndeadArmyForgiveTeammateGoal extends Goal { final PathfinderMob mob; @@ -21,6 +21,10 @@ public boolean requiresUpdateEveryTick() { @Override public void tick() { this.mob.setTarget( null ); + this.mob.targetSelector.getRunningGoals() + .filter( wrappedGoal->wrappedGoal.getGoal() instanceof HurtByTargetGoal ) + .map( goal->( HurtByTargetGoal )goal.getGoal() ) + .forEach( HurtByTargetGoal::stop ); } @Override diff --git a/src/main/java/com/majruszsdifficulty/gui/BleedingGui.java b/src/main/java/com/majruszsdifficulty/gui/BleedingGui.java index 079731f3d..b1ea33f30 100644 --- a/src/main/java/com/majruszsdifficulty/gui/BleedingGui.java +++ b/src/main/java/com/majruszsdifficulty/gui/BleedingGui.java @@ -3,7 +3,7 @@ import com.majruszsdifficulty.Registries; import com.mlib.Random; import com.mlib.Utility; -import com.mlib.gamemodifiers.contexts.OnClientTick; +import com.mlib.contexts.OnClientTick; import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.client.Minecraft; diff --git a/src/main/java/com/majruszsdifficulty/items/BadOmenPotionItem.java b/src/main/java/com/majruszsdifficulty/items/BadOmenPotionItem.java deleted file mode 100644 index 334946dec..000000000 --- a/src/main/java/com/majruszsdifficulty/items/BadOmenPotionItem.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.majruszsdifficulty.items; - -import com.majruszsdifficulty.Registries; -import com.mlib.Utility; -import com.mlib.items.ItemHelper; -import com.mlib.mobeffects.MobEffectHelper; -import com.mlib.text.TextHelper; -import net.minecraft.ChatFormatting; -import net.minecraft.advancements.CriteriaTriggers; -import net.minecraft.network.chat.CommonComponents; -import net.minecraft.network.chat.*; -import net.minecraft.server.level.ServerPlayer; -import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResultHolder; -import net.minecraft.world.effect.MobEffects; -import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.player.Player; -import net.minecraft.world.item.*; -import net.minecraft.world.level.Level; - -import javax.annotation.Nullable; -import java.util.List; - -public class BadOmenPotionItem extends Item { - static final String TOOLTIP_ID = "item.majruszsdifficulty.bad_omen_potion.effect"; - - public BadOmenPotionItem() { - super( new Properties().tab( Registries.ITEM_GROUP ).rarity( Rarity.UNCOMMON ).stacksTo( 16 ) ); - } - - @Override - public InteractionResultHolder< ItemStack > use( Level world, Player player, InteractionHand hand ) { - return ItemUtils.startUsingInstantly( world, player, hand ); - } - - @Override - public ItemStack finishUsingItem( ItemStack itemStack, Level level, LivingEntity entity ) { - if( entity instanceof Player player ) { - ItemHelper.consumeItemOnUse( itemStack, player ); - } - if( entity instanceof ServerPlayer serverPlayer ) { - CriteriaTriggers.CONSUME_ITEM.trigger( serverPlayer, itemStack ); - MobEffectHelper.tryToStackAmplifier( serverPlayer, MobEffects.BAD_OMEN, Utility.minutesToTicks( 90.0 ), 0, 5 ); - } - - return itemStack; - } - - @Override - public UseAnim getUseAnimation( ItemStack itemStack ) { - return UseAnim.DRINK; - } - - @Override - public int getUseDuration( ItemStack itemStack ) { - return 32; - } - - @Override - public boolean isFoil( ItemStack itemStack ) { - return true; - } - - @Override - public void appendHoverText( ItemStack itemStack, @Nullable Level level, List< Component > components, TooltipFlag flag ) { - String amplifier = TextHelper.signed( 1 ); - - components.add( new TextComponent( "" ) ); - components.add( new TranslatableComponent( "potion.whenDrank" ).withStyle( ChatFormatting.DARK_PURPLE ) ); - components.add( new TranslatableComponent( TOOLTIP_ID, amplifier ).withStyle( ChatFormatting.BLUE ) ); - } -} diff --git a/src/main/java/com/majruszsdifficulty/items/BandageItem.java b/src/main/java/com/majruszsdifficulty/items/BandageItem.java index d53c9d135..cb4e4a2c2 100644 --- a/src/main/java/com/majruszsdifficulty/items/BandageItem.java +++ b/src/main/java/com/majruszsdifficulty/items/BandageItem.java @@ -3,13 +3,13 @@ import com.majruszsdifficulty.Registries; import com.majruszsdifficulty.effects.BleedingEffect; import com.mlib.Utility; -import com.mlib.annotations.AutoInstance; +import com.mlib.modhelper.AutoInstance; import com.mlib.config.ConfigGroup; import com.mlib.config.EffectConfig; import com.mlib.effects.SoundHandler; -import com.mlib.gamemodifiers.Condition; -import com.mlib.gamemodifiers.ModConfigs; -import com.mlib.gamemodifiers.contexts.OnPlayerInteract; +import com.mlib.contexts.base.Condition; +import com.mlib.contexts.base.ModConfigs; +import com.mlib.contexts.OnPlayerInteract; import com.mlib.items.ItemHelper; import com.mlib.text.TextHelper; import net.minecraft.ChatFormatting; @@ -19,7 +19,6 @@ import net.minecraft.server.level.ServerPlayer; import net.minecraft.util.StringUtil; import net.minecraft.world.InteractionResult; -import net.minecraft.world.effect.MobEffects; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.ai.gossip.GossipType; import net.minecraft.world.entity.npc.Villager; @@ -70,18 +69,18 @@ private MutableComponent buildComponent( EffectConfig config ) { public static class Effects { static Effects INSTANCE = null; final ConfigGroup bandageGroup = new ConfigGroup(); - final EffectConfig regeneration = new EffectConfig( MobEffects.REGENERATION, 0, 4.0 ); + final EffectConfig regeneration = new EffectConfig( Registries.GLASS_REGENERATION, 0, 20.0 ); final ConfigGroup goldenBandageGroup = new ConfigGroup(); - final EffectConfig goldenRegeneration = new EffectConfig( MobEffects.REGENERATION, 1, 4.0 ); - final EffectConfig goldenImmunity = new EffectConfig( Registries.BLEEDING_IMMUNITY, 0, 60.0 ); + final EffectConfig goldenRegeneration = new EffectConfig( Registries.GLASS_REGENERATION, 1, 20.0 ); + final EffectConfig goldenImmunity = new EffectConfig( Registries.BLEEDING_IMMUNITY, 0, 90.0 ); public Effects() { - ConfigGroup group = ModConfigs.registerSubgroup( Registries.Groups.DEFAULT ).name( "Bandages" ); + ConfigGroup group = ModConfigs.registerSubgroup( Registries.Groups.DEFAULT ); INSTANCE = this; - this.bandageGroup.addConfig( this.regeneration.name( "Regeneration" ) ); - this.goldenBandageGroup.addConfig( this.goldenRegeneration.name( "Regeneration" ) ) + this.bandageGroup.addConfig( this.regeneration.name( "RegenerativeWrap" ) ); + this.goldenBandageGroup.addConfig( this.goldenRegeneration.name( "RegenerativeWrap" ) ) .addConfig( this.goldenImmunity.name( "Immunity" ) ); OnPlayerInteract.listen( this::useBandage ) @@ -138,7 +137,11 @@ private static void increaseReputation( Villager villager, Player player ) { private static void removeBleeding( ItemStack itemStack, Player player, LivingEntity target ) { BleedingEffect bleeding = Registries.BLEEDING.get(); if( target.hasEffect( bleeding ) && player instanceof ServerPlayer serverPlayer ) { - Registries.BANDAGE_TRIGGER.trigger( serverPlayer, ( BandageItem )itemStack.getItem(), target.equals( serverPlayer ) ); + if( target.equals( serverPlayer ) ) { + Registries.HELPER.triggerAchievement( serverPlayer, "bandage_used" ); + } else if( itemStack.getItem() instanceof GoldenBandageItem ) { + Registries.HELPER.triggerAchievement( serverPlayer, "golden_bandage_used_on_others" ); + } } target.removeEffect( bleeding ); } diff --git a/src/main/java/com/majruszsdifficulty/items/EnderPouchItem.java b/src/main/java/com/majruszsdifficulty/items/EnderPouchItem.java index 78e092c24..3f210d6e8 100644 --- a/src/main/java/com/majruszsdifficulty/items/EnderPouchItem.java +++ b/src/main/java/com/majruszsdifficulty/items/EnderPouchItem.java @@ -2,8 +2,8 @@ import com.majruszsdifficulty.Registries; import com.mlib.effects.SoundHandler; -import com.mlib.gamemodifiers.Condition; -import com.mlib.gamemodifiers.contexts.OnPlayerInteract; +import com.mlib.contexts.base.Condition; +import com.mlib.contexts.OnPlayerInteract; import net.minecraft.server.level.ServerLevel; import net.minecraft.stats.Stats; import net.minecraft.world.InteractionResult; @@ -25,7 +25,7 @@ private void openEnderChest( OnPlayerInteract.Data data ) { data.player.awardStat( Stats.OPEN_ENDERCHEST ); data.player.swing( data.hand ); if( data.getLevel() instanceof ServerLevel level ) { - SoundHandler.ITEM_PICKUP.play( level, data.player.position(), SoundHandler.randomized( 0.5f ) ); + SoundHandler.ENDERMAN_TELEPORT.play( level, data.player.position(), SoundHandler.randomized( 0.5f ), SoundHandler.randomized( 0.7f ) ); } data.event.setCancellationResult( InteractionResult.SUCCESS ); } diff --git a/src/main/java/com/majruszsdifficulty/items/EnderiumHoeItem.java b/src/main/java/com/majruszsdifficulty/items/EnderiumHoeItem.java index 28b763297..ef471c5f6 100644 --- a/src/main/java/com/majruszsdifficulty/items/EnderiumHoeItem.java +++ b/src/main/java/com/majruszsdifficulty/items/EnderiumHoeItem.java @@ -1,10 +1,10 @@ package com.majruszsdifficulty.items; import com.majruszsdifficulty.Registries; -import com.mlib.annotations.AutoInstance; -import com.mlib.gamemodifiers.Condition; -import com.mlib.gamemodifiers.contexts.OnFarmlandTillCheck; -import com.mlib.gamemodifiers.contexts.OnItemAttributeTooltip; +import com.mlib.modhelper.AutoInstance; +import com.mlib.contexts.base.Condition; +import com.mlib.contexts.OnFarmlandTillCheck; +import com.mlib.contexts.OnItemAttributeTooltip; import net.minecraft.ChatFormatting; import net.minecraft.network.chat.*; import net.minecraft.world.entity.EquipmentSlot; diff --git a/src/main/java/com/majruszsdifficulty/items/EvokerFangScrollItem.java b/src/main/java/com/majruszsdifficulty/items/EvokerFangScrollItem.java new file mode 100644 index 000000000..ec16dca67 --- /dev/null +++ b/src/main/java/com/majruszsdifficulty/items/EvokerFangScrollItem.java @@ -0,0 +1,115 @@ +package com.majruszsdifficulty.items; + +import com.majruszsdifficulty.Registries; +import com.mlib.modhelper.AutoInstance; +import com.mlib.data.SerializableHelper; +import com.mlib.data.SerializableStructure; +import com.mlib.entities.EntityHelper; +import com.mlib.contexts.base.Condition; +import com.mlib.contexts.OnItemAttributeTooltip; +import com.mlib.contexts.OnPreDamaged; +import com.mlib.levels.LevelHelper; +import com.mlib.math.AnyPos; +import com.mlib.math.AnyRot; +import com.mlib.math.Range; +import net.minecraft.ChatFormatting; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.sounds.SoundEvent; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.util.Mth; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.projectile.EvokerFangs; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; +import net.minecraft.world.phys.Vec3; + +import java.util.ArrayList; +import java.util.List; + +public class EvokerFangScrollItem extends ScrollItem { + public static int ATTACK_DAMAGE = 12; + public static Range< Integer > ATTACK_RANGE = new Range<>( 8, 20 ); + + @Override + protected void useScroll( ItemStack itemStack, Level level, LivingEntity entity, float useRatio ) { + super.useScroll( itemStack, level, entity, useRatio ); + + double rotation = Math.toRadians( entity.getYRot() ) - Math.PI / 2.0; + this.getAttackPattern( entity, ( int )Mth.lerp( useRatio, ATTACK_RANGE.from, ATTACK_RANGE.to ) ) + .forEach( spawnPoint->{ + EvokerFangs evokerFangs = new EvokerFangs( level, spawnPoint.pos.x, spawnPoint.pos.y, spawnPoint.pos.z, ( float )rotation, spawnPoint.cooldown, entity ); + SerializableHelper.modify( DamageInfo::new, evokerFangs.getPersistentData(), damageInfo->damageInfo.extraDamage = ( int )( ATTACK_DAMAGE - 6.0f ) ); + + level.addFreshEntity( evokerFangs ); + } ); + } + + @Override + protected SoundEvent getPrepareSound() { + return SoundEvents.EVOKER_PREPARE_SUMMON; + } + + @Override + protected SoundEvent getCastSound() { + return SoundEvents.EVOKER_CAST_SPELL; + } + + private List< SpawnPoint > getAttackPattern( LivingEntity entity, int attackLength ) { + List< SpawnPoint > spawnPoints = new ArrayList<>(); + AnyRot lookRotation = EntityHelper.getLookRotation( entity ); + for( int x = 0; x <= attackLength; ++x ) { + for( int z = -1; z <= 1; ++z ) { + int cooldown = Math.abs( x ) + 4; + Vec3 position = AnyPos.from( entity.position() ).floor().add( AnyPos.from( x, 0, z ).rot( lookRotation ).round() ).vec3(); + LevelHelper.findBlockPosOnGround( entity.level, position.x, new Range<>( position.y - 3, position.y + 3 ), position.z ) + .ifPresent( blockPos->spawnPoints.add( new SpawnPoint( AnyPos.from( blockPos ).add( 0.5, 0.0, 0.5 ).vec3(), cooldown ) ) ); + } + } + + return spawnPoints; + } + + private record SpawnPoint( Vec3 pos, int cooldown ) {} + + @AutoInstance + public static class Spell { + public Spell() { + OnPreDamaged.listen( this::increaseDamage ) + .addCondition( Condition.isServer() ) + .addCondition( Condition.predicate( data->data.source.getDirectEntity() instanceof EvokerFangs ) ) + .addCondition( OnPreDamaged.dealtAnyDamage() ); + } + + private void increaseDamage( OnPreDamaged.Data data ) { + DamageInfo damageInfo = SerializableHelper.read( DamageInfo::new, data.source.getDirectEntity().getPersistentData() ); + + data.extraDamage += damageInfo.extraDamage; + } + } + + @AutoInstance + public static class Tooltip { + public Tooltip() { + OnItemAttributeTooltip.listen( this::addSpellInfo ) + .addCondition( Condition.predicate( data->data.itemStack.is( Registries.EVOKER_FANG_SCROLL.get() ) ) ); + } + + private void addSpellInfo( OnItemAttributeTooltip.Data data ) { + List.of( + new TranslatableComponent( "majruszsdifficulty.scrolls.attack_damage", ATTACK_DAMAGE ).withStyle( ChatFormatting.DARK_GREEN ), + new TranslatableComponent( "majruszsdifficulty.scrolls.attack_range", "%d-%d".formatted( ATTACK_RANGE.from, ATTACK_RANGE.to ) ) + .withStyle( ChatFormatting.DARK_GREEN ) + ).forEach( component->data.add( EquipmentSlot.MAINHAND, component ) ); + } + } + + private static class DamageInfo extends SerializableStructure { + int extraDamage = 0; + + public DamageInfo() { + this.defineInteger( "MajruszsProgressiveDifficultyEvokerFangDamage", ()->this.extraDamage, x->this.extraDamage = x ); + } + } +} diff --git a/src/main/java/com/majruszsdifficulty/items/RecallPotionItem.java b/src/main/java/com/majruszsdifficulty/items/RecallPotionItem.java index 76d947f04..a2ef0a77d 100644 --- a/src/main/java/com/majruszsdifficulty/items/RecallPotionItem.java +++ b/src/main/java/com/majruszsdifficulty/items/RecallPotionItem.java @@ -58,11 +58,6 @@ public int getUseDuration( ItemStack itemStack ) { return 32; } - @Override - public boolean isFoil( ItemStack itemStack ) { - return true; - } - @Override public void appendHoverText( ItemStack itemStack, @Nullable Level level, List< Component > components, TooltipFlag flag ) { components.add( new TextComponent( "" ) ); diff --git a/src/main/java/com/majruszsdifficulty/items/ScrollItem.java b/src/main/java/com/majruszsdifficulty/items/ScrollItem.java new file mode 100644 index 000000000..ea8c02fce --- /dev/null +++ b/src/main/java/com/majruszsdifficulty/items/ScrollItem.java @@ -0,0 +1,79 @@ +package com.majruszsdifficulty.items; + +import com.majruszsdifficulty.Registries; +import com.mlib.Utility; +import com.mlib.effects.SoundHandler; +import com.mlib.items.ItemHelper; +import net.minecraft.sounds.SoundEvent; +import net.minecraft.sounds.SoundSource; +import net.minecraft.util.Mth; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResultHolder; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.*; +import net.minecraft.world.level.Level; + +import java.util.function.Supplier; + +public abstract class ScrollItem extends Item { + public static final int MIN_DURATION = Utility.secondsToTicks( 1.0 ); + + public ScrollItem() { + super( new Properties().tab( Registries.ITEM_GROUP ).rarity( Rarity.UNCOMMON ).stacksTo( 1 ) ); + } + + @Override + public InteractionResultHolder< ItemStack > use( Level level, Player player, InteractionHand hand ) { + this.playSound( this::getPrepareSound, level, player, 1.0f ); + + return ItemUtils.startUsingInstantly( level, player, hand ); + } + + @Override + public ItemStack finishUsingItem( ItemStack itemStack, Level level, LivingEntity entity ) { + this.useScroll( itemStack, level, entity, 1.0f ); + + return itemStack; + } + + @Override + public void releaseUsing( ItemStack itemStack, Level level, LivingEntity entity, int ticksLeft ) { + if( ( this.getUseDuration( itemStack ) - ticksLeft ) < MIN_DURATION ) { + this.disableItem( itemStack, entity, Utility.secondsToTicks( 1.0 ) ); + return; + } + + float useRatio = Mth.clamp( 1.0f - ( float )ticksLeft / ( this.getUseDuration( itemStack ) - MIN_DURATION ), 0.0f, 1.0f ); + this.useScroll( itemStack, level, entity, useRatio ); + } + + @Override + public UseAnim getUseAnimation( ItemStack itemStack ) { + return UseAnim.BOW; + } + + @Override + public int getUseDuration( ItemStack itemStack ) { + return Utility.secondsToTicks( 3.0 ); + } + + protected void useScroll( ItemStack itemStack, Level level, LivingEntity entity, float useRatio ) { + this.disableItem( itemStack, entity, Utility.secondsToTicks( 16.0 ) ); + this.playSound( this::getCastSound, level, entity, 2.0f ); + } + + protected void playSound( Supplier< SoundEvent > sound, Level level, LivingEntity entity, float volumeScale ) { + new SoundHandler( sound.get(), SoundSource.PLAYERS, SoundHandler.randomized( volumeScale ) ).play( level, entity.position() ); + } + + protected void disableItem( ItemStack itemStack, LivingEntity entity, int ticks ) { + if( entity instanceof Player player ) { + ItemHelper.addCooldown( player, ticks, itemStack.getItem() ); + } + } + + protected abstract SoundEvent getPrepareSound(); + + protected abstract SoundEvent getCastSound(); +} diff --git a/src/main/java/com/majruszsdifficulty/items/SoulJarItem.java b/src/main/java/com/majruszsdifficulty/items/SoulJarItem.java index c118c0d29..f9a7d19d8 100644 --- a/src/main/java/com/majruszsdifficulty/items/SoulJarItem.java +++ b/src/main/java/com/majruszsdifficulty/items/SoulJarItem.java @@ -1,21 +1,22 @@ package com.majruszsdifficulty.items; import com.majruszsdifficulty.Registries; -import com.majruszsdifficulty.gamemodifiers.contexts.OnSoulJarMultiplier; -import com.mlib.annotations.AutoInstance; +import com.majruszsdifficulty.contexts.OnSoulJarMultiplier; +import com.mlib.modhelper.AutoInstance; import com.mlib.attributes.AttributeHandler; +import com.mlib.data.SerializableHelper; import com.mlib.data.SerializableStructure; import com.mlib.effects.SoundHandler; -import com.mlib.gamemodifiers.Condition; -import com.mlib.gamemodifiers.contexts.*; +import com.mlib.contexts.base.Condition; +import com.mlib.contexts.*; import com.mlib.text.TextHelper; import net.minecraft.ChatFormatting; import net.minecraft.client.Minecraft; -import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; import net.minecraft.network.chat.TextComponent; import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.server.level.ServerLevel; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResultHolder; import net.minecraft.world.entity.*; @@ -27,30 +28,26 @@ import net.minecraft.world.item.Rarity; import net.minecraft.world.level.Level; import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.common.ForgeMod; import net.minecraftforge.fml.DistExecutor; import javax.annotation.Nullable; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; +import java.util.*; import java.util.function.Function; public class SoulJarItem extends Item { static final float DAMAGE_BONUS = 2.5f; static final float MOVE_BONUS = 0.15f; static final float RANGE_BONUS = 0.5f; - static final int ARMOR_BONUS = 2; + static final int ARMOR_BONUS = 3; static final float MINE_BONUS = 0.15f; static final int LUCK_BONUS = 1; static final float SWIM_BONUS = 0.30f; public static ItemStack randomItemStack( int bonusCount ) { ItemStack itemStack = new ItemStack( Registries.SOUL_JAR.get() ); - BonusInfo bonusInfo = new BonusInfo( itemStack.getOrCreateTag() ); - bonusInfo.bonusCount = bonusCount; - bonusInfo.write( itemStack.getOrCreateTag() ); + SerializableHelper.modify( BonusInfo::new, itemStack.getOrCreateTag(), info->info.bonusCount = bonusCount ); return itemStack; } @@ -59,19 +56,16 @@ public SoulJarItem() { super( new Properties().stacksTo( 1 ).rarity( Rarity.UNCOMMON ).tab( Registries.ITEM_GROUP ) ); } - @Override - public boolean isFoil( ItemStack itemStack ) { - return new BonusInfo( itemStack.getOrCreateTag() ).hasBonuses(); - } - @Override public InteractionResultHolder< ItemStack > use( Level level, Player player, InteractionHand hand ) { ItemStack itemStack = player.getItemInHand( hand ); - BonusInfo bonusInfo = new BonusInfo( itemStack.getOrCreateTag() ); + BonusInfo bonusInfo = SerializableHelper.read( BonusInfo::new, itemStack.getOrCreateTag() ); if( bonusInfo.bonusMask == 0b0 ) { - bonusInfo.randomize(); - bonusInfo.write( itemStack.getOrCreateTag() ); - SoundHandler.ENCHANT.play( level, player.position() ); + if( level instanceof ServerLevel ) { + bonusInfo.randomize(); + bonusInfo.write( itemStack.getOrCreateTag() ); + SoundHandler.ENCHANT.play( level, player.position() ); + } return InteractionResultHolder.sidedSuccess( itemStack, level.isClientSide() ); } @@ -91,7 +85,10 @@ public Handler() { .addCondition( Condition.predicate( data->hasBonus( data.attacker, BonusType.DAMAGE ) ) ); OnBreakSpeed.listen( this::increaseSpeed ) - .addCondition( Condition.predicate( data->hasBonus( data.player, BonusType.MINING ) ) ); + .addCondition( Condition.predicate( data->hasBonus( data.player, BonusType.MINE ) ) ); + + OnLoot.listen( this::applyRandomSouls ) + .addCondition( Condition.isServer() ); OnItemAttributeTooltip.listen( this::addTooltip ) .addCondition( Condition.predicate( data->data.itemStack.getItem() instanceof SoulJarItem ) ); @@ -105,7 +102,7 @@ private static boolean hasBonus( @Nullable Entity entity, BonusType bonusType ) if( !( itemStack.getItem() instanceof SoulJarItem ) ) return false; - return new BonusInfo( itemStack.getOrCreateTag() ) + return SerializableHelper.read( BonusInfo::new, itemStack.getOrCreateTag() ) .getBonusTypes() .contains( bonusType ); } @@ -154,9 +151,23 @@ private void increaseSpeed( OnBreakSpeed.Data data ) { data.event.setNewSpeed( data.event.getNewSpeed() + data.event.getOriginalSpeed() * MINE_BONUS * getMultiplier( data.player ) ); } + private void applyRandomSouls( OnLoot.Data data ) { + for( ItemStack itemStack : data.generatedLoot ) { + if( !( itemStack.getItem() instanceof SoulJarItem ) ) { + continue; + } + + SerializableHelper.modify( BonusInfo::new, itemStack.getOrCreateTag(), bonusInfo->{ + if( bonusInfo.bonusMask == 0b0 ) { + bonusInfo.randomize(); + } + } ); + } + } + private void addTooltip( OnItemAttributeTooltip.Data data ) { Player player = DistExecutor.unsafeCallWhenOn( Dist.CLIENT, ()->()->Minecraft.getInstance().player ); - BonusInfo bonusInfo = new BonusInfo( data.itemStack.getOrCreateTag() ); + BonusInfo bonusInfo = SerializableHelper.read( BonusInfo::new, data.itemStack.getOrCreateTag() ); float multiplier = getMultiplier( player, data.itemStack ); for( BonusType bonusType : bonusInfo.getBonusTypes() ) { data.add( EquipmentSlot.OFFHAND, bonusType.getBonusComponent( multiplier ) ); @@ -164,7 +175,7 @@ private void addTooltip( OnItemAttributeTooltip.Data data ) { } private void addTooltip( OnItemTooltip.Data data ) { - BonusInfo bonusInfo = new BonusInfo( data.itemStack.getOrCreateTag() ); + BonusInfo bonusInfo = SerializableHelper.read( BonusInfo::new, data.itemStack.getOrCreateTag() ); if( bonusInfo.hasBonuses() ) { MutableComponent souls = new TextComponent( "" ); for( BonusType bonusType : bonusInfo.getBonusTypes() ) { @@ -181,13 +192,11 @@ public static class BonusInfo extends SerializableStructure { public int bonusMask = 0b0; public int bonusCount = 3; - public BonusInfo( CompoundTag tag ) { + public BonusInfo() { super( "SoulJar" ); - this.define( "BonusMask", ()->this.bonusMask, x->this.bonusMask = x ); - this.define( "BonusCount", ()->this.bonusCount, x->this.bonusCount = x ); - - this.read( tag ); + this.defineInteger( "BonusMask", ()->this.bonusMask, x->this.bonusMask = x ); + this.defineInteger( "BonusCount", ()->this.bonusCount, x->this.bonusCount = x ); } public void randomize() { @@ -228,7 +237,7 @@ public enum BonusType { MOVE( 1 << 1, "item.majruszsdifficulty.soul_jar.move", "entity.minecraft.horse", ChatFormatting.WHITE, multiplier->TextHelper.signedPercent( MOVE_BONUS * multiplier ) ), RANGE( 1 << 2, "item.majruszsdifficulty.soul_jar.range", "entity.minecraft.enderman", ChatFormatting.DARK_PURPLE, multiplier->TextHelper.signed( RANGE_BONUS * multiplier ) ), ARMOR( 1 << 3, "item.majruszsdifficulty.soul_jar.armor", "entity.majruszsdifficulty.tank", ChatFormatting.BLUE, multiplier->TextHelper.signed( ( int )( ARMOR_BONUS * multiplier ) ) ), - MINING( 1 << 4, "item.majruszsdifficulty.soul_jar.mine", "entity.minecraft.sniffer", ChatFormatting.YELLOW, multiplier->TextHelper.signedPercent( MINE_BONUS * multiplier ) ), + MINE( 1 << 4, "item.majruszsdifficulty.soul_jar.mine", "entity.minecraft.sniffer", ChatFormatting.YELLOW, multiplier->TextHelper.signedPercent( MINE_BONUS * multiplier ) ), LUCK( 1 << 5, "item.majruszsdifficulty.soul_jar.luck", "entity.minecraft.rabbit", ChatFormatting.GREEN, multiplier->TextHelper.signed( ( int )( LUCK_BONUS * multiplier ) ) ), SWIM( 1 << 6, "item.majruszsdifficulty.soul_jar.swim", "entity.minecraft.dolphin", ChatFormatting.AQUA, multiplier->TextHelper.signedPercent( SWIM_BONUS * multiplier ) ); @@ -256,4 +265,27 @@ public Component getSoulComponent() { .withStyle( this.soulFormatting ); } } + + @OnlyIn( Dist.CLIENT ) + public static class ItemColor implements net.minecraft.client.color.item.ItemColor { + static final Map< BonusType, Integer > COLOR_MAPPING = Map.of( + BonusType.DAMAGE, 0xcc5555, + BonusType.MOVE, 0xdddddd, + BonusType.RANGE, 0xcc55cc, + BonusType.ARMOR, 0x5555cc, + BonusType.MINE, 0xcccc55, + BonusType.LUCK, 0x55cc55, + BonusType.SWIM, 0x55cccc + ); + + @Override + public int getColor( ItemStack itemStack, int index ) { + if( index == 0 ) { + return 0xffffff; + } + + BonusInfo bonusInfo = SerializableHelper.read( BonusInfo::new, itemStack.getOrCreateTag() ); + return bonusInfo.hasBonuses() ? COLOR_MAPPING.get( bonusInfo.getBonusTypes().get( index - 1 ) ) : 0xeeeeee - index * 0x111111; + } + } } diff --git a/src/main/java/com/majruszsdifficulty/items/TatteredArmorItem.java b/src/main/java/com/majruszsdifficulty/items/TatteredArmorItem.java index 71e6e3806..6a139aab7 100644 --- a/src/main/java/com/majruszsdifficulty/items/TatteredArmorItem.java +++ b/src/main/java/com/majruszsdifficulty/items/TatteredArmorItem.java @@ -4,6 +4,7 @@ import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.item.*; +import net.minecraft.world.entity.LivingEntity; import javax.annotation.Nullable; @@ -22,6 +23,11 @@ public static class Boots extends TatteredArmorItem { public Boots() { super( EquipmentSlot.FEET ); } + + @Override + public boolean canWalkOnPowderedSnow( ItemStack itemStack, LivingEntity wearer ) { + return itemStack.getItem().equals( this ); + } } public static class Chestplate extends TatteredArmorItem { diff --git a/src/main/java/com/majruszsdifficulty/items/TreasureBagItem.java b/src/main/java/com/majruszsdifficulty/items/TreasureBagItem.java index ec192ea4a..72326244e 100644 --- a/src/main/java/com/majruszsdifficulty/items/TreasureBagItem.java +++ b/src/main/java/com/majruszsdifficulty/items/TreasureBagItem.java @@ -1,14 +1,14 @@ package com.majruszsdifficulty.items; -import com.majruszsdifficulty.MajruszsHelper; import com.majruszsdifficulty.Registries; import com.majruszsdifficulty.config.GameStageIntegerConfig; -import com.majruszsdifficulty.gamemodifiers.configs.TreasureBagConfig; -import com.majruszsdifficulty.gamemodifiers.contexts.OnTreasureBagOpened; +import com.majruszsdifficulty.config.TreasureBagConfig; +import com.majruszsdifficulty.contexts.OnTreasureBagOpened; import com.majruszsdifficulty.treasurebags.TreasureBagProgressClient; import com.mlib.effects.SoundHandler; import com.mlib.items.ItemHelper; import com.mlib.math.Range; +import net.minecraft.ChatFormatting; import net.minecraft.network.chat.*; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerLevel; @@ -85,7 +85,10 @@ public InteractionResultHolder< ItemStack > use( Level level, Player player, Int @Override @OnlyIn( Dist.CLIENT ) public void appendHoverText( ItemStack itemStack, @Nullable Level world, List< Component > tooltip, TooltipFlag flag ) { - MajruszsHelper.addAdvancedTranslatableTexts( tooltip, flag, ITEM_TOOLTIP_TRANSLATION_KEY, " " ); + if( flag.isAdvanced() ) { + tooltip.add( new TranslatableComponent( ITEM_TOOLTIP_TRANSLATION_KEY ).withStyle( ChatFormatting.GRAY ) ); + tooltip.add( new TranslatableComponent( " " ) ); + } tooltip.addAll( TreasureBagProgressClient.getTextComponents( this ) ); } @@ -109,7 +112,7 @@ private void triggerTreasureBagAdvancement( ServerPlayer player ) { } public static class UndeadArmy extends TreasureBagItem { - public static final ResourceLocation LOCATION = Registries.getLocation( "gameplay/undead_army_treasure_loot" ); + public static final ResourceLocation LOCATION = Registries.getLocation( "gameplay/treasure_bag_undead_army" ); public static final TreasureBagConfig CONFIG = new TreasureBagConfig( "UndeadArmy" ); public UndeadArmy() { @@ -118,7 +121,7 @@ public UndeadArmy() { } public static class ElderGuardian extends TreasureBagItem { - public static final ResourceLocation LOCATION = Registries.getLocation( "gameplay/elder_guardian_treasure_loot" ); + public static final ResourceLocation LOCATION = Registries.getLocation( "gameplay/treasure_bag_elder_guardian" ); public static final TreasureBagConfig CONFIG = new TreasureBagConfig( "ElderGuardian" ); public ElderGuardian() { @@ -127,7 +130,7 @@ public ElderGuardian() { } public static class Wither extends TreasureBagItem { - public static final ResourceLocation LOCATION = Registries.getLocation( "gameplay/wither_treasure_loot" ); + public static final ResourceLocation LOCATION = Registries.getLocation( "gameplay/treasure_bag_wither" ); public static final TreasureBagConfig CONFIG = new TreasureBagConfig( "Wither" ); public Wither() { @@ -136,7 +139,7 @@ public Wither() { } public static class EnderDragon extends TreasureBagItem { - public static final ResourceLocation LOCATION = Registries.getLocation( "gameplay/ender_dragon_treasure_loot" ); + public static final ResourceLocation LOCATION = Registries.getLocation( "gameplay/treasure_bag_ender_dragon" ); public static final TreasureBagConfig CONFIG = new TreasureBagConfig( "EnderDragon" ); public EnderDragon() { @@ -145,7 +148,7 @@ public EnderDragon() { } public static class Fishing extends TreasureBagItem { - public static final ResourceLocation LOCATION = Registries.getLocation( "gameplay/fishing_treasure_loot" ); + public static final ResourceLocation LOCATION = Registries.getLocation( "gameplay/treasure_bag_fishing" ); public static final TreasureBagConfig CONFIG = new TreasureBagConfig( "Fishing" ); public static final GameStageIntegerConfig REQUIRED_FISH_COUNT = new GameStageIntegerConfig( 20, 15, 10, new Range<>( 3, 100 ) ); @@ -159,7 +162,7 @@ public Fishing() { } public static class Pillager extends TreasureBagItem { - public static final ResourceLocation LOCATION = Registries.getLocation( "gameplay/pillager_treasure_loot" ); + public static final ResourceLocation LOCATION = Registries.getLocation( "gameplay/treasure_bag_pillager" ); public static final TreasureBagConfig CONFIG = new TreasureBagConfig( "PillagerRaid" ); public Pillager() { diff --git a/src/main/java/com/majruszsdifficulty/items/UndeadBattleStandardItem.java b/src/main/java/com/majruszsdifficulty/items/UndeadBattleStandardItem.java index 8ddb19f4f..2b7489243 100644 --- a/src/main/java/com/majruszsdifficulty/items/UndeadBattleStandardItem.java +++ b/src/main/java/com/majruszsdifficulty/items/UndeadBattleStandardItem.java @@ -1,9 +1,9 @@ package com.majruszsdifficulty.items; -import com.majruszsdifficulty.MajruszsHelper; import com.majruszsdifficulty.Registries; import com.mlib.items.ItemHelper; import net.minecraft.network.chat.*; +import net.minecraft.ChatFormatting; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResultHolder; import net.minecraft.world.entity.player.Player; @@ -41,7 +41,10 @@ public InteractionResultHolder< ItemStack > use( Level world, Player player, Int @Override @OnlyIn( Dist.CLIENT ) public void appendHoverText( ItemStack itemStack, @Nullable Level world, List< Component > tooltip, TooltipFlag flag ) { - tooltip.add( new TranslatableComponent( TOOLTIP_TRANSLATION_KEY_1 ) ); - MajruszsHelper.addAdvancedTranslatableTexts( tooltip, flag, TOOLTIP_TRANSLATION_KEY_2, TOOLTIP_TRANSLATION_KEY_3 ); + tooltip.add( new TranslatableComponent( TOOLTIP_TRANSLATION_KEY_1 ).withStyle( ChatFormatting.GRAY ) ); + if( flag.isAdvanced() ) { + tooltip.add( new TranslatableComponent( TOOLTIP_TRANSLATION_KEY_2 ).withStyle( ChatFormatting.GRAY ) ); + tooltip.add( new TranslatableComponent( TOOLTIP_TRANSLATION_KEY_3 ).withStyle( ChatFormatting.GRAY ) ); + } } } diff --git a/src/main/java/com/majruszsdifficulty/items/WitherSwordItem.java b/src/main/java/com/majruszsdifficulty/items/WitherSwordItem.java index 7717ad3a7..99f649ce3 100644 --- a/src/main/java/com/majruszsdifficulty/items/WitherSwordItem.java +++ b/src/main/java/com/majruszsdifficulty/items/WitherSwordItem.java @@ -1,24 +1,43 @@ package com.majruszsdifficulty.items; import com.majruszsdifficulty.Registries; -import com.mlib.annotations.AutoInstance; +import com.majruszsdifficulty.contexts.base.CustomConditions; +import com.majruszsdifficulty.gamestage.GameStage; +import com.mlib.modhelper.AutoInstance; import com.mlib.config.ConfigGroup; import com.mlib.config.EffectConfig; -import com.mlib.gamemodifiers.Condition; -import com.mlib.gamemodifiers.ModConfigs; -import com.mlib.gamemodifiers.contexts.OnDamaged; -import com.mlib.gamemodifiers.contexts.OnItemAttributeTooltip; +import com.mlib.data.SerializableHelper; +import com.mlib.data.SerializableStructure; +import com.mlib.effects.ParticleHandler; +import com.mlib.entities.EntityHelper; +import com.mlib.contexts.base.Condition; +import com.mlib.contexts.base.ModConfigs; +import com.mlib.contexts.OnDamaged; +import com.mlib.contexts.OnDeath; +import com.mlib.contexts.OnItemAttributeTooltip; import com.mlib.items.ItemHelper; import com.mlib.mobeffects.MobEffectHelper; import com.mlib.text.TextHelper; +import com.mlib.time.Time; import net.minecraft.ChatFormatting; import net.minecraft.network.chat.*; +import net.minecraft.server.level.ServerLevel; import net.minecraft.world.effect.MobEffects; +import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.entity.MobSpawnType; +import net.minecraft.world.entity.monster.Skeleton; import net.minecraft.world.item.Rarity; import net.minecraft.world.item.SwordItem; +import net.minecraft.world.phys.Vec3; public class WitherSwordItem extends SwordItem { + static final String GROUP_ID = Registries.getLocationString( "wither_sword" ); + + static { + ModConfigs.init( Registries.Groups.DEFAULT, GROUP_ID ).name( "WitherSword" ); + } + public WitherSwordItem() { super( CustomItemTier.WITHER, 3, -2.4f, new Properties().tab( Registries.ITEM_GROUP ).rarity( Rarity.UNCOMMON ) ); } @@ -29,8 +48,8 @@ public static class Effect { final EffectConfig wither = new EffectConfig( MobEffects.WITHER, 1, 6.0 ); public Effect() { - ConfigGroup group = ModConfigs.registerSubgroup( Registries.Groups.DEFAULT ) - .name( "WitherSwordEffect" ) + ConfigGroup group = ModConfigs.registerSubgroup( GROUP_ID ) + .name( "Effect" ) .comment( "Wither Sword inflicts wither effect." ); OnDamaged.listen( this::applyWither ) @@ -56,4 +75,58 @@ private void addTooltip( OnItemAttributeTooltip.Data data ) { } } + @AutoInstance + public static class TurnSkeletonIntoWitherSkeleton { + public TurnSkeletonIntoWitherSkeleton() { + ConfigGroup group = ModConfigs.registerSubgroup( GROUP_ID ) + .name( "TransformSkeletons" ) + .comment( "If the Skeleton dies from Wither Sword it will respawn as Wither Skeleton in a few seconds." ); + + OnDamaged.listen( this::applyWitherTag ) + .addCondition( Condition.predicate( data->data.attacker != null ) ) + .addCondition( Condition.predicate( data->data.attacker.getMainHandItem().getItem() instanceof WitherSwordItem ) ) + .addCondition( Condition.predicate( data->data.target instanceof Skeleton ) ) + .insertTo( group ); + + OnDeath.listen( this::spawnWitherSkeleton ) + .addCondition( Condition.isServer() ) + .addCondition( CustomConditions.gameStageAtLeast( GameStage.MASTER ) ) + .addCondition( Condition.chanceCRD( 0.5, true ) ) + .addCondition( Condition.excludable() ) + .addCondition( Condition.predicate( data->SerializableHelper.read( Data::new, data.target.getPersistentData() ).hasWitherTag ) ) + .insertTo( group ); + } + + private void applyWitherTag( OnDamaged.Data data ) { + SerializableHelper.modify( Data::new, data.target.getPersistentData(), subdata->subdata.hasWitherTag = true ); + } + + private void spawnWitherSkeleton( OnDeath.Data data ) { + ServerLevel level = data.getServerLevel(); + Time.slider( 7.0, slider->{ + Vec3 position = data.target.position().add( 0.0, 1.0, 0.0 ); + if( slider.getTicksLeft() % 5 == 0 ) { + ParticleHandler.SOUL.spawn( level, position, ( int )( slider.getRatio() * 10 ), ParticleHandler.offset( slider.getRatio() ) ); + } + if( slider.getTicksLeft() == 2 ) { + ParticleHandler.SOUL.spawn( level, position, 100, ParticleHandler.offset( 0.5f ) ); + ParticleHandler.SOUL.spawn( level, position, 100, ParticleHandler.offset( 1.0f ) ); + } + if( slider.isFinished() ) { + EntityHelper.createSpawner( EntityType.WITHER_SKELETON, level ) + .mobSpawnType( MobSpawnType.EVENT ) + .position( data.target.position() ) + .spawn(); + } + } ); + } + + private static class Data extends SerializableStructure { + boolean hasWitherTag = false; + + public Data() { + this.defineBoolean( "MajruszsDifficultyWitherTag", ()->this.hasWitherTag, x->this.hasWitherTag = x ); + } + } + } } diff --git a/src/main/java/com/majruszsdifficulty/itemsets/EnderiumSet.java b/src/main/java/com/majruszsdifficulty/itemsets/EnderiumSet.java index 2a2dec938..c20cccaae 100644 --- a/src/main/java/com/majruszsdifficulty/itemsets/EnderiumSet.java +++ b/src/main/java/com/majruszsdifficulty/itemsets/EnderiumSet.java @@ -3,14 +3,14 @@ import com.majruszsdifficulty.Registries; import com.mlib.Random; import com.mlib.Utility; -import com.mlib.annotations.AutoInstance; +import com.mlib.modhelper.AutoInstance; import com.mlib.effects.ParticleHandler; import com.mlib.entities.EntityHelper; -import com.mlib.gamemodifiers.Condition; -import com.mlib.gamemodifiers.contexts.OnChorusFruitTeleport; -import com.mlib.gamemodifiers.contexts.OnDeath; -import com.mlib.gamemodifiers.contexts.OnEnderManAnger; -import com.mlib.gamemodifiers.contexts.OnLootLevel; +import com.mlib.contexts.base.Condition; +import com.mlib.contexts.OnChorusFruitTeleport; +import com.mlib.contexts.OnDeath; +import com.mlib.contexts.OnEnderManAnger; +import com.mlib.contexts.OnLootLevel; import com.mlib.itemsets.BonusData; import com.mlib.itemsets.ItemData; import com.mlib.itemsets.ItemSet; @@ -87,7 +87,7 @@ private void giveRandomPotionEffect( OnChorusFruitTeleport.Data data ) { .filter( effect->MobEffectHelper.getAmplifier( data.event.getEntityLiving(), effect ) == -1 ) .toList(); - MobEffectHelper.tryToApply( data.event.getEntityLiving(), Random.nextRandom( !notAppliedEffects.isEmpty() ? notAppliedEffects : List.of( EFFECTS ) ), Utility.minutesToTicks( 1.5 ), 0 ); + MobEffectHelper.tryToApply( data.event.getEntityLiving(), Random.next( !notAppliedEffects.isEmpty() ? notAppliedEffects : List.of( EFFECTS ) ), Utility.minutesToTicks( 1.5 ), 0 ); data.event.setCanceled( true ); } diff --git a/src/main/java/com/majruszsdifficulty/itemsets/UndeadSet.java b/src/main/java/com/majruszsdifficulty/itemsets/UndeadSet.java index f0aa6413d..87233d342 100644 --- a/src/main/java/com/majruszsdifficulty/itemsets/UndeadSet.java +++ b/src/main/java/com/majruszsdifficulty/itemsets/UndeadSet.java @@ -1,12 +1,12 @@ package com.majruszsdifficulty.itemsets; import com.majruszsdifficulty.Registries; -import com.majruszsdifficulty.gamemodifiers.contexts.OnSoulJarMultiplier; -import com.mlib.annotations.AutoInstance; +import com.majruszsdifficulty.contexts.OnSoulJarMultiplier; +import com.mlib.modhelper.AutoInstance; import com.mlib.attributes.AttributeHandler; -import com.mlib.gamemodifiers.Condition; -import com.mlib.gamemodifiers.contexts.OnFoodPropertiesGet; -import com.mlib.gamemodifiers.contexts.OnItemEquipped; +import com.mlib.contexts.base.Condition; +import com.mlib.contexts.OnFoodPropertiesGet; +import com.mlib.contexts.OnItemEquipped; import com.mlib.itemsets.BonusData; import com.mlib.itemsets.ItemData; import com.mlib.itemsets.ItemSet; @@ -28,7 +28,7 @@ public class UndeadSet extends ItemSet { static final FoodProperties FLESH_NO_EFFECT = new FoodProperties.Builder().nutrition( 4 ).saturationMod( 0.1f ).meat().build(); static final FoodProperties FLESH_EXTRA_HUNGER = new FoodProperties.Builder().nutrition( 4 * 2 ).saturationMod( 0.1f ).meat().build(); static final AttributeHandler ARMOR_ATTRIBUTE = new AttributeHandler( "6bf545e0-8f10-483b-9c2d-6ab369e2cb1f", "UndeadSetArmorBonus", Attributes.ARMOR, AttributeModifier.Operation.ADDITION ); - static final int EXTRA_ARMOR = 5; + static final int EXTRA_ARMOR = 4; static final ItemData ITEM_1 = new ItemData( Registries.TATTERED_HELMET, EquipmentSlot.HEAD ); static final ItemData ITEM_2 = new ItemData( Registries.TATTERED_CHESTPLATE, EquipmentSlot.CHEST ); static final ItemData ITEM_3 = new ItemData( Registries.TATTERED_LEGGINGS, EquipmentSlot.LEGS ); diff --git a/src/main/java/com/majruszsdifficulty/models/BlackWidowModel.java b/src/main/java/com/majruszsdifficulty/models/BlackWidowModel.java deleted file mode 100644 index 3bd2fbabd..000000000 --- a/src/main/java/com/majruszsdifficulty/models/BlackWidowModel.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.majruszsdifficulty.models; - -import net.minecraft.client.model.SpiderModel; -import net.minecraft.client.model.geom.ModelPart; -import net.minecraft.client.model.geom.PartPose; -import net.minecraft.client.model.geom.builders.*; -import net.minecraft.world.entity.Entity; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; - -@OnlyIn( Dist.CLIENT ) -public class BlackWidowModel< Type extends Entity > extends SpiderModel< Type > { - public static LayerDefinition createBodyLayer() { - MeshDefinition meshdefinition = new MeshDefinition(); - PartDefinition partdefinition = meshdefinition.getRoot(); - - partdefinition.addOrReplaceChild("head", CubeListBuilder.create().texOffs(0, 11).addBox(-2.0F, -3.0F, -3.0F, 4.0F, 3.0F, 4.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 21.0F, -2.0F)); - - partdefinition.addOrReplaceChild("body0", CubeListBuilder.create().texOffs(16, 11).addBox(-1.0F, -2.0F, -1.0F, 2.0F, 2.0F, 1.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 21.0F, 0.0F)); - - partdefinition.addOrReplaceChild("body1", CubeListBuilder.create().texOffs(0, 0).addBox(-3.0F, -4.0F, 0.0F, 6.0F, 5.0F, 6.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 21.0F, 0.0F)); - - partdefinition.addOrReplaceChild("right_front_leg", CubeListBuilder.create().texOffs(0, 18).addBox(-7.0F, -0.5F, -1.5F, 7.0F, 1.0F, 1.0F, new CubeDeformation(0.0F)), PartPose.offset(-1.0F, 20.5F, -1.5F)); - - partdefinition.addOrReplaceChild("left_front_leg", CubeListBuilder.create().texOffs(0, 18).addBox(0.0F, -0.5F, -1.5F, 7.0F, 1.0F, 1.0F, new CubeDeformation(0.0F)), PartPose.offset(1.0F, 20.5F, -1.5F)); - - partdefinition.addOrReplaceChild("right_middle_front_leg", CubeListBuilder.create().texOffs(0, 18).addBox(-7.0F, -0.5F, -1.5F, 7.0F, 1.0F, 1.0F, new CubeDeformation(0.0F)), PartPose.offset(-1.0F, 20.5F, -0.5F)); - - partdefinition.addOrReplaceChild("left_middle_front_leg", CubeListBuilder.create().texOffs(0, 18).addBox(0.0F, -0.5F, -1.5F, 7.0F, 1.0F, 1.0F, new CubeDeformation(0.0F)), PartPose.offset(1.0F, 20.5F, -0.5F)); - - partdefinition.addOrReplaceChild("right_middle_hind_leg", CubeListBuilder.create().texOffs(0, 18).addBox(-7.0F, -0.5F, -1.5F, 7.0F, 1.0F, 1.0F, new CubeDeformation(0.0F)), PartPose.offset(-1.0F, 20.5F, 0.5F)); - - partdefinition.addOrReplaceChild("left_middle_hind_leg", CubeListBuilder.create().texOffs(0, 18).addBox(0.0F, -0.5F, -1.5F, 7.0F, 1.0F, 1.0F, new CubeDeformation(0.0F)), PartPose.offset(1.0F, 20.5F, 0.5F)); - - partdefinition.addOrReplaceChild("right_hind_leg", CubeListBuilder.create().texOffs(0, 18).addBox(-7.0F, -0.5F, -1.5F, 7.0F, 1.0F, 1.0F, new CubeDeformation(0.0F)), PartPose.offset(-1.0F, 20.5F, 1.5F)); - - partdefinition.addOrReplaceChild("left_hind_leg", CubeListBuilder.create().texOffs(0, 18).addBox(0.0F, -0.5F, -1.5F, 7.0F, 1.0F, 1.0F, new CubeDeformation(0.0F)), PartPose.offset(1.0F, 20.5F, 1.5F)); - - partdefinition.addOrReplaceChild("symbol", CubeListBuilder.create().texOffs(0, 20).addBox(-1.5F, -7.0F, 1.5F, 3.0F, 5.0F, 3.0F, new CubeDeformation(0.1F)), PartPose.offset(0.0F, 24.0F, 0.0F)); - - return LayerDefinition.create( meshdefinition, 32, 32 ); - } - - public BlackWidowModel( ModelPart p_170984_ ) { - super( p_170984_ ); - } - - @Override - public void setupAnim( Type entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch ) { - super.setupAnim( entity, 2.3f * limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch ); - } -} \ No newline at end of file diff --git a/src/main/java/com/majruszsdifficulty/models/CerberusModel.java b/src/main/java/com/majruszsdifficulty/models/CerberusModel.java index 46bb4e4ac..a36cecefc 100644 --- a/src/main/java/com/majruszsdifficulty/models/CerberusModel.java +++ b/src/main/java/com/majruszsdifficulty/models/CerberusModel.java @@ -21,12 +21,6 @@ public class CerberusModel< Type extends CerberusEntity > extends HierarchicalMo static final Animation< Float > BITE_JAW_ROTATION_X = new Animation<>( 1.0f ); static final Animation< Float > BREATH_JAW_ROTATION_X = new Animation<>( 1.0f ); static final Animation< Vector3f > BITE_SIDE_NECK_ROTATION = new Animation<>( 1.0f ); - static final Animation< Float > GALLOP_FRONT_LEG_1_ROTATION_X = new Animation<>( 1.0f ); - static final Animation< Float > GALLOP_FRONT_LEG_2_ROTATION_X = new Animation<>( 1.0f ); - static final Animation< Float > GALLOP_HIND_LEG_1_ROTATION_X = new Animation<>( 1.0f ); - static final Animation< Float > GALLOP_HIND_LEG_2_ROTATION_X = new Animation<>( 1.0f ); - static final Animation< Float > GALLOP_SPINE_ROTATION_X = new Animation<>( 1.0f ); - static final Animation< Float > GALLOP_BODY_POSITION_Y = new Animation<>( 1.0f ); static { BITE_JAW_ROTATION_X.add( 0.00f, new Frame.Degrees( 0.0f ) ) @@ -48,42 +42,6 @@ public class CerberusModel< Type extends CerberusEntity > extends HierarchicalMo .add( 0.30f, new Frame.Vector( -15.0f, 0.0f, -30.0f, InterpolationType.SQUARE ) ) .add( 0.70f, new Frame.Vector( 0.0f, 0.0f, 0.0f, InterpolationType.SQUARE ) ) .add( 1.00f, new Frame.Vector( 0.0f, 0.0f, 0.0f ) ); - - GALLOP_FRONT_LEG_1_ROTATION_X.add( 0.00f, new Frame.Degrees( 45.0f ) ) - .add( 0.25f, new Frame.Degrees( 15.0f ) ) - .add( 0.50f, new Frame.Degrees( -15.0f ) ) - .add( 0.75f, new Frame.Degrees( 30.0f ) ) - .add( 1.00f, new Frame.Degrees( 45.00f ) ); - - GALLOP_FRONT_LEG_2_ROTATION_X.add( 0.00f, new Frame.Degrees( 15.0f ) ) - .add( 0.25f, new Frame.Degrees( 0.0f ) ) - .add( 0.50f, new Frame.Degrees( 30.0f ) ) - .add( 0.75f, new Frame.Degrees( 45.0f ) ) - .add( 1.00f, new Frame.Degrees( 15.00f ) ); - - GALLOP_HIND_LEG_1_ROTATION_X.add( 0.00f, new Frame.Degrees( -15.0f ) ) - .add( 0.25f, new Frame.Degrees( 15.0f ) ) - .add( 0.50f, new Frame.Degrees( -15.0f ) ) - .add( 0.75f, new Frame.Degrees( -45.0f ) ) - .add( 1.00f, new Frame.Degrees( -15.00f ) ); - - GALLOP_HIND_LEG_2_ROTATION_X.add( 0.00f, new Frame.Degrees( -45.0f ) ) - .add( 0.25f, new Frame.Degrees( -15.0f ) ) - .add( 0.50f, new Frame.Degrees( 15.0f ) ) - .add( 0.75f, new Frame.Degrees( -15.0f ) ) - .add( 1.00f, new Frame.Degrees( -45.00f ) ); - - GALLOP_SPINE_ROTATION_X.add( 0.00f, new Frame.Degrees( 0.0f ) ) - .add( 0.25f, new Frame.Degrees( -5.00f, InterpolationType.SQUARE ) ) - .add( 0.50f, new Frame.Degrees( 5.00f, InterpolationType.SQUARE ) ) - .add( 0.75f, new Frame.Degrees( 10.00f, InterpolationType.SQUARE ) ) - .add( 1.00f, new Frame.Degrees( 0.00f, InterpolationType.SQUARE ) ); - - GALLOP_BODY_POSITION_Y.add( 0.00f, new Frame.Value( 0.0f ) ) - .add( 0.25f, new Frame.Value( 0.0f, InterpolationType.SQUARE ) ) - .add( 0.50f, new Frame.Value( 0.0f, InterpolationType.SQUARE ) ) - .add( 0.75f, new Frame.Value( 2.0f, InterpolationType.SQUARE ) ) - .add( 1.00f, new Frame.Value( 0.00f, InterpolationType.SQUARE ) ); } final ModelPart root; @@ -93,8 +51,8 @@ public class CerberusModel< Type extends CerberusEntity > extends HierarchicalMo final ModelPart neck1, head1, jawUpper1, jawLower1; final ModelPart neck2, head2, jawUpper2, jawLower2; final ModelPart neck3, head3, jawUpper3, jawLower3; - final ModelPart frontThigh1, frontThigh2; - final ModelPart hindThigh1, hindThigh2; + final ModelPart frontLeg1, frontLeg2; + final ModelPart hindLeg1, hindLeg2; public CerberusModel( ModelPart root ) { this.root = root; @@ -117,27 +75,27 @@ public CerberusModel( ModelPart root ) { this.jawUpper3 = this.head3.getChild( "jawUpper3" ); this.jawLower3 = this.head3.getChild( "jawLower3" ); - this.frontThigh1 = this.spine.getChild( "frontThigh1" ); - this.frontThigh2 = this.spine.getChild( "frontThigh2" ); - this.hindThigh1 = this.spine.getChild( "hindThigh1" ); - this.hindThigh2 = this.spine.getChild( "hindThigh2" ); + this.frontLeg1 = this.spine.getChild( "frontLeg1" ); + this.frontLeg2 = this.spine.getChild( "frontLeg2" ); + this.hindLeg1 = this.spine.getChild( "hindLeg1" ); + this.hindLeg2 = this.spine.getChild( "hindLeg2" ); } public static LayerDefinition createBodyLayer() { MeshDefinition meshdefinition = new MeshDefinition(); PartDefinition partdefinition = meshdefinition.getRoot(); - PartDefinition body = partdefinition.addOrReplaceChild( "body", CubeListBuilder.create(), PartPose.offset( 0.0F, 25.0F, 0.0F ) ); + PartDefinition body = partdefinition.addOrReplaceChild( "body", CubeListBuilder.create(), PartPose.offset( 0.0F, 27.0F, -1.0F ) ); PartDefinition spine = body.addOrReplaceChild( "spine", CubeListBuilder.create() - .texOffs( 28, 23 ) - .addBox( -2.0F, -2.0F, -12.0F, 4.0F, 4.0F, 25.0F, new CubeDeformation( 0.0F ) ), PartPose.offsetAndRotation( 0.0F, -25.0F, 2.0F, 0.0F, 0.0F, 0.0F ) ); + .texOffs( 31, 38 ) + .addBox( -2.0F, -2.0F, -12.0F, 4.0F, 4.0F, 22.0F, new CubeDeformation( 0.0F ) ), PartPose.offset( 0.0F, -25.0F, 2.0F ) ); - PartDefinition necks = spine.addOrReplaceChild( "necks", CubeListBuilder.create(), PartPose.offset( 0.0F, -2.0F, -10.0F ) ); + PartDefinition necks = spine.addOrReplaceChild( "necks", CubeListBuilder.create(), PartPose.offset( 0.0F, -3.0F, -10.0F ) ); PartDefinition neck1 = necks.addOrReplaceChild( "neck1", CubeListBuilder.create() .texOffs( 0, 45 ) - .addBox( -2.0F, -2.0F, -6.0F, 4.0F, 4.0F, 8.0F, new CubeDeformation( -0.1F ) ), PartPose.offsetAndRotation( -4.0F, 2.0F, -1.0F, 0.0F, 0.6109F, 0.0F ) ); + .addBox( -2.0F, -2.0F, -6.0F, 4.0F, 4.0F, 8.0F, new CubeDeformation( -0.1F ) ), PartPose.offsetAndRotation( -5.0F, 4.0F, 2.0F, 0.0F, 0.6109F, 0.0F ) ); PartDefinition head1 = neck1.addOrReplaceChild( "head1", CubeListBuilder.create() .texOffs( 0, 31 ) @@ -169,7 +127,7 @@ public static LayerDefinition createBodyLayer() { PartDefinition neck2 = necks.addOrReplaceChild( "neck2", CubeListBuilder.create() .texOffs( 0, 45 ) - .addBox( -2.0F, -2.0F, -6.0F, 4.0F, 4.0F, 8.0F, new CubeDeformation( -0.1F ) ), PartPose.offsetAndRotation( 0.0F, 1.0F, -1.0F, -0.5236F, 0.0F, 0.0F ) ); + .addBox( -2.0F, -2.0F, -6.0F, 4.0F, 4.0F, 8.0F, new CubeDeformation( -0.1F ) ), PartPose.offsetAndRotation( 0.0F, 3.0F, -1.0F, -0.5236F, 0.0F, 0.0F ) ); PartDefinition head2 = neck2.addOrReplaceChild( "head2", CubeListBuilder.create() .texOffs( 0, 31 ) @@ -201,7 +159,7 @@ public static LayerDefinition createBodyLayer() { PartDefinition neck3 = necks.addOrReplaceChild( "neck3", CubeListBuilder.create() .texOffs( 0, 45 ) - .addBox( -2.0F, -2.0F, -6.0F, 4.0F, 4.0F, 8.0F, new CubeDeformation( -0.1F ) ), PartPose.offsetAndRotation( 4.0F, 2.0F, -1.0F, 0.0F, -0.6109F, 0.0F ) ); + .addBox( -2.0F, -2.0F, -6.0F, 4.0F, 4.0F, 8.0F, new CubeDeformation( -0.1F ) ), PartPose.offsetAndRotation( 5.0F, 4.0F, 2.0F, 0.0F, -0.6109F, 0.0F ) ); PartDefinition head3 = neck3.addOrReplaceChild( "head3", CubeListBuilder.create() .texOffs( 0, 31 ) @@ -233,47 +191,31 @@ public static LayerDefinition createBodyLayer() { PartDefinition chest = spine.addOrReplaceChild( "chest", CubeListBuilder.create() .texOffs( 28, 0 ) - .addBox( -6.0F, -4.5F, -5.0F, 12.0F, 9.0F, 14.0F, new CubeDeformation( 0.0F ) ), PartPose.offsetAndRotation( 0.0F, 2.5F, -3.0F, 0.0F, 3.1416F, 0.0F ) ); - - PartDefinition frontThigh1 = spine.addOrReplaceChild( "frontThigh1", CubeListBuilder.create() - .texOffs( 80, 19 ) - .addBox( -4.0F, -2.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation( 0.0F ) ), PartPose.offsetAndRotation( -6.0F, 1.0F, -9.0F, 0.5236F, 0.0F, 0.0F ) ); - - PartDefinition frontCalf1 = frontThigh1.addOrReplaceChild( "frontCalf1", CubeListBuilder.create() - .texOffs( 80, 0 ) - .addBox( -2.0F, 0.0F, -2.0F, 4.0F, 15.0F, 4.0F, new CubeDeformation( 0.0F ) ), PartPose.offsetAndRotation( -2.0F, 10.0F, 0.0F, -0.7854F, 0.0F, 0.0F ) ); - - PartDefinition frontThigh2 = spine.addOrReplaceChild( "frontThigh2", CubeListBuilder.create() - .texOffs( 80, 19 ) - .addBox( 0.0F, -2.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation( 0.0F ) ), PartPose.offsetAndRotation( 6.0F, 1.0F, -9.0F, 0.5236F, 0.0F, 0.0F ) ); + .addBox( -7.0F, -6.5F, -5.0F, 14.0F, 8.0F, 12.0F, new CubeDeformation( 0.0F ) ), PartPose.offsetAndRotation( 0.0F, 4.5F, -5.0F, 0.0F, 3.1416F, 0.0F ) ); - PartDefinition frontCalf2 = frontThigh2.addOrReplaceChild( "frontCalf2", CubeListBuilder.create() - .texOffs( 80, 0 ) - .addBox( -2.0F, 0.0F, -2.0F, 4.0F, 15.0F, 4.0F, new CubeDeformation( 0.0F ) ), PartPose.offsetAndRotation( 2.0F, 10.0F, 0.0F, -0.7854F, 0.0F, 0.0F ) ); + PartDefinition frontLeg1 = spine.addOrReplaceChild( "frontLeg1", CubeListBuilder.create() + .texOffs( 28, 22 ) + .addBox( -2.0F, -1.0F, -2.0F, 4.0F, 20.0F, 4.0F, new CubeDeformation( 0.1F ) ), PartPose.offset( 5.0F, 3.0F, -9.0F ) ); - PartDefinition tail = spine.addOrReplaceChild( "tail", CubeListBuilder.create() - .texOffs( 28, 23 ) - .addBox( -1.0F, 0.0F, -1.5F, 2.0F, 10.0F, 2.0F, new CubeDeformation( 0.0F ) ), PartPose.offsetAndRotation( 0.0F, -1.0F, 13.5F, 0.6109F, 0.0F, 0.0F ) ); - - PartDefinition tail2 = tail.addOrReplaceChild( "tail2", CubeListBuilder.create() - .texOffs( 28, 23 ) - .addBox( -1.0F, 0.0F, -1.0F, 2.0F, 10.0F, 2.0F, new CubeDeformation( 0.0F ) ), PartPose.offsetAndRotation( 0.0F, 10.0F, -0.5F, -0.4363F, 0.0F, 0.0F ) ); + PartDefinition frontLeg2 = spine.addOrReplaceChild( "frontLeg2", CubeListBuilder.create() + .texOffs( 28, 22 ) + .addBox( -2.0F, 0.0F, -2.0F, 4.0F, 20.0F, 4.0F, new CubeDeformation( 0.1F ) ), PartPose.offset( -5.0F, 2.0F, -9.0F ) ); - PartDefinition hindThigh1 = spine.addOrReplaceChild( "hindThigh1", CubeListBuilder.create() - .texOffs( 80, 19 ) - .addBox( -4.0F, -2.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation( 0.0F ) ), PartPose.offsetAndRotation( -2.0F, 1.0F, 10.0F, -0.3491F, 0.0F, 0.0F ) ); + PartDefinition pelvis = spine.addOrReplaceChild( "pelvis", CubeListBuilder.create() + .texOffs( 53, 22 ) + .addBox( -6.0F, -4.5F, -16.0F, 12.0F, 4.0F, 6.0F, new CubeDeformation( 0.0F ) ), PartPose.offsetAndRotation( 0.0F, 2.5F, -6.0F, 0.0F, 3.1416F, 0.0F ) ); - PartDefinition hindCalf1 = hindThigh1.addOrReplaceChild( "hindCalf1", CubeListBuilder.create() - .texOffs( 80, 0 ) - .addBox( -2.0F, 0.0F, -2.0F, 4.0F, 15.0F, 4.0F, new CubeDeformation( 0.0F ) ), PartPose.offsetAndRotation( -2.0F, 10.0F, 0.0F, 0.5236F, 0.0F, 0.0F ) ); + PartDefinition hindLeg1 = spine.addOrReplaceChild( "hindLeg1", CubeListBuilder.create() + .texOffs( 28, 22 ) + .addBox( -2.0F, 0.0F, -2.0F, 4.0F, 20.0F, 4.0F, new CubeDeformation( 0.0F ) ), PartPose.offset( 4.0F, 2.0F, 7.0F ) ); - PartDefinition hindThigh2 = spine.addOrReplaceChild( "hindThigh2", CubeListBuilder.create() - .texOffs( 80, 19 ) - .addBox( 0.0F, -2.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation( 0.0F ) ), PartPose.offsetAndRotation( 2.0F, 1.0F, 10.0F, -0.3491F, 0.0F, 0.0F ) ); + PartDefinition hindLeg2 = spine.addOrReplaceChild( "hindLeg2", CubeListBuilder.create() + .texOffs( 28, 22 ) + .addBox( -2.0F, 0.0F, -2.0F, 4.0F, 20.0F, 4.0F, new CubeDeformation( 0.0F ) ), PartPose.offset( -4.0F, 2.0F, 7.0F ) ); - PartDefinition hindCalf2 = hindThigh2.addOrReplaceChild( "hindCalf2", CubeListBuilder.create() - .texOffs( 80, 0 ) - .addBox( -2.0F, 0.0F, -2.0F, 4.0F, 15.0F, 4.0F, new CubeDeformation( 0.0F ) ), PartPose.offsetAndRotation( 2.0F, 10.0F, 0.0F, 0.5236F, 0.0F, 0.0F ) ); + PartDefinition tail = spine.addOrReplaceChild( "tail", CubeListBuilder.create() + .texOffs( 44, 22 ) + .addBox( -1.0F, 0.0F, -1.0F, 2.0F, 18.0F, 2.0F, new CubeDeformation( 0.0F ) ), PartPose.offsetAndRotation( 0.0F, -1.0F, 10.0F, 0.3927F, 0.0F, 0.0F ) ); return LayerDefinition.create( meshdefinition, 96, 64 ); } @@ -294,30 +236,20 @@ public void setupAnim( Type cerberus, float limbSwing, float limbSwingAmount, fl this.necks.yRot = ( float )Math.toRadians( netHeadYaw ); this.necks.xRot = ( float )Math.toRadians( headPitch ) + 0.0873f; + // head rotation for side heads to follow the main one + this.neck1.yRot = ( float )( Math.toRadians( 35.0f + netHeadYaw * ( netHeadYaw < 0.0f ? 0.255f : -0.075f ) + 2.0f * Math.sin( 0.1f * ageInTicks ) ) ); + this.neck3.yRot = ( float )( Math.toRadians( -35.0f + netHeadYaw * ( netHeadYaw > 0.0f ? 0.225f : -0.075f ) - 2.0f * Math.cos( 0.1f * ageInTicks ) ) ); + // jaw rotation dependent on players distance float jawRotation = ( float )Math.toRadians( -1.0f * Math.sin( ageInTicks / 10.0f ) - 15.0f * Mth.clamp( 1.20f - this.getPlayerDistance( cerberus ) / 5.0f, 0.0f, 1.0f ) ); this.jawUpper1.xRot = this.jawUpper2.xRot = this.jawUpper3.xRot = jawRotation; this.jawLower1.xRot = this.jawLower2.xRot = this.jawLower3.xRot = jawRotation; // movement anims - if( cerberus.hasTarget ) { - // gallop anims - float swingRatio = ( limbSwing * 0.175f ) % 1.0f; - this.frontThigh1.xRot = ( float )Math.toRadians( 30.0f ) - GALLOP_FRONT_LEG_1_ROTATION_X.apply( swingRatio, ageInTicks ) * limbSwingAmount; - this.frontThigh2.xRot = ( float )Math.toRadians( 30.0f ) - GALLOP_FRONT_LEG_2_ROTATION_X.apply( swingRatio, ageInTicks ) * limbSwingAmount; - this.hindThigh1.xRot = ( float )Math.toRadians( -20.0f ) - GALLOP_HIND_LEG_1_ROTATION_X.apply( swingRatio, ageInTicks ) * limbSwingAmount; - this.hindThigh2.xRot = ( float )Math.toRadians( -20.0f ) - GALLOP_HIND_LEG_2_ROTATION_X.apply( swingRatio, ageInTicks ) * limbSwingAmount; - this.spine.xRot -= GALLOP_SPINE_ROTATION_X.apply( swingRatio, ageInTicks ) * limbSwingAmount; - this.body.y = 25.0f - GALLOP_BODY_POSITION_Y.apply( swingRatio, ageInTicks ) * limbSwingAmount; - } else { - // walk anims - float swingRatio = ( float )( Math.cos( 0.4f * limbSwing ) * limbSwingAmount ); - this.frontThigh2.xRot = ( float )Math.toRadians( 30.0f + 30.0f * swingRatio ); - this.hindThigh2.xRot = ( float )Math.toRadians( -20.0f + 30.0f * swingRatio ); - this.frontThigh1.xRot = ( float )Math.toRadians( 30.0f - 30.0f * swingRatio ); - this.hindThigh1.xRot = ( float )Math.toRadians( -20.0f - 30.0f * swingRatio ); - this.body.y = 25.0f + 1.0f * Math.abs( swingRatio ); - } + float limbFactor1 = 0.5f * limbSwing, limbFactor2 = 0.6f * limbSwingAmount; + this.frontLeg1.xRot = this.hindLeg1.xRot = ( float )( Math.cos( limbFactor1 ) * limbFactor2 ); + this.frontLeg2.xRot = this.hindLeg2.xRot = ( float )( Math.cos( limbFactor1 + Math.PI ) * limbFactor2 ); + this.body.y = 27.0f + 1.0f * Math.abs( ( float )Math.cos( limbFactor1 ) * limbSwingAmount ); // bite anims (jaw) float biteRatio = skills.getRatio( CerberusEntity.SkillType.BITE ); diff --git a/src/main/java/com/majruszsdifficulty/models/GiantModel.java b/src/main/java/com/majruszsdifficulty/models/GiantModel.java new file mode 100644 index 000000000..57e68f491 --- /dev/null +++ b/src/main/java/com/majruszsdifficulty/models/GiantModel.java @@ -0,0 +1,24 @@ +package com.majruszsdifficulty.models; + +import com.majruszsdifficulty.entities.GiantEntity; +import net.minecraft.client.model.AbstractZombieModel; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; + +@OnlyIn( Dist.CLIENT ) +public class GiantModel< Type extends GiantEntity > extends AbstractZombieModel< Type > { + public GiantModel( ModelPart root ) { + super( root ); + } + + @Override + public boolean isAggressive( GiantEntity giant ) { + return false; + } + + @Override + public void setupAnim( Type giant, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch ) { + super.setupAnim( giant, 0.25f * limbSwing, 0.5f * limbSwingAmount, ageInTicks, netHeadYaw, headPitch ); + } +} diff --git a/src/main/java/com/majruszsdifficulty/particles/ParticleUtil.java b/src/main/java/com/majruszsdifficulty/particles/ParticleUtil.java deleted file mode 100644 index d329f8aa1..000000000 --- a/src/main/java/com/majruszsdifficulty/particles/ParticleUtil.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.majruszsdifficulty.particles; - -import com.majruszsdifficulty.MajruszsDifficulty; -import com.majruszsdifficulty.Registries; -import net.minecraft.client.Minecraft; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.client.event.ParticleFactoryRegisterEvent; -import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.fml.common.Mod; - -@Mod.EventBusSubscriber( modid = MajruszsDifficulty.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD ) -public class ParticleUtil { - @OnlyIn( Dist.CLIENT ) - @SubscribeEvent - public static void registerParticles( ParticleFactoryRegisterEvent event ) { - Minecraft.getInstance().particleEngine.register( Registries.BLOOD.get(), BloodParticle.Factory::new ); - } -} diff --git a/src/main/java/com/majruszsdifficulty/renderers/BlackWidowEyesLayer.java b/src/main/java/com/majruszsdifficulty/renderers/BlackWidowEyesLayer.java deleted file mode 100644 index 6f74ac1d9..000000000 --- a/src/main/java/com/majruszsdifficulty/renderers/BlackWidowEyesLayer.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.majruszsdifficulty.renderers; - -import com.majruszsdifficulty.Registries; -import com.majruszsdifficulty.entities.BlackWidowEntity; -import com.majruszsdifficulty.models.BlackWidowModel; -import net.minecraft.client.renderer.RenderType; -import net.minecraft.client.renderer.entity.RenderLayerParent; -import net.minecraft.client.renderer.entity.layers.EyesLayer; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; - -@OnlyIn( Dist.CLIENT ) -public class BlackWidowEyesLayer extends EyesLayer< BlackWidowEntity, BlackWidowModel< BlackWidowEntity > > { - static final RenderType SPIDER_EYES = Registries.getEyesRenderType( "textures/entity/black_widow_eyes.png" ); - - public BlackWidowEyesLayer( RenderLayerParent< BlackWidowEntity, BlackWidowModel< BlackWidowEntity > > layer ) { - super( layer ); - } - - @Override - public RenderType renderType() { - return SPIDER_EYES; - } -} \ No newline at end of file diff --git a/src/main/java/com/majruszsdifficulty/renderers/BlackWidowRenderer.java b/src/main/java/com/majruszsdifficulty/renderers/BlackWidowRenderer.java deleted file mode 100644 index a9e029f93..000000000 --- a/src/main/java/com/majruszsdifficulty/renderers/BlackWidowRenderer.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.majruszsdifficulty.renderers; - -import com.majruszsdifficulty.Registries; -import com.majruszsdifficulty.entities.BlackWidowEntity; -import com.majruszsdifficulty.models.BlackWidowModel; -import com.mojang.blaze3d.vertex.PoseStack; -import net.minecraft.client.model.geom.ModelLayerLocation; -import net.minecraft.client.renderer.MultiBufferSource; -import net.minecraft.client.renderer.entity.EntityRendererProvider; -import net.minecraft.client.renderer.entity.MobRenderer; -import net.minecraft.resources.ResourceLocation; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; - -@OnlyIn( Dist.CLIENT ) -public class BlackWidowRenderer extends MobRenderer< BlackWidowEntity, BlackWidowModel< BlackWidowEntity > > { - public static final ModelLayerLocation LAYER = Registries.getModelLayer( "black_widow" ); - static final ResourceLocation TEXTURE = Registries.getLocation( "textures/entity/black_widow.png" ); - - public BlackWidowRenderer( EntityRendererProvider.Context context ) { - super( context, new BlackWidowModel<>( context.bakeLayer( LAYER ) ), 0.25f ); - this.addLayer( new BlackWidowEyesLayer( this ) ); - } - - @Override - public ResourceLocation getTextureLocation( BlackWidowEntity blackWidow ) { - return TEXTURE; - } - - @Override - public void render( BlackWidowEntity blackWidow, float p_114209_, float partialTicks, PoseStack poseStack, - MultiBufferSource bufferSource, int packedLight - ) { - this.model.prepareMobModel( blackWidow, 0.0f, 0.0f, partialTicks ); - - super.render( blackWidow, p_114209_, partialTicks, poseStack, bufferSource, packedLight ); - } - - @Override - protected float getFlipDegrees( BlackWidowEntity blackWidow ) { - return 180.0f; - } -} diff --git a/src/main/java/com/majruszsdifficulty/renderers/GiantRenderer.java b/src/main/java/com/majruszsdifficulty/renderers/GiantRenderer.java new file mode 100644 index 000000000..9659abd13 --- /dev/null +++ b/src/main/java/com/majruszsdifficulty/renderers/GiantRenderer.java @@ -0,0 +1,39 @@ +package com.majruszsdifficulty.renderers; + +import com.majruszsdifficulty.Registries; +import com.majruszsdifficulty.entities.GiantEntity; +import com.majruszsdifficulty.models.GiantModel; +import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.model.geom.ModelLayerLocation; +import net.minecraft.client.model.geom.ModelLayers; +import net.minecraft.client.renderer.entity.EntityRendererProvider; +import net.minecraft.client.renderer.entity.MobRenderer; +import net.minecraft.client.renderer.entity.layers.HumanoidArmorLayer; +import net.minecraft.client.renderer.entity.layers.ItemInHandLayer; +import net.minecraft.resources.ResourceLocation; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; + +@OnlyIn( Dist.CLIENT ) +public class GiantRenderer extends MobRenderer< GiantEntity, GiantModel< GiantEntity > > { + public static final ModelLayerLocation LAYER = Registries.getModelLayer( "giant" ); + public static final ResourceLocation TEXTURE = Registries.getLocation( "textures/entity/giant.png" ); + public static final float SCALE = 5.0f; + + public GiantRenderer( EntityRendererProvider.Context context ) { + super( context, new GiantModel<>( context.bakeLayer( LAYER ) ), 0.4f * SCALE ); + + this.addLayer( new ItemInHandLayer<>( this ) ); + this.addLayer( new HumanoidArmorLayer<>( this, new GiantModel<>( context.bakeLayer( ModelLayers.GIANT_INNER_ARMOR ) ), new GiantModel<>( context.bakeLayer( ModelLayers.GIANT_OUTER_ARMOR ) ) ) ); + } + + @Override + public ResourceLocation getTextureLocation( GiantEntity giant ) { + return TEXTURE; + } + + @Override + protected void scale( GiantEntity giant, PoseStack stack, float p_114777_ ) { + stack.scale( SCALE, SCALE, SCALE ); + } +} diff --git a/src/main/java/com/majruszsdifficulty/treasurebags/TreasureBagManager.java b/src/main/java/com/majruszsdifficulty/treasurebags/TreasureBagManager.java index 00a46bb69..d28d56704 100644 --- a/src/main/java/com/majruszsdifficulty/treasurebags/TreasureBagManager.java +++ b/src/main/java/com/majruszsdifficulty/treasurebags/TreasureBagManager.java @@ -3,15 +3,15 @@ import com.majruszsdifficulty.Registries; import com.majruszsdifficulty.items.TreasureBagItem; import com.mlib.Utility; -import com.mlib.annotations.AutoInstance; +import com.mlib.modhelper.AutoInstance; import com.mlib.config.ConfigGroup; import com.mlib.data.SerializableStructure; -import com.mlib.gamemodifiers.Condition; -import com.mlib.gamemodifiers.ModConfigs; -import com.mlib.gamemodifiers.contexts.OnDamaged; -import com.mlib.gamemodifiers.contexts.OnDeath; -import com.mlib.gamemodifiers.contexts.OnItemFished; -import com.mlib.gamemodifiers.contexts.OnPlayerTick; +import com.mlib.contexts.base.Condition; +import com.mlib.contexts.base.ModConfigs; +import com.mlib.contexts.OnDamaged; +import com.mlib.contexts.OnDeath; +import com.mlib.contexts.OnItemFished; +import com.mlib.contexts.OnPlayerTick; import com.mlib.items.ItemHelper; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; @@ -178,7 +178,7 @@ static class FishingData extends SerializableStructure { int fishedItems = 0; public FishingData() { - this.define( "TreasureBagFishingCounter", ()->this.fishedItems, x->this.fishedItems = x ); + this.defineInteger( "TreasureBagFishingCounter", ()->this.fishedItems, x->this.fishedItems = x ); } } @@ -186,7 +186,7 @@ static class RaidData extends SerializableStructure { int raidId = -1; public RaidData() { - this.define( "TreasureBagLastPillagerRaidID", ()->this.raidId, x->this.raidId = x ); + this.defineInteger( "TreasureBagLastPillagerRaidID", ()->this.raidId, x->this.raidId = x ); } } diff --git a/src/main/java/com/majruszsdifficulty/treasurebags/TreasureBagProgressManager.java b/src/main/java/com/majruszsdifficulty/treasurebags/TreasureBagProgressManager.java index ed6f5f6d8..fcd1731b1 100644 --- a/src/main/java/com/majruszsdifficulty/treasurebags/TreasureBagProgressManager.java +++ b/src/main/java/com/majruszsdifficulty/treasurebags/TreasureBagProgressManager.java @@ -1,18 +1,17 @@ package com.majruszsdifficulty.treasurebags; -import com.majruszsdifficulty.PacketHandler; import com.majruszsdifficulty.Registries; -import com.majruszsdifficulty.gamemodifiers.contexts.OnTreasureBagOpened; +import com.majruszsdifficulty.contexts.OnTreasureBagOpened; import com.majruszsdifficulty.items.TreasureBagItem; import com.majruszsdifficulty.treasurebags.data.LootData; import com.majruszsdifficulty.treasurebags.data.LootProgressData; import com.majruszsdifficulty.treasurebags.data.TreasureBagData; import com.mlib.ObfuscationGetter; import com.mlib.Utility; -import com.mlib.annotations.AutoInstance; -import com.mlib.data.SerializableStructure; -import com.mlib.gamemodifiers.Condition; -import com.mlib.gamemodifiers.contexts.OnPlayerLogged; +import com.mlib.modhelper.AutoInstance; +import com.mlib.data.SerializableMap; +import com.mlib.contexts.base.Condition; +import com.mlib.contexts.OnPlayerLogged; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; @@ -25,13 +24,15 @@ import java.util.*; -public class TreasureBagProgressManager extends SerializableStructure { +public class TreasureBagProgressManager extends SerializableMap { static final ObfuscationGetter.Field< LootTable, List< LootPool > > POOLS = new ObfuscationGetter.Field<>( LootTable.class, "f_79109_" ); static final ObfuscationGetter.Field< LootPool, LootPoolEntryContainer[] > ENTRIES = new ObfuscationGetter.Field<>( LootPool.class, "f_79023_" ); - final Map< String, LootProgressData > lootProgressMap = new HashMap<>(); + Map< String, LootProgressData > lootProgressMap = new HashMap<>(); public TreasureBagProgressManager() { - this.define( "LootProgress", ()->this.lootProgressMap, this.lootProgressMap::putAll, LootProgressData::new ); + super( "LootProgress" ); + + this.defineCustom( ()->this.lootProgressMap, x->this.lootProgressMap = x, LootProgressData::new ); } public void clearProgress( Player player ) { @@ -96,7 +97,7 @@ private void createDefaultProgress( Player player ) { private void sendMessageTo( Player player ) { if( player instanceof ServerPlayer serverPlayer ) { - PacketHandler.CHANNEL.send( PacketDistributor.PLAYER.with( ()->serverPlayer ), this.get( serverPlayer ) ); + Registries.HELPER.sendMessage( PacketDistributor.PLAYER.with( ()->serverPlayer ), this.get( serverPlayer ) ); } } diff --git a/src/main/java/com/majruszsdifficulty/treasurebags/commands/TreasureBagResetProgressCommand.java b/src/main/java/com/majruszsdifficulty/treasurebags/commands/TreasureBagResetProgressCommand.java index 1870496b5..ba0ff295d 100644 --- a/src/main/java/com/majruszsdifficulty/treasurebags/commands/TreasureBagResetProgressCommand.java +++ b/src/main/java/com/majruszsdifficulty/treasurebags/commands/TreasureBagResetProgressCommand.java @@ -2,7 +2,7 @@ import com.majruszsdifficulty.Registries; import com.mlib.Utility; -import com.mlib.annotations.AutoInstance; +import com.mlib.modhelper.AutoInstance; import com.mlib.commands.Command; import com.mlib.commands.CommandData; import com.mojang.brigadier.exceptions.CommandSyntaxException; diff --git a/src/main/java/com/majruszsdifficulty/treasurebags/commands/TreasureBagUnlockAllCommand.java b/src/main/java/com/majruszsdifficulty/treasurebags/commands/TreasureBagUnlockAllCommand.java index 57e499f7d..13ca7bde8 100644 --- a/src/main/java/com/majruszsdifficulty/treasurebags/commands/TreasureBagUnlockAllCommand.java +++ b/src/main/java/com/majruszsdifficulty/treasurebags/commands/TreasureBagUnlockAllCommand.java @@ -2,7 +2,7 @@ import com.majruszsdifficulty.Registries; import com.mlib.Utility; -import com.mlib.annotations.AutoInstance; +import com.mlib.modhelper.AutoInstance; import com.mlib.commands.Command; import com.mlib.commands.CommandData; import com.mojang.brigadier.exceptions.CommandSyntaxException; diff --git a/src/main/java/com/majruszsdifficulty/treasurebags/data/LootData.java b/src/main/java/com/majruszsdifficulty/treasurebags/data/LootData.java index 3a48e7cd8..de519a660 100644 --- a/src/main/java/com/majruszsdifficulty/treasurebags/data/LootData.java +++ b/src/main/java/com/majruszsdifficulty/treasurebags/data/LootData.java @@ -8,9 +8,9 @@ public class LootData extends SerializableStructure { public int quality; public LootData() { - this.define( "item", ()->this.itemId, x->this.itemId = x ); - this.define( "unlocked", ()->this.isUnlocked, x->this.isUnlocked = x ); - this.define( "quality", ()->this.quality, x->this.quality = x ); + this.defineString( "item", ()->this.itemId, x->this.itemId = x ); + this.defineBoolean( "unlocked", ()->this.isUnlocked, x->this.isUnlocked = x ); + this.defineInteger( "quality", ()->this.quality, x->this.quality = x ); } public LootData( String itemId, boolean isUnlocked, int quality ) { diff --git a/src/main/java/com/majruszsdifficulty/treasurebags/data/LootProgressData.java b/src/main/java/com/majruszsdifficulty/treasurebags/data/LootProgressData.java index 74f6c6344..1462e9408 100644 --- a/src/main/java/com/majruszsdifficulty/treasurebags/data/LootProgressData.java +++ b/src/main/java/com/majruszsdifficulty/treasurebags/data/LootProgressData.java @@ -3,6 +3,7 @@ import com.majruszsdifficulty.items.TreasureBagItem; import com.majruszsdifficulty.treasurebags.TreasureBagProgressClient; import com.mlib.Utility; +import com.mlib.data.SerializableMap; import com.mlib.data.SerializableStructure; import net.minecraft.client.Minecraft; import net.minecraftforge.api.distmarker.Dist; @@ -12,11 +13,13 @@ import java.util.HashMap; import java.util.Map; -public class LootProgressData extends SerializableStructure { - public final Map< String, TreasureBagData > treasureBags = new HashMap<>(); +public class LootProgressData extends SerializableMap { + public Map< String, TreasureBagData > treasureBags = new HashMap<>(); public LootProgressData() { - this.define( "TreasureBags", ()->this.treasureBags, this.treasureBags::putAll, TreasureBagData::new ); + super( "TreasureBags" ); + + this.defineCustom( ()->this.treasureBags, x->this.treasureBags = x, TreasureBagData::new ); } public TreasureBagData get( TreasureBagItem item ) { diff --git a/src/main/java/com/majruszsdifficulty/treasurebags/data/TreasureBagData.java b/src/main/java/com/majruszsdifficulty/treasurebags/data/TreasureBagData.java index f6e944f2e..619dbcd3d 100644 --- a/src/main/java/com/majruszsdifficulty/treasurebags/data/TreasureBagData.java +++ b/src/main/java/com/majruszsdifficulty/treasurebags/data/TreasureBagData.java @@ -1,17 +1,20 @@ package com.majruszsdifficulty.treasurebags.data; +import com.mlib.data.SerializableList; import com.mlib.data.SerializableStructure; import java.util.ArrayList; import java.util.List; -public class TreasureBagData extends SerializableStructure { - public final List< LootData > lootDataList; +public class TreasureBagData extends SerializableList { + public List< LootData > lootDataList; public TreasureBagData( List< LootData > lootDataList ) { + super( "LootDataList" ); + this.lootDataList = lootDataList; - this.define( "LootDataList", ()->this.lootDataList, this.lootDataList::addAll, LootData::new ); + this.defineCustom( ()->this.lootDataList, x->this.lootDataList = x, LootData::new ); } public TreasureBagData() { diff --git a/src/main/java/com/majruszsdifficulty/triggers/BandageTrigger.java b/src/main/java/com/majruszsdifficulty/triggers/BandageTrigger.java deleted file mode 100644 index ac214ba67..000000000 --- a/src/main/java/com/majruszsdifficulty/triggers/BandageTrigger.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.majruszsdifficulty.triggers; - -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.majruszsdifficulty.Registries; -import com.majruszsdifficulty.items.BandageItem; -import net.minecraft.advancements.critereon.*; -import net.minecraft.core.Registry; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.server.level.ServerPlayer; -import net.minecraftforge.registries.ForgeRegistries; - -@Deprecated( forRemoval = true ) -public class BandageTrigger extends SimpleCriterionTrigger< BandageTrigger.Instance > { - private static final ResourceLocation ID = Registries.getLocation( "bandage_used" ); - - @Override - public ResourceLocation getId() { - return ID; - } - - @Override - public BandageTrigger.Instance createInstance( JsonObject jsonObject, EntityPredicate.Composite predicate, DeserializationContext conditions - ) { - JsonElement bandageID = jsonObject.get( "bandage_id" ); - JsonElement usedOnOneself = jsonObject.get( "used_on_oneself" ); - - return new BandageTrigger.Instance( predicate, bandageID.getAsString(), usedOnOneself.getAsBoolean() ); - } - - /** Triggers an advancement for given player. */ - public void trigger( ServerPlayer player, BandageItem item, boolean usedOnOneself ) { - this.trigger( player, instance->instance.test( item, usedOnOneself ) ); - } - - public static class Instance extends AbstractCriterionTriggerInstance { - private final String bandageID; - private final boolean usedOnOneself; - - public Instance( EntityPredicate.Composite predicate, String bandageID, boolean usedOnOneself ) { - super( BandageTrigger.ID, predicate ); - - this.bandageID = bandageID; - this.usedOnOneself = usedOnOneself; - } - - public JsonObject serializeToJson( SerializationContext conditions ) { - JsonObject jsonObject = super.serializeToJson( conditions ); - jsonObject.addProperty( "bandage_id", this.bandageID ); - jsonObject.addProperty( "used_on_oneself", this.usedOnOneself ); - - return jsonObject; - } - - public boolean test( BandageItem item, boolean usedOnOneself ) { - return usedOnOneself == this.usedOnOneself && ForgeRegistries.ITEMS.getKey( item ).toString().equals( this.bandageID ); - } - } -} diff --git a/src/main/java/com/majruszsdifficulty/undeadarmy/Config.java b/src/main/java/com/majruszsdifficulty/undeadarmy/Config.java index 6b3c4e3c0..bf8003afa 100644 --- a/src/main/java/com/majruszsdifficulty/undeadarmy/Config.java +++ b/src/main/java/com/majruszsdifficulty/undeadarmy/Config.java @@ -6,20 +6,21 @@ import com.majruszsdifficulty.undeadarmy.data.UndeadArmyInfo; import com.majruszsdifficulty.undeadarmy.data.WaveDef; import com.majruszsdifficulty.undeadarmy.data.WavesDef; -import com.mlib.annotations.AutoInstance; import com.mlib.config.BooleanConfig; import com.mlib.config.ConfigGroup; import com.mlib.config.DoubleConfig; import com.mlib.config.IntegerConfig; +import com.mlib.contexts.OnDeath; +import com.mlib.contexts.OnLoot; +import com.mlib.contexts.OnServerTick; +import com.mlib.contexts.base.Condition; +import com.mlib.contexts.base.ModConfigs; import com.mlib.data.JsonListener; -import com.mlib.gamemodifiers.Condition; -import com.mlib.gamemodifiers.ModConfigs; -import com.mlib.gamemodifiers.contexts.OnDeath; -import com.mlib.gamemodifiers.contexts.OnLoot; -import com.mlib.gamemodifiers.contexts.OnServerTick; +import com.mlib.data.SerializableHelper; import com.mlib.levels.LevelHelper; import com.mlib.loot.LootHelper; import com.mlib.math.Range; +import com.mlib.modhelper.AutoInstance; import net.minecraft.ChatFormatting; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.TranslatableComponent; @@ -27,6 +28,7 @@ import net.minecraft.server.level.ServerPlayer; import net.minecraft.util.Mth; import net.minecraft.world.entity.Mob; +import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.MobType; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.storage.loot.LootContext; @@ -35,36 +37,51 @@ import net.minecraft.world.level.storage.loot.parameters.LootContextParams; import java.util.List; +import java.util.function.Consumer; import java.util.function.Supplier; @AutoInstance public class Config { static final ResourceLocation EXTRA_LOOT_ID = Registries.getLocation( "undead_army/extra_mob_loot" ); private final BooleanConfig availability = new BooleanConfig( true ); + private final BooleanConfig naturalSpawnsOnly = new BooleanConfig( false ); + private final BooleanConfig resetParticipantsKillRequirement = new BooleanConfig( true ); private final DoubleConfig waveDuration = new DoubleConfig( 1200.0, new Range<>( 300.0, 3600.0 ) ); - private final DoubleConfig preparationDuration = new DoubleConfig( 10.0, new Range<>( 4.0, 30.0 ) ); + private final DoubleConfig preparationDuration = new DoubleConfig( 10.0, new Range<>( 1.0, 30.0 ) ); private final DoubleConfig highlightDelay = new DoubleConfig( 300.0, new Range<>( 30.0, 3600.0 ) ); private final DoubleConfig extraSizePerPlayer = new DoubleConfig( 0.5, new Range<>( 0.0, 1.0 ) ); private final IntegerConfig armyRadius = new IntegerConfig( 70, new Range<>( 35, 140 ) ); private final IntegerConfig killRequirement = new IntegerConfig( 75, new Range<>( 0, 1000 ) ); private final IntegerConfig killRequirementFirst = new IntegerConfig( 25, new Range<>( 0, 1000 ) ); + private final IntegerConfig killRequirementWarning = new IntegerConfig( 3, new Range<>( 0, 1000 ) ); private final Supplier< WavesDef > wavesDef; public Config() { ConfigGroup group = ModConfigs.registerSubgroup( Registries.Groups.UNDEAD_ARMY ) - .addConfig( this.availability.name( "is_enabled" ).comment( "Determines whether the Undead Army can spawn in any way." ) ) - .addConfig( this.waveDuration.name( "wave_duration" ).comment( "Duration that players have to defeat a single wave (in seconds)." ) ) - .addConfig( this.preparationDuration.name( "preparation_duration" ).comment( "Duration before the next wave arrives (in seconds)." ) ) - .addConfig( this.highlightDelay.name( "highlight_delay" ).comment( "Duration before all mobs will be highlighted (in seconds)." ) ) + .addConfig( this.availability.name( "is_enabled" ) + .comment( "Determines whether the Undead Army can spawn in any way." ) ) + .addConfig( this.naturalSpawnsOnly.name( "natural_spawns_only" ) + .comment( "Determines if the undead has to spawn naturally to contribute to the kill_requirement." ) ) + .addConfig( this.waveDuration.name( "wave_duration" ) + .comment( "Duration that players have to defeat a single wave (in seconds)." ) ) + .addConfig( this.preparationDuration.name( "preparation_duration" ) + .comment( "Duration before the next wave arrives (in seconds)." ) ) + .addConfig( this.highlightDelay.name( "highlight_delay" ) + .comment( "Duration before all mobs will be highlighted (in seconds)." ) ) .addConfig( this.extraSizePerPlayer.name( "extra_size_per_player" ) .comment( "Extra size ratio per each additional player on multiplayer (0.25 means ~25% bigger army per player)." ) ) - .addConfig( this.armyRadius.name( "army_radius" ).comment( "Radius, which determines how big is the raid circle (in blocks)." ) ) + .addConfig( this.armyRadius.name( "army_radius" ) + .comment( "Radius, which determines how big is the raid circle (in blocks)." ) ) .addConfig( this.killRequirement.name( "kill_requirement" ) .comment( "Required amount of killed undead to start the Undead Army. (set to 0 if you want to disable this)" ) ) .addConfig( this.killRequirementFirst.name( "kill_requirement_first" ) - .comment( "Required amount of killed undead to start the first Undead Army." ) ); + .comment( "Required amount of killed undead to start the first Undead Army." ) ) + .addConfig( this.resetParticipantsKillRequirement.name( "reset_participants_kill_requirement" ) + .comment( "If all participants of an undead army should have their kill count reset (false resets only the person who caused it)." ) ) + .addConfig( this.killRequirementWarning.name( "kill_requirement_warning" ) + .comment( "How many left to kill until the undead army warning shows up (set to 0 to disable this)." ) ); - this.wavesDef = JsonListener.add( "undead_army", Registries.getLocation( "waves" ), WavesDef.class, WavesDef::new ); + this.wavesDef = JsonListener.add( "custom", Registries.getLocation( "undead_army_waves" ), WavesDef.class, WavesDef::new ); OnServerTick.listen( data->Registries.getUndeadArmyManager().tick() ) .addCondition( Condition.isEndPhase() ) @@ -91,6 +108,10 @@ public boolean isEnabled() { return this.availability.isEnabled(); } + public boolean getNaturalSpawnsOnly() {return this.naturalSpawnsOnly.isEnabled();} + + public boolean isResetAllParticipantsKillRequirementsEnabled() {return this.resetParticipantsKillRequirement.isEnabled();} + public int getWaveDuration() { return this.waveDuration.asTicks(); } @@ -127,6 +148,8 @@ public int getSpawnRadius() { return this.getArmyRadius() - 15; // maybe one day add a config } + public int getKillRequirementWarning() {return this.killRequirementWarning.get();} + public WaveDef getWave( int waveIdx ) { List< WaveDef > waves = this.getWaves(); @@ -141,26 +164,24 @@ public List< WaveDef > getWaves() { } public UndeadArmyInfo readUndeadArmyInfo( CompoundTag tag ) { - UndeadArmyInfo info = new UndeadArmyInfo(); - info.killedUndead = this.getInitialKillsCount(); - info.read( tag ); + return SerializableHelper.read( ()->new UndeadArmyInfo( this.getInitialKillsCount() ), tag ); + } - return info; + public void modifyUndeadArmyInfo( CompoundTag tag, Consumer< UndeadArmyInfo > consumer ) { + SerializableHelper.modify( ()->new UndeadArmyInfo( this.getInitialKillsCount() ), tag, consumer ); } private void updateKilledUndead( OnDeath.Data data ) { ServerPlayer player = ( ServerPlayer )data.attacker; - CompoundTag tag = player.getPersistentData(); - UndeadArmyInfo info = this.readUndeadArmyInfo( tag ); - - ++info.killedUndead; - if( info.killedUndead >= this.getRequiredKills() && Registries.getUndeadArmyManager().tryToSpawn( player ) ) { - info.killedUndead = 0; - } else if( info.killedUndead == this.getRequiredKills() - 3 ) { - player.displayClientMessage( new TranslatableComponent( "majruszsdifficulty.undead_army.warning" ).withStyle( ChatFormatting.DARK_PURPLE ), false ); - } - info.write( tag ); + this.modifyUndeadArmyInfo( player.getPersistentData(), info->{ + ++info.killedUndead; + if( info.killedUndead >= this.getRequiredKills() && Registries.getUndeadArmyManager().tryToSpawn( player ) ) { + info.killedUndead = 0; + } else if( this.getKillRequirementWarning() > 0 && info.killedUndead == this.getRequiredKills() - this.getKillRequirementWarning() ) { + player.displayClientMessage( new TranslatableComponent( "majruszsdifficulty.undead_army.warning" ).withStyle( ChatFormatting.DARK_PURPLE ), false ); + } + } ); } private void giveExtraLoot( OnLoot.Data data ) { diff --git a/src/main/java/com/majruszsdifficulty/undeadarmy/UndeadArmy.java b/src/main/java/com/majruszsdifficulty/undeadarmy/UndeadArmy.java index 78967addf..1488f24dd 100644 --- a/src/main/java/com/majruszsdifficulty/undeadarmy/UndeadArmy.java +++ b/src/main/java/com/majruszsdifficulty/undeadarmy/UndeadArmy.java @@ -26,9 +26,9 @@ public class UndeadArmy extends SerializableStructure { public final Components components = new Components( this ); public final List< ServerPlayer > participants = new ArrayList<>(); - public final List< MobInfo > mobsLeft = new ArrayList<>(); public final ServerLevel level; public final Config config; + public List< MobInfo > mobsLeft = new ArrayList<>(); public BlockPos positionToAttack; public Direction direction; public Phase phase = new Phase(); @@ -40,17 +40,17 @@ public UndeadArmy( ServerLevel level, Config config ) { this.level = level; this.config = config; - this.define( "mobs_left", ()->this.mobsLeft, this.mobsLeft::addAll, MobInfo::new ); - this.define( "position", ()->this.positionToAttack, x->this.positionToAttack = x ); - this.define( "direction", ()->this.direction, x->this.direction = x, Direction::values ); - this.define( "phase", ()->this.phase, x->this.phase = x, Phase::new ); - this.define( "current_wave", ()->this.currentWave, x->this.currentWave = x ); + this.defineCustom( "mobs_left", ()->this.mobsLeft, this::readMobsLeft, MobInfo::new ); + this.defineBlockPos( "position", ()->this.positionToAttack, x->this.positionToAttack = x ); + this.defineEnum( "direction", ()->this.direction, x->this.direction = x, Direction::values ); + this.defineCustom( "phase", ()->this.phase, x->this.phase = x, Phase::new ); + this.defineInteger( "current_wave", ()->this.currentWave, x->this.currentWave = x ); } public void start( BlockPos positionToAttack, Direction direction ) { this.positionToAttack = positionToAttack; this.direction = direction; - this.setState( Phase.State.STARTED, Utility.secondsToTicks( 6.7 ) ); + this.setState( Phase.State.STARTED, Utility.secondsToTicks( 6.4 ) ); this.components.dispatch( IComponent::onStart ); } @@ -116,9 +116,9 @@ public boolean isPartOfWave( Entity entity ) { return this.mobsLeft.stream().anyMatch( mobInfo->mobInfo.uuid != null && mobInfo.uuid.equals( entity.getUUID() ) ); } - @Override - protected void onRead() { + private void readMobsLeft( List< MobInfo > mobsLeft ) { this.areEntitiesLoaded = false; + this.mobsLeft = mobsLeft; } private void forEachSpawnedUndead( Consumer< LivingEntity > consumer ) { diff --git a/src/main/java/com/majruszsdifficulty/undeadarmy/UndeadArmyManager.java b/src/main/java/com/majruszsdifficulty/undeadarmy/UndeadArmyManager.java index 6f007e01d..ecda35f31 100644 --- a/src/main/java/com/majruszsdifficulty/undeadarmy/UndeadArmyManager.java +++ b/src/main/java/com/majruszsdifficulty/undeadarmy/UndeadArmyManager.java @@ -10,6 +10,7 @@ import net.minecraft.world.Difficulty; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.GameRules; import net.minecraft.world.level.Level; import net.minecraft.world.level.levelgen.Heightmap; @@ -21,15 +22,15 @@ public class UndeadArmyManager extends SerializableStructure { public static final UndeadArmyManager NOT_LOADED = new UndeadArmyManager(); - final List< UndeadArmy > undeadArmies = new ArrayList<>(); final ServerLevel level; final Config config; + List< UndeadArmy > undeadArmies = new ArrayList<>(); public UndeadArmyManager( ServerLevel level, Config config ) { this.level = level; this.config = config; - this.define( "undead_armies", ()->this.undeadArmies, this.undeadArmies::addAll, ()->new UndeadArmy( level, config ) ); + this.defineCustom( "undead_armies", ()->this.undeadArmies, x->this.undeadArmies = x, ()->new UndeadArmy( level, config ) ); } private UndeadArmyManager() { @@ -46,6 +47,7 @@ public boolean tryToSpawn( Player player ) { public boolean tryToSpawn( BlockPos position, Optional< Direction > direction ) { return this.config.isEnabled() && this.level.getDifficulty() != Difficulty.PEACEFUL + && !this.level.getGameRules().getBoolean( GameRules.RULE_DISABLE_RAIDS ) && this.findNearestUndeadArmy( position ) == null && this.undeadArmies.add( this.setupNewArmy( position, direction ) ); } @@ -90,7 +92,7 @@ void tick() { private UndeadArmy setupNewArmy( BlockPos position, Optional< Direction > direction ) { UndeadArmy undeadArmy = new UndeadArmy( this.level, this.config ); - undeadArmy.start( position, direction.orElse( Random.nextRandom( Direction.values() ) ) ); + undeadArmy.start( position, direction.orElse( Random.next( Direction.values() ) ) ); return undeadArmy; } diff --git a/src/main/java/com/majruszsdifficulty/undeadarmy/UndeadArmyPatrol.java b/src/main/java/com/majruszsdifficulty/undeadarmy/UndeadArmyPatrol.java index fb20a6417..a311d2ec0 100644 --- a/src/main/java/com/majruszsdifficulty/undeadarmy/UndeadArmyPatrol.java +++ b/src/main/java/com/majruszsdifficulty/undeadarmy/UndeadArmyPatrol.java @@ -1,16 +1,16 @@ package com.majruszsdifficulty.undeadarmy; import com.majruszsdifficulty.Registries; -import com.majruszsdifficulty.gamemodifiers.CustomConditions; -import com.majruszsdifficulty.gamemodifiers.configs.MobGroupConfig; +import com.majruszsdifficulty.contexts.base.CustomConditions; +import com.majruszsdifficulty.config.MobGroupConfig; import com.majruszsdifficulty.gamestage.GameStage; import com.majruszsdifficulty.undeadarmy.data.ExtraLootInfo; import com.mlib.Random; -import com.mlib.annotations.AutoInstance; +import com.mlib.modhelper.AutoInstance; import com.mlib.config.ConfigGroup; -import com.mlib.gamemodifiers.Condition; -import com.mlib.gamemodifiers.ModConfigs; -import com.mlib.gamemodifiers.contexts.OnSpawned; +import com.mlib.contexts.base.Condition; +import com.mlib.contexts.base.ModConfigs; +import com.mlib.contexts.OnSpawned; import com.mlib.math.Range; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.PathfinderMob; @@ -18,13 +18,15 @@ import net.minecraft.world.entity.monster.Skeleton; import net.minecraft.world.entity.monster.Stray; import net.minecraft.world.entity.monster.Zombie; +import net.minecraft.world.level.Level; import java.util.List; +import java.util.function.Supplier; @AutoInstance -public class UndeadArmyPatrol { +public class UndeadArmyPatrol implements Supplier< MobGroupConfig > { final MobGroupConfig mobGroups = new MobGroupConfig( - ()->Random.nextRandom( List.of( EntityType.ZOMBIE, EntityType.HUSK ) ), + ()->Random.next( List.of( EntityType.ZOMBIE, EntityType.HUSK, EntityType.SKELETON, EntityType.STRAY ) ), new Range<>( 2, 4 ), Registries.getLocation( "undead_army/equipment_wave_3" ), Registries.getLocation( "undead_army/equipment_wave_2" ) @@ -37,11 +39,12 @@ public UndeadArmyPatrol() { OnSpawned.listenSafe( this::spawnGroup ) .addCondition( CustomConditions.gameStageAtLeast( GameStage.NORMAL ) ) - .addCondition( Condition.chanceCRD( 0.0625, true ) ) + .addCondition( Condition.chanceCRD( 0.10, true ) ) .addCondition( CustomConditions.isNotPartOfGroup( data->data.target ) ) .addCondition( CustomConditions.isNotPartOfUndeadArmy( data->data.target ) ) .addCondition( CustomConditions.isNotNearUndeadArmy( data->data.target ) ) .addCondition( Condition.isServer() ) + .addCondition( Condition.isLevel( Level.OVERWORLD ) ) .addCondition( Condition.excludable() ) .addCondition( OnSpawned.isNotLoadedFromDisk() ) .addCondition( OnSpawned.is( Zombie.class, Skeleton.class, Husk.class, Stray.class ) ) @@ -49,6 +52,11 @@ public UndeadArmyPatrol() { .insertTo( group ); } + @Override + public MobGroupConfig get() { + return this.mobGroups; + } + private void spawnGroup( OnSpawned.Data data ) { PathfinderMob leader = ( PathfinderMob )data.target; List< PathfinderMob > mobs = this.mobGroups.spawn( leader ); diff --git a/src/main/java/com/majruszsdifficulty/undeadarmy/commands/UndeadArmyHighlightCommand.java b/src/main/java/com/majruszsdifficulty/undeadarmy/commands/UndeadArmyHighlightCommand.java index 52c98f023..fe3e4a0cd 100644 --- a/src/main/java/com/majruszsdifficulty/undeadarmy/commands/UndeadArmyHighlightCommand.java +++ b/src/main/java/com/majruszsdifficulty/undeadarmy/commands/UndeadArmyHighlightCommand.java @@ -1,7 +1,7 @@ package com.majruszsdifficulty.undeadarmy.commands; import com.majruszsdifficulty.undeadarmy.UndeadArmy; -import com.mlib.annotations.AutoInstance; +import com.mlib.modhelper.AutoInstance; @AutoInstance public class UndeadArmyHighlightCommand extends UndeadArmyCommand { diff --git a/src/main/java/com/majruszsdifficulty/undeadarmy/commands/UndeadArmyKillAllCommand.java b/src/main/java/com/majruszsdifficulty/undeadarmy/commands/UndeadArmyKillAllCommand.java index b0f4bf650..3369f24ac 100644 --- a/src/main/java/com/majruszsdifficulty/undeadarmy/commands/UndeadArmyKillAllCommand.java +++ b/src/main/java/com/majruszsdifficulty/undeadarmy/commands/UndeadArmyKillAllCommand.java @@ -1,7 +1,7 @@ package com.majruszsdifficulty.undeadarmy.commands; import com.majruszsdifficulty.undeadarmy.UndeadArmy; -import com.mlib.annotations.AutoInstance; +import com.mlib.modhelper.AutoInstance; @AutoInstance public class UndeadArmyKillAllCommand extends UndeadArmyCommand { diff --git a/src/main/java/com/majruszsdifficulty/undeadarmy/commands/UndeadArmyListAllCommand.java b/src/main/java/com/majruszsdifficulty/undeadarmy/commands/UndeadArmyListAllCommand.java index a4dad793c..2809a4824 100644 --- a/src/main/java/com/majruszsdifficulty/undeadarmy/commands/UndeadArmyListAllCommand.java +++ b/src/main/java/com/majruszsdifficulty/undeadarmy/commands/UndeadArmyListAllCommand.java @@ -2,7 +2,7 @@ import com.majruszsdifficulty.Registries; import com.majruszsdifficulty.undeadarmy.UndeadArmy; -import com.mlib.annotations.AutoInstance; +import com.mlib.modhelper.AutoInstance; import com.mlib.commands.Command; import com.mlib.commands.CommandData; import com.mlib.text.TextHelper; diff --git a/src/main/java/com/majruszsdifficulty/undeadarmy/commands/UndeadArmyPersonalProgressCommand.java b/src/main/java/com/majruszsdifficulty/undeadarmy/commands/UndeadArmyPersonalProgressCommand.java index 48e085770..ce1e220ef 100644 --- a/src/main/java/com/majruszsdifficulty/undeadarmy/commands/UndeadArmyPersonalProgressCommand.java +++ b/src/main/java/com/majruszsdifficulty/undeadarmy/commands/UndeadArmyPersonalProgressCommand.java @@ -3,7 +3,7 @@ import com.majruszsdifficulty.Registries; import com.majruszsdifficulty.undeadarmy.Config; import com.majruszsdifficulty.undeadarmy.data.UndeadArmyInfo; -import com.mlib.annotations.AutoInstance; +import com.mlib.modhelper.AutoInstance; import com.mlib.commands.Command; import com.mlib.commands.CommandData; import com.mojang.brigadier.exceptions.CommandSyntaxException; diff --git a/src/main/java/com/majruszsdifficulty/undeadarmy/commands/UndeadArmyStartCommand.java b/src/main/java/com/majruszsdifficulty/undeadarmy/commands/UndeadArmyStartCommand.java index f21b2df04..2b77495f0 100644 --- a/src/main/java/com/majruszsdifficulty/undeadarmy/commands/UndeadArmyStartCommand.java +++ b/src/main/java/com/majruszsdifficulty/undeadarmy/commands/UndeadArmyStartCommand.java @@ -2,7 +2,7 @@ import com.majruszsdifficulty.Registries; import com.majruszsdifficulty.undeadarmy.data.Direction; -import com.mlib.annotations.AutoInstance; +import com.mlib.modhelper.AutoInstance; import com.mlib.commands.Command; import com.mlib.commands.CommandData; import com.mojang.brigadier.exceptions.CommandSyntaxException; diff --git a/src/main/java/com/majruszsdifficulty/undeadarmy/commands/UndeadArmyStopCommand.java b/src/main/java/com/majruszsdifficulty/undeadarmy/commands/UndeadArmyStopCommand.java index 118880a08..2011b4f0c 100644 --- a/src/main/java/com/majruszsdifficulty/undeadarmy/commands/UndeadArmyStopCommand.java +++ b/src/main/java/com/majruszsdifficulty/undeadarmy/commands/UndeadArmyStopCommand.java @@ -1,7 +1,7 @@ package com.majruszsdifficulty.undeadarmy.commands; import com.majruszsdifficulty.undeadarmy.UndeadArmy; -import com.mlib.annotations.AutoInstance; +import com.mlib.modhelper.AutoInstance; @AutoInstance public class UndeadArmyStopCommand extends UndeadArmyCommand { diff --git a/src/main/java/com/majruszsdifficulty/undeadarmy/components/AdvancementsController.java b/src/main/java/com/majruszsdifficulty/undeadarmy/components/AdvancementsController.java index 4320b9d79..8da8e6122 100644 --- a/src/main/java/com/majruszsdifficulty/undeadarmy/components/AdvancementsController.java +++ b/src/main/java/com/majruszsdifficulty/undeadarmy/components/AdvancementsController.java @@ -7,7 +7,7 @@ record AdvancementsController( UndeadArmy undeadArmy ) implements IComponent { @Override public void onWaveFinished() { if( this.undeadArmy.isLastWave() ) { - this.undeadArmy.participants.forEach( participant->Registries.BASIC_TRIGGER.trigger( participant, "army_defeated" ) ); + this.undeadArmy.participants.forEach( participant->Registries.HELPER.triggerAchievement( participant, "army_defeated" ) ); } } } diff --git a/src/main/java/com/majruszsdifficulty/undeadarmy/components/Components.java b/src/main/java/com/majruszsdifficulty/undeadarmy/components/Components.java index 4909b9b1a..0a2d92e88 100644 --- a/src/main/java/com/majruszsdifficulty/undeadarmy/components/Components.java +++ b/src/main/java/com/majruszsdifficulty/undeadarmy/components/Components.java @@ -14,6 +14,7 @@ public Components( UndeadArmy undeadArmy ) { this.add( ParticipantsUpdater::new ); this.add( BossUpdater::new ); this.add( MobSpawner::new ); + this.add( LightningSpawner::new ); this.add( WaveController::new ); this.add( WeatherController::new ); this.add( MobHighlighter::new ); diff --git a/src/main/java/com/majruszsdifficulty/undeadarmy/components/LightningSpawner.java b/src/main/java/com/majruszsdifficulty/undeadarmy/components/LightningSpawner.java new file mode 100644 index 000000000..18f09e5fe --- /dev/null +++ b/src/main/java/com/majruszsdifficulty/undeadarmy/components/LightningSpawner.java @@ -0,0 +1,34 @@ +package com.majruszsdifficulty.undeadarmy.components; + +import com.majruszsdifficulty.undeadarmy.UndeadArmy; +import com.majruszsdifficulty.undeadarmy.data.MobInfo; +import com.majruszsdifficulty.undeadarmy.data.Phase; +import com.mlib.math.AnyPos; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.LightningBolt; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +record LightningSpawner( UndeadArmy undeadArmy ) implements IComponent { + @Override + public void onStateChanged() { + if( this.undeadArmy.phase.state == Phase.State.WAVE_PREPARING ) { + this.spawnLightningStrikes(); + } + } + + private void spawnLightningStrikes() { + List< MobInfo > mobsLeft = new ArrayList<>( this.undeadArmy.mobsLeft ); + Collections.shuffle( mobsLeft ); + for( int idx = 0; idx < 3 && idx < mobsLeft.size(); ++idx ) { + LightningBolt lightningBolt = EntityType.LIGHTNING_BOLT.create( this.undeadArmy.level ); + if( lightningBolt != null ) { + lightningBolt.moveTo( AnyPos.from( mobsLeft.get( idx ).position ).center().vec3() ); + lightningBolt.setVisualOnly( true ); + this.undeadArmy.level.addFreshEntity( lightningBolt ); + } + } + } +} diff --git a/src/main/java/com/majruszsdifficulty/undeadarmy/components/MobSpawner.java b/src/main/java/com/majruszsdifficulty/undeadarmy/components/MobSpawner.java index 11d715bee..24c668718 100644 --- a/src/main/java/com/majruszsdifficulty/undeadarmy/components/MobSpawner.java +++ b/src/main/java/com/majruszsdifficulty/undeadarmy/components/MobSpawner.java @@ -59,7 +59,7 @@ private MobInfo getNextMobToSpawn() { private void spawnMob( MobInfo mobInfo ) { Vec3 position = AnyPos.from( mobInfo.position ).add( 0.0, 0.25, 0.0 ).vec3(); - Entity entity = EntityHelper.spawn( mobInfo.type, this.undeadArmy.level, position ); + Entity entity = EntityHelper.createSpawner( mobInfo.type, this.undeadArmy.level ).position( position ).spawn(); if( !( entity instanceof PathfinderMob mob ) ) { this.undeadArmy.mobsLeft.remove( mobInfo ); // something went wrong, mob could not spawn, and we do not want to block the Undead Army return; @@ -77,7 +77,7 @@ private void generateMobList() { float sizeMultiplier = this.undeadArmy.config.getSizeMultiplier( this.undeadArmy.participants.size() ); WaveDef waveDef = this.undeadArmy.config.getWave( this.undeadArmy.currentWave + 1 ); waveDef.mobDefs.forEach( mobDef->{ - int totalCount = Random.roundRandomly( mobDef.count * sizeMultiplier ); + int totalCount = Random.round( mobDef.count * sizeMultiplier ); for( int i = 0; i < totalCount; ++i ) { this.addToPendingMobs( mobDef, false ); } @@ -115,7 +115,7 @@ private Vec3 buildOffset() { int y = 0; int z = direction.x != 0 ? 24 : 8; - return AnyPos.from( direction.x * spawnRadius, 0, direction.z * spawnRadius ).add( Random.getRandomVector( -x, x, -y, y, -z, z ) ).vec3(); + return AnyPos.from( direction.x * spawnRadius, 0, direction.z * spawnRadius ).add( Random.nextVector( -x, x, -y, y, -z, z ) ).vec3(); } private void tryToLoadEquipment( PathfinderMob mob, MobInfo mobInfo ) { diff --git a/src/main/java/com/majruszsdifficulty/undeadarmy/components/RewardsController.java b/src/main/java/com/majruszsdifficulty/undeadarmy/components/RewardsController.java index 4445e0b31..4427758aa 100644 --- a/src/main/java/com/majruszsdifficulty/undeadarmy/components/RewardsController.java +++ b/src/main/java/com/majruszsdifficulty/undeadarmy/components/RewardsController.java @@ -13,6 +13,9 @@ public void onWaveFinished() { this.giveExperienceReward(); if( this.undeadArmy.isLastWave() ) { this.giveTreasureReward(); + if( this.undeadArmy.config.isResetAllParticipantsKillRequirementsEnabled() ) { + this.resetAllKillRequirements(); + } } } @@ -30,4 +33,10 @@ private void giveTreasureReward() { ItemHelper.giveItemStackToPlayer( new ItemStack( Registries.UNDEAD_ARMY_TREASURE_BAG.get() ), participant, this.undeadArmy.level ); } ); } + + private void resetAllKillRequirements() { + this.undeadArmy.participants.forEach( participant->{ + this.undeadArmy.config.modifyUndeadArmyInfo( participant.getPersistentData(), info->info.killedUndead = 0 ); + } ); + } } diff --git a/src/main/java/com/majruszsdifficulty/undeadarmy/data/ExtraLootInfo.java b/src/main/java/com/majruszsdifficulty/undeadarmy/data/ExtraLootInfo.java index 10175c73b..a7e05e4db 100644 --- a/src/main/java/com/majruszsdifficulty/undeadarmy/data/ExtraLootInfo.java +++ b/src/main/java/com/majruszsdifficulty/undeadarmy/data/ExtraLootInfo.java @@ -1,5 +1,6 @@ package com.majruszsdifficulty.undeadarmy.data; +import com.mlib.data.SerializableHelper; import com.mlib.data.SerializableStructure; import net.minecraft.world.entity.Entity; @@ -7,21 +8,16 @@ public class ExtraLootInfo extends SerializableStructure { public boolean hasExtraLoot = false; public static void addExtraLootTag( Entity entity ) { - ExtraLootInfo extraLootInfo = new ExtraLootInfo(); - extraLootInfo.hasExtraLoot = true; - extraLootInfo.write( entity.getPersistentData() ); + SerializableHelper.modify( ExtraLootInfo::new, entity.getPersistentData(), info->info.hasExtraLoot = true ); } public static boolean hasExtraLootTag( Entity entity ) { - ExtraLootInfo extraLootInfo = new ExtraLootInfo(); - extraLootInfo.read( entity.getPersistentData() ); - - return extraLootInfo.hasExtraLoot; + return SerializableHelper.read( ExtraLootInfo::new, entity.getPersistentData() ).hasExtraLoot; } public ExtraLootInfo() { super( "UndeadArmy" ); - this.define( "has_extra_loot", ()->this.hasExtraLoot, x->this.hasExtraLoot = x ); + this.defineBoolean( "has_extra_loot", ()->this.hasExtraLoot, x->this.hasExtraLoot = x ); } } diff --git a/src/main/java/com/majruszsdifficulty/undeadarmy/data/MobDef.java b/src/main/java/com/majruszsdifficulty/undeadarmy/data/MobDef.java index bd9c97b67..692d87233 100644 --- a/src/main/java/com/majruszsdifficulty/undeadarmy/data/MobDef.java +++ b/src/main/java/com/majruszsdifficulty/undeadarmy/data/MobDef.java @@ -10,8 +10,8 @@ public class MobDef extends SerializableStructure { public ResourceLocation equipment; public MobDef() { - this.define( "type", ()->this.type, x->this.type = x ); - this.define( "count", ()->this.count, x->this.count = x ); - this.define( "equipment", ()->this.equipment, x->this.equipment = x ); + this.defineEntityType( "type", ()->this.type, x->this.type = x ); + this.defineInteger( "count", ()->this.count, x->this.count = x ); + this.defineLocation( "equipment", ()->this.equipment, x->this.equipment = x ); } } diff --git a/src/main/java/com/majruszsdifficulty/undeadarmy/data/MobInfo.java b/src/main/java/com/majruszsdifficulty/undeadarmy/data/MobInfo.java index 07113be0f..660be0a11 100644 --- a/src/main/java/com/majruszsdifficulty/undeadarmy/data/MobInfo.java +++ b/src/main/java/com/majruszsdifficulty/undeadarmy/data/MobInfo.java @@ -19,11 +19,11 @@ public class MobInfo extends SerializableStructure { public UUID uuid = null; public MobInfo() { - this.define( "type", ()->this.type, x->this.type = x ); - this.define( "equipment", ()->this.equipment, x->this.equipment = x ); - this.define( "position", ()->this.position, x->this.position = x ); - this.define( "is_boss", ()->this.isBoss, x->this.isBoss = x ); - this.define( "uuid", ()->this.uuid, x->this.uuid = x ); + this.defineEntityType( "type", ()->this.type, x->this.type = x ); + this.defineLocation( "equipment", ()->this.equipment, x->this.equipment = x ); + this.defineBlockPos( "position", ()->this.position, x->this.position = x ); + this.defineBoolean( "is_boss", ()->this.isBoss, x->this.isBoss = x ); + this.defineUUID( "uuid", ()->this.uuid, x->this.uuid = x ); } public MobInfo( MobDef def, BlockPos position, boolean isBoss ) { diff --git a/src/main/java/com/majruszsdifficulty/undeadarmy/data/Phase.java b/src/main/java/com/majruszsdifficulty/undeadarmy/data/Phase.java index 2ca6776bf..c30f77e6e 100644 --- a/src/main/java/com/majruszsdifficulty/undeadarmy/data/Phase.java +++ b/src/main/java/com/majruszsdifficulty/undeadarmy/data/Phase.java @@ -10,10 +10,10 @@ public class Phase extends SerializableStructure { public int healthTotal = 0; public Phase() { - this.define( "state", ()->this.state, x->this.state = x, State::values ); - this.define( "ticks_left", ()->this.ticksLeft, x->this.ticksLeft = x ); - this.define( "ticks_total", ()->this.ticksTotal, x->this.ticksTotal = x ); - this.define( "health_total", ()->this.healthTotal, x->this.healthTotal = x ); + this.defineEnum( "state", ()->this.state, x->this.state = x, State::values ); + this.defineInteger( "ticks_left", ()->this.ticksLeft, x->this.ticksLeft = x ); + this.defineInteger( "ticks_total", ()->this.ticksTotal, x->this.ticksTotal = x ); + this.defineInteger( "health_total", ()->this.healthTotal, x->this.healthTotal = x ); } public float getRatio() { diff --git a/src/main/java/com/majruszsdifficulty/undeadarmy/data/UndeadArmyInfo.java b/src/main/java/com/majruszsdifficulty/undeadarmy/data/UndeadArmyInfo.java index 4b9ba680b..33e587e3a 100644 --- a/src/main/java/com/majruszsdifficulty/undeadarmy/data/UndeadArmyInfo.java +++ b/src/main/java/com/majruszsdifficulty/undeadarmy/data/UndeadArmyInfo.java @@ -3,11 +3,13 @@ import com.mlib.data.SerializableStructure; public class UndeadArmyInfo extends SerializableStructure { - public int killedUndead = 0; + public int killedUndead; - public UndeadArmyInfo() { + public UndeadArmyInfo( int initialKillsCount ) { super( "UndeadArmy" ); - this.define( "killed_undead", ()->this.killedUndead, x->this.killedUndead = x ); + this.killedUndead = initialKillsCount; + + this.defineInteger( "killed_undead", ()->this.killedUndead, x->this.killedUndead = x ); } } diff --git a/src/main/java/com/majruszsdifficulty/undeadarmy/data/WaveDef.java b/src/main/java/com/majruszsdifficulty/undeadarmy/data/WaveDef.java index b515bc884..3db897cb1 100644 --- a/src/main/java/com/majruszsdifficulty/undeadarmy/data/WaveDef.java +++ b/src/main/java/com/majruszsdifficulty/undeadarmy/data/WaveDef.java @@ -7,15 +7,15 @@ import java.util.List; public class WaveDef extends SerializableStructure { - public final List< MobDef > mobDefs = new ArrayList<>(); + public List< MobDef > mobDefs = new ArrayList<>(); public MobDef boss; public int experience = 0; public GameStage gameStage = GameStage.NORMAL; public WaveDef() { - this.define( "mobs", ()->this.mobDefs, this.mobDefs::addAll, MobDef::new ); - this.define( "boss", ()->this.boss, x->this.boss = x, MobDef::new ); - this.define( "exp", ()->this.experience, x->this.experience = x ); - this.define( "game_stage", ()->this.gameStage, x->this.gameStage = x, GameStage::values ); + this.defineCustom( "mobs", ()->this.mobDefs, x->this.mobDefs = x, MobDef::new ); + this.defineCustom( "boss", ()->this.boss, x->this.boss = x, MobDef::new ); + this.defineInteger( "exp", ()->this.experience, x->this.experience = x ); + this.defineEnum( "game_stage", ()->this.gameStage, x->this.gameStage = x, GameStage::values ); } } diff --git a/src/main/java/com/majruszsdifficulty/undeadarmy/data/WavesDef.java b/src/main/java/com/majruszsdifficulty/undeadarmy/data/WavesDef.java index 166b77edc..c4ffa4ccb 100644 --- a/src/main/java/com/majruszsdifficulty/undeadarmy/data/WavesDef.java +++ b/src/main/java/com/majruszsdifficulty/undeadarmy/data/WavesDef.java @@ -1,16 +1,16 @@ package com.majruszsdifficulty.undeadarmy.data; -import com.mlib.data.SerializableStructure; +import com.mlib.data.SerializableList; import java.util.ArrayList; import java.util.List; import java.util.stream.Stream; -public class WavesDef extends SerializableStructure { - public final List< WaveDef > waveDefs = new ArrayList<>(); +public class WavesDef extends SerializableList { + public List< WaveDef > waveDefs = new ArrayList<>(); public WavesDef() { - this.define( null, ()->this.waveDefs, this.waveDefs::addAll, WaveDef::new ); + this.defineCustom( ()->this.waveDefs, x->this.waveDefs = x, WaveDef::new ); } public Stream< WaveDef > stream() { diff --git a/src/main/resources/assets/majruszsdifficulty/lang/de_de.json b/src/main/resources/assets/majruszsdifficulty/lang/de_de.json new file mode 100644 index 000000000..b699ccbae --- /dev/null +++ b/src/main/resources/assets/majruszsdifficulty/lang/de_de.json @@ -0,0 +1,191 @@ +{ + "entity.majruszsdifficulty.creeperling": "Creeperling", + "entity.majruszsdifficulty.tank": "Tank", + "entity.majruszsdifficulty.cursed_armor": "Verfluchte Rüstung", + "entity.majruszsdifficulty.cerberus": "Zerberus", + "entity.majruszsdifficulty.black_widow": "Schwarze Witwe", + "effect.majruszsdifficulty.bleeding": "Blutung", + "effect.majruszsdifficulty.bleeding.description": "Verursacht mit der Zeit tödlichen Schaden. Wird hauptsächlich durch scharfe Werkzeuge, Zombies und Spinnen verursacht. Hat keinen Einfluss auf Untote.", + "effect.majruszsdifficulty.bleeding.item_tooltip": " %1$s Chance, um Blutung %2$s zu verursachen", + "effect.majruszsdifficulty.bleeding.armor_tooltip": "x%1$s Chance auf Blutung", + "effect.majruszsdifficulty.bleeding_immunity": "Immunität gegen Blutung", + "effect.majruszsdifficulty.bleeding_immunity.description": "Macht den Spieler immun gegen Blutungen.", + "itemGroup.majruszsdifficulty.primary": "Majrusz's Progressive Schwierigkeit", + "itemGroup.majruszsdifficulty.treasure_bags": "Schatztaschen", + "item.majruszsdifficulty.illusioner_spawn_egg": "Illusionist-Spawn-Ei", + "item.majruszsdifficulty.creeperling_spawn_egg": "Creeperling-Spawn-Ei", + "item.majruszsdifficulty.tank_spawn_egg": "Tank-Spawn-Ei", + "item.majruszsdifficulty.black_widow_spawn_egg": "Schwarze Witwe-Spawn-Ei", + "item.majruszsdifficulty.cursed_armor_spawn_egg": "Verfluchte Rüstung-Spawn-Ei", + "item.majruszsdifficulty.cursed_armor_spawn_egg.locations": "Verfluchte Rüstungen können in diesen Truhen gefunden werden:", + "item.majruszsdifficulty.cerberus_spawn_egg": "Zerberus-Spawn-Ei", + "item.majruszsdifficulty.undead_battle_standard": "Standard für Untote-Kämpfe", + "item.majruszsdifficulty.undead_battle_standard.item_tooltip1": "Beschwört die Armee der Untoten.", + "item.majruszsdifficulty.undead_battle_standard.item_tooltip2": "Die Armee kann nur in der", + "item.majruszsdifficulty.undead_battle_standard.item_tooltip3": "Oberwelt beschworen werden!", + "item.majruszsdifficulty.undead_army_treasure_bag": "Undead Army Schatztasche", + "item.majruszsdifficulty.elder_guardian_treasure_bag": "Elder Guardian-Schatztasche", + "item.majruszsdifficulty.wither_treasure_bag": "Wither-Schatztasche", + "item.majruszsdifficulty.ender_dragon_treasure_bag": "Enderdrache-Schatztasche", + "item.majruszsdifficulty.fishing_treasure_bag": "Angler-Schatztasche", + "item.majruszsdifficulty.pillager_treasure_bag": "Überfall-Schatztasche", + "item.majruszsdifficulty.warden_treasure_bag": "Wärter-Schatztasche", + "item.majruszsdifficulty.bandage": "Verband", + "item.majruszsdifficulty.bandage.effect": "Stoppt Blutungen", + "item.majruszsdifficulty.enderium_shard": "Enderium-Scherbe", + "item.majruszsdifficulty.enderium_ingot": "Enderiumklumpen", + "item.majruszsdifficulty.enderium_sword": "Enderiumschwert", + "item.majruszsdifficulty.enderium_shovel": "Enderiumschaufel", + "item.majruszsdifficulty.enderium_pickaxe": "Enderiumspitzhacke", + "item.majruszsdifficulty.enderium_axe": "Enderiumaxt", + "item.majruszsdifficulty.enderium_hoe": "Enderiumhacke", + "item.majruszsdifficulty.enderium_hoe.effect": " Vergrößert die bearbeitete Fläche", + "item.majruszsdifficulty.enderium_helmet": "Enderiumhelm", + "item.majruszsdifficulty.enderium_chestplate": "Enderiumharnisch", + "item.majruszsdifficulty.enderium_leggings": "Enderiumbeinschutz", + "item.majruszsdifficulty.enderium_boots": "Enderiumstiefel", + "item.majruszsdifficulty.cloth": "Stoff", + "item.majruszsdifficulty.tattered_helmet": "Zerrissene Kappe", + "item.majruszsdifficulty.tattered_chestplate": "Zerrissene Tunika", + "item.majruszsdifficulty.tattered_leggings": "Zerrissene Hose", + "item.majruszsdifficulty.tattered_boots": "Zerrissene Stiefel", + "item.majruszsdifficulty.wither_sword": "Witherschwert", + "item.majruszsdifficulty.wither_sword.effect": " %1$s Chance, um Wither %2$s zu verursachen", + "item.majruszsdifficulty.enderium_shard_locator": "Enderiumscherben-Lokalisator", + "item.majruszsdifficulty.ender_pouch": "Ender-Beutel", + "item.majruszsdifficulty.golden_bandage": "Goldener Verband", + "item.majruszsdifficulty.recall_potion": "Rückruftrank", + "item.majruszsdifficulty.recall_potion.effect": "Teleportiert zurück nach Hause", + "item.majruszsdifficulty.bad_omen_potion": "Drohendes Unheil-Trank", + "item.majruszsdifficulty.bad_omen_potion.effect": "%1$s Drohendes Unheil-Stufe", + "item.majruszsdifficulty.cerberus_fang": "Zerberus-Zahn", + "item.majruszsdifficulty.soul_jar": "Seelenkrug", + "item.majruszsdifficulty.soul_jar.item_tooltip1": "Enthält %1$s zufällige Seelen.", + "item.majruszsdifficulty.soul_jar.item_tooltip2": "Rechtsklick zum Ziehen von Seelen...", + "item.majruszsdifficulty.soul_jar.item_tooltip3": "Enthält Seelen:", + "item.majruszsdifficulty.soul_jar.smite": "%1$s Angriffsschaden gegen Untote", + "item.majruszsdifficulty.soul_jar.move": "%1$s Bewegungsgeschwindigkeit", + "item.majruszsdifficulty.soul_jar.range": "%1$s Reichweite", + "item.majruszsdifficulty.soul_jar.armor": "%1$s Rüstung", + "item.majruszsdifficulty.soul_jar.mine": "%1$s Abbaugeschwindigkeit", + "item.majruszsdifficulty.soul_jar.luck": "%1$s Glück", + "item.majruszsdifficulty.soul_jar.swim": "%1$s Schwimm-Geschwindigkeit", + "entity.minecraft.sniffer": "Schnüffler", + "item.minecraft.tipped_arrow.effect.wither": "Pfeil der Ausdörrung", + "item.minecraft.potion.effect.wither": "Trank der Ausdörrung", + "item.minecraft.splash_potion.effect.wither": "Wurftrank der Ausdörrung", + "item.minecraft.lingering_potion.effect.wither": "Verweiltrank der Ausdörrung", + "block.majruszsdifficulty.enderium_shard_ore": "Enderiumscherbenerz", + "block.majruszsdifficulty.enderium_block": "Enderiumblock", + "block.majruszsdifficulty.infested_end_stone": "Befallener Endstein", + "commands.gamestage.changed": "Die Spielphase wurde geändert in %s.", + "commands.gamestage.cannot_change": "Die Spielphase ist bereits %s!", + "commands.gamestage.current": "Die aktuelle Spielphase ist %s.", + "commands.undeadarmy.finished": "Eine Untoten-Armee wurde gestoppt an Position: %s", + "commands.undeadarmy.missing": "Es gibt keine Untoten-Armee an Position: %s", + "commands.undeadarmy.started": "Eine Untoten-Armee wurde an folgender Position erzeugt: %s", + "commands.undeadarmy.cannot_start": "Eine Untoten-Armee konnte an folgender Position nicht erzeugt werden: %s", + "commands.undeadarmy.killed": "Alle Einheiten der Untoten-Armee wurden getötet an Position: %s", + "commands.undeadarmy.highlighted": "Alle Einheiten der Untoten-Armee wurden hervorgehoben an Position: %s", + "commands.undeadarmy.list": "Liste aller aktiven Untoten-Armeen:", + "commands.undeadarmy.list_empty": "Es ist keine Untoten-Armee im Einsatz.", + "commands.undeadarmy.progress": "%1$s muss %2$s weitere Untote töten, um die Untoten-Armee zu starten.", + "commands.treasurebag.reset": "Der Fortschritt aller Schatztaschen wurde für %1$s neu gestartet.", + "commands.treasurebag.unlockall": "Der Fortschritt aller Sachatztaschen wurde für %1$s maximiert.", + "commands.clampedregionaldifficulty": "Die begrenzte regionale Schwierigkeit bei %1$s ist %2$s.", + "majruszsdifficulty.stages.normal": "Normaler Modus", + "majruszsdifficulty.stages.expert": "Experten-Modus", + "majruszsdifficulty.stages.master": "Meister-Modus", + "majruszsdifficulty.on_expert_mode_start": "Die uralten Geister des Lichts und der Dunkelheit wurden freigelassen", + "majruszsdifficulty.on_master_mode_start": "Das drohende Unheil naht...", + "majruszsdifficulty.treasure_bag.item_tooltip": "Rechtsklick zum Öffnen der Tasche.", + "majruszsdifficulty.treasure_bag.hint_tooltip": "SHIFT drücken, um mögliche Drops anzuzeigen...", + "majruszsdifficulty.treasure_bag.list_tooltip": "Mögliche Drops (%1$s/%2$s)", + "majruszsdifficulty.treasure_bag.new_items": "Du hast neue Gegenstände in %1$s gefunden!", + "majruszsdifficulty.undead_army.title": "Untoten-Armee", + "majruszsdifficulty.undead_army.wave": "(Welle %1$s)", + "majruszsdifficulty.undead_army.victory": "Sieg!", + "majruszsdifficulty.undead_army.failed": "Untoten-Armee hat gewonnen", + "majruszsdifficulty.undead_army.between_waves": "Welle besiegt", + "majruszsdifficulty.undead_army.approaching": "Eine Untoten-Armee nähert sich von %1$s!", + "majruszsdifficulty.undead_army.approached": "Eine Untoten-Armee ist eingetroffen!", + "majruszsdifficulty.undead_army.warning": "In der Ferne ertönen Trommeln...", + "majruszsdifficulty.undead_army.on_expert": "Die Untoten-Armee wurde von Kräften aus dem Nether gestärkt.", + "majruszsdifficulty.undead_army.west": "Westen", + "majruszsdifficulty.undead_army.east": "Osten", + "majruszsdifficulty.undead_army.north": "Norden", + "majruszsdifficulty.undead_army.south": "Süden", + "majruszsdifficulty.subtitle.undead_army.approaching": "Untoten-Armee nähert sich", + "majruszsdifficulty.subtitle.undead_army.wave_started": "Welle gestartet", + "majruszsdifficulty.sets.enderium.name": "Set des Ends", + "majruszsdifficulty.sets.enderium.bonus_1": "Macht alle Enderman weniger feindselig.", + "majruszsdifficulty.sets.enderium.bonus_2": "Gibt eine weitere Stufe Plünderung im End.", + "majruszsdifficulty.sets.enderium.bonus_3": "Ersetzt %1$s zufällige Teleportationen durch einen zufälligen Trank-Effekt.", + "majruszsdifficulty.sets.enderium.bonus_4": "Verhindert das Sterben in der Leere.", + "majruszsdifficulty.sets.undead.name": "Untoten-Set", + "majruszsdifficulty.sets.undead.bonus_1": "Entfernt %1$s Effekt von %2$s.", + "majruszsdifficulty.sets.undead.bonus_2": "Doppelte Hungerpunkte durch %1$s wiederhergestellt.", + "majruszsdifficulty.sets.undead.bonus_3": "Erhöht Rüsung um %1$s.", + "majruszsdifficulty.sets.undead.bonus_4": "Verdoppelt die angewendeten Boosts um %1$s.", + "majruszsdifficulty.smithing.enderium.upgrade": "Enderiumaufwertung", + "majruszsdifficulty.smithing.enderium.applies_to": "Netheritausrüstung", + "majruszsdifficulty.smithing.enderium.ingredients": "Enderiumbarren", + "majruszsdifficulty.smithing.enderium.base_slot": "Netheritrüstung, -waffe oder -werkzeug hinzufügen", + "majruszsdifficulty.smithing.enderium.additions_slot": "Enderiumbarren hinzufügen", + "death.attack.bleeding": "%1$s ist verblutet", + "death.attack.bleeding.player": "%1$s ist an Verletzungen verblutet, die von %2$s verursacht wurden", + "advancements.progressive_difficulty.root.title": "Normaler Modus", + "advancements.progressive_difficulty.root.description": "Alles scheint so friedlich", + "advancements.progressive_difficulty.expert_mode.title": "Experten-Modus", + "advancements.progressive_difficulty.master_mode.title": "Meister-Modus", + "advancements.progressive_difficulty.bleeding.title": "Ist das... Blut?", + "advancements.progressive_difficulty.bleeding.description": "Zum ersten Mal bluten", + "advancements.progressive_difficulty.bleeding_inflicted.title": "Lass sie bluten", + "advancements.progressive_difficulty.bleeding_inflicted.description": "Lasse jeden Mob bluten", + "advancements.progressive_difficulty.bleeding_cactus.title": "Autsch!", + "advancements.progressive_difficulty.bleeding_cactus.description": "Berühre einen Kaktus und blute", + "advancements.progressive_difficulty.bleeding_healed.title": "'Es ist nur ein Kratzer!", + "advancements.progressive_difficulty.bleeding_healed.description": "Nutze einen Verband, um eine Blutung zu stoppen", + "advancements.progressive_difficulty.bleeding_healed_other.title": "Für einen Freund in Not", + "advancements.progressive_difficulty.bleeding_healed_other.description": "Nutze einen goldenen Verband für jemand anderen", + "advancements.progressive_difficulty.kill_yourself.title": "'Töte dich selbst' hat eine neue Bedeutung erhalten", + "advancements.progressive_difficulty.kill_yourself.description": "Besiege die untote Version von dir selbst", + "advancements.progressive_difficulty.undead_army.title": "Gespenstisch gruselige Armee", + "advancements.progressive_difficulty.undead_army.description": "Besiege die Untoten-Armee", + "advancements.progressive_difficulty.creeperling.title": "Was war das!?", + "advancements.progressive_difficulty.creeperling.description": "Begegne einem Creeperling", + "advancements.progressive_difficulty.enderman_teleport_attack.title": "Ich bin Verwirrung", + "advancements.progressive_difficulty.enderman_teleport_attack.description": "Werde vom Enderman teleportiert", + "advancements.progressive_difficulty.enderium_shard.title": "Seltsame Scherben", + "advancements.progressive_difficulty.enderium_shard.description": "Enderium-Scherbe erhalten", + "advancements.progressive_difficulty.enderium_ingot.title": "Misteriöser Barren", + "advancements.progressive_difficulty.enderium_ingot.description": "Enderiumbarren erhalten", + "advancements.progressive_difficulty.fishing_treasure_bag.title": "Gelegenheitsangler", + "advancements.progressive_difficulty.fishing_treasure_bag.description": "Öffne die erste Angler-Schatztasche", + "advancements.progressive_difficulty.fishing_treasure_bag_16.title": "Fischerei-Fanatiker", + "advancements.progressive_difficulty.fishing_treasure_bag_16.description": "Öffne sie sechzente Angler-Schatztasche", + "advancements.progressive_difficulty.undead_army_treasure_bag.title": "Friedhof", + "advancements.progressive_difficulty.undead_army_treasure_bag.description": "Öffne die erste Untoten-Armee-Schatztasche", + "advancements.progressive_difficulty.undead_army_treasure_bag_16.title": "Haufen von Knochen", + "advancements.progressive_difficulty.undead_army_treasure_bag_16.description": "Öffne die sechzente Untoten-Armee-Schatztasche", + "advancements.progressive_difficulty.pillager_treasure_bag.title": "Preis für einen Helden", + "advancements.progressive_difficulty.pillager_treasure_bag.description": "Öffne die erste Überfall-Schatztasche", + "advancements.progressive_difficulty.pillager_treasure_bag_16.title": "Der Wächter", + "advancements.progressive_difficulty.pillager_treasure_bag_16.description": "Öffne die sechzente Überfall-Schatztasche", + "advancements.progressive_difficulty.elder_guardian_treasure_bag.title": "Stachelige Tasche", + "advancements.progressive_difficulty.elder_guardian_treasure_bag.description": "Öffne die erste Schatztasche des großen Wächters", + "advancements.progressive_difficulty.elder_guardian_treasure_bag_16.title": "Ozeanräuber", + "advancements.progressive_difficulty.elder_guardian_treasure_bag_16.description": "Öffne die sechzente Schatztasche des großen Wächters", + "advancements.progressive_difficulty.wither_treasure_bag.title": "Verdorrte Schätze", + "advancements.progressive_difficulty.wither_treasure_bag.description": "Öffne die erste Wither-Schatztasche", + "advancements.progressive_difficulty.wither_treasure_bag_16.title": "Herr des Nethers", + "advancements.progressive_difficulty.wither_treasure_bag_16.description": "Öffne die sechzente Wither-Schatztasche", + "advancements.progressive_difficulty.ender_dragon_treasure_bag.title": "Nicht irdische Schätze", + "advancements.progressive_difficulty.ender_dragon_treasure_bag.description": "Öffne die erste Enderdrache-Schatztasche", + "advancements.progressive_difficulty.ender_dragon_treasure_bag_16.title": "Das Ende vom Ende?", + "advancements.progressive_difficulty.ender_dragon_treasure_bag_16.description": "Öffne die sechzente Enderdrache-Schatztasche", + "advancements.progressive_difficulty.warden_treasure_bag.title": "Verbotene Tasche", + "advancements.progressive_difficulty.warden_treasure_bag.description": "Öffne die erste Wärter-Schatztasche", + "advancements.progressive_difficulty.warden_treasure_bag_16.title": "Meister der Stille", + "advancements.progressive_difficulty.warden_treasure_bag_16.description": "Öffne die sechzente Wärter-Schatztasche" +} \ No newline at end of file diff --git a/src/main/resources/assets/majruszsdifficulty/lang/en_us.json b/src/main/resources/assets/majruszsdifficulty/lang/en_us.json index 9b63cd144..d1c59ab3b 100644 --- a/src/main/resources/assets/majruszsdifficulty/lang/en_us.json +++ b/src/main/resources/assets/majruszsdifficulty/lang/en_us.json @@ -3,22 +3,24 @@ "entity.majruszsdifficulty.tank": "Tank", "entity.majruszsdifficulty.cursed_armor": "Cursed Armor", "entity.majruszsdifficulty.cerberus": "Cerberus", - "entity.majruszsdifficulty.black_widow": "Black Widow", + "entity.majruszsdifficulty.giant": "Giant", "effect.majruszsdifficulty.bleeding": "Bleeding", "effect.majruszsdifficulty.bleeding.description": "Inflicts lethal damage over time. It is mainly caused by sharp tools, zombies and spiders. Does not affect undead.", "effect.majruszsdifficulty.bleeding.item_tooltip": " %1$s Chance To Inflict Bleeding %2$s", "effect.majruszsdifficulty.bleeding.armor_tooltip": "x%1$s Chance To Bleed", "effect.majruszsdifficulty.bleeding_immunity": "Bleeding Immunity", "effect.majruszsdifficulty.bleeding_immunity.description": "Makes the player immune to Bleeding.", + "effect.majruszsdifficulty.glass_regeneration": "Glass Regeneration", + "effect.majruszsdifficulty.glass_regeneration.description": "Weaker version of Regeneration that can be interrupted by taking damage.", "itemGroup.majruszsdifficulty.primary": "Majrusz's Progressive Difficulty", "itemGroup.majruszsdifficulty.treasure_bags": "Treasure Bags", "item.majruszsdifficulty.illusioner_spawn_egg": "Illusioner Spawn Egg", "item.majruszsdifficulty.creeperling_spawn_egg": "Creeperling Spawn Egg", "item.majruszsdifficulty.tank_spawn_egg": "Tank Spawn Egg", - "item.majruszsdifficulty.black_widow_spawn_egg": "Black Widow Spawn Egg", "item.majruszsdifficulty.cursed_armor_spawn_egg": "Cursed Armor Spawn Egg", "item.majruszsdifficulty.cursed_armor_spawn_egg.locations": "Cursed Armor can be found in these chests:", "item.majruszsdifficulty.cerberus_spawn_egg": "Cerberus Spawn Egg", + "item.majruszsdifficulty.giant_spawn_egg": "Giant Spawn Egg", "item.majruszsdifficulty.undead_battle_standard": "Undead Battle Standard", "item.majruszsdifficulty.undead_battle_standard.item_tooltip1": "Summons the Undead Army.", "item.majruszsdifficulty.undead_battle_standard.item_tooltip2": "The army can only be", @@ -56,8 +58,7 @@ "item.majruszsdifficulty.golden_bandage": "Golden Bandage", "item.majruszsdifficulty.recall_potion": "Recall Potion", "item.majruszsdifficulty.recall_potion.effect": "Teleports Back Home", - "item.majruszsdifficulty.bad_omen_potion": "Bad Omen Potion", - "item.majruszsdifficulty.bad_omen_potion.effect": "%1$s Bad Omen Level", + "item.majruszsdifficulty.evoker_fang_scroll": "Scroll of Evoker Fangs", "item.majruszsdifficulty.cerberus_fang": "Cerberus Fang", "item.majruszsdifficulty.soul_jar": "Soul Jar", "item.majruszsdifficulty.soul_jar.item_tooltip1": "Contains %1$s random souls inside.", @@ -70,6 +71,7 @@ "item.majruszsdifficulty.soul_jar.mine": "%1$s Mine Speed", "item.majruszsdifficulty.soul_jar.luck": "%1$s Luck", "item.majruszsdifficulty.soul_jar.swim": "%1$s Swim Speed", + "item.majruszsdifficulty.sonic_boom_scroll": "Scroll of Sonic Boom", "entity.minecraft.sniffer": "Sniffer", "item.minecraft.tipped_arrow.effect.wither": "Arrow of Wither", "item.minecraft.potion.effect.wither": "Potion of Wither", @@ -111,6 +113,7 @@ "majruszsdifficulty.undead_army.approached": "An Undead Army has arrived!", "majruszsdifficulty.undead_army.warning": "Drums begin to echo in the distance...", "majruszsdifficulty.undead_army.on_expert": "The Undead Army has been empowered by Nether forces", + "majruszsdifficulty.undead_army.on_master": "The Undead Army has been empowered by gigantic forces", "majruszsdifficulty.undead_army.west": "west", "majruszsdifficulty.undead_army.east": "east", "majruszsdifficulty.undead_army.north": "north", @@ -127,6 +130,8 @@ "majruszsdifficulty.sets.undead.bonus_2": "Doubles hunger points restored by %1$s.", "majruszsdifficulty.sets.undead.bonus_3": "Increases armor by %1$s.", "majruszsdifficulty.sets.undead.bonus_4": "Doubles boosts applied by %1$s.", + "majruszsdifficulty.scrolls.attack_damage": " %1$s Attack Damage", + "majruszsdifficulty.scrolls.attack_range": " %1$s Attack Range", "death.attack.bleeding": "%1$s bled to death", "death.attack.bleeding.player": "%1$s bled to death from injuries caused by %2$s", "advancements.progressive_difficulty.root.title": "Normal Mode", @@ -135,7 +140,7 @@ "advancements.progressive_difficulty.master_mode.title": "Master Mode", "advancements.progressive_difficulty.bleeding.title": "Is this... blood?", "advancements.progressive_difficulty.bleeding.description": "Bleed for the first time", - "advancements.progressive_difficulty.bleeding_inflicted.title": "Make'em Bleed", + "advancements.progressive_difficulty.bleeding_inflicted.title": "Bloodthirsty", "advancements.progressive_difficulty.bleeding_inflicted.description": "Make any mob bleed", "advancements.progressive_difficulty.bleeding_cactus.title": "Ouch!", "advancements.progressive_difficulty.bleeding_cactus.description": "Touch a cactus and bleed", @@ -149,7 +154,7 @@ "advancements.progressive_difficulty.undead_army.description": "Defeat the Undead Army", "advancements.progressive_difficulty.creeperling.title": "What Was That!?", "advancements.progressive_difficulty.creeperling.description": "Encounter a Creeperling", - "advancements.progressive_difficulty.enderman_teleport_attack.title": "I am Confusion", + "advancements.progressive_difficulty.enderman_teleport_attack.title": "I Am Confusion", "advancements.progressive_difficulty.enderman_teleport_attack.description": "Get teleported by the Enderman", "advancements.progressive_difficulty.enderium_shard.title": "Strange Shards", "advancements.progressive_difficulty.enderium_shard.description": "Acquire Enderium Shard", diff --git a/src/main/resources/assets/majruszsdifficulty/lang/es_es.json b/src/main/resources/assets/majruszsdifficulty/lang/es_es.json index 65d1e28d1..176e09e78 100644 --- a/src/main/resources/assets/majruszsdifficulty/lang/es_es.json +++ b/src/main/resources/assets/majruszsdifficulty/lang/es_es.json @@ -3,7 +3,6 @@ "entity.majruszsdifficulty.tank": "Tanque", "entity.majruszsdifficulty.cursed_armor": "Armadura maldita", "entity.majruszsdifficulty.cerberus": "Cerbero", - "entity.majruszsdifficulty.black_widow": "Viuda negra", "effect.majruszsdifficulty.bleeding": "Sangrado", "effect.majruszsdifficulty.bleeding.description": "Inflige daño letal a lo largo del tiempo. Lo causan principalmente herramientas afiladas, zombis y arañas. No afecta a los muertos vivientes.", "effect.majruszsdifficulty.bleeding.item_tooltip": " %1$s de probabilidad de infligir sangrado durante %2$s", @@ -15,7 +14,6 @@ "item.majruszsdifficulty.illusioner_spawn_egg": "Generar ilusionista", "item.majruszsdifficulty.creeperling_spawn_egg": "Generar creepercito", "item.majruszsdifficulty.tank_spawn_egg": "Generar tanque", - "item.majruszsdifficulty.black_widow_spawn_egg": "Generar viuda negra", "item.majruszsdifficulty.cursed_armor_spawn_egg": "Generar armadura maldita", "item.majruszsdifficulty.cursed_armor_spawn_egg.locations": "La armadura maldita se puede encontrar en estos cofres:", "item.majruszsdifficulty.cerberus_spawn_egg": "Generar cerbero", @@ -56,8 +54,6 @@ "item.majruszsdifficulty.golden_bandage": "Venda dorada", "item.majruszsdifficulty.recall_potion": "Poción de retirada", "item.majruszsdifficulty.recall_potion.effect": "Teletransporta de vuelta a casa", - "item.majruszsdifficulty.bad_omen_potion": "Poción de mal presagio", - "item.majruszsdifficulty.bad_omen_potion.effect": "%1$s Nivel de mal presagio", "item.majruszsdifficulty.cerberus_fang": "Colmillo de Cerbero", "item.majruszsdifficulty.soul_jar": "Frasco de almas", "item.majruszsdifficulty.soul_jar.item_tooltip1": "Contiene %1$s almas aleatorias dentro", diff --git a/src/main/resources/assets/majruszsdifficulty/lang/fr_fr.json b/src/main/resources/assets/majruszsdifficulty/lang/fr_fr.json index d3413b3b4..ae898f7cb 100644 --- a/src/main/resources/assets/majruszsdifficulty/lang/fr_fr.json +++ b/src/main/resources/assets/majruszsdifficulty/lang/fr_fr.json @@ -1,83 +1,201 @@ { + "entity.majruszsdifficulty.creeperling": "Mini-Creeper", + "entity.majruszsdifficulty.tank": "Goliath mort-vivant", + "entity.majruszsdifficulty.cursed_armor": "Armure funeste", + "entity.majruszsdifficulty.cerberus": "Cerbère", "entity.majruszsdifficulty.giant": "Géant", - "entity.majruszsdifficulty.pillager_wolf": "Chien de pillard", - "entity.majruszsdifficulty.elite_skeleton": "Squelette d՚élite", - "entity.majruszsdifficulty.creeperling": "Bébé creeper", - "effect.majruszsdifficulty.bleeding": "Saignement", - "effect.majruszsdifficulty.bleeding_immunity": "Imunité au saignement", - "itemGroup.majruszsdifficulty.primary": "Majrusz՚s Progressive Difficulty", - "item.majruszsdifficulty.giant_spawn_egg": "Oeuf d՚apparition de Géant", - "item.majruszsdifficulty.illusioner_spawn_egg": "Oeuf d՚apparition d՚illusionniste", - "item.majruszsdifficulty.pillager_wolf_spawn_egg": "Oeuf d՚apparition de chien de pillard", - "item.majruszsdifficulty.elite_skeleton_spawn_egg": "Oeuf d՚apparition de squelette d՚élite", - "item.majruszsdifficulty.sky_keeper_spawn_egg": "Oeuf d՚apparition de guadien de l՚End", - "item.majruszsdifficulty.creeperling_spawn_egg": "Oeuf d՚apparition de bébé creeper", - "item.majruszsdifficulty.wither_sword": "Épée de Wither", - "item.majruszsdifficulty.wither_sword.effect": "Inflige Wither II pour quelques secondes en frappant.", - "item.majruszsdifficulty.undead_battle_standard": "Étendard de bataille de mort-vivants", - "item.majruszsdifficulty.undead_battle_standard.item_tooltip1": "Invoque l՚armée de mort-vivants.", - "item.majruszsdifficulty.undead_battle_standard.item_tooltip2": "L՚armée de mort-vivants peut être", - "item.majruszsdifficulty.undead_battle_standard.item_tooltip3": "invoquée seulement dans le monde normal!", - "item.majruszsdifficulty.undead_army_treasure_bag": "Sac au trésors de l՚armée de mort-vivants", - "item.majruszsdifficulty.elder_guardian_treasure_bag": "Sac au trésors de grand guardien", - "item.majruszsdifficulty.wither_treasure_bag": "Sac au trésors de Wither", - "item.majruszsdifficulty.ender_dragon_treasure_bag": "Sac au trésors d՚Ender Dragon", - "item.majruszsdifficulty.fishing_treasure_bag": "Sac au trésors de pêcheur", + "effect.majruszsdifficulty.bleeding": "Hémorragie", + "effect.majruszsdifficulty.bleeding.description": "Inflige des dégâts au fil du temps qui peuvent tuer. Principalement provoqué par des outils tranchants, des attaques de zombie ou des morsures d'araignée. N'affecte pas les morts-vivants", + "effect.majruszsdifficulty.bleeding.item_tooltip": " %1$s de chances d'infliger l'effet Hémorragie %2$s", + "effect.majruszsdifficulty.bleeding.armor_tooltip": "Chance de subir l'effet Hémorragie multipliée par %1$s (cumulable)", + "effect.majruszsdifficulty.bleeding_immunity": "Antihémorragie", + "effect.majruszsdifficulty.bleeding_immunity.description": "Immunise le joueur contre l'effet Hémorragie", + "effect.majruszsdifficulty.glass_regeneration": "Bandage régénérant", + "effect.majruszsdifficulty.glass_regeneration.description": "Version plus faible de l'effet Régénération qui peut être interrompue en subissant des dégâts", + "itemGroup.majruszsdifficulty.primary": "Majrusz's Progressive Difficulty", + "itemGroup.majruszsdifficulty.treasure_bags": "Sacs à trésors", + "item.majruszsdifficulty.advancement_bleeding": "Trophée de succès de l'effet Hémorragie", + "item.majruszsdifficulty.advancement_normal": "Trophée de succès du Stade Normal", + "item.majruszsdifficulty.advancement_expert": "Trophée de succès du Stade Expert", + "item.majruszsdifficulty.advancement_master": "Trophée de succès du Stade Maître", + "item.majruszsdifficulty.illusioner_spawn_egg": "Oeuf d'apparition d'illusionniste", + "item.majruszsdifficulty.creeperling_spawn_egg": "Oeuf d'apparition de Mini-Creeper", + "item.majruszsdifficulty.tank_spawn_egg": "Oeuf d'apparition de Goliath mort-vivant", + "item.majruszsdifficulty.cursed_armor_spawn_egg": "Oeuf d'apparition de l'Armure funeste", + "item.majruszsdifficulty.cursed_armor_spawn_egg.locations": "Une Armure funeste peut surgir de ces types de coffres : ", + "item.majruszsdifficulty.cerberus_spawn_egg": "Oeuf d'apparition de Cerbère", + "item.majruszsdifficulty.giant_spawn_egg": "Oeuf d'apparition de géant", + "item.majruszsdifficulty.undead_battle_standard": "Présage de l'armée de morts-vivants", + "item.majruszsdifficulty.undead_battle_standard.item_tooltip1": "Déploie une armée de morts-vivants à votre position.", + "item.majruszsdifficulty.undead_battle_standard.item_tooltip2": "Cette armée ne peut être invoquée", + "item.majruszsdifficulty.undead_battle_standard.item_tooltip3": "que dans le monde normal !", + "item.majruszsdifficulty.undead_army_treasure_bag": "Sac à trésors de l'armée de morts-vivants", + "item.majruszsdifficulty.elder_guardian_treasure_bag": "Sac à trésors de grand gardien", + "item.majruszsdifficulty.wither_treasure_bag": "Sac à trésors de Wither", + "item.majruszsdifficulty.ender_dragon_treasure_bag": "Sac à trésors d'Ender Dragon", + "item.majruszsdifficulty.fishing_treasure_bag": "Sac à trésors de pêcheur", + "item.majruszsdifficulty.pillager_treasure_bag": "Sac à trésors d'invasion", + "item.majruszsdifficulty.warden_treasure_bag": "Sac à trésors de Warden", "item.majruszsdifficulty.bandage": "Bandage", - "item.majruszsdifficulty.hermes_boots": "Bottes d'Hermes", - "item.majruszsdifficulty.hermes_boots.item_tooltip": "Augmente la vitesse de déplacement quand elles sont équipés.", - "item.majruszsdifficulty.enderium_shard": "Fragment de l՚End", - "item.majruszsdifficulty.enderium_ingot": "Lingot de l՚End", - "item.majruszsdifficulty.enderium_sword": "Épée de l՚End", - "item.majruszsdifficulty.enderium_sword.item_tooltip": "Chance d՚infliger Lévitation en frappant tout en étant accroupi.", - "item.majruszsdifficulty.enderium_shovel": "Pelle de l՚End", - "item.majruszsdifficulty.enderium_pickaxe": "Pioche de l՚End", - "item.majruszsdifficulty.enderium_axe": "Hache de l՚End", - "item.majruszsdifficulty.enderium_hoe": "Houe de l՚End", - "item.majruszsdifficulty.enderium_helmet": "Casque de l՚End", - "item.majruszsdifficulty.enderium_helmet.item_tooltip": "armure", - "item.majruszsdifficulty.enderium_chestplate": "Plastron de l՚End", - "item.majruszsdifficulty.enderium_chestplate.item_tooltip": "armure", - "item.majruszsdifficulty.enderium_leggings": "Jambière de l՚End", - "item.majruszsdifficulty.enderium_leggings.item_tooltip": "bonus d'armure en fonction du niveau d՚enchantement", - "item.majruszsdifficulty.enderium_boots": "Bottes de l՚End", - "item.majruszsdifficulty.enderium_boots.item_tooltip": "armure", - "item.majruszsdifficulty.cloth": "tissue déchiré", - "item.majruszsdifficulty.enderium_shard_locator": "Localisateur de fragment de l՚End", + "item.majruszsdifficulty.bandage.effect": "Soigne de l'effet Hémorragie", + "item.majruszsdifficulty.enderium_shard": "Éclat d'Enderium", + "item.majruszsdifficulty.enderium_ingot": "Lingot d'Enderium", + "item.majruszsdifficulty.enderium_sword": "Épée en Enderium", + "item.majruszsdifficulty.enderium_shovel": "Pelle en Enderium", + "item.majruszsdifficulty.enderium_pickaxe": "Pioche en Enderium", + "item.majruszsdifficulty.enderium_axe": "Hache en Enderium", + "item.majruszsdifficulty.enderium_hoe": "Houe en Enderium", + "item.majruszsdifficulty.enderium_hoe.effect": " Laboure une zone de 3x3 lorsque vous n'êtes pas accroupi", + "item.majruszsdifficulty.enderium_helmet": "Casque en Enderium", + "item.majruszsdifficulty.enderium_chestplate": "Plastron en Enderium", + "item.majruszsdifficulty.enderium_leggings": "Jambières en Enderium", + "item.majruszsdifficulty.enderium_boots": "Bottes en Enderium", + "item.majruszsdifficulty.cloth": "Lambeau", + "item.majruszsdifficulty.tattered_helmet": "Chapeau en Lambeaux", + "item.majruszsdifficulty.tattered_chestplate": "Tunique en Lambeaux", + "item.majruszsdifficulty.tattered_leggings": "Pantalon en Lambeaux", + "item.majruszsdifficulty.tattered_boots": "Bottes en Lambeaux", + "item.majruszsdifficulty.wither_sword": "Épée de Wither", + "item.majruszsdifficulty.wither_sword.effect": " %1$s de chances d'infliger l'effet Décomposition %2$s", + "item.majruszsdifficulty.enderium_shard_locator": "Boussole d'éclats d'Enderium", + "item.majruszsdifficulty.ender_pouch": "Saccoche de l'Ender", "item.majruszsdifficulty.golden_bandage": "Bandage doré", - "block.majruszsdifficulty.enderium_shard_ore": "Minerai de fragment de l՚End", - "block.majruszsdifficulty.enderium_shard_ore.warning": "Après destruction de ce bloc, tout les Endermans proches vous attaqueront!", - "block.majruszsdifficulty.enderium_block": "Bloc de l՚End", - "block.majruszsdifficulty.infested_end_stone": "Pierre de l՚End infesté", - "commands.game_state.change": "Le jeu est maintenant en", - "commands.game_state.current": "Le jeu est en", - "commands.undead_army.undead_left": "nombre de monstres de l՚armée de mort-vivants restants:", - "commands.undead_army.missing": "Il n՚y a pas de monstres de l՚armée de mort-vivants ici!", - "commands.regional_difficulty": "difficulté régional actuelle:", - "majruszsdifficulty.stages.normal": "Mode Normal", - "majruszsdifficulty.stages.expert": "Mode Expert", - "majruszsdifficulty.stages.master": "Mode Maitre", - "majruszsdifficulty.on_expert_mode_start": "Les anciens esprits de lumière et ténèbres ont été relachés.", - "majruszsdifficulty.on_master_mode_start": "L՚Apocalypse approche...", - "majruszsdifficulty.treasure_bag.item_tooltip": "Clic droit en le tenant pour ouvrir le sac.", - "majruszsdifficulty.undead_army.title": "Armée de mort-vivants", + "item.majruszsdifficulty.recall_potion": "Potion de rappel", + "item.majruszsdifficulty.recall_potion.effect": "Téléporte au point de réapparition", + "item.majruszsdifficulty.evoker_fang_scroll": "Parchemin de maîtrise des mâchoires d'évocateur", + "item.majruszsdifficulty.cerberus_fang": "Croc de Cerbère", + "item.majruszsdifficulty.soul_jar": "Jarre des âmes", + "item.majruszsdifficulty.soul_jar.item_tooltip1": "Contient %1$s âmes aux bonus aléatoires.", + "item.majruszsdifficulty.soul_jar.item_tooltip2": "Clic droit pour libérer les pouvoirs des âmes...", + "item.majruszsdifficulty.soul_jar.item_tooltip3": "Âmes libérées : ", + "item.majruszsdifficulty.soul_jar.smite": "%1$s dégâts supplémentaires infligés aux morts-vivants", + "item.majruszsdifficulty.soul_jar.move": "%1$s de rapidité", + "item.majruszsdifficulty.soul_jar.range": "%1$s blocs de portée", + "item.majruszsdifficulty.soul_jar.armor": "%1$s points d'armure", + "item.majruszsdifficulty.soul_jar.mine": "%1$s de vitesse de minage", + "item.majruszsdifficulty.soul_jar.luck": "%1$s de chance", + "item.majruszsdifficulty.soul_jar.swim": "%1$s de vitesse de nage", + "item.majruszsdifficulty.sonic_boom_scroll": "Parchemin de maîtrise du hurlement sonique", + "item.minecraft.tipped_arrow.effect.wither": "Flèche de décomposition", + "item.minecraft.potion.effect.wither": "Potion de décomposition", + "item.minecraft.splash_potion.effect.wither": "Potion de décomposition jetable", + "item.minecraft.lingering_potion.effect.wither": "Potion de décomposition persistante", + "block.majruszsdifficulty.enderium_shard_ore": "Minerai d'éclats d'Enderium", + "block.majruszsdifficulty.enderium_block": "Bloc d'Enderium", + "block.majruszsdifficulty.infested_end_stone": "Pierre de l'End infestée", + "commands.gamestage.changed": "Le stade du jeu est maintenant réglé sur le %s", + "commands.gamestage.cannot_change": "Rien n'a changé, le stade du jeu est déjà réglé sur le %s !", + "commands.gamestage.current": "Le stade du jeu est actuellement réglé sur le %s", + "commands.undeadarmy.finished": "Une armée de morts-vivants a été repliée à la position %s", + "commands.undeadarmy.missing": "Il n'y a pas d'armée de morts-vivants déployée à la position %s", + "commands.undeadarmy.started": "Une armée de morts-vivants a été déployée à la position %s", + "commands.undeadarmy.cannot_start": "Impossible de déployer une armée de morts-vivants à la position %s", + "commands.undeadarmy.killed": "Toutes les unités de l'armée de morts-vivants à la position %s ont été anéanties", + "commands.undeadarmy.highlighted": "Toutes les unités de l'armée de morts-vivants à la position %s ont été mises en surbrillance", + "commands.undeadarmy.list": "Liste de toutes les armées de morts-vivants déployées : ", + "commands.undeadarmy.list_empty": "Il n'y a aucune armée de morts-vivants déployée actuellement !", + "commands.undeadarmy.progress": "%1$s doit encore tuer %2$s mort(s)-vivant(s) avant de pouvoir déployer une armée", + "commands.treasurebag.reset": "Tous les butins possibles des sacs à trésors connus de %1$s ont été réinitialisés", + "commands.treasurebag.unlockall": "Tout les butins possibles des sacs à trésors ont été révélés à %1$s", + "commands.clampedregionaldifficulty": "La difficulté régionale bornée à la position %1$s est de %2$s", + "majruszsdifficulty.stages.normal": "Stade Normal", + "majruszsdifficulty.stages.expert": "Stade Expert", + "majruszsdifficulty.stages.master": "Stade Maître", + "majruszsdifficulty.on_expert_mode_start": "Les antiques esprits de clarté et de ténèbres se sont éveillés", + "majruszsdifficulty.on_master_mode_start": "Un présage funeste se rapproche...", + "majruszsdifficulty.treasure_bag.item_tooltip": "Clic droit pour ouvrir le sac", + "majruszsdifficulty.treasure_bag.hint_tooltip": "Maintenez MAJ appuyé pour voir les butins possibles...", + "majruszsdifficulty.treasure_bag.list_tooltip": "Butins possibles (%1$s/%2$s)", + "majruszsdifficulty.treasure_bag.new_items": "Le %1$s vient de révéler un nouveau butin !", + "majruszsdifficulty.undead_army.title": "Armée de morts-vivants", "majruszsdifficulty.undead_army.wave": "(Vague %1$s)", - "majruszsdifficulty.undead_army.victory": "Victoire!", - "majruszsdifficulty.undead_army.failed": "L՚armée de mort-vivants à gagné", - "majruszsdifficulty.undead_army.between_waves": "Vague vaincus", - "majruszsdifficulty.undead_army.approaching": "Une armée de mort-vivants approche depuis %1$s!", - "majruszsdifficulty.undead_army.west": "l՚ouest", - "majruszsdifficulty.undead_army.east": "l՚est", - "majruszsdifficulty.undead_army.north": "le nord", - "majruszsdifficulty.undead_army.south": "le sud", - "majruszsdifficulty.subtitle.undead_army.approaching": "L՚armée de mort-vivants approche", - "majruszsdifficulty.subtitle.undead_army.wave_started": "La vague à commencé", - "majruszsdifficulty.effects.haste_tooltip": "Donne Hate en cassant un bloc.", - "item.majruszsdifficulty.tattered_helmet": "Casque de mort-vivants", - "item.majruszsdifficulty.tattered_chestplate": "Plastron de mort-vivants", - "item.majruszsdifficulty.tattered_leggings": "Jambière de mort-vivants", - "item.majruszsdifficulty.tattered_boots": "Bottes de mort-vivants", - "majruszsdifficulty.items.disabled_tooltip": "Cet item est désactivé et n՚est pas disponible en mode survie!", - "death.attack.bleeding": "%1$s à saigné à mort", - "death.attack.bleeding.player": "%1$s à saigné à mort par blessures infligé par %2$s" -} \ No newline at end of file + "majruszsdifficulty.undead_army.victory": "Victoire", + "majruszsdifficulty.undead_army.failed": "Défaite", + "majruszsdifficulty.undead_army.between_waves": "Une nouvelle vague approche...", + "majruszsdifficulty.undead_army.approaching": "Une armée de morts-vivants approche %1$s !", + "majruszsdifficulty.undead_army.approached": "Une armée de morts-vivants a été déployée !", + "majruszsdifficulty.undead_army.warning": "Le grondement lointain de tambours commence à résonner...", + "majruszsdifficulty.undead_army.on_expert": "Des âmes troublées du Nether se sont ralliées à l'armée de morts-vivants", + "majruszsdifficulty.undead_army.on_master": "De puissantes forces en quête de vengeance viennent renforcer l'armée de morts-vivants", + "majruszsdifficulty.undead_army.west": "de l'ouest", + "majruszsdifficulty.undead_army.east": "de l'est", + "majruszsdifficulty.undead_army.north": "du nord", + "majruszsdifficulty.undead_army.south": "du sud", + "majruszsdifficulty.subtitle.undead_army.approaching": "Armée de morts-vivants s'approchant", + "majruszsdifficulty.subtitle.undead_army.wave_started": "Vague d'ennemi qui démarre", + "majruszsdifficulty.sets.enderium.name": "Équipement en Enderium", + "majruszsdifficulty.sets.enderium.bonus_1": "Permet de regarder sans risque un Enderman dans les yeux", + "majruszsdifficulty.sets.enderium.bonus_2": "Confère un niveau supplémentaire de Butin dans l'End", + "majruszsdifficulty.sets.enderium.bonus_3": "Remplace l'effet de téléportation aléatoire du %1$s par un effet de potion bénéfique aléatoire", + "majruszsdifficulty.sets.enderium.bonus_4": "Préserve de la mort si vous tombez dans le Vide", + "majruszsdifficulty.sets.undead.name": "Équipement en Lambeaux", + "majruszsdifficulty.sets.undead.bonus_1": "Retire l'effet %1$s lorsque de la %2$s est consommée", + "majruszsdifficulty.sets.undead.bonus_2": "Double les points de faim restaurés par la %1$s", + "majruszsdifficulty.sets.undead.bonus_3": "Augmente le nombre de points d'armure par %1$s", + "majruszsdifficulty.sets.undead.bonus_4": "Chaque âme libérée de la %1$s est doublement efficace", + "majruszsdifficulty.scrolls.attack_damage": " %1$s dégâts supplémentaires", + "majruszsdifficulty.scrolls.attack_range": " %1$s de portée d'attaque", + "majruszsdifficulty.smithing.enderium.upgrade": "Amélioration en Enderium", + "majruszsdifficulty.smithing.enderium.applies_to": "Équipement en Netherite", + "majruszsdifficulty.smithing.enderium.ingredients": "Lingot d'Enderium", + "majruszsdifficulty.smithing.enderium.base_slot": "Ajoutez une pièce d'armure, une arme ou un outil en Netherite", + "majruszsdifficulty.smithing.enderium.additions_slot": "Ajoutez un lingot d'Enderium", + "death.attack.bleeding": "%1$s est mort(e) d'une hémorragie", + "death.attack.bleeding.player": "%1$s est mort(e) d'une hémorragie suite aux blessures causées par (un(e)) %2$s", + "advancements.progressive_difficulty.root.title": "Stade Normal", + "advancements.progressive_difficulty.root.description": "J'préfère quand c'est un peu trop plus moins calme...", + "advancements.progressive_difficulty.expert_mode.title": "Stade Expert", + "advancements.progressive_difficulty.expert_mode.description": "Bienvenue en enfer, comment était la chute ?", + "advancements.progressive_difficulty.master_mode.title": "Stade Maître", + "advancements.progressive_difficulty.master_mode.description": "N'oubliez pas que c'est au fond du trou qu'on voit mieux le trou", + "advancements.progressive_difficulty.bleeding.title": "Ça ne peut pas être... du SANG !", + "advancements.progressive_difficulty.bleeding.description": "Subissez une hémorragie", + "advancements.progressive_difficulty.bleeding_inflicted.title": "Ce sang, tout ce sang !", + "advancements.progressive_difficulty.bleeding_inflicted.description": "Provoquez une hémorragie sur une créature", + "advancements.progressive_difficulty.bleeding_cactus.title": "Aïe !", + "advancements.progressive_difficulty.bleeding_cactus.description": "Frottez-vous à un cactus... et subissez-en les conséquences", + "advancements.progressive_difficulty.bleeding_healed.title": "J'ai été touché... ou pas", + "advancements.progressive_difficulty.bleeding_healed.description": "Utilisez un bandage pour arrêter votre hémorragie", + "advancements.progressive_difficulty.bleeding_healed_other.title": "C'est pour un \"ami\"", + "advancements.progressive_difficulty.bleeding_healed_other.description": "Faites le garrot à quelqu'un d'autre à l'aide d'un bandage doré", + "advancements.progressive_difficulty.kill_yourself.title": "\"Soit ton propre ennemi\"", + "advancements.progressive_difficulty.kill_yourself.description": "Tuez votre alter ego mort-vivant", + "advancements.progressive_difficulty.undead_army.title": "Retour dans la tombe", + "advancements.progressive_difficulty.undead_army.description": "Tuez toutes les unités d'une armée de morts-vivants", + "advancements.progressive_difficulty.creeperling.title": "Petit et... explosif ?!", + "advancements.progressive_difficulty.creeperling.description": "Faites la connaissance d'un Mini-Crepeer, que vous le vouliez ou non", + "advancements.progressive_difficulty.enderman_teleport_attack.title": "Quelle est cette sorcellerie ?", + "advancements.progressive_difficulty.enderman_teleport_attack.description": "Faites-vous téléporter hors de votre cachette par un Enderman", + "advancements.progressive_difficulty.enderium_shard.title": "Un sans-éclat sans renom", + "advancements.progressive_difficulty.enderium_shard.description": "Obtenez des éclats d'Enderium dans la dernière dimension du jeu", + "advancements.progressive_difficulty.enderium_ingot.title": "Drôle de lingot", + "advancements.progressive_difficulty.enderium_ingot.description": "Obtenez un lingot d'Enderium dans votre inventaire", + "advancements.progressive_difficulty.fishing_treasure_bag.title": "Pêcheur en intérim", + "advancements.progressive_difficulty.fishing_treasure_bag.description": "Ouvrez votre premier sac à trésors de pêcheur", + "advancements.progressive_difficulty.fishing_treasure_bag_16.title": "Mordu de la pêche", + "advancements.progressive_difficulty.fishing_treasure_bag_16.description": "Témoignez de votre addiction au butin de pêche en ouvrant votre seizième sac à trésors de pêcheur", + "advancements.progressive_difficulty.undead_army_treasure_bag.title": "Jouons aux osselets", + "advancements.progressive_difficulty.undead_army_treasure_bag.description": "Ouvrez votre premier sac à trésors de l'armée de morts-vivants", + "advancements.progressive_difficulty.undead_army_treasure_bag_16.title": "Nécrologue en chair et en os", + "advancements.progressive_difficulty.undead_army_treasure_bag_16.description": "Devenez la hantise des morts-vivants en ouvrant votre seizième sac à trésors de l'armée de morts-vivants", + "advancements.progressive_difficulty.pillager_treasure_bag.title": "Héros (récompensé) du village", + "advancements.progressive_difficulty.pillager_treasure_bag.description": "Ouvrez votre premier sac à trésors d'invasion", + "advancements.progressive_difficulty.pillager_treasure_bag_16.title": "Consultant en sécurité", + "advancements.progressive_difficulty.pillager_treasure_bag_16.description": "Démontrez vos aptitudes de défense en ouvrant votre seizième sac à trésors d'invasion", + "advancements.progressive_difficulty.elder_guardian_treasure_bag.title": "Un sujet épineux", + "advancements.progressive_difficulty.elder_guardian_treasure_bag.description": "Ouvrez votre premier sac à trésors de grand gardien", + "advancements.progressive_difficulty.elder_guardian_treasure_bag_16.title": "Nettoyeur d'océans", + "advancements.progressive_difficulty.elder_guardian_treasure_bag_16.description": "Affirmez votre engagement pour l'environnement en ouvrant votre seizième sac à trésors de grand gardien", + "advancements.progressive_difficulty.wither_treasure_bag.title": "Un trésor si flétrissable", + "advancements.progressive_difficulty.wither_treasure_bag.description": "Ouvrez votre premier sac à trésors de Wither", + "advancements.progressive_difficulty.wither_treasure_bag_16.title": "Conservateur face au dépéris", + "advancements.progressive_difficulty.wither_treasure_bag_16.description": "Régnez sur le flétrissement en ouvrant votre seizième sac à trésors de Wither", + "advancements.progressive_difficulty.ender_dragon_treasure_bag.title": "Trésor d'un autre monde", + "advancements.progressive_difficulty.ender_dragon_treasure_bag.description": "Ouvrez votre premier sac à trésors d'Ender Dragon", + "advancements.progressive_difficulty.ender_dragon_treasure_bag_16.title": "Fin ? Fin.", + "advancements.progressive_difficulty.ender_dragon_treasure_bag_16.description": "Achevez un nouveau chapitre de votre aventure en ouvrant votre seizième sac à trésors d'Ender Dragon", + "advancements.progressive_difficulty.warden_treasure_bag.title": "Le sac du silence", + "advancements.progressive_difficulty.warden_treasure_bag.description": "Ouvrez (sans faire trop de bruit) votre premier sac à trésors de Warden", + "advancements.progressive_difficulty.warden_treasure_bag_16.title": "Empereur du silence", + "advancements.progressive_difficulty.warden_treasure_bag_16.description": "Montrez votre contrôle parfait de vos mouvements en ouvrant votre seizième sac à trésors de Warden" +} diff --git a/src/main/resources/assets/majruszsdifficulty/lang/pl_pl.json b/src/main/resources/assets/majruszsdifficulty/lang/pl_pl.json index 98a51c5fb..accdb6381 100644 --- a/src/main/resources/assets/majruszsdifficulty/lang/pl_pl.json +++ b/src/main/resources/assets/majruszsdifficulty/lang/pl_pl.json @@ -3,22 +3,24 @@ "entity.majruszsdifficulty.tank": "Tank", "entity.majruszsdifficulty.cursed_armor": "Przeklęta zbroja", "entity.majruszsdifficulty.cerberus": "Cerber", - "entity.majruszsdifficulty.black_widow": "Czarna wdowa", + "entity.majruszsdifficulty.giant": "Gigant", "effect.majruszsdifficulty.bleeding": "Krwawienie", "effect.majruszsdifficulty.bleeding.description": "Zadaje śmiertelne obrażenia od czasu do czasu. Głównie wywoływane ostrymi przedmiotami, przez zombie oraz przez pająki. Nie wpływa na nieumarłych.", "effect.majruszsdifficulty.bleeding.item_tooltip": " %1$s szansy na wywołanie krwawienia %2$s", "effect.majruszsdifficulty.bleeding.armor_tooltip": "x%1$s szansa na krwawienie", "effect.majruszsdifficulty.bleeding_immunity": "Odporność na krwawienie", "effect.majruszsdifficulty.bleeding_immunity.description": "Powoduje, że gracz nie otrzymuje żadnych obrażeń od krwawienia.", + "effect.majruszsdifficulty.glass_regeneration": "Szklana regeneracja", + "effect.majruszsdifficulty.glass_regeneration.description": "Słabsza wersja efektu regeneracji, która może zostać przerwana poprzez otrzymanie obrażeń.", "itemGroup.majruszsdifficulty.primary": "Majrusz's Progressive Difficulty", "itemGroup.majruszsdifficulty.treasure_bags": "Worki ze skarbami", "item.majruszsdifficulty.illusioner_spawn_egg": "Jajo przywołujące iluzjoniera", "item.majruszsdifficulty.creeperling_spawn_egg": "Jajo przywołujące creeperlinga", "item.majruszsdifficulty.tank_spawn_egg": "Jajo przywołujące tanka", - "item.majruszsdifficulty.black_widow_spawn_egg": "Jajo przywołujące czarną wdowę", "item.majruszsdifficulty.cursed_armor_spawn_egg": "Jajo przywołujące przeklętą zbroję", "item.majruszsdifficulty.cursed_armor_spawn_egg.locations": "Przeklęta zbroja może zostać znaleziona w tych skrzyniach:", "item.majruszsdifficulty.cerberus_spawn_egg": "Jajo przywołujące cerbera", + "item.majruszsdifficulty.giant_spawn_egg": "Jajo przywołujące giganta", "item.majruszsdifficulty.undead_battle_standard": "Bitewny sztandar nieumarłych", "item.majruszsdifficulty.undead_battle_standard.item_tooltip1": "Przywołuje armię nieumarłych.", "item.majruszsdifficulty.undead_battle_standard.item_tooltip2": "Armia nieumarłych może zostać", @@ -56,8 +58,7 @@ "item.majruszsdifficulty.golden_bandage": "Złoty bandaż", "item.majruszsdifficulty.recall_potion": "Mikstura powrotu", "item.majruszsdifficulty.recall_potion.effect": "Teleportuje z powrotem do domu", - "item.majruszsdifficulty.bad_omen_potion": "Mikstura złego omenu", - "item.majruszsdifficulty.bad_omen_potion.effect": "%1$s poziom złego omenu", + "item.majruszsdifficulty.evoker_fang_scroll": "Zwój kłów evokera", "item.majruszsdifficulty.cerberus_fang": "Kieł cerbera", "item.majruszsdifficulty.soul_jar": "Słój dusz", "item.majruszsdifficulty.soul_jar.item_tooltip1": "Zawiera %1$s losowe dusze w środku.", @@ -70,6 +71,7 @@ "item.majruszsdifficulty.soul_jar.mine": "%1$s prędkości kopania", "item.majruszsdifficulty.soul_jar.luck": "%1$s szczęścia", "item.majruszsdifficulty.soul_jar.swim": "%1$s prędkości pływania", + "item.majruszsdifficulty.sonic_boom_scroll": "Zwój fali dźwiękowej", "item.minecraft.tipped_arrow.effect.wither": "Strzała obumierania", "item.minecraft.potion.effect.wither": "Mikstura obumierania", "item.minecraft.splash_potion.effect.wither": "Miotana mikstura obumierania", @@ -109,7 +111,8 @@ "majruszsdifficulty.undead_army.approaching": "Armia nieumarłych nadchodzi %1$s!", "majruszsdifficulty.undead_army.approached": "Armia nieumarłych nadeszła!", "majruszsdifficulty.undead_army.warning": "W oddali zaczynają rozbrzmiewać bębny...", - "majruszsdifficulty.undead_army.on_expert": "Armia nieumarłych została zasilona piekielnymi oddziałami", + "majruszsdifficulty.undead_army.on_expert": "Armia nieumarłych została wzmocniona piekielnymi oddziałami", + "majruszsdifficulty.undead_army.on_master": "Armia nieumarłych została wzmocniona olbrzymimi oddziałami", "majruszsdifficulty.undead_army.west": "z zachodu", "majruszsdifficulty.undead_army.east": "ze wschodu", "majruszsdifficulty.undead_army.north": "z północy", @@ -126,6 +129,8 @@ "majruszsdifficulty.sets.undead.bonus_2": "Podwaja liczbę punktów głodu zregenerowanych przez %1$s.", "majruszsdifficulty.sets.undead.bonus_3": "Zwiększa pancerz o %1$s.", "majruszsdifficulty.sets.undead.bonus_4": "Podwaja premie przyznawane za %1$s.", + "majruszsdifficulty.scrolls.attack_damage": " %1$s obrażeń", + "majruszsdifficulty.scrolls.attack_range": " %1$s zasięg ataku", "death.attack.bleeding": "%1$s wykrwawił się na śmierć", "death.attack.bleeding.player": "%1$s wykrwawił się na śmierć na wskutek ran od %2$s", "death.attack.infested": "%1$s został zjedzony od środka ", @@ -136,7 +141,7 @@ "advancements.progressive_difficulty.master_mode.title": "Tryb mistrza", "advancements.progressive_difficulty.bleeding.title": "Czy ja krwawię?", "advancements.progressive_difficulty.bleeding.description": "Zacznij krwawić po raz pierwszy", - "advancements.progressive_difficulty.bleeding_inflicted.title": "Dziś zamieszkasz w glebie", + "advancements.progressive_difficulty.bleeding_inflicted.title": "Żądny krwi", "advancements.progressive_difficulty.bleeding_inflicted.description": "Wywołaj krwawienie u dowolnego moba", "advancements.progressive_difficulty.bleeding_cactus.title": "Auć!", "advancements.progressive_difficulty.bleeding_cactus.description": "Zacznij krwawić po dotknięciu kaktusa", diff --git a/src/main/resources/assets/majruszsdifficulty/lang/uk_ua.json b/src/main/resources/assets/majruszsdifficulty/lang/uk_ua.json index 88ad4c50e..88d66b59f 100644 --- a/src/main/resources/assets/majruszsdifficulty/lang/uk_ua.json +++ b/src/main/resources/assets/majruszsdifficulty/lang/uk_ua.json @@ -14,7 +14,6 @@ "item.majruszsdifficulty.illusioner_spawn_egg": "Яйце виклику іллюзіонина", "item.majruszsdifficulty.creeperling_spawn_egg": "Яйце виклику кріплінґа", "item.majruszsdifficulty.tank_spawn_egg": "Яйце виклику велетня", - "item.majruszsdifficulty.black_widow_spawn_egg": "Яйце виклику чорної вдови", "item.majruszsdifficulty.cursed_armor_spawn_egg": "Яйце виклику проклятих обладунків", "item.majruszsdifficulty.cursed_armor_spawn_egg.locations": "Прокляті обладунки можна знайти в цих скринях:", "item.majruszsdifficulty.undead_battle_standard": "Стяг армії нежиті", diff --git a/src/main/resources/assets/majruszsdifficulty/lang/zh_cn.json b/src/main/resources/assets/majruszsdifficulty/lang/zh_cn.json index 03b2db030..2f220e5be 100644 --- a/src/main/resources/assets/majruszsdifficulty/lang/zh_cn.json +++ b/src/main/resources/assets/majruszsdifficulty/lang/zh_cn.json @@ -3,7 +3,6 @@ "entity.majruszsdifficulty.tank": "坦克", "entity.majruszsdifficulty.cursed_armor": "被诅咒的盔甲", "entity.majruszsdifficulty.cerberus": "地狱犬", - "entity.majruszsdifficulty.black_widow": "黑寡妇", "effect.majruszsdifficulty.bleeding": "流血", "effect.majruszsdifficulty.bleeding.description": "感染后造成可以致死的伤害,主要由锋利的工具、僵尸和蜘蛛造成,对亡灵无效。", "effect.majruszsdifficulty.bleeding.item_tooltip": " %1$s 概率造成 %2$s", @@ -15,7 +14,6 @@ "item.majruszsdifficulty.illusioner_spawn_egg": "幻术师刷怪蛋", "item.majruszsdifficulty.creeperling_spawn_egg": "小苦力怕刷怪蛋", "item.majruszsdifficulty.tank_spawn_egg": "坦克刷怪蛋", - "item.majruszsdifficulty.black_widow_spawn_egg": "黑寡妇刷怪蛋", "item.majruszsdifficulty.cursed_armor_spawn_egg": "诅咒盔甲刷怪蛋", "item.majruszsdifficulty.cursed_armor_spawn_egg.locations": "诅咒盔甲可以在以下箱子中找到:", "item.majruszsdifficulty.cerberus_spawn_egg": "地狱犬刷怪蛋", @@ -56,8 +54,6 @@ "item.majruszsdifficulty.golden_bandage": "金绷带", "item.majruszsdifficulty.recall_potion": "回忆药水", "item.majruszsdifficulty.recall_potion.effect": "传送回家", - "item.majruszsdifficulty.bad_omen_potion": "恶兆药水", - "item.majruszsdifficulty.bad_omen_potion.effect": "%1$s 恶兆等级", "item.majruszsdifficulty.cerberus_fang": "地狱犬牙", "item.majruszsdifficulty.soul_jar": "灵魂罐", "item.majruszsdifficulty.soul_jar.item_tooltip1": "含有 %1$s 种随机灵魂在内", diff --git a/src/main/resources/assets/majruszsdifficulty/lang/zh_tw.json b/src/main/resources/assets/majruszsdifficulty/lang/zh_tw.json new file mode 100644 index 000000000..9e7ee2920 --- /dev/null +++ b/src/main/resources/assets/majruszsdifficulty/lang/zh_tw.json @@ -0,0 +1,191 @@ +{ + "entity.majruszsdifficulty.creeperling": "迷你苦力怕", + "entity.majruszsdifficulty.tank": "坦克", + "entity.majruszsdifficulty.cursed_armor": "受詛咒的盔甲", + "entity.majruszsdifficulty.cerberus": "地獄三頭犬", + "entity.majruszsdifficulty.black_widow": "黑寡婦", + "effect.majruszsdifficulty.bleeding": "失血", + "effect.majruszsdifficulty.bleeding.description": "持續給予可致命的傷害,主要由鋒利的工具、殭屍和蜘蛛造成,對不死族無效.", + "effect.majruszsdifficulty.bleeding.item_tooltip": " %1$s機率造成%2$s", + "effect.majruszsdifficulty.bleeding.armor_tooltip": "x%1$s機率失血", + "effect.majruszsdifficulty.bleeding_immunity": "免疫失血", + "effect.majruszsdifficulty.bleeding_immunity.description": "使玩家免疫於失血.", + "itemGroup.majruszsdifficulty.primary": "Majrusz的漸進式難度", + "itemGroup.majruszsdifficulty.treasure_bags": "寶藏袋", + "item.majruszsdifficulty.illusioner_spawn_egg": "幻術師 生怪蛋", + "item.majruszsdifficulty.creeperling_spawn_egg": "迷你苦力怕 生怪蛋", + "item.majruszsdifficulty.tank_spawn_egg": "坦克 生怪蛋", + "item.majruszsdifficulty.black_widow_spawn_egg": "黑寡婦 生怪蛋", + "item.majruszsdifficulty.cursed_armor_spawn_egg": "受詛咒的盔甲 生怪蛋", + "item.majruszsdifficulty.cursed_armor_spawn_egg.locations": "受詛咒的盔甲可以在這些地點的箱子中找到:", + "item.majruszsdifficulty.cerberus_spawn_egg": "地獄三頭犬 生怪蛋", + "item.majruszsdifficulty.undead_battle_standard": "不死族軍旗", + "item.majruszsdifficulty.undead_battle_standard.item_tooltip1": "召喚不死軍團。", + "item.majruszsdifficulty.undead_battle_standard.item_tooltip2": "不死軍團", + "item.majruszsdifficulty.undead_battle_standard.item_tooltip3": "僅能在主世界中召喚!", + "item.majruszsdifficulty.undead_army_treasure_bag": "不死軍團寶藏袋", + "item.majruszsdifficulty.elder_guardian_treasure_bag": "遠古深海守衛寶藏袋", + "item.majruszsdifficulty.wither_treasure_bag": "凋零寶藏袋", + "item.majruszsdifficulty.ender_dragon_treasure_bag": "終界龍寶藏袋", + "item.majruszsdifficulty.fishing_treasure_bag": "釣魚者寶藏袋", + "item.majruszsdifficulty.pillager_treasure_bag": "突襲寶藏袋", + "item.majruszsdifficulty.warden_treasure_bag": "伏守者寶藏袋", + "item.majruszsdifficulty.bandage": "繃帶", + "item.majruszsdifficulty.bandage.effect": "止血", + "item.majruszsdifficulty.enderium_shard": "終界合金碎片", + "item.majruszsdifficulty.enderium_ingot": "終界合金錠", + "item.majruszsdifficulty.enderium_sword": "終界合金劍", + "item.majruszsdifficulty.enderium_shovel": "終界合金鏟", + "item.majruszsdifficulty.enderium_pickaxe": "終界合金鎬", + "item.majruszsdifficulty.enderium_axe": "終界合金斧", + "item.majruszsdifficulty.enderium_hoe": "終界合金鋤", + "item.majruszsdifficulty.enderium_hoe.effect": " 增加耕種面積", + "item.majruszsdifficulty.enderium_helmet": "終界合金頭盔", + "item.majruszsdifficulty.enderium_chestplate": "終界合金胸甲", + "item.majruszsdifficulty.enderium_leggings": "終界合金護腿", + "item.majruszsdifficulty.enderium_boots": "終界合金靴子", + "item.majruszsdifficulty.cloth": "布料", + "item.majruszsdifficulty.tattered_helmet": "破爛的帽子", + "item.majruszsdifficulty.tattered_chestplate": "破爛的袍子", + "item.majruszsdifficulty.tattered_leggings": "破爛的褲子", + "item.majruszsdifficulty.tattered_boots": "破爛的靴子", + "item.majruszsdifficulty.wither_sword": "凋零劍", + "item.majruszsdifficulty.wither_sword.effect": " %1$s機率造成凋零%2$s", + "item.majruszsdifficulty.enderium_shard_locator": "終界合金碎片定位器", + "item.majruszsdifficulty.ender_pouch": "終界錦囊", + "item.majruszsdifficulty.golden_bandage": "黃金繃帶", + "item.majruszsdifficulty.recall_potion": "回憶藥水", + "item.majruszsdifficulty.recall_potion.effect": "傳送回重生點", + "item.majruszsdifficulty.bad_omen_potion": "不祥之兆藥水n", + "item.majruszsdifficulty.bad_omen_potion.effect": "%1$s不祥之兆等級", + "item.majruszsdifficulty.cerberus_fang": "三頭犬之牙", + "item.majruszsdifficulty.soul_jar": "靈魂罐", + "item.majruszsdifficulty.soul_jar.item_tooltip1": "隨機裝著%1$s種靈魂在罐中。", + "item.majruszsdifficulty.soul_jar.item_tooltip2": "點擊右鍵揭密靈魂...", + "item.majruszsdifficulty.soul_jar.item_tooltip3": "裝著靈魂:", + "item.majruszsdifficulty.soul_jar.smite": "%1$s對不死族的傷害", + "item.majruszsdifficulty.soul_jar.move": "%1$s移動速度", + "item.majruszsdifficulty.soul_jar.range": "%1$s範圍", + "item.majruszsdifficulty.soul_jar.armor": "%1$s護甲", + "item.majruszsdifficulty.soul_jar.mine": "%1$s挖掘速度", + "item.majruszsdifficulty.soul_jar.luck": "%1$s幸運", + "item.majruszsdifficulty.soul_jar.swim": "%1$s水中速度", + "entity.minecraft.sniffer": "嗅探獸", + "item.minecraft.tipped_arrow.effect.wither": "凋零之箭", + "item.minecraft.potion.effect.wither": "凋零藥水", + "item.minecraft.splash_potion.effect.wither": "飛濺 凋零藥水", + "item.minecraft.lingering_potion.effect.wither": "滯留 凋零藥水", + "block.majruszsdifficulty.enderium_shard_ore": "終界合金礦", + "block.majruszsdifficulty.enderium_block": "終界合金方塊", + "block.majruszsdifficulty.infested_end_stone": "蛀蝕的終界石", + "commands.gamestage.changed": "遊戲階段變更為%s.", + "commands.gamestage.cannot_change": "遊戲階段已經是%s!", + "commands.gamestage.current": "目前遊戲階段是%s.", + "commands.undeadarmy.finished": "一支不死軍團已停留在位置: %s", + "commands.undeadarmy.missing": "這裡沒有沒有不死軍團: %s", + "commands.undeadarmy.started": "一支不死軍團生成在位置: %s", + "commands.undeadarmy.cannot_start": "不死軍團無法生成在此位置: %s", + "commands.undeadarmy.killed": "此位置的不死軍團成員皆被殺死: %s", + "commands.undeadarmy.highlighted": "此位置的不死軍團成員皆被標記: %s", + "commands.undeadarmy.list": "顯示所有不死軍團進度:", + "commands.undeadarmy.list_empty": "目前進度中沒有不死軍團!", + "commands.undeadarmy.progress": "%1$s還需要再擊殺%2$s之不死生物來召喚不死軍團。", + "commands.treasurebag.reset": "%1$s的寶藏袋進度已被重設。", + "commands.treasurebag.unlockall": "%1$s的寶藏袋進度已升至最高級。", + "commands.clampedregionaldifficulty": "Clamped regional difficulty at %1$s is %2$s.", + "majruszsdifficulty.stages.normal": "一般模式", + "majruszsdifficulty.stages.expert": "專家模式", + "majruszsdifficulty.stages.master": "大師模式", + "majruszsdifficulty.on_expert_mode_start": "遠古的黑暗與光明靈魂被釋放了", + "majruszsdifficulty.on_master_mode_start": "災難即將到來...", + "majruszsdifficulty.treasure_bag.item_tooltip": "右鍵來開啟寶藏袋.", + "majruszsdifficulty.treasure_bag.hint_tooltip": "按下SHIFT來顯示掉落品列表...", + "majruszsdifficulty.treasure_bag.list_tooltip": "可能的掉落物(%1$s/%2$s)", + "majruszsdifficulty.treasure_bag.new_items": "你在 %1$s 找到了新物品!", + "majruszsdifficulty.undead_army.title": "不死軍團", + "majruszsdifficulty.undead_army.wave": "(波次%1$s)", + "majruszsdifficulty.undead_army.victory": "勝利!", + "majruszsdifficulty.undead_army.failed": "不死軍團獲勝", + "majruszsdifficulty.undead_army.between_waves": "波次完成", + "majruszsdifficulty.undead_army.approaching": "一支不死軍團由%1$s襲來!", + "majruszsdifficulty.undead_army.approached": "不死軍團抵達!", + "majruszsdifficulty.undead_army.warning": "鼓聲在遠方迴盪...", + "majruszsdifficulty.undead_army.on_expert": "不死軍團得到地獄之力", + "majruszsdifficulty.undead_army.west": "西方", + "majruszsdifficulty.undead_army.east": "東方", + "majruszsdifficulty.undead_army.north": "北方", + "majruszsdifficulty.undead_army.south": "南方", + "majruszsdifficulty.subtitle.undead_army.approaching": "不死軍團接近中", + "majruszsdifficulty.subtitle.undead_army.wave_started": "波次開始", + "majruszsdifficulty.sets.enderium.name": "終界套裝", + "majruszsdifficulty.sets.enderium.bonus_1": "減少終界使者所產生的敵意.", + "majruszsdifficulty.sets.enderium.bonus_2": "在終界可以提升掠奪等級.", + "majruszsdifficulty.sets.enderium.bonus_3": "吃下%1$s會獲得隨機藥水效果", + "majruszsdifficulty.sets.enderium.bonus_4": "在虛空中不會死亡.", + "majruszsdifficulty.sets.undead.name": "不死套裝", + "majruszsdifficulty.sets.undead.bonus_1": "移除%2$s的%1$s效果.", + "majruszsdifficulty.sets.undead.bonus_2": "%1$s的飢餓值回復量為兩倍", + "majruszsdifficulty.sets.undead.bonus_3": "增加%1$s護甲值。", + "majruszsdifficulty.sets.undead.bonus_4": "%1$s效果翻倍", + "majruszsdifficulty.smithing.enderium.upgrade": "終界合金升級", + "majruszsdifficulty.smithing.enderium.applies_to": "獄髓裝備", + "majruszsdifficulty.smithing.enderium.ingredients": "終界合金錠", + "majruszsdifficulty.smithing.enderium.base_slot": "Add netherite armor, weapon, or tool", + "majruszsdifficulty.smithing.enderium.additions_slot": "增加終界合金錠", + "death.attack.bleeding": "%1$s失血過多致死", + "death.attack.bleeding.player": " 因為%2$s導致%1$s失血過多致死", + "advancements.progressive_difficulty.root.title": "一般模式", + "advancements.progressive_difficulty.root.description": "一切看起來很和平", + "advancements.progressive_difficulty.expert_mode.title": "專家模式", + "advancements.progressive_difficulty.master_mode.title": "大師模式", + "advancements.progressive_difficulty.bleeding.title": "這難道....是血?", + "advancements.progressive_difficulty.bleeding.description": "第一次流血", + "advancements.progressive_difficulty.bleeding_inflicted.title": "讓他們流血", + "advancements.progressive_difficulty.bleeding_inflicted.description": "使任意生物流血", + "advancements.progressive_difficulty.bleeding_cactus.title": "噢!", + "advancements.progressive_difficulty.bleeding_cactus.description": "碰到仙人掌並流血", + "advancements.progressive_difficulty.bleeding_healed.title": "不痛不癢!", + "advancements.progressive_difficulty.bleeding_healed.description": "使用繃帶來止血", + "advancements.progressive_difficulty.bleeding_healed_other.title": "患難見真情", + "advancements.progressive_difficulty.bleeding_healed_other.description": "對他人使用黃金繃帶", + "advancements.progressive_difficulty.kill_yourself.title": "重新定義「自殺」", + "advancements.progressive_difficulty.kill_yourself.description": "擊殺僵屍化的自己", + "advancements.progressive_difficulty.undead_army.title": "幽靈般可怕的軍隊", + "advancements.progressive_difficulty.undead_army.description": "擊敗不死軍團", + "advancements.progressive_difficulty.creeperling.title": "那啥!?", + "advancements.progressive_difficulty.creeperling.description": "遇到迷你苦力怕", + "advancements.progressive_difficulty.enderman_teleport_attack.title": "我很困擾", + "advancements.progressive_difficulty.enderman_teleport_attack.description": "被終界使者傳送", + "advancements.progressive_difficulty.enderium_shard.title": "奇怪的碎片", + "advancements.progressive_difficulty.enderium_shard.description": "獲得終界合金碎片", + "advancements.progressive_difficulty.enderium_ingot.title": "神密的金屬錠", + "advancements.progressive_difficulty.enderium_ingot.description": "獲得終界合金錠", + "advancements.progressive_difficulty.fishing_treasure_bag.title": "新手釣魚家", + "advancements.progressive_difficulty.fishing_treasure_bag.description": "打開第一個釣魚者寶藏袋", + "advancements.progressive_difficulty.fishing_treasure_bag_16.title": "釣魚狂樂者", + "advancements.progressive_difficulty.fishing_treasure_bag_16.description": "打開第十六個釣魚者寶藏袋", + "advancements.progressive_difficulty.undead_army_treasure_bag.title": "墓園", + "advancements.progressive_difficulty.undead_army_treasure_bag.description": "打開第一個不死軍團寶藏袋", + "advancements.progressive_difficulty.undead_army_treasure_bag_16.title": "一堆骨頭", + "advancements.progressive_difficulty.undead_army_treasure_bag_16.description": "打開第十六個不死軍團寶藏袋", + "advancements.progressive_difficulty.pillager_treasure_bag.title": "給英雄的獎勵", + "advancements.progressive_difficulty.pillager_treasure_bag.description": "打開第一個掠奪寶藏袋", + "advancements.progressive_difficulty.pillager_treasure_bag_16.title": "守護者", + "advancements.progressive_difficulty.pillager_treasure_bag_16.description": "打開第十六個掠奪寶藏袋", + "advancements.progressive_difficulty.elder_guardian_treasure_bag.title": "尖刺的袋子", + "advancements.progressive_difficulty.elder_guardian_treasure_bag.description": "打開第一個遠古深海守衛寶藏袋", + "advancements.progressive_difficulty.elder_guardian_treasure_bag_16.title": "海洋掠奪者", + "advancements.progressive_difficulty.elder_guardian_treasure_bag_16.description": "打開第十六個遠古深海守衛寶藏袋", + "advancements.progressive_difficulty.wither_treasure_bag.title": "凋零的寶藏", + "advancements.progressive_difficulty.wither_treasure_bag.description": "打開第一個凋零寶藏袋", + "advancements.progressive_difficulty.wither_treasure_bag_16.title": "地獄之王", + "advancements.progressive_difficulty.wither_treasure_bag_16.description": "打開第十六個凋零寶藏袋", + "advancements.progressive_difficulty.ender_dragon_treasure_bag.title": "荒謬的寶藏", + "advancements.progressive_difficulty.ender_dragon_treasure_bag.description": "打開第一個終界龍寶藏袋", + "advancements.progressive_difficulty.ender_dragon_treasure_bag_16.title": "結束的結束?", + "advancements.progressive_difficulty.ender_dragon_treasure_bag_16.description": "打開第十六個終界龍寶藏袋", + "advancements.progressive_difficulty.warden_treasure_bag.title": "被遺忘的袋子", + "advancements.progressive_difficulty.warden_treasure_bag.description": "打開第一個伏守者寶藏袋", + "advancements.progressive_difficulty.warden_treasure_bag_16.title": "潛行之王", + "advancements.progressive_difficulty.warden_treasure_bag_16.description": "打開第十六個伏守者寶藏袋" +} \ No newline at end of file diff --git a/src/main/resources/assets/majruszsdifficulty/models/item/bad_omen_potion.json b/src/main/resources/assets/majruszsdifficulty/models/item/bad_omen_potion.json deleted file mode 100644 index b78da4b43..000000000 --- a/src/main/resources/assets/majruszsdifficulty/models/item/bad_omen_potion.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "item/generated", - "textures": { - "layer0": "majruszsdifficulty:item/bad_omen_potion" - } -} diff --git a/src/main/resources/assets/majruszsdifficulty/models/item/black_widow_spawn_egg.json b/src/main/resources/assets/majruszsdifficulty/models/item/black_widow_spawn_egg.json deleted file mode 100644 index 7a2c6da81..000000000 --- a/src/main/resources/assets/majruszsdifficulty/models/item/black_widow_spawn_egg.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "parent": "item/template_spawn_egg" -} \ No newline at end of file diff --git a/src/main/resources/assets/majruszsdifficulty/models/item/enderium_boots.json b/src/main/resources/assets/majruszsdifficulty/models/item/enderium_boots.json index 5f4fe3de1..0fa3baf0d 100644 --- a/src/main/resources/assets/majruszsdifficulty/models/item/enderium_boots.json +++ b/src/main/resources/assets/majruszsdifficulty/models/item/enderium_boots.json @@ -1,5 +1,67 @@ { "parent": "minecraft:item/generated", + "overrides": [ + { + "model": "majruszsdifficulty:item/trim/enderium_boots_quartz_trim", + "predicate": { + "trim_type": 0.1 + } + }, + { + "model": "majruszsdifficulty:item/trim/enderium_boots_iron_trim", + "predicate": { + "trim_type": 0.2 + } + }, + { + "model": "majruszsdifficulty:item/trim/enderium_boots_netherite_trim", + "predicate": { + "trim_type": 0.3 + } + }, + { + "model": "majruszsdifficulty:item/trim/enderium_boots_redstone_trim", + "predicate": { + "trim_type": 0.4 + } + }, + { + "model": "majruszsdifficulty:item/trim/enderium_boots_copper_trim", + "predicate": { + "trim_type": 0.5 + } + }, + { + "model": "majruszsdifficulty:item/trim/enderium_boots_gold_trim", + "predicate": { + "trim_type": 0.6 + } + }, + { + "model": "majruszsdifficulty:item/trim/enderium_boots_emerald_trim", + "predicate": { + "trim_type": 0.7 + } + }, + { + "model": "majruszsdifficulty:item/trim/enderium_boots_diamond_trim", + "predicate": { + "trim_type": 0.8 + } + }, + { + "model": "majruszsdifficulty:item/trim/enderium_boots_lapis_trim", + "predicate": { + "trim_type": 0.9 + } + }, + { + "model": "majruszsdifficulty:item/trim/enderium_boots_amethyst_trim", + "predicate": { + "trim_type": 1.0 + } + } + ], "textures": { "layer0": "majruszsdifficulty:item/enderium_boots" } diff --git a/src/main/resources/assets/majruszsdifficulty/models/item/enderium_chestplate.json b/src/main/resources/assets/majruszsdifficulty/models/item/enderium_chestplate.json index af1698d6c..1c38b9118 100644 --- a/src/main/resources/assets/majruszsdifficulty/models/item/enderium_chestplate.json +++ b/src/main/resources/assets/majruszsdifficulty/models/item/enderium_chestplate.json @@ -1,5 +1,67 @@ { "parent": "minecraft:item/generated", + "overrides": [ + { + "model": "majruszsdifficulty:item/trim/enderium_chestplate_quartz_trim", + "predicate": { + "trim_type": 0.1 + } + }, + { + "model": "majruszsdifficulty:item/trim/enderium_chestplate_iron_trim", + "predicate": { + "trim_type": 0.2 + } + }, + { + "model": "majruszsdifficulty:item/trim/enderium_chestplate_netherite_trim", + "predicate": { + "trim_type": 0.3 + } + }, + { + "model": "majruszsdifficulty:item/trim/enderium_chestplate_redstone_trim", + "predicate": { + "trim_type": 0.4 + } + }, + { + "model": "majruszsdifficulty:item/trim/enderium_chestplate_copper_trim", + "predicate": { + "trim_type": 0.5 + } + }, + { + "model": "majruszsdifficulty:item/trim/enderium_chestplate_gold_trim", + "predicate": { + "trim_type": 0.6 + } + }, + { + "model": "majruszsdifficulty:item/trim/enderium_chestplate_emerald_trim", + "predicate": { + "trim_type": 0.7 + } + }, + { + "model": "majruszsdifficulty:item/trim/enderium_chestplate_diamond_trim", + "predicate": { + "trim_type": 0.8 + } + }, + { + "model": "majruszsdifficulty:item/trim/enderium_chestplate_lapis_trim", + "predicate": { + "trim_type": 0.9 + } + }, + { + "model": "majruszsdifficulty:item/trim/enderium_chestplate_amethyst_trim", + "predicate": { + "trim_type": 1.0 + } + } + ], "textures": { "layer0": "majruszsdifficulty:item/enderium_chestplate" } diff --git a/src/main/resources/assets/majruszsdifficulty/models/item/enderium_helmet.json b/src/main/resources/assets/majruszsdifficulty/models/item/enderium_helmet.json index 57d226995..458e109ae 100644 --- a/src/main/resources/assets/majruszsdifficulty/models/item/enderium_helmet.json +++ b/src/main/resources/assets/majruszsdifficulty/models/item/enderium_helmet.json @@ -1,5 +1,67 @@ { "parent": "minecraft:item/generated", + "overrides": [ + { + "model": "majruszsdifficulty:item/trim/enderium_helmet_quartz_trim", + "predicate": { + "trim_type": 0.1 + } + }, + { + "model": "majruszsdifficulty:item/trim/enderium_helmet_iron_trim", + "predicate": { + "trim_type": 0.2 + } + }, + { + "model": "majruszsdifficulty:item/trim/enderium_helmet_netherite_trim", + "predicate": { + "trim_type": 0.3 + } + }, + { + "model": "majruszsdifficulty:item/trim/enderium_helmet_redstone_trim", + "predicate": { + "trim_type": 0.4 + } + }, + { + "model": "majruszsdifficulty:item/trim/enderium_helmet_copper_trim", + "predicate": { + "trim_type": 0.5 + } + }, + { + "model": "majruszsdifficulty:item/trim/enderium_helmet_gold_trim", + "predicate": { + "trim_type": 0.6 + } + }, + { + "model": "majruszsdifficulty:item/trim/enderium_helmet_emerald_trim", + "predicate": { + "trim_type": 0.7 + } + }, + { + "model": "majruszsdifficulty:item/trim/enderium_helmet_diamond_trim", + "predicate": { + "trim_type": 0.8 + } + }, + { + "model": "majruszsdifficulty:item/trim/enderium_helmet_lapis_trim", + "predicate": { + "trim_type": 0.9 + } + }, + { + "model": "majruszsdifficulty:item/trim/enderium_helmet_amethyst_trim", + "predicate": { + "trim_type": 1.0 + } + } + ], "textures": { "layer0": "majruszsdifficulty:item/enderium_helmet" } diff --git a/src/main/resources/assets/majruszsdifficulty/models/item/enderium_leggings.json b/src/main/resources/assets/majruszsdifficulty/models/item/enderium_leggings.json index 9ca63f0f3..e19e4c051 100644 --- a/src/main/resources/assets/majruszsdifficulty/models/item/enderium_leggings.json +++ b/src/main/resources/assets/majruszsdifficulty/models/item/enderium_leggings.json @@ -1,5 +1,67 @@ { "parent": "minecraft:item/generated", + "overrides": [ + { + "model": "majruszsdifficulty:item/trim/enderium_leggings_quartz_trim", + "predicate": { + "trim_type": 0.1 + } + }, + { + "model": "majruszsdifficulty:item/trim/enderium_leggings_iron_trim", + "predicate": { + "trim_type": 0.2 + } + }, + { + "model": "majruszsdifficulty:item/trim/enderium_leggings_netherite_trim", + "predicate": { + "trim_type": 0.3 + } + }, + { + "model": "majruszsdifficulty:item/trim/enderium_leggings_redstone_trim", + "predicate": { + "trim_type": 0.4 + } + }, + { + "model": "majruszsdifficulty:item/trim/enderium_leggings_copper_trim", + "predicate": { + "trim_type": 0.5 + } + }, + { + "model": "majruszsdifficulty:item/trim/enderium_leggings_gold_trim", + "predicate": { + "trim_type": 0.6 + } + }, + { + "model": "majruszsdifficulty:item/trim/enderium_leggings_emerald_trim", + "predicate": { + "trim_type": 0.7 + } + }, + { + "model": "majruszsdifficulty:item/trim/enderium_leggings_diamond_trim", + "predicate": { + "trim_type": 0.8 + } + }, + { + "model": "majruszsdifficulty:item/trim/enderium_leggings_lapis_trim", + "predicate": { + "trim_type": 0.9 + } + }, + { + "model": "majruszsdifficulty:item/trim/enderium_leggings_amethyst_trim", + "predicate": { + "trim_type": 1.0 + } + } + ], "textures": { "layer0": "majruszsdifficulty:item/enderium_leggings" } diff --git a/src/main/resources/assets/majruszsdifficulty/models/item/evoker_fang_scroll.json b/src/main/resources/assets/majruszsdifficulty/models/item/evoker_fang_scroll.json new file mode 100644 index 000000000..307a4ff7e --- /dev/null +++ b/src/main/resources/assets/majruszsdifficulty/models/item/evoker_fang_scroll.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "majruszsdifficulty:item/evoker_fang_scroll" + } +} diff --git a/src/main/resources/assets/majruszsdifficulty/models/item/sonic_boom_scroll.json b/src/main/resources/assets/majruszsdifficulty/models/item/sonic_boom_scroll.json new file mode 100644 index 000000000..15a711e81 --- /dev/null +++ b/src/main/resources/assets/majruszsdifficulty/models/item/sonic_boom_scroll.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "majruszsdifficulty:item/sonic_boom_scroll" + } +} diff --git a/src/main/resources/assets/majruszsdifficulty/models/item/soul_jar.json b/src/main/resources/assets/majruszsdifficulty/models/item/soul_jar.json index ed55a08dd..75ce9dc92 100644 --- a/src/main/resources/assets/majruszsdifficulty/models/item/soul_jar.json +++ b/src/main/resources/assets/majruszsdifficulty/models/item/soul_jar.json @@ -1,6 +1,9 @@ { "parent": "item/generated", "textures": { - "layer0": "majruszsdifficulty:item/soul_jar" + "layer0": "majruszsdifficulty:item/soul_jar", + "layer1": "majruszsdifficulty:item/soul_jar_soul1", + "layer2": "majruszsdifficulty:item/soul_jar_soul2", + "layer3": "majruszsdifficulty:item/soul_jar_soul3" } } diff --git a/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_boots_amethyst_trim.json b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_boots_amethyst_trim.json new file mode 100644 index 000000000..25606c11e --- /dev/null +++ b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_boots_amethyst_trim.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "majruszsdifficulty:item/enderium_boots", + "layer1": "minecraft:trims/items/boots_trim_amethyst" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_boots_copper_trim.json b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_boots_copper_trim.json new file mode 100644 index 000000000..049afee8f --- /dev/null +++ b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_boots_copper_trim.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "majruszsdifficulty:item/enderium_boots", + "layer1": "minecraft:trims/items/boots_trim_copper" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_boots_diamond_trim.json b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_boots_diamond_trim.json new file mode 100644 index 000000000..f00300a26 --- /dev/null +++ b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_boots_diamond_trim.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "majruszsdifficulty:item/enderium_boots", + "layer1": "minecraft:trims/items/boots_trim_diamond" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_boots_emerald_trim.json b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_boots_emerald_trim.json new file mode 100644 index 000000000..608011747 --- /dev/null +++ b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_boots_emerald_trim.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "majruszsdifficulty:item/enderium_boots", + "layer1": "minecraft:trims/items/boots_trim_emerald" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_boots_gold_trim.json b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_boots_gold_trim.json new file mode 100644 index 000000000..950e7112d --- /dev/null +++ b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_boots_gold_trim.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "majruszsdifficulty:item/enderium_boots", + "layer1": "minecraft:trims/items/boots_trim_gold" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_boots_iron_trim.json b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_boots_iron_trim.json new file mode 100644 index 000000000..7270a2f0f --- /dev/null +++ b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_boots_iron_trim.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "majruszsdifficulty:item/enderium_boots", + "layer1": "minecraft:trims/items/boots_trim_iron" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_boots_lapis_trim.json b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_boots_lapis_trim.json new file mode 100644 index 000000000..43246a708 --- /dev/null +++ b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_boots_lapis_trim.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "majruszsdifficulty:item/enderium_boots", + "layer1": "minecraft:trims/items/boots_trim_lapis" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_boots_netherite_trim.json b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_boots_netherite_trim.json new file mode 100644 index 000000000..624cfd32d --- /dev/null +++ b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_boots_netherite_trim.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "majruszsdifficulty:item/enderium_boots", + "layer1": "minecraft:trims/items/boots_trim_netherite" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_boots_quartz_trim.json b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_boots_quartz_trim.json new file mode 100644 index 000000000..bfb5a4b44 --- /dev/null +++ b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_boots_quartz_trim.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "majruszsdifficulty:item/enderium_boots", + "layer1": "minecraft:trims/items/boots_trim_quartz" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_boots_redstone_trim.json b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_boots_redstone_trim.json new file mode 100644 index 000000000..06bd9b8f7 --- /dev/null +++ b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_boots_redstone_trim.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "majruszsdifficulty:item/enderium_boots", + "layer1": "minecraft:trims/items/boots_trim_redstone" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_chestplate_amethyst_trim.json b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_chestplate_amethyst_trim.json new file mode 100644 index 000000000..b21ee7908 --- /dev/null +++ b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_chestplate_amethyst_trim.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "majruszsdifficulty:item/enderium_chestplate", + "layer1": "minecraft:trims/items/chestplate_trim_amethyst" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_chestplate_copper_trim.json b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_chestplate_copper_trim.json new file mode 100644 index 000000000..527655e0c --- /dev/null +++ b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_chestplate_copper_trim.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "majruszsdifficulty:item/enderium_chestplate", + "layer1": "minecraft:trims/items/chestplate_trim_copper" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_chestplate_diamond_trim.json b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_chestplate_diamond_trim.json new file mode 100644 index 000000000..2ed419e43 --- /dev/null +++ b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_chestplate_diamond_trim.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "majruszsdifficulty:item/enderium_chestplate", + "layer1": "minecraft:trims/items/chestplate_trim_diamond" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_chestplate_emerald_trim.json b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_chestplate_emerald_trim.json new file mode 100644 index 000000000..88e62601d --- /dev/null +++ b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_chestplate_emerald_trim.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "majruszsdifficulty:item/enderium_chestplate", + "layer1": "minecraft:trims/items/chestplate_trim_emerald" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_chestplate_gold_trim.json b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_chestplate_gold_trim.json new file mode 100644 index 000000000..b2717415b --- /dev/null +++ b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_chestplate_gold_trim.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "majruszsdifficulty:item/enderium_chestplate", + "layer1": "minecraft:trims/items/chestplate_trim_gold" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_chestplate_iron_trim.json b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_chestplate_iron_trim.json new file mode 100644 index 000000000..295059c96 --- /dev/null +++ b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_chestplate_iron_trim.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "majruszsdifficulty:item/enderium_chestplate", + "layer1": "minecraft:trims/items/chestplate_trim_iron" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_chestplate_lapis_trim.json b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_chestplate_lapis_trim.json new file mode 100644 index 000000000..162f36bea --- /dev/null +++ b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_chestplate_lapis_trim.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "majruszsdifficulty:item/enderium_chestplate", + "layer1": "minecraft:trims/items/chestplate_trim_lapis" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_chestplate_netherite_trim.json b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_chestplate_netherite_trim.json new file mode 100644 index 000000000..82c14d03c --- /dev/null +++ b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_chestplate_netherite_trim.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "majruszsdifficulty:item/enderium_chestplate", + "layer1": "minecraft:trims/items/chestplate_trim_netherite" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_chestplate_quartz_trim.json b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_chestplate_quartz_trim.json new file mode 100644 index 000000000..e9cd475d8 --- /dev/null +++ b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_chestplate_quartz_trim.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "majruszsdifficulty:item/enderium_chestplate", + "layer1": "minecraft:trims/items/chestplate_trim_quartz" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_chestplate_redstone_trim.json b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_chestplate_redstone_trim.json new file mode 100644 index 000000000..bf7deed15 --- /dev/null +++ b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_chestplate_redstone_trim.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "majruszsdifficulty:item/enderium_chestplate", + "layer1": "minecraft:trims/items/chestplate_trim_redstone" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_helmet_amethyst_trim.json b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_helmet_amethyst_trim.json new file mode 100644 index 000000000..22bd96311 --- /dev/null +++ b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_helmet_amethyst_trim.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "majruszsdifficulty:item/enderium_helmet", + "layer1": "minecraft:trims/items/helmet_trim_amethyst" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_helmet_copper_trim.json b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_helmet_copper_trim.json new file mode 100644 index 000000000..a2cac70fc --- /dev/null +++ b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_helmet_copper_trim.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "majruszsdifficulty:item/enderium_helmet", + "layer1": "minecraft:trims/items/helmet_trim_copper" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_helmet_diamond_trim.json b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_helmet_diamond_trim.json new file mode 100644 index 000000000..73feadc54 --- /dev/null +++ b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_helmet_diamond_trim.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "majruszsdifficulty:item/enderium_helmet", + "layer1": "minecraft:trims/items/helmet_trim_diamond" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_helmet_emerald_trim.json b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_helmet_emerald_trim.json new file mode 100644 index 000000000..9c71c2be9 --- /dev/null +++ b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_helmet_emerald_trim.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "majruszsdifficulty:item/enderium_helmet", + "layer1": "minecraft:trims/items/helmet_trim_emerald" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_helmet_gold_trim.json b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_helmet_gold_trim.json new file mode 100644 index 000000000..42a4c6abb --- /dev/null +++ b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_helmet_gold_trim.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "majruszsdifficulty:item/enderium_helmet", + "layer1": "minecraft:trims/items/helmet_trim_gold" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_helmet_iron_trim.json b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_helmet_iron_trim.json new file mode 100644 index 000000000..5ac026e02 --- /dev/null +++ b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_helmet_iron_trim.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "majruszsdifficulty:item/enderium_helmet", + "layer1": "minecraft:trims/items/helmet_trim_iron" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_helmet_lapis_trim.json b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_helmet_lapis_trim.json new file mode 100644 index 000000000..f297ff72f --- /dev/null +++ b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_helmet_lapis_trim.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "majruszsdifficulty:item/enderium_helmet", + "layer1": "minecraft:trims/items/helmet_trim_lapis" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_helmet_netherite_trim.json b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_helmet_netherite_trim.json new file mode 100644 index 000000000..7cfa2b58e --- /dev/null +++ b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_helmet_netherite_trim.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "majruszsdifficulty:item/enderium_helmet", + "layer1": "minecraft:trims/items/helmet_trim_netherite" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_helmet_quartz_trim.json b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_helmet_quartz_trim.json new file mode 100644 index 000000000..38fcb59bf --- /dev/null +++ b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_helmet_quartz_trim.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "majruszsdifficulty:item/enderium_helmet", + "layer1": "minecraft:trims/items/helmet_trim_quartz" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_helmet_redstone_trim.json b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_helmet_redstone_trim.json new file mode 100644 index 000000000..66b820433 --- /dev/null +++ b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_helmet_redstone_trim.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "majruszsdifficulty:item/enderium_helmet", + "layer1": "minecraft:trims/items/helmet_trim_redstone" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_leggings_amethyst_trim.json b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_leggings_amethyst_trim.json new file mode 100644 index 000000000..50166e207 --- /dev/null +++ b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_leggings_amethyst_trim.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "majruszsdifficulty:item/enderium_leggings", + "layer1": "minecraft:trims/items/leggings_trim_amethyst" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_leggings_copper_trim.json b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_leggings_copper_trim.json new file mode 100644 index 000000000..fe0b5e275 --- /dev/null +++ b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_leggings_copper_trim.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "majruszsdifficulty:item/enderium_leggings", + "layer1": "minecraft:trims/items/leggings_trim_copper" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_leggings_diamond_trim.json b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_leggings_diamond_trim.json new file mode 100644 index 000000000..f33d2a5f0 --- /dev/null +++ b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_leggings_diamond_trim.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "majruszsdifficulty:item/enderium_leggings", + "layer1": "minecraft:trims/items/leggings_trim_diamond" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_leggings_emerald_trim.json b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_leggings_emerald_trim.json new file mode 100644 index 000000000..ac69efbca --- /dev/null +++ b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_leggings_emerald_trim.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "majruszsdifficulty:item/enderium_leggings", + "layer1": "minecraft:trims/items/leggings_trim_emerald" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_leggings_gold_trim.json b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_leggings_gold_trim.json new file mode 100644 index 000000000..e9694b32d --- /dev/null +++ b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_leggings_gold_trim.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "majruszsdifficulty:item/enderium_leggings", + "layer1": "minecraft:trims/items/leggings_trim_gold" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_leggings_iron_trim.json b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_leggings_iron_trim.json new file mode 100644 index 000000000..477544e0e --- /dev/null +++ b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_leggings_iron_trim.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "majruszsdifficulty:item/enderium_leggings", + "layer1": "minecraft:trims/items/leggings_trim_iron" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_leggings_lapis_trim.json b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_leggings_lapis_trim.json new file mode 100644 index 000000000..175b8c69c --- /dev/null +++ b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_leggings_lapis_trim.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "majruszsdifficulty:item/enderium_leggings", + "layer1": "minecraft:trims/items/leggings_trim_lapis" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_leggings_netherite_trim.json b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_leggings_netherite_trim.json new file mode 100644 index 000000000..e6d34e069 --- /dev/null +++ b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_leggings_netherite_trim.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "majruszsdifficulty:item/enderium_leggings", + "layer1": "minecraft:trims/items/leggings_trim_netherite" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_leggings_quartz_trim.json b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_leggings_quartz_trim.json new file mode 100644 index 000000000..9d976bda3 --- /dev/null +++ b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_leggings_quartz_trim.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "majruszsdifficulty:item/enderium_leggings", + "layer1": "minecraft:trims/items/leggings_trim_quartz" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_leggings_redstone_trim.json b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_leggings_redstone_trim.json new file mode 100644 index 000000000..425ca01ef --- /dev/null +++ b/src/main/resources/assets/majruszsdifficulty/models/item/trim/enderium_leggings_redstone_trim.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "majruszsdifficulty:item/enderium_leggings", + "layer1": "minecraft:trims/items/leggings_trim_redstone" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/majruszsdifficulty/textures/entity/black_widow.png b/src/main/resources/assets/majruszsdifficulty/textures/entity/black_widow.png deleted file mode 100644 index 72a05af1f..000000000 Binary files a/src/main/resources/assets/majruszsdifficulty/textures/entity/black_widow.png and /dev/null differ diff --git a/src/main/resources/assets/majruszsdifficulty/textures/entity/black_widow_eyes.png b/src/main/resources/assets/majruszsdifficulty/textures/entity/black_widow_eyes.png deleted file mode 100644 index 750ff85cd..000000000 Binary files a/src/main/resources/assets/majruszsdifficulty/textures/entity/black_widow_eyes.png and /dev/null differ diff --git a/src/main/resources/assets/majruszsdifficulty/textures/entity/cerberus.png b/src/main/resources/assets/majruszsdifficulty/textures/entity/cerberus.png index a7ad40519..75eac245d 100644 Binary files a/src/main/resources/assets/majruszsdifficulty/textures/entity/cerberus.png and b/src/main/resources/assets/majruszsdifficulty/textures/entity/cerberus.png differ diff --git a/src/main/resources/assets/majruszsdifficulty/textures/entity/giant.png b/src/main/resources/assets/majruszsdifficulty/textures/entity/giant.png new file mode 100644 index 000000000..86379b0c9 Binary files /dev/null and b/src/main/resources/assets/majruszsdifficulty/textures/entity/giant.png differ diff --git a/src/main/resources/assets/majruszsdifficulty/textures/item/bad_omen_potion.png b/src/main/resources/assets/majruszsdifficulty/textures/item/bad_omen_potion.png deleted file mode 100644 index 8a9d2b0cb..000000000 Binary files a/src/main/resources/assets/majruszsdifficulty/textures/item/bad_omen_potion.png and /dev/null differ diff --git a/src/main/resources/assets/majruszsdifficulty/textures/item/evoker_fang_scroll.png b/src/main/resources/assets/majruszsdifficulty/textures/item/evoker_fang_scroll.png new file mode 100644 index 000000000..e74c009bc Binary files /dev/null and b/src/main/resources/assets/majruszsdifficulty/textures/item/evoker_fang_scroll.png differ diff --git a/src/main/resources/assets/majruszsdifficulty/textures/item/sonic_boom_scroll.png b/src/main/resources/assets/majruszsdifficulty/textures/item/sonic_boom_scroll.png new file mode 100644 index 000000000..3e85b9fb3 Binary files /dev/null and b/src/main/resources/assets/majruszsdifficulty/textures/item/sonic_boom_scroll.png differ diff --git a/src/main/resources/assets/majruszsdifficulty/textures/item/soul_jar.png b/src/main/resources/assets/majruszsdifficulty/textures/item/soul_jar.png index 5654c264b..550c33f93 100644 Binary files a/src/main/resources/assets/majruszsdifficulty/textures/item/soul_jar.png and b/src/main/resources/assets/majruszsdifficulty/textures/item/soul_jar.png differ diff --git a/src/main/resources/assets/majruszsdifficulty/textures/item/soul_jar_soul1.png b/src/main/resources/assets/majruszsdifficulty/textures/item/soul_jar_soul1.png new file mode 100644 index 000000000..8660408d9 Binary files /dev/null and b/src/main/resources/assets/majruszsdifficulty/textures/item/soul_jar_soul1.png differ diff --git a/src/main/resources/assets/majruszsdifficulty/textures/item/soul_jar.png.mcmeta b/src/main/resources/assets/majruszsdifficulty/textures/item/soul_jar_soul1.png.mcmeta similarity index 81% rename from src/main/resources/assets/majruszsdifficulty/textures/item/soul_jar.png.mcmeta rename to src/main/resources/assets/majruszsdifficulty/textures/item/soul_jar_soul1.png.mcmeta index c95159e96..9e9bd75e8 100644 --- a/src/main/resources/assets/majruszsdifficulty/textures/item/soul_jar.png.mcmeta +++ b/src/main/resources/assets/majruszsdifficulty/textures/item/soul_jar_soul1.png.mcmeta @@ -1,6 +1,6 @@ { "animation": { - "frametime": 2, + "frametime": 3, "frames": [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ] diff --git a/src/main/resources/assets/majruszsdifficulty/textures/item/soul_jar_soul2.png b/src/main/resources/assets/majruszsdifficulty/textures/item/soul_jar_soul2.png new file mode 100644 index 000000000..d9c833231 Binary files /dev/null and b/src/main/resources/assets/majruszsdifficulty/textures/item/soul_jar_soul2.png differ diff --git a/src/main/resources/assets/majruszsdifficulty/textures/item/soul_jar_soul2.png.mcmeta b/src/main/resources/assets/majruszsdifficulty/textures/item/soul_jar_soul2.png.mcmeta new file mode 100644 index 000000000..9e9bd75e8 --- /dev/null +++ b/src/main/resources/assets/majruszsdifficulty/textures/item/soul_jar_soul2.png.mcmeta @@ -0,0 +1,8 @@ +{ + "animation": { + "frametime": 3, + "frames": [ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 + ] + } +} \ No newline at end of file diff --git a/src/main/resources/assets/majruszsdifficulty/textures/item/soul_jar_soul3.png b/src/main/resources/assets/majruszsdifficulty/textures/item/soul_jar_soul3.png new file mode 100644 index 000000000..2213cbc2e Binary files /dev/null and b/src/main/resources/assets/majruszsdifficulty/textures/item/soul_jar_soul3.png differ diff --git a/src/main/resources/assets/majruszsdifficulty/textures/item/soul_jar_soul3.png.mcmeta b/src/main/resources/assets/majruszsdifficulty/textures/item/soul_jar_soul3.png.mcmeta new file mode 100644 index 000000000..9e9bd75e8 --- /dev/null +++ b/src/main/resources/assets/majruszsdifficulty/textures/item/soul_jar_soul3.png.mcmeta @@ -0,0 +1,8 @@ +{ + "animation": { + "frametime": 3, + "frames": [ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 + ] + } +} \ No newline at end of file diff --git a/src/main/resources/assets/majruszsdifficulty/textures/mob_effect/glass_regeneration.png b/src/main/resources/assets/majruszsdifficulty/textures/mob_effect/glass_regeneration.png new file mode 100644 index 000000000..32284955c Binary files /dev/null and b/src/main/resources/assets/majruszsdifficulty/textures/mob_effect/glass_regeneration.png differ diff --git a/src/main/resources/assets/majruszsdifficulty/textures/mob_effect/regenerative_wrap.png b/src/main/resources/assets/majruszsdifficulty/textures/mob_effect/regenerative_wrap.png new file mode 100644 index 000000000..951a363aa Binary files /dev/null and b/src/main/resources/assets/majruszsdifficulty/textures/mob_effect/regenerative_wrap.png differ diff --git a/src/main/resources/data/majruszsdifficulty/advancements/progressive_difficulty/bleeding_healed.json b/src/main/resources/data/majruszsdifficulty/advancements/progressive_difficulty/bleeding_healed.json index 3fd586f55..3957de955 100644 --- a/src/main/resources/data/majruszsdifficulty/advancements/progressive_difficulty/bleeding_healed.json +++ b/src/main/resources/data/majruszsdifficulty/advancements/progressive_difficulty/bleeding_healed.json @@ -17,10 +17,9 @@ }, "criteria": { "bleeding_healed": { - "trigger": "majruszsdifficulty:bandage_used", + "trigger": "majruszsdifficulty:basic_trigger", "conditions": { - "bandage_id": "majruszsdifficulty:bandage", - "used_on_oneself": true + "type": "bandage_used" } } }, diff --git a/src/main/resources/data/majruszsdifficulty/advancements/progressive_difficulty/bleeding_healed_other.json b/src/main/resources/data/majruszsdifficulty/advancements/progressive_difficulty/bleeding_healed_other.json index cc17da2a7..38e2a0cf7 100644 --- a/src/main/resources/data/majruszsdifficulty/advancements/progressive_difficulty/bleeding_healed_other.json +++ b/src/main/resources/data/majruszsdifficulty/advancements/progressive_difficulty/bleeding_healed_other.json @@ -20,10 +20,9 @@ }, "criteria": { "bleeding_healed": { - "trigger": "majruszsdifficulty:bandage_used", + "trigger": "majruszsdifficulty:basic_trigger", "conditions": { - "bandage_id": "majruszsdifficulty:golden_bandage", - "used_on_oneself": false + "type": "golden_bandage_used_on_others" } } }, diff --git a/src/main/resources/data/majruszsdifficulty/custom/bleeding_armor.json b/src/main/resources/data/majruszsdifficulty/custom/bleeding_armor.json new file mode 100644 index 000000000..ceb34943b --- /dev/null +++ b/src/main/resources/data/majruszsdifficulty/custom/bleeding_armor.json @@ -0,0 +1,18 @@ +[ + { + "id": "{regex}.*_helmet", + "chance_multiplier": 0.8 + }, + { + "id": "{regex}.*_chestplate", + "chance_multiplier": 0.6 + }, + { + "id": "{regex}.*_leggings", + "chance_multiplier": 0.7 + }, + { + "id": "{regex}.*_boots", + "chance_multiplier": 0.9 + } +] \ No newline at end of file diff --git a/src/main/resources/data/majruszsdifficulty/custom/bleeding_tools.json b/src/main/resources/data/majruszsdifficulty/custom/bleeding_tools.json new file mode 100644 index 000000000..be35deefd --- /dev/null +++ b/src/main/resources/data/majruszsdifficulty/custom/bleeding_tools.json @@ -0,0 +1,46 @@ +[ + { + "id": "minecraft:trident", + "chance": 0.25 + }, + { + "id": "{regex}.*_sword", + "chance": 0.25, + "enchantments": [ + { + "id": "minecraft:sharpness", + "extra_chance": 0.015 + }, + { + "id": "{regex}(minecraft:smite)|(minecraft:bane_of_arthropods)|(majruszsenchantments:misanthropy)", + "extra_chance": 0.01 + } + ] + }, + { + "id": "{regex}.*_axe", + "chance": 0.225, + "enchantments": [ + { + "id": "minecraft:sharpness", + "extra_chance": 0.015 + }, + { + "id": "{regex}(minecraft:smite)|(minecraft:bane_of_arthropods)|(majruszsenchantments:misanthropy)", + "extra_chance": 0.01 + } + ] + }, + { + "id": "{regex}(.*_pickaxe)|minecraft:shears", + "chance": 0.2 + }, + { + "id": "{regex}.*_shovel", + "chance": 0.175 + }, + { + "id": "{regex}.*_hoe", + "chance": 0.15 + } +] \ No newline at end of file diff --git a/src/main/resources/data/majruszsdifficulty/custom/cursed_armor_locations.json b/src/main/resources/data/majruszsdifficulty/custom/cursed_armor_locations.json new file mode 100644 index 000000000..749e3ccc0 --- /dev/null +++ b/src/main/resources/data/majruszsdifficulty/custom/cursed_armor_locations.json @@ -0,0 +1,48 @@ +[ + { + "loot": "majruszsdifficulty:gameplay/cursed_armor_dungeon", + "chests": [ + "minecraft:chests/simple_dungeon" + ], + "sound": "minecraft:item.armor.equip_leather", + "chance": 0.5 + }, + { + "loot": "majruszsdifficulty:gameplay/cursed_armor_stronghold", + "chests": [ + "minecraft:chests/stronghold_corridor", + "minecraft:chests/stronghold_crossing", + "minecraft:chests/stronghold_library" + ], + "sound": "minecraft:item.armor.equip_chain", + "chance": 0.4 + }, + { + "loot": "majruszsdifficulty:gameplay/cursed_armor_portal", + "chests": [ + "minecraft:chests/ruined_portal" + ], + "sound": "minecraft:item.armor.equip_gold", + "chance": 1.0 + }, + { + "loot": "majruszsdifficulty:gameplay/cursed_armor_nether", + "chests": [ + "minecraft:chests/bastion_bridge", + "minecraft:chests/bastion_hoglin_stable", + "minecraft:chests/bastion_other", + "minecraft:chests/bastion_treasure", + "minecraft:chests/nether_bridge" + ], + "sound": "minecraft:item.armor.equip_gold", + "chance": 0.25 + }, + { + "loot": "majruszsdifficulty:gameplay/cursed_armor_end", + "chests": [ + "minecraft:chests/end_city_treasure" + ], + "sound": "minecraft:item.armor.equip_diamond", + "chance": 0.5 + } +] \ No newline at end of file diff --git a/src/main/resources/data/majruszsdifficulty/game_stages/messages.json b/src/main/resources/data/majruszsdifficulty/custom/game_stage_messages.json similarity index 71% rename from src/main/resources/data/majruszsdifficulty/game_stages/messages.json rename to src/main/resources/data/majruszsdifficulty/custom/game_stage_messages.json index dce98d1c1..15d38a677 100644 --- a/src/main/resources/data/majruszsdifficulty/game_stages/messages.json +++ b/src/main/resources/data/majruszsdifficulty/custom/game_stage_messages.json @@ -11,5 +11,10 @@ { "id": "majruszsdifficulty.on_master_mode_start", "game_stage": "MASTER" + }, + { + "id": "majruszsdifficulty.undead_army.on_master", + "game_stage": "MASTER", + "style": "DARK_PURPLE" } ] \ No newline at end of file diff --git a/src/main/resources/data/majruszsdifficulty/undead_army/waves.json b/src/main/resources/data/majruszsdifficulty/custom/undead_army_waves.json similarity index 79% rename from src/main/resources/data/majruszsdifficulty/undead_army/waves.json rename to src/main/resources/data/majruszsdifficulty/custom/undead_army_waves.json index 60699cf02..3cd5b44f5 100644 --- a/src/main/resources/data/majruszsdifficulty/undead_army/waves.json +++ b/src/main/resources/data/majruszsdifficulty/custom/undead_army_waves.json @@ -9,7 +9,7 @@ { "type": "minecraft:skeleton", "count": 2, - "equipment": "majruszsdifficulty:undead_army/equipment_wave_1_skeleton" + "equipment": "majruszsdifficulty:undead_army/equipment_wave_1" }, { "type": "minecraft:zombie", @@ -19,7 +19,7 @@ { "type": "minecraft:skeleton", "count": 2, - "equipment": "majruszsdifficulty:undead_army/equipment_wave_1_skeleton" + "equipment": "majruszsdifficulty:undead_army/equipment_wave_1" } ], "exp": 8 @@ -34,7 +34,7 @@ { "type": "minecraft:skeleton", "count": 3, - "equipment": "majruszsdifficulty:undead_army/equipment_wave_2_skeleton" + "equipment": "majruszsdifficulty:undead_army/equipment_wave_2" }, { "type": "minecraft:zombie", @@ -44,7 +44,7 @@ { "type": "minecraft:skeleton", "count": 2, - "equipment": "majruszsdifficulty:undead_army/equipment_wave_2_skeleton" + "equipment": "majruszsdifficulty:undead_army/equipment_wave_2" } ], "exp": 16 @@ -86,7 +86,7 @@ }, { "type": "minecraft:wither_skeleton", - "equipment": "majruszsdifficulty:undead_army/equipment_wave_4_wither_skeleton" + "equipment": "majruszsdifficulty:undead_army/equipment_wave_4" }, { "type": "minecraft:skeleton", @@ -95,7 +95,7 @@ }, { "type": "minecraft:wither_skeleton", - "equipment": "majruszsdifficulty:undead_army/equipment_wave_4_wither_skeleton" + "equipment": "majruszsdifficulty:undead_army/equipment_wave_4" }, { "type": "majruszsdifficulty:tank" @@ -107,7 +107,7 @@ }, { "type": "minecraft:wither_skeleton", - "equipment": "majruszsdifficulty:undead_army/equipment_wave_4_wither_skeleton" + "equipment": "majruszsdifficulty:undead_army/equipment_wave_4" }, { "type": "minecraft:stray", @@ -116,7 +116,7 @@ }, { "type": "minecraft:wither_skeleton", - "equipment": "majruszsdifficulty:undead_army/equipment_wave_4_wither_skeleton" + "equipment": "majruszsdifficulty:undead_army/equipment_wave_4" } ], "exp": 32, @@ -140,7 +140,7 @@ { "type": "minecraft:wither_skeleton", "count": 2, - "equipment": "majruszsdifficulty:undead_army/equipment_wave_5_wither_skeleton" + "equipment": "majruszsdifficulty:undead_army/equipment_wave_5" }, { "type": "majruszsdifficulty:tank" @@ -153,7 +153,7 @@ { "type": "minecraft:wither_skeleton", "count": 2, - "equipment": "majruszsdifficulty:undead_army/equipment_wave_5_wither_skeleton" + "equipment": "majruszsdifficulty:undead_army/equipment_wave_5" } ], "boss": { @@ -161,5 +161,41 @@ }, "exp": 40, "game_stage": "EXPERT" + }, + { + "mobs": [ + { + "type": "minecraft:zombie", + "equipment": "majruszsdifficulty:undead_army/equipment_wave_6" + }, + { + "type": "minecraft:skeleton", + "equipment": "majruszsdifficulty:undead_army/equipment_wave_6_skeleton" + }, + { + "type": "majruszsdifficulty:tank" + }, + { + "type": "minecraft:stray", + "equipment": "majruszsdifficulty:undead_army/equipment_wave_6_skeleton" + }, + { + "type": "minecraft:husk", + "equipment": "majruszsdifficulty:undead_army/equipment_wave_6" + }, + { + "type": "minecraft:wither_skeleton", + "equipment": "majruszsdifficulty:undead_army/equipment_wave_6_wither_skeleton" + }, + { + "type": "majruszsdifficulty:cerberus" + } + ], + "boss": { + "type": "majruszsdifficulty:giant", + "equipment": "majruszsdifficulty:undead_army/equipment_wave_6" + }, + "exp": 48, + "game_stage": "MASTER" } ] \ No newline at end of file diff --git a/src/main/resources/data/majruszsdifficulty/forge/biome_modifier/nether_mobs_modifier.json b/src/main/resources/data/majruszsdifficulty/forge/biome_modifier/nether_mobs_modifier.json new file mode 100644 index 000000000..3cda2a30b --- /dev/null +++ b/src/main/resources/data/majruszsdifficulty/forge/biome_modifier/nether_mobs_modifier.json @@ -0,0 +1,12 @@ +{ + "type": "forge:add_spawns", + "biomes": "#minecraft:is_nether", + "spawners": [ + { + "type": "majruszsdifficulty:cerberus", + "weight": 1, + "minCount": 1, + "maxCount": 1 + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/majruszsdifficulty/loot_tables/entities/giant.json b/src/main/resources/data/majruszsdifficulty/loot_tables/entities/giant.json new file mode 100644 index 000000000..4a6be1d2f --- /dev/null +++ b/src/main/resources/data/majruszsdifficulty/loot_tables/entities/giant.json @@ -0,0 +1,31 @@ +{ + "type": "minecraft:entity", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "name": "minecraft:rotten_flesh", + "functions": [ + { + "function": "minecraft:set_count", + "count": { + "min": 5.0, + "max": 10.0, + "type": "minecraft:uniform" + } + }, + { + "function": "minecraft:looting_enchant", + "count": { + "min": 3.0, + "max": 5.0 + } + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/majruszsdifficulty/loot_tables/gameplay/cursed_armor_dungeon_loot.json b/src/main/resources/data/majruszsdifficulty/loot_tables/gameplay/cursed_armor_dungeon.json similarity index 92% rename from src/main/resources/data/majruszsdifficulty/loot_tables/gameplay/cursed_armor_dungeon_loot.json rename to src/main/resources/data/majruszsdifficulty/loot_tables/gameplay/cursed_armor_dungeon.json index 6a3d8ac27..16b5818cf 100644 --- a/src/main/resources/data/majruszsdifficulty/loot_tables/gameplay/cursed_armor_dungeon_loot.json +++ b/src/main/resources/data/majruszsdifficulty/loot_tables/gameplay/cursed_armor_dungeon.json @@ -1,10 +1,4 @@ { - "mlib": "majruszsdifficulty:gameplay/cursed_armor_dungeon_loot", - "cursed_armor": { - "loot": "minecraft:chests/simple_dungeon", - "sound": "minecraft:item.armor.equip_leather", - "chance": 0.5 - }, "type": "minecraft:gift", "pools": [ { diff --git a/src/main/resources/data/majruszsdifficulty/loot_tables/gameplay/cursed_armor_end_loot.json b/src/main/resources/data/majruszsdifficulty/loot_tables/gameplay/cursed_armor_end.json similarity index 93% rename from src/main/resources/data/majruszsdifficulty/loot_tables/gameplay/cursed_armor_end_loot.json rename to src/main/resources/data/majruszsdifficulty/loot_tables/gameplay/cursed_armor_end.json index 92bea8fa1..3cfec073a 100644 --- a/src/main/resources/data/majruszsdifficulty/loot_tables/gameplay/cursed_armor_end_loot.json +++ b/src/main/resources/data/majruszsdifficulty/loot_tables/gameplay/cursed_armor_end.json @@ -1,10 +1,4 @@ { - "mlib": "majruszsdifficulty:gameplay/cursed_armor_end_loot", - "cursed_armor": { - "loot": "minecraft:chests/end_city_treasure", - "sound": "minecraft:item.armor.equip_diamond", - "chance": 0.5 - }, "type": "minecraft:gift", "pools": [ { diff --git a/src/main/resources/data/majruszsdifficulty/loot_tables/gameplay/cursed_armor_portal_loot.json b/src/main/resources/data/majruszsdifficulty/loot_tables/gameplay/cursed_armor_nether.json similarity index 92% rename from src/main/resources/data/majruszsdifficulty/loot_tables/gameplay/cursed_armor_portal_loot.json rename to src/main/resources/data/majruszsdifficulty/loot_tables/gameplay/cursed_armor_nether.json index 6f5b77d94..2eefad61d 100644 --- a/src/main/resources/data/majruszsdifficulty/loot_tables/gameplay/cursed_armor_portal_loot.json +++ b/src/main/resources/data/majruszsdifficulty/loot_tables/gameplay/cursed_armor_nether.json @@ -1,10 +1,4 @@ { - "mlib": "majruszsdifficulty:gameplay/cursed_armor_portal_loot", - "cursed_armor": { - "loot": "minecraft:chests/ruined_portal", - "sound": "minecraft:item.armor.equip_gold", - "chance": 1.0 - }, "type": "minecraft:gift", "pools": [ { diff --git a/src/main/resources/data/majruszsdifficulty/loot_tables/gameplay/cursed_armor_nether_loot.json b/src/main/resources/data/majruszsdifficulty/loot_tables/gameplay/cursed_armor_portal.json similarity index 86% rename from src/main/resources/data/majruszsdifficulty/loot_tables/gameplay/cursed_armor_nether_loot.json rename to src/main/resources/data/majruszsdifficulty/loot_tables/gameplay/cursed_armor_portal.json index dd415a17a..2eefad61d 100644 --- a/src/main/resources/data/majruszsdifficulty/loot_tables/gameplay/cursed_armor_nether_loot.json +++ b/src/main/resources/data/majruszsdifficulty/loot_tables/gameplay/cursed_armor_portal.json @@ -1,16 +1,4 @@ { - "mlib": "majruszsdifficulty:gameplay/cursed_armor_portal_loot", - "cursed_armor": { - "loot": [ - "minecraft:chests/bastion_bridge", - "minecraft:chests/bastion_hoglin_stable", - "minecraft:chests/bastion_other", - "minecraft:chests/bastion_treasure", - "minecraft:chests/nether_bridge" - ], - "sound": "minecraft:item.armor.equip_gold", - "chance": 0.25 - }, "type": "minecraft:gift", "pools": [ { diff --git a/src/main/resources/data/majruszsdifficulty/loot_tables/gameplay/cursed_armor_stronghold_loot.json b/src/main/resources/data/majruszsdifficulty/loot_tables/gameplay/cursed_armor_stronghold.json similarity index 88% rename from src/main/resources/data/majruszsdifficulty/loot_tables/gameplay/cursed_armor_stronghold_loot.json rename to src/main/resources/data/majruszsdifficulty/loot_tables/gameplay/cursed_armor_stronghold.json index 250d8e91e..0a08cbe0f 100644 --- a/src/main/resources/data/majruszsdifficulty/loot_tables/gameplay/cursed_armor_stronghold_loot.json +++ b/src/main/resources/data/majruszsdifficulty/loot_tables/gameplay/cursed_armor_stronghold.json @@ -1,14 +1,4 @@ { - "mlib": "majruszsdifficulty:gameplay/cursed_armor_library_loot", - "cursed_armor": { - "loot": [ - "minecraft:chests/stronghold_corridor", - "minecraft:chests/stronghold_crossing", - "minecraft:chests/stronghold_library" - ], - "sound": "minecraft:item.armor.equip_chain", - "chance": 0.4 - }, "type": "minecraft:gift", "pools": [ { diff --git a/src/main/resources/data/majruszsdifficulty/loot_tables/gameplay/elder_guardian_treasure_loot.json b/src/main/resources/data/majruszsdifficulty/loot_tables/gameplay/treasure_bag_elder_guardian.json similarity index 96% rename from src/main/resources/data/majruszsdifficulty/loot_tables/gameplay/elder_guardian_treasure_loot.json rename to src/main/resources/data/majruszsdifficulty/loot_tables/gameplay/treasure_bag_elder_guardian.json index dcadbb097..581628a4a 100644 --- a/src/main/resources/data/majruszsdifficulty/loot_tables/gameplay/elder_guardian_treasure_loot.json +++ b/src/main/resources/data/majruszsdifficulty/loot_tables/gameplay/treasure_bag_elder_guardian.json @@ -1,5 +1,4 @@ { - "mlib": "majruszsdifficulty:gameplay/elder_guardian_treasure_loot", "type": "minecraft:gift", "pools": [ { diff --git a/src/main/resources/data/majruszsdifficulty/loot_tables/gameplay/ender_dragon_treasure_loot.json b/src/main/resources/data/majruszsdifficulty/loot_tables/gameplay/treasure_bag_ender_dragon.json similarity index 94% rename from src/main/resources/data/majruszsdifficulty/loot_tables/gameplay/ender_dragon_treasure_loot.json rename to src/main/resources/data/majruszsdifficulty/loot_tables/gameplay/treasure_bag_ender_dragon.json index bb83ac127..a239a9fce 100644 --- a/src/main/resources/data/majruszsdifficulty/loot_tables/gameplay/ender_dragon_treasure_loot.json +++ b/src/main/resources/data/majruszsdifficulty/loot_tables/gameplay/treasure_bag_ender_dragon.json @@ -1,5 +1,4 @@ { - "mlib": "majruszsdifficulty:gameplay/ender_dragon_treasure_loot", "type": "minecraft:gift", "pools": [ { diff --git a/src/main/resources/data/majruszsdifficulty/loot_tables/gameplay/fishing_treasure_loot.json b/src/main/resources/data/majruszsdifficulty/loot_tables/gameplay/treasure_bag_fishing.json similarity index 98% rename from src/main/resources/data/majruszsdifficulty/loot_tables/gameplay/fishing_treasure_loot.json rename to src/main/resources/data/majruszsdifficulty/loot_tables/gameplay/treasure_bag_fishing.json index fe112fce0..83f316730 100644 --- a/src/main/resources/data/majruszsdifficulty/loot_tables/gameplay/fishing_treasure_loot.json +++ b/src/main/resources/data/majruszsdifficulty/loot_tables/gameplay/treasure_bag_fishing.json @@ -1,5 +1,4 @@ { - "mlib": "majruszsdifficulty:gameplay/fishing_treasure_loot", "type": "minecraft:gift", "pools": [ { diff --git a/src/main/resources/data/majruszsdifficulty/loot_tables/gameplay/pillager_treasure_loot.json b/src/main/resources/data/majruszsdifficulty/loot_tables/gameplay/treasure_bag_pillager.json similarity index 82% rename from src/main/resources/data/majruszsdifficulty/loot_tables/gameplay/pillager_treasure_loot.json rename to src/main/resources/data/majruszsdifficulty/loot_tables/gameplay/treasure_bag_pillager.json index c74542e7d..50570654b 100644 --- a/src/main/resources/data/majruszsdifficulty/loot_tables/gameplay/pillager_treasure_loot.json +++ b/src/main/resources/data/majruszsdifficulty/loot_tables/gameplay/treasure_bag_pillager.json @@ -1,5 +1,4 @@ { - "mlib": "majruszsdifficulty:gameplay/pillager_treasure_loot", "type": "minecraft:gift", "pools": [ { @@ -8,32 +7,23 @@ { "type": "minecraft:item", "name": "majruszsdifficulty:recall_potion", + "weight": 3, "quality": 4, "functions": [ { "function": "set_count", "count": { - "min": 2, - "max": 5 + "min": 4, + "max": 8 } } ] - } - ] - }, - { - "rolls": 1, - "entries": [ + }, { "type": "minecraft:item", - "name": "majruszsdifficulty:bad_omen_potion", - "quality": 4, - "conditions": [ - { - "condition": "minecraft:random_chance", - "chance": 0.33333 - } - ] + "name": "majruszsdifficulty:evoker_fang_scroll", + "weight": 1, + "quality": 4 } ] }, diff --git a/src/main/resources/data/majruszsdifficulty/loot_tables/gameplay/undead_army_treasure_loot.json b/src/main/resources/data/majruszsdifficulty/loot_tables/gameplay/treasure_bag_undead_army.json similarity index 97% rename from src/main/resources/data/majruszsdifficulty/loot_tables/gameplay/undead_army_treasure_loot.json rename to src/main/resources/data/majruszsdifficulty/loot_tables/gameplay/treasure_bag_undead_army.json index bb81ba178..e45aa74c2 100644 --- a/src/main/resources/data/majruszsdifficulty/loot_tables/gameplay/undead_army_treasure_loot.json +++ b/src/main/resources/data/majruszsdifficulty/loot_tables/gameplay/treasure_bag_undead_army.json @@ -1,5 +1,4 @@ { - "mlib": "majruszsdifficulty:gameplay/undead_army_treasure_loot", "type": "minecraft:gift", "pools": [ { diff --git a/src/main/resources/data/majruszsdifficulty/loot_tables/gameplay/wither_treasure_loot.json b/src/main/resources/data/majruszsdifficulty/loot_tables/gameplay/treasure_bag_wither.json similarity index 95% rename from src/main/resources/data/majruszsdifficulty/loot_tables/gameplay/wither_treasure_loot.json rename to src/main/resources/data/majruszsdifficulty/loot_tables/gameplay/treasure_bag_wither.json index 2c11091de..b514cd505 100644 --- a/src/main/resources/data/majruszsdifficulty/loot_tables/gameplay/wither_treasure_loot.json +++ b/src/main/resources/data/majruszsdifficulty/loot_tables/gameplay/treasure_bag_wither.json @@ -1,5 +1,4 @@ { - "mlib": "majruszsdifficulty:gameplay/wither_treasure_loot", "type": "minecraft:gift", "pools": [ { diff --git a/src/main/resources/data/majruszsdifficulty/loot_tables/mob_groups/piglin_leader.json b/src/main/resources/data/majruszsdifficulty/loot_tables/mob_groups/piglin_leader.json index fbac15ea8..4413f3bf4 100644 --- a/src/main/resources/data/majruszsdifficulty/loot_tables/mob_groups/piglin_leader.json +++ b/src/main/resources/data/majruszsdifficulty/loot_tables/mob_groups/piglin_leader.json @@ -1,5 +1,4 @@ { - "mlib": "majruszsdifficulty:mob_groups/piglin_leader", "type": "minecraft:gift", "pools": [ { diff --git a/src/main/resources/data/majruszsdifficulty/loot_tables/mob_groups/piglin_sidekick.json b/src/main/resources/data/majruszsdifficulty/loot_tables/mob_groups/piglin_sidekick.json index 7644d3bde..a72597b56 100644 --- a/src/main/resources/data/majruszsdifficulty/loot_tables/mob_groups/piglin_sidekick.json +++ b/src/main/resources/data/majruszsdifficulty/loot_tables/mob_groups/piglin_sidekick.json @@ -1,5 +1,4 @@ { - "mlib": "majruszsdifficulty:mob_groups/piglin_sidekick", "type": "minecraft:gift", "pools": [ { diff --git a/src/main/resources/data/majruszsdifficulty/loot_tables/mob_groups/skeleton_leader.json b/src/main/resources/data/majruszsdifficulty/loot_tables/mob_groups/skeleton_leader.json index f5f8c1425..102d2c912 100644 --- a/src/main/resources/data/majruszsdifficulty/loot_tables/mob_groups/skeleton_leader.json +++ b/src/main/resources/data/majruszsdifficulty/loot_tables/mob_groups/skeleton_leader.json @@ -1,5 +1,4 @@ { - "mlib": "majruszsdifficulty:mob_groups/skeleton_leader", "type": "minecraft:gift", "pools": [ { diff --git a/src/main/resources/data/majruszsdifficulty/loot_tables/mob_groups/skeleton_sidekick.json b/src/main/resources/data/majruszsdifficulty/loot_tables/mob_groups/skeleton_sidekick.json index 20f010d68..941e16090 100644 --- a/src/main/resources/data/majruszsdifficulty/loot_tables/mob_groups/skeleton_sidekick.json +++ b/src/main/resources/data/majruszsdifficulty/loot_tables/mob_groups/skeleton_sidekick.json @@ -1,5 +1,4 @@ { - "mlib": "majruszsdifficulty:mob_groups/skeleton_sidekick", "type": "minecraft:gift", "pools": [ { diff --git a/src/main/resources/data/majruszsdifficulty/loot_tables/mob_groups/zombie_leader.json b/src/main/resources/data/majruszsdifficulty/loot_tables/mob_groups/zombie_leader.json index 8dd917e94..2124a4584 100644 --- a/src/main/resources/data/majruszsdifficulty/loot_tables/mob_groups/zombie_leader.json +++ b/src/main/resources/data/majruszsdifficulty/loot_tables/mob_groups/zombie_leader.json @@ -1,5 +1,4 @@ { - "mlib": "majruszsdifficulty:mob_groups/zombie_leader", "type": "minecraft:gift", "pools": [ { diff --git a/src/main/resources/data/majruszsdifficulty/loot_tables/mob_groups/zombie_sidekick.json b/src/main/resources/data/majruszsdifficulty/loot_tables/mob_groups/zombie_sidekick.json index 732e6ce55..157b386e2 100644 --- a/src/main/resources/data/majruszsdifficulty/loot_tables/mob_groups/zombie_sidekick.json +++ b/src/main/resources/data/majruszsdifficulty/loot_tables/mob_groups/zombie_sidekick.json @@ -1,5 +1,4 @@ { - "mlib": "majruszsdifficulty:mob_groups/zombie_sidekick", "type": "minecraft:gift", "pools": [ { diff --git a/src/main/resources/data/majruszsdifficulty/loot_tables/undead_army/equipment_wave_2_skeleton.json b/src/main/resources/data/majruszsdifficulty/loot_tables/undead_army/equipment_wave_2_skeleton.json deleted file mode 100644 index da9120167..000000000 --- a/src/main/resources/data/majruszsdifficulty/loot_tables/undead_army/equipment_wave_2_skeleton.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "type": "minecraft:gift", - "pools": [ - { - "rolls": 1, - "entries": [ - { - "type": "minecraft:loot_table", - "name": "majruszsdifficulty:undead_army/equipment_wave_2" - } - ] - }, - { - "rolls": 1, - "entries": [ - { - "type": "minecraft:item", - "name": "minecraft:bow", - "weight": 90, - "functions": [ - { - "function": "minecraft:set_damage", - "damage": { - "type": "minecraft:uniform", - "max": 0.5, - "min": 0.25 - }, - "add": false - } - ] - }, - { - "type": "minecraft:item", - "name": "minecraft:bow", - "weight": 10, - "functions": [ - { - "function": "minecraft:set_damage", - "damage": { - "type": "minecraft:uniform", - "max": 0.5, - "min": 0.25 - }, - "add": false - }, - { - "function": "minecraft:enchant_randomly" - } - ] - } - ] - } - ] -} \ No newline at end of file diff --git a/src/main/resources/data/majruszsdifficulty/loot_tables/undead_army/equipment_wave_3_skeleton.json b/src/main/resources/data/majruszsdifficulty/loot_tables/undead_army/equipment_wave_3_skeleton.json index 159ed6028..74f574e3c 100644 --- a/src/main/resources/data/majruszsdifficulty/loot_tables/undead_army/equipment_wave_3_skeleton.json +++ b/src/main/resources/data/majruszsdifficulty/loot_tables/undead_army/equipment_wave_3_skeleton.json @@ -16,23 +16,6 @@ { "type": "minecraft:item", "name": "minecraft:bow", - "weight": 80, - "functions": [ - { - "function": "minecraft:set_damage", - "damage": { - "type": "minecraft:uniform", - "max": 0.5, - "min": 0.25 - }, - "add": false - } - ] - }, - { - "type": "minecraft:item", - "name": "minecraft:bow", - "weight": 20, "functions": [ { "function": "minecraft:set_damage", @@ -46,6 +29,12 @@ { "function": "minecraft:enchant_randomly" } + ], + "conditions": [ + { + "condition": "minecraft:random_chance", + "chance": 0.2 + } ] } ] diff --git a/src/main/resources/data/majruszsdifficulty/loot_tables/undead_army/equipment_wave_4_skeleton.json b/src/main/resources/data/majruszsdifficulty/loot_tables/undead_army/equipment_wave_4_skeleton.json index 60d0ae999..94a4e7817 100644 --- a/src/main/resources/data/majruszsdifficulty/loot_tables/undead_army/equipment_wave_4_skeleton.json +++ b/src/main/resources/data/majruszsdifficulty/loot_tables/undead_army/equipment_wave_4_skeleton.json @@ -16,23 +16,6 @@ { "type": "minecraft:item", "name": "minecraft:bow", - "weight": 70, - "functions": [ - { - "function": "minecraft:set_damage", - "damage": { - "type": "minecraft:uniform", - "max": 0.5, - "min": 0.25 - }, - "add": false - } - ] - }, - { - "type": "minecraft:item", - "name": "minecraft:bow", - "weight": 30, "functions": [ { "function": "minecraft:set_damage", @@ -46,6 +29,12 @@ { "function": "minecraft:enchant_randomly" } + ], + "conditions": [ + { + "condition": "minecraft:random_chance", + "chance": 0.3 + } ] } ] diff --git a/src/main/resources/data/majruszsdifficulty/loot_tables/undead_army/equipment_wave_5_skeleton.json b/src/main/resources/data/majruszsdifficulty/loot_tables/undead_army/equipment_wave_5_skeleton.json index e383a36ca..8ee24b2a1 100644 --- a/src/main/resources/data/majruszsdifficulty/loot_tables/undead_army/equipment_wave_5_skeleton.json +++ b/src/main/resources/data/majruszsdifficulty/loot_tables/undead_army/equipment_wave_5_skeleton.json @@ -16,23 +16,6 @@ { "type": "minecraft:item", "name": "minecraft:bow", - "weight": 60, - "functions": [ - { - "function": "minecraft:set_damage", - "damage": { - "type": "minecraft:uniform", - "max": 0.5, - "min": 0.25 - }, - "add": false - } - ] - }, - { - "type": "minecraft:item", - "name": "minecraft:bow", - "weight": 40, "functions": [ { "function": "minecraft:set_damage", @@ -46,6 +29,12 @@ { "function": "minecraft:enchant_randomly" } + ], + "conditions": [ + { + "condition": "minecraft:random_chance", + "chance": 0.4 + } ] } ] diff --git a/src/main/resources/data/majruszsdifficulty/loot_tables/undead_army/equipment_wave_5_wither_skeleton.json b/src/main/resources/data/majruszsdifficulty/loot_tables/undead_army/equipment_wave_5_wither_skeleton.json deleted file mode 100644 index a833f3c19..000000000 --- a/src/main/resources/data/majruszsdifficulty/loot_tables/undead_army/equipment_wave_5_wither_skeleton.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "type": "minecraft:gift", - "pools": [ - { - "rolls": 1, - "entries": [ - { - "type": "minecraft:loot_table", - "name": "majruszsdifficulty:undead_army/equipment_wave_5" - } - ] - }, - { - "rolls": 1, - "entries": [ - { - "type": "minecraft:item", - "name": "minecraft:stone_sword", - "functions": [ - { - "function": "minecraft:set_damage", - "damage": { - "type": "minecraft:uniform", - "max": 0.5, - "min": 0.25 - }, - "add": false - } - ] - } - ] - } - ] -} \ No newline at end of file diff --git a/src/main/resources/data/majruszsdifficulty/loot_tables/undead_army/equipment_wave_6.json b/src/main/resources/data/majruszsdifficulty/loot_tables/undead_army/equipment_wave_6.json new file mode 100644 index 000000000..32f50e05c --- /dev/null +++ b/src/main/resources/data/majruszsdifficulty/loot_tables/undead_army/equipment_wave_6.json @@ -0,0 +1,97 @@ +{ + "type": "minecraft:gift", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "name": "majruszsdifficulty:tattered_helmet", + "functions": [ + { + "function": "minecraft:set_damage", + "damage": { + "type": "minecraft:uniform", + "max": 0.5, + "min": 0.25 + }, + "add": false + }, + { + "function": "minecraft:enchant_randomly" + } + ] + } + ] + }, + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "name": "majruszsdifficulty:tattered_chestplate", + "functions": [ + { + "function": "minecraft:set_damage", + "damage": { + "type": "minecraft:uniform", + "max": 0.5, + "min": 0.25 + }, + "add": false + }, + { + "function": "minecraft:enchant_randomly" + } + ] + } + ] + }, + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "name": "majruszsdifficulty:tattered_leggings", + "functions": [ + { + "function": "minecraft:set_damage", + "damage": { + "type": "minecraft:uniform", + "max": 0.5, + "min": 0.25 + }, + "add": false + }, + { + "function": "minecraft:enchant_randomly" + } + ] + } + ] + }, + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "name": "majruszsdifficulty:tattered_boots", + "functions": [ + { + "function": "minecraft:set_damage", + "damage": { + "type": "minecraft:uniform", + "max": 0.5, + "min": 0.25 + }, + "add": false + }, + { + "function": "minecraft:enchant_randomly" + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/majruszsdifficulty/loot_tables/undead_army/equipment_wave_1_skeleton.json b/src/main/resources/data/majruszsdifficulty/loot_tables/undead_army/equipment_wave_6_skeleton.json similarity index 88% rename from src/main/resources/data/majruszsdifficulty/loot_tables/undead_army/equipment_wave_1_skeleton.json rename to src/main/resources/data/majruszsdifficulty/loot_tables/undead_army/equipment_wave_6_skeleton.json index 6f6600bbd..2cc823633 100644 --- a/src/main/resources/data/majruszsdifficulty/loot_tables/undead_army/equipment_wave_1_skeleton.json +++ b/src/main/resources/data/majruszsdifficulty/loot_tables/undead_army/equipment_wave_6_skeleton.json @@ -6,7 +6,7 @@ "entries": [ { "type": "minecraft:loot_table", - "name": "majruszsdifficulty:undead_army/equipment_wave_1" + "name": "majruszsdifficulty:undead_army/equipment_wave_6" } ] }, @@ -25,6 +25,9 @@ "min": 0.25 }, "add": false + }, + { + "function": "minecraft:enchant_randomly" } ] } diff --git a/src/main/resources/data/majruszsdifficulty/loot_tables/undead_army/equipment_wave_4_wither_skeleton.json b/src/main/resources/data/majruszsdifficulty/loot_tables/undead_army/equipment_wave_6_wither_skeleton.json similarity index 88% rename from src/main/resources/data/majruszsdifficulty/loot_tables/undead_army/equipment_wave_4_wither_skeleton.json rename to src/main/resources/data/majruszsdifficulty/loot_tables/undead_army/equipment_wave_6_wither_skeleton.json index 3e40fb35a..f67c132a4 100644 --- a/src/main/resources/data/majruszsdifficulty/loot_tables/undead_army/equipment_wave_4_wither_skeleton.json +++ b/src/main/resources/data/majruszsdifficulty/loot_tables/undead_army/equipment_wave_6_wither_skeleton.json @@ -6,7 +6,7 @@ "entries": [ { "type": "minecraft:loot_table", - "name": "majruszsdifficulty:undead_army/equipment_wave_4" + "name": "majruszsdifficulty:undead_army/equipment_wave_6" } ] }, @@ -25,6 +25,9 @@ "min": 0.25 }, "add": false + }, + { + "function": "minecraft:enchant_randomly" } ] } diff --git a/src/main/resources/data/minecraft/tags/damage_type/bypasses_armor.json b/src/main/resources/data/minecraft/tags/damage_type/bypasses_armor.json new file mode 100644 index 000000000..5a30d471b --- /dev/null +++ b/src/main/resources/data/minecraft/tags/damage_type/bypasses_armor.json @@ -0,0 +1,5 @@ +{ + "values": [ + "majruszsdifficulty:bleeding" + ] +} \ No newline at end of file diff --git a/src/main/resources/data/minecraft/tags/items/trimmable_armor.json b/src/main/resources/data/minecraft/tags/items/trimmable_armor.json new file mode 100644 index 000000000..c56ae2795 --- /dev/null +++ b/src/main/resources/data/minecraft/tags/items/trimmable_armor.json @@ -0,0 +1,8 @@ +{ + "values": [ + "majruszsdifficulty:enderium_helmet", + "majruszsdifficulty:enderium_chestplate", + "majruszsdifficulty:enderium_leggings", + "majruszsdifficulty:enderium_boots" + ] +} \ No newline at end of file