diff --git a/build.gradle b/build.gradle index c232019eb..b14087d22 100644 --- a/build.gradle +++ b/build.gradle @@ -14,11 +14,7 @@ apply plugin: 'eclipse' apply plugin: 'maven-publish' apply plugin: 'org.spongepowered.mixin' -<<<<<<< HEAD -version = '1.6.1' -======= version = '1.7.0' ->>>>>>> 5bfad34a (Removed unfinished tag) group = 'com.majruszsdifficulty' archivesBaseName = 'majruszs-difficulty-1.19.2' @@ -80,7 +76,7 @@ repositories { dependencies { minecraft 'net.minecraftforge:forge:1.19.2-43.2.0' - implementation fg.deobf( 'com.mlib:majrusz-library-1.19.2:3.1.0' ) + implementation fg.deobf( 'com.mlib:majrusz-library-1.19.2:3.2.0' ) } // Example for how to get properties into the manifest for reading at runtime. diff --git a/libs/majrusz-library-1.19.2-3.1.0.jar b/libs/majrusz-library-1.19.2-3.1.0.jar deleted file mode 100644 index caa8f0a55..000000000 Binary files a/libs/majrusz-library-1.19.2-3.1.0.jar and /dev/null differ diff --git a/libs/majrusz-library-1.19.3-3.2.0.jar b/libs/majrusz-library-1.19.2-3.2.0.jar similarity index 78% rename from libs/majrusz-library-1.19.3-3.2.0.jar rename to libs/majrusz-library-1.19.2-3.2.0.jar index bc12ee46d..390f2fe1b 100644 Binary files a/libs/majrusz-library-1.19.3-3.2.0.jar and b/libs/majrusz-library-1.19.2-3.2.0.jar differ diff --git a/src/main/java/com/majruszsdifficulty/CreativeModeTabs.java b/src/main/java/com/majruszsdifficulty/CreativeModeTabs.java deleted file mode 100644 index 97009f10f..000000000 --- a/src/main/java/com/majruszsdifficulty/CreativeModeTabs.java +++ /dev/null @@ -1,162 +0,0 @@ -package com.majruszsdifficulty; - -import com.majruszsdifficulty.items.SoulJarItem; -import com.mlib.annotations.AutoInstance; -import com.mlib.items.CreativeModeTabHelper; -import net.minecraft.network.chat.Component; -import net.minecraft.world.flag.FeatureFlagSet; -import net.minecraft.world.item.CreativeModeTab; -import net.minecraft.world.item.Item; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.Items; -import net.minecraft.world.item.alchemy.Potion; -import net.minecraft.world.item.alchemy.PotionUtils; -import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; - -import java.util.function.Supplier; -import java.util.stream.Stream; - -@AutoInstance -public class CreativeModeTabs { - public CreativeModeTabs() { - var primary = CreativeModeTabHelper.newTab( FMLJavaModLoadingContext.get(), Registries.getLocation( "primary" ) ); - primary.accept( builder->builder.title( Component.translatable( "itemGroup.majruszsdifficulty.primary" ) ) - .icon( ()->new ItemStack( Registries.BATTLE_STANDARD.get() ) ) - .displayItems( this::definePrimaryItems ) ); - - var treasureBags = CreativeModeTabHelper.newTab( FMLJavaModLoadingContext.get(), Registries.getLocation( "treasure_bags" ) ); - treasureBags.accept( builder->builder.title( Component.translatable( "itemGroup.majruszsdifficulty.treasure_bags" ) ) - .displayItems( this::defineTreasureBagItems ) - .withTabFactory( TreasureBag::new ) ); - } - - private static ItemStack newItemStackWithPotion( Item item, Potion potion ) { - return PotionUtils.setPotion( new ItemStack( item ), potion ); - } - - private void definePrimaryItems( FeatureFlagSet flagSet, CreativeModeTab.Output output, boolean hasPermissions ) { - Stream.of( - new ItemStack( Registries.BANDAGE.get() ), - new ItemStack( Registries.GOLDEN_BANDAGE.get() ), - - new ItemStack( Registries.CLOTH.get() ), - new ItemStack( Registries.BATTLE_STANDARD.get() ), - new ItemStack( Registries.TATTERED_HELMET.get() ), - new ItemStack( Registries.TATTERED_CHESTPLATE.get() ), - new ItemStack( Registries.TATTERED_LEGGINGS.get() ), - new ItemStack( Registries.TATTERED_BOOTS.get() ), - new ItemStack( Registries.CERBERUS_FANG.get() ), - - new ItemStack( Registries.INFESTED_END_STONE_ITEM.get() ), - new ItemStack( Registries.ENDERIUM_SHARD_ORE_ITEM.get() ), - new ItemStack( Registries.ENDERIUM_BLOCK_ITEM.get() ), - new ItemStack( Registries.ENDERIUM_SHARD.get() ), - new ItemStack( Registries.ENDERIUM_INGOT.get() ), - new ItemStack( Registries.ENDERIUM_HELMET.get() ), - new ItemStack( Registries.ENDERIUM_CHESTPLATE.get() ), - new ItemStack( Registries.ENDERIUM_LEGGINGS.get() ), - new ItemStack( Registries.ENDERIUM_BOOTS.get() ), - new ItemStack( Registries.ENDERIUM_SWORD.get() ), - new ItemStack( Registries.ENDERIUM_PICKAXE.get() ), - new ItemStack( Registries.ENDERIUM_AXE.get() ), - new ItemStack( Registries.ENDERIUM_SHOVEL.get() ), - new ItemStack( Registries.ENDERIUM_HOE.get() ), - newItemStackWithPotion( Items.TIPPED_ARROW, Registries.WITHER_POTION.get() ), - newItemStackWithPotion( Items.TIPPED_ARROW, Registries.WITHER_POTION_LONG.get() ), - newItemStackWithPotion( Items.TIPPED_ARROW, Registries.WITHER_POTION_STRONG.get() ), - newItemStackWithPotion( Items.POTION, Registries.WITHER_POTION.get() ), - newItemStackWithPotion( Items.POTION, Registries.WITHER_POTION_LONG.get() ), - newItemStackWithPotion( Items.POTION, Registries.WITHER_POTION_STRONG.get() ), - newItemStackWithPotion( Items.SPLASH_POTION, Registries.WITHER_POTION.get() ), - newItemStackWithPotion( Items.SPLASH_POTION, Registries.WITHER_POTION_LONG.get() ), - newItemStackWithPotion( Items.SPLASH_POTION, Registries.WITHER_POTION_STRONG.get() ), - newItemStackWithPotion( Items.LINGERING_POTION, Registries.WITHER_POTION.get() ), - newItemStackWithPotion( Items.LINGERING_POTION, Registries.WITHER_POTION_LONG.get() ), - newItemStackWithPotion( Items.LINGERING_POTION, Registries.WITHER_POTION_STRONG.get() ) - ).forEach( output::accept ); - - Stream.of( - Items.TIPPED_ARROW, - Items.POTION, - Items.SPLASH_POTION, - Items.LINGERING_POTION - ).forEach( item->Stream.of( - Registries.WITHER_POTION, - Registries.WITHER_POTION_LONG, - Registries.WITHER_POTION_STRONG - ).forEach( potion->PotionUtils.setPotion( new ItemStack( item ), potion.get() ) ) ); - - Stream.of( - new ItemStack( Registries.ILLUSIONER_SPAWN_EGG.get() ), - new ItemStack( Registries.CREEPERLING_SPAWN_EGG.get() ), - new ItemStack( Registries.TANK_SPAWN_EGG.get() ), - new ItemStack( Registries.CURSED_ARMOR_SPAWN_EGG.get() ), - new ItemStack( Registries.CERBERUS_SPAWN_EGG.get() ), - new ItemStack( Registries.BLACK_WIDOW_SPAWN_EGG.get() ) - ).forEach( output::accept ); - } - - private void defineTreasureBagItems( FeatureFlagSet flagSet, CreativeModeTab.Output output, boolean hasPermissions ) { - Stream.of( - new ItemStack( Registries.FISHING_TREASURE_BAG.get() ), - notImplemented(), - notImplemented(), - - new ItemStack( Registries.UNDEAD_ARMY_TREASURE_BAG.get() ), - SoulJarItem.randomItemStack( 3 ), - notImplemented(), - - new ItemStack( Registries.PILLAGER_TREASURE_BAG.get() ), - new ItemStack( Registries.RECALL_POTION.get() ), - new ItemStack( Registries.BAD_OMEN_POTION.get() ), - - new ItemStack( Registries.ELDER_GUARDIAN_TREASURE_BAG.get() ), - notImplemented(), - notImplemented(), - - new ItemStack( Registries.WARDEN_TREASURE_BAG.get() ), - notImplemented(), - notImplemented(), - - new ItemStack( Registries.WITHER_TREASURE_BAG.get() ), - new ItemStack( Registries.WITHER_SWORD.get() ), - notImplemented(), - - new ItemStack( Registries.ENDER_DRAGON_TREASURE_BAG.get() ), - new ItemStack( Registries.ENDERIUM_SHARD_LOCATOR.get() ), - new ItemStack( Registries.ENDER_POUCH.get() ) - ).forEach( output::accept ); - } - - int counter = 0; - - private ItemStack notImplemented() { - ItemStack itemStack = new ItemStack( Items.DIRT ).setHoverName( Component.translatable( "Coming soon..." ) ); - itemStack.getOrCreateTagElement( String.format( "dirt_%d", ++counter ) ); // items must be unique, so well... - - return itemStack; - } - - private static class TreasureBag extends CreativeModeTab { - final Supplier< ItemStack > currentIcon; - - protected TreasureBag( Builder builder ) { - super( builder ); - - this.currentIcon = CreativeModeTabHelper.buildMultiIcon( Stream.of( - Registries.FISHING_TREASURE_BAG, - Registries.UNDEAD_ARMY_TREASURE_BAG, - Registries.PILLAGER_TREASURE_BAG, - Registries.ELDER_GUARDIAN_TREASURE_BAG, - Registries.WARDEN_TREASURE_BAG, - Registries.WITHER_TREASURE_BAG, - Registries.ENDER_DRAGON_TREASURE_BAG - ) ); - } - - @Override - public ItemStack getIconItem() { - return this.currentIcon.get(); - } - } -} diff --git a/src/main/java/com/majruszsdifficulty/goals/UndeadArmyAttackPositionGoal.java b/src/main/java/com/majruszsdifficulty/goals/UndeadArmyAttackPositionGoal.java index 1bfd6fc13..fd9641cf3 100644 --- a/src/main/java/com/majruszsdifficulty/goals/UndeadArmyAttackPositionGoal.java +++ b/src/main/java/com/majruszsdifficulty/goals/UndeadArmyAttackPositionGoal.java @@ -5,6 +5,7 @@ import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.ai.goal.Goal; import net.minecraft.world.entity.ai.navigation.PathNavigation; +import net.minecraft.world.phys.Vec3; public class UndeadArmyAttackPositionGoal extends Goal { final Mob undead; @@ -55,7 +56,7 @@ private boolean hasAnyTarget() { } private double getDistanceToAttackPosition() { - return VectorHelper.distanceHorizontal( this.undead.position(), this.attackPosition.getCenter() ); + return VectorHelper.distanceHorizontal( this.undead.position(), new Vec3( this.attackPosition.getX() + 0.5, this.attackPosition.getY() + 0.5, this.attackPosition.getZ() + 0.5 ) ); } } diff --git a/src/main/java/com/majruszsdifficulty/items/CerberusFangItem.java b/src/main/java/com/majruszsdifficulty/items/CerberusFangItem.java index dc3a1e557..3cf8e96af 100644 --- a/src/main/java/com/majruszsdifficulty/items/CerberusFangItem.java +++ b/src/main/java/com/majruszsdifficulty/items/CerberusFangItem.java @@ -1,9 +1,46 @@ package com.majruszsdifficulty.items; +import com.majruszsdifficulty.Registries; +import net.minecraft.core.NonNullList; +import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.alchemy.Potion; +import net.minecraft.world.item.alchemy.PotionUtils; + +import java.util.stream.Stream; public class CerberusFangItem extends Item { public CerberusFangItem() { - super( new Properties() ); + super( new Properties().tab( Registries.ITEM_GROUP ) ); + } + + @Override + public void fillItemCategory( CreativeModeTab creativeModeTab, NonNullList< ItemStack > itemStacks ) { + super.fillItemCategory( creativeModeTab, itemStacks ); + + if( !this.allowedIn( creativeModeTab ) ) { + return; + } + + Stream.of( + newItemStackWithPotion( Items.TIPPED_ARROW, Registries.WITHER_POTION.get() ), + newItemStackWithPotion( Items.TIPPED_ARROW, Registries.WITHER_POTION_LONG.get() ), + newItemStackWithPotion( Items.TIPPED_ARROW, Registries.WITHER_POTION_STRONG.get() ), + newItemStackWithPotion( Items.POTION, Registries.WITHER_POTION.get() ), + newItemStackWithPotion( Items.POTION, Registries.WITHER_POTION_LONG.get() ), + newItemStackWithPotion( Items.POTION, Registries.WITHER_POTION_STRONG.get() ), + newItemStackWithPotion( Items.SPLASH_POTION, Registries.WITHER_POTION.get() ), + newItemStackWithPotion( Items.SPLASH_POTION, Registries.WITHER_POTION_LONG.get() ), + newItemStackWithPotion( Items.SPLASH_POTION, Registries.WITHER_POTION_STRONG.get() ), + newItemStackWithPotion( Items.LINGERING_POTION, Registries.WITHER_POTION.get() ), + newItemStackWithPotion( Items.LINGERING_POTION, Registries.WITHER_POTION_LONG.get() ), + newItemStackWithPotion( Items.LINGERING_POTION, Registries.WITHER_POTION_STRONG.get() ) + ).forEach( itemStacks::add ); + } + + private static ItemStack newItemStackWithPotion( Item item, Potion potion ) { + return PotionUtils.setPotion( new ItemStack( item ), potion ); } } diff --git a/src/main/java/com/majruszsdifficulty/items/ClothItem.java b/src/main/java/com/majruszsdifficulty/items/ClothItem.java index d8e2a6547..8665c6c04 100644 --- a/src/main/java/com/majruszsdifficulty/items/ClothItem.java +++ b/src/main/java/com/majruszsdifficulty/items/ClothItem.java @@ -14,17 +14,4 @@ public class ClothItem extends Item { public ClothItem() { super( new Properties().tab( Registries.ITEM_GROUP ) ); } - - @Override - public void fillItemCategory( CreativeModeTab itemGroup, NonNullList< ItemStack > itemStacks ) { - if( !this.allowedIn( itemGroup ) ) - return; - - Stream.of( - UndeadArmorItem.constructItem( UndeadArmorItem.HELMET_ID ), - UndeadArmorItem.constructItem( UndeadArmorItem.CHESTPLATE_ID ), - UndeadArmorItem.constructItem( UndeadArmorItem.LEGGINGS_ID ), - UndeadArmorItem.constructItem( UndeadArmorItem.BOOTS_ID ) - ).forEach( itemStacks::add ); - } } diff --git a/src/main/java/com/majruszsdifficulty/items/SoulJarItem.java b/src/main/java/com/majruszsdifficulty/items/SoulJarItem.java index 2285d7792..577679823 100644 --- a/src/main/java/com/majruszsdifficulty/items/SoulJarItem.java +++ b/src/main/java/com/majruszsdifficulty/items/SoulJarItem.java @@ -59,7 +59,7 @@ public static ItemStack randomItemStack( int bonusCount ) { } public SoulJarItem() { - super( new Properties().stacksTo( 1 ).rarity( Rarity.UNCOMMON ) ); + super( new Properties().stacksTo( 1 ).rarity( Rarity.UNCOMMON ).tab( Registries.ITEM_GROUP ) ); } @Override diff --git a/src/main/java/com/majruszsdifficulty/items/TatteredArmorItem.java b/src/main/java/com/majruszsdifficulty/items/TatteredArmorItem.java index 6c5495be9..71e6e3806 100644 --- a/src/main/java/com/majruszsdifficulty/items/TatteredArmorItem.java +++ b/src/main/java/com/majruszsdifficulty/items/TatteredArmorItem.java @@ -9,7 +9,7 @@ public class TatteredArmorItem extends ArmorItem { public TatteredArmorItem( EquipmentSlot slot ) { - super( CustomArmorMaterial.UNDEAD, slot, new Item.Properties().rarity( Rarity.UNCOMMON ) ); + super( CustomArmorMaterial.UNDEAD, slot, new Item.Properties().rarity( Rarity.UNCOMMON ).tab( Registries.ITEM_GROUP ) ); } @Nullable diff --git a/src/main/java/com/majruszsdifficulty/models/CerberusModel.java b/src/main/java/com/majruszsdifficulty/models/CerberusModel.java index 98f379ea4..bf0ab027f 100644 --- a/src/main/java/com/majruszsdifficulty/models/CerberusModel.java +++ b/src/main/java/com/majruszsdifficulty/models/CerberusModel.java @@ -5,6 +5,7 @@ import com.mlib.animations.Frame; import com.mlib.animations.InterpolationType; import com.mlib.math.VectorHelper; +import com.mojang.math.Vector3f; import net.minecraft.client.Minecraft; import net.minecraft.client.model.HierarchicalModel; import net.minecraft.client.model.geom.ModelPart; @@ -14,7 +15,6 @@ import net.minecraft.util.Mth; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -import org.joml.Vector3f; @OnlyIn( Dist.CLIENT ) public class CerberusModel< Type extends CerberusEntity > extends HierarchicalModel< Type > { @@ -332,11 +332,12 @@ public void setupAnim( Type cerberus, float limbSwing, float limbSwingAmount, fl this.jawLower1.xRot = this.jawLower2.xRot = this.jawLower3.xRot = breathJawRotation; // bite anims (side necks) - Vector3f neckRotation = new Vector3f( BITE_SIDE_NECK_ROTATION.apply( biteRatio, ageInTicks ) ).mul( ( float )Math.PI / 180.0f ); - this.neck1.xRot = neckRotation.x; - this.neck1.zRot = neckRotation.z; - this.neck3.xRot = neckRotation.x; - this.neck3.zRot = -neckRotation.z; + Vector3f neckRotation = BITE_SIDE_NECK_ROTATION.apply( biteRatio, ageInTicks ); + neckRotation.mul( ( float )Math.PI / 180.0f ); + this.neck1.xRot = neckRotation.x(); + this.neck1.zRot = neckRotation.z(); + this.neck3.xRot = neckRotation.x(); + this.neck3.zRot = -neckRotation.z(); } private float getPlayerDistance( Type cerberus ) { diff --git a/src/main/java/com/majruszsdifficulty/undeadarmy/UndeadArmy.java b/src/main/java/com/majruszsdifficulty/undeadarmy/UndeadArmy.java index d3555f943..1163885b1 100644 --- a/src/main/java/com/majruszsdifficulty/undeadarmy/UndeadArmy.java +++ b/src/main/java/com/majruszsdifficulty/undeadarmy/UndeadArmy.java @@ -17,6 +17,7 @@ import net.minecraft.world.effect.MobEffects; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.phys.Vec3; import java.util.ArrayList; import java.util.List; @@ -96,7 +97,10 @@ public void setState( Phase.State state, int ticksLeft ) { } public double distanceTo( BlockPos position ) { - return VectorHelper.distanceHorizontal( position.getCenter(), this.positionToAttack.getCenter() ); + return VectorHelper.distanceHorizontal( + new Vec3( position.getX() + 0.5, position.getY() + 0.5, position.getZ() + 0.5 ), + new Vec3( this.positionToAttack.getX() + 0.5, this.positionToAttack.getY() + 0.5, this.positionToAttack.getZ() + 0.5 ) + ); } public boolean hasFinished() {