diff --git a/src/main/generated/.cache/89b86ab0e66f527166d98df92ddbcf5416ed58f6 b/src/main/generated/.cache/89b86ab0e66f527166d98df92ddbcf5416ed58f6 index 18f8874..e2d652a 100644 --- a/src/main/generated/.cache/89b86ab0e66f527166d98df92ddbcf5416ed58f6 +++ b/src/main/generated/.cache/89b86ab0e66f527166d98df92ddbcf5416ed58f6 @@ -1,2 +1,2 @@ -// 1.19.2 2024-04-19T22:45:49.3401001 Language +// 1.19.2 2024-04-20T13:20:04.2533668 Language cf9144aa31d03773d984551199f36d4c66351a1f assets\the_origin_of_magic\lang\en_us.json diff --git a/src/main/generated/.cache/dc1d6e7286e7569a79007c10f809d49635ea1c49 b/src/main/generated/.cache/dc1d6e7286e7569a79007c10f809d49635ea1c49 index d64cc03..8b7f784 100644 --- a/src/main/generated/.cache/dc1d6e7286e7569a79007c10f809d49635ea1c49 +++ b/src/main/generated/.cache/dc1d6e7286e7569a79007c10f809d49635ea1c49 @@ -1,2 +1,2 @@ -// 1.19.2 2024-04-19T22:45:49.3370978 Block Loot Tables +// 1.19.2 2024-04-20T13:20:04.2507738 Block Loot Tables fe57f13449a11436bbede8c37e01bd0d1cd87191 data\the_origin_of_magic\loot_tables\blocks\magic_workbench.json diff --git a/src/main/generated/.cache/f3798f81c7b6fecad2cbfec741314f8a66c0eca3 b/src/main/generated/.cache/f3798f81c7b6fecad2cbfec741314f8a66c0eca3 index 3b50f0f..d3b7bff 100644 --- a/src/main/generated/.cache/f3798f81c7b6fecad2cbfec741314f8a66c0eca3 +++ b/src/main/generated/.cache/f3798f81c7b6fecad2cbfec741314f8a66c0eca3 @@ -1,3 +1,5 @@ -// 1.19.2 2024-04-19T22:45:49.3434062 Models +// 1.19.2 2024-04-20T13:20:04.2558702 Models 02d3ff4716d16f7c5a4dd4432d1b98f744a13f02 assets\the_origin_of_magic\models\item\blood_essence.json +b1555a32206034cd8f1b13891371182e88d9d40a assets\the_origin_of_magic\models\item\test_magic.json 03b1f5cc891077d36d38a8d98d2ffe49396f8229 assets\the_origin_of_magic\models\item\water_magic_element.json +a50a32a25dfc8a066cacf0c15ac0420396c0c5fc assets\the_origin_of_magic\models\item\hoglin_entity_limiter.json diff --git a/src/main/generated/assets/the_origin_of_magic/models/item/hoglin_entity_limiter.json b/src/main/generated/assets/the_origin_of_magic/models/item/hoglin_entity_limiter.json new file mode 100644 index 0000000..8a84741 --- /dev/null +++ b/src/main/generated/assets/the_origin_of_magic/models/item/hoglin_entity_limiter.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "the_origin_of_magic:item/hoglin_entity_limiter" + } +} \ No newline at end of file diff --git a/src/main/generated/assets/the_origin_of_magic/models/item/test_magic.json b/src/main/generated/assets/the_origin_of_magic/models/item/test_magic.json new file mode 100644 index 0000000..cac2aa4 --- /dev/null +++ b/src/main/generated/assets/the_origin_of_magic/models/item/test_magic.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "the_origin_of_magic:item/test_magic" + } +} \ No newline at end of file diff --git a/src/main/java/com/ictye/the_origin_of_magic/Contents/AllEntity.java b/src/main/java/com/ictye/the_origin_of_magic/Contents/AllEntity.java index e8e9677..d455c14 100644 --- a/src/main/java/com/ictye/the_origin_of_magic/Contents/AllEntity.java +++ b/src/main/java/com/ictye/the_origin_of_magic/Contents/AllEntity.java @@ -1,20 +1,22 @@ package com.ictye.the_origin_of_magic.Contents; +import com.ictye.the_origin_of_magic.foundation.Entitys.Magics.ExplosionThrownMagic; import com.ictye.the_origin_of_magic.foundation.Entitys.Magics.StdThrownMagic; -import com.ictye.the_origin_of_magic.foundation.Entitys.Magics.TestThrownMagic; +import com.ictye.the_origin_of_magic.the_origin_of_magic; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.fabricmc.fabric.api.client.rendering.v1.EntityRendererRegistry; import net.fabricmc.fabric.api.object.builder.v1.entity.FabricEntityTypeBuilder; import net.minecraft.client.render.entity.FlyingItemEntityRenderer; -import net.minecraft.entity.*; +import net.minecraft.entity.EntityDimensions; +import net.minecraft.entity.EntityType; +import net.minecraft.entity.SpawnGroup; import net.minecraft.util.Identifier; import net.minecraft.util.registry.Registry; -import com.ictye.the_origin_of_magic.the_origin_of_magic; public class AllEntity { - public static final EntityType TEST_MAGIC_ENTITY_TYPE= FabricEntityTypeBuilder.create(SpawnGroup.MISC, TestThrownMagic::new) + public static final EntityType TEST_MAGIC_ENTITY_TYPE= FabricEntityTypeBuilder.create(SpawnGroup.MISC, ExplosionThrownMagic::new) .dimensions(EntityDimensions.fixed(0.25F, 0.25F)) .trackRangeBlocks(4).trackedUpdateRate(10) .build(); diff --git a/src/main/java/com/ictye/the_origin_of_magic/Contents/AllItem.java b/src/main/java/com/ictye/the_origin_of_magic/Contents/AllItem.java index b4d9392..3bdfad5 100644 --- a/src/main/java/com/ictye/the_origin_of_magic/Contents/AllItem.java +++ b/src/main/java/com/ictye/the_origin_of_magic/Contents/AllItem.java @@ -1,7 +1,6 @@ package com.ictye.the_origin_of_magic.Contents; import com.ictye.the_origin_of_magic.foundation.Items.Magic.LimiterItem.UndeadEntityLimiterItem; -import com.ictye.the_origin_of_magic.foundation.Items.Magic.StdMagicItem; import com.ictye.the_origin_of_magic.foundation.Items.Magic.TestMagicEntityItem; import com.ictye.the_origin_of_magic.foundation.Items.Staff.DeadwoodStaff; import com.ictye.the_origin_of_magic.foundation.Items.Staff.TestStaff; @@ -49,15 +48,15 @@ public class AllItem { /** * 所有魔法 */ - public static final Item TEST_MAGIC = createMagic("Test Magic","test_magic",new TestMagicEntityItem(new FabricItemSettings() + public static final Item TEST_MAGIC = new TestMagicEntityItem(new FabricItemSettings() .maxCount(1) - .group(TheOriginOfMagicItemGroup), AllEntity.TEST_MAGIC_ENTITY_TYPE)); // 測試魔法 + .group(TheOriginOfMagicItemGroup), AllEntity.TEST_MAGIC_ENTITY_TYPE); // 測試魔法 - public static final Item HOGLIN_ENTITY_LIMITER = createMagic("Hoglin Entity Limiter","hoglin_entity_limiter",new UndeadEntityLimiterItem(new FabricItemSettings() + public static final Item HOGLIN_ENTITY_LIMITER = new UndeadEntityLimiterItem(new FabricItemSettings() .maxCount(1) .group(TheOriginOfMagicItemGroup) .maxDamage(100) - .rarity(Rarity.COMMON),null)); + .rarity(Rarity.COMMON),null); /** * 所有材料 @@ -75,9 +74,11 @@ public class AllItem { /** * 物品ID列表 */ - public static Map ItemMap = Map.of( + public static final Map ItemMap = Map.of( "deadwood_staff",DEADWOOD_STAFF, "test_staff",TEST_STAFF, + "test_magic",TEST_MAGIC, + "hoglin_entity_limiter", HOGLIN_ENTITY_LIMITER, "blood_essence",BLOOD_ESSENCE, "water_magic_element",WATER_MAGIC_ELEMENT ); @@ -85,9 +86,11 @@ public class AllItem { /** * 物品英文翻譯列表 */ - public static Map ItemTransMap = Map.of( + public static final Map ItemTransMap = Map.of( "Deadwood Staff",DEADWOOD_STAFF, "Test Staff",TEST_STAFF, + "Test Magic",TEST_MAGIC, + "Hoglin Entity Limiter", HOGLIN_ENTITY_LIMITER, "Blood Essence", BLOOD_ESSENCE, "Water Magic Element",WATER_MAGIC_ELEMENT ); @@ -95,18 +98,13 @@ public class AllItem { /** * 物品模型列表 */ - public static Map< Item,Model> ItemModelMap = Map.of( + public static final Map< Item,Model> ItemModelMap = Map.of( BLOOD_ESSENCE,Models.GENERATED, - WATER_MAGIC_ELEMENT,Models.GENERATED + WATER_MAGIC_ELEMENT,Models.GENERATED, + TEST_MAGIC,Models.GENERATED, + HOGLIN_ENTITY_LIMITER,Models.GENERATED ); - private static Item createMagic(String name, String id, StdMagicItem magicItem){ - ItemMap.put(id,magicItem); - ItemModelMap.put(magicItem,Models.GENERATED); - ItemTransMap.put(name,magicItem); - return magicItem; - } - private static void registerItem(String name, Item item){ Registry.register(Registry.ITEM, new Identifier(the_origin_of_magic.Mod_Id, name), item); } diff --git a/src/main/java/com/ictye/the_origin_of_magic/foundation/Entitys/Magics/TestThrownMagic.java b/src/main/java/com/ictye/the_origin_of_magic/foundation/Entitys/Magics/ExplosionThrownMagic.java similarity index 63% rename from src/main/java/com/ictye/the_origin_of_magic/foundation/Entitys/Magics/TestThrownMagic.java rename to src/main/java/com/ictye/the_origin_of_magic/foundation/Entitys/Magics/ExplosionThrownMagic.java index 289043c..e60094f 100644 --- a/src/main/java/com/ictye/the_origin_of_magic/foundation/Entitys/Magics/TestThrownMagic.java +++ b/src/main/java/com/ictye/the_origin_of_magic/foundation/Entitys/Magics/ExplosionThrownMagic.java @@ -8,10 +8,11 @@ import net.minecraft.particle.ParticleTypes; import net.minecraft.util.hit.HitResult; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import net.minecraft.world.explosion.Explosion; -public class TestThrownMagic extends StdThrownMagic { +public class ExplosionThrownMagic extends StdThrownMagic { private float exolisionRate; @@ -20,17 +21,17 @@ protected float getGravity() { return 0.0F; } - public TestThrownMagic(EntityType entityType, World world) { + public ExplosionThrownMagic(EntityType entityType, World world) { super(entityType, world); this.exolisionRate = 1.0F; } - public TestThrownMagic(EntityType type, LivingEntity owner, World world) { + public ExplosionThrownMagic(EntityType type, LivingEntity owner, World world) { super(type, owner, world); this.exolisionRate = 1.0F; } - public TestThrownMagic(EntityType type, LivingEntity owner, World world, float exolisionRate) { + public ExplosionThrownMagic(EntityType type, LivingEntity owner, World world, float exolisionRate) { this(type, owner, world); this.exolisionRate = exolisionRate; } @@ -62,6 +63,13 @@ public ItemStack getStack() { @Override public void tick() { super.tick(); - this.world.addParticle(ParticleTypes.DRAGON_BREATH, this.getX(), this.getY(), this.getZ(), 0.0D, 0.0D, 0.0D); + this.world.addParticle(ParticleTypes.FIREWORK, this.getX(), this.getY(), this.getZ(), 0.0D, 0.0D, 0.0D); + Vec3d v = this.getVelocity(); + for(int i = 8;i > 0;i--){ + double x = random.nextDouble() * 2 - 1; + double y = random.nextDouble() * 2 - 1; + double z = random.nextDouble() * 2 - 1; + this.world.addParticle(ParticleTypes.FLAME, this.getX(), this.getY(), this.getZ(), x/2, y/2, z/2); + } } } diff --git a/src/main/java/com/ictye/the_origin_of_magic/foundation/Entitys/Magics/Limiters/HostileEntityLimiter.java b/src/main/java/com/ictye/the_origin_of_magic/foundation/Entitys/Magics/Limiters/HostileEntityLimiter.java index c4bcf47..431feaf 100644 --- a/src/main/java/com/ictye/the_origin_of_magic/foundation/Entitys/Magics/Limiters/HostileEntityLimiter.java +++ b/src/main/java/com/ictye/the_origin_of_magic/foundation/Entitys/Magics/Limiters/HostileEntityLimiter.java @@ -1,6 +1,6 @@ package com.ictye.the_origin_of_magic.foundation.Entitys.Magics.Limiters; -import net.minecraft.entity.mob.HoglinEntity; +import net.minecraft.entity.mob.HostileEntity; import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.hit.EntityHitResult; import net.minecraft.util.hit.HitResult; @@ -11,7 +11,7 @@ public class HostileEntityLimiter extends StdMagicLimiter { public boolean canEffect(@Nullable EntityHitResult entityHitResult, @Nullable HitResult hitResult, @Nullable BlockHitResult blockHitResult) { // 判斷是否為亡靈生物 if (entityHitResult != null) { - return entityHitResult.getEntity() instanceof HoglinEntity; + return entityHitResult.getEntity() instanceof HostileEntity; } return false; } diff --git a/src/main/java/com/ictye/the_origin_of_magic/foundation/Items/Magic/TestMagicEntityItem.java b/src/main/java/com/ictye/the_origin_of_magic/foundation/Items/Magic/TestMagicEntityItem.java index 8642abb..49ce99b 100644 --- a/src/main/java/com/ictye/the_origin_of_magic/foundation/Items/Magic/TestMagicEntityItem.java +++ b/src/main/java/com/ictye/the_origin_of_magic/foundation/Items/Magic/TestMagicEntityItem.java @@ -1,8 +1,8 @@ package com.ictye.the_origin_of_magic.foundation.Items.Magic; import com.ictye.the_origin_of_magic.Contents.AllEntity; +import com.ictye.the_origin_of_magic.foundation.Entitys.Magics.ExplosionThrownMagic; import com.ictye.the_origin_of_magic.foundation.Entitys.Magics.StdThrownMagic; -import com.ictye.the_origin_of_magic.foundation.Entitys.Magics.TestThrownMagic; import net.minecraft.entity.EntityType; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.world.World; @@ -16,6 +16,6 @@ public TestMagicEntityItem(Settings settings, EntityType entityT @Override public StdThrownMagic getMagic(PlayerEntity user, World world, float exolisionRate, int hartRate) { - return new TestThrownMagic(magicEntityType,user,world,exolisionRate); + return new ExplosionThrownMagic(magicEntityType,user,world,exolisionRate); } } diff --git a/src/main/java/com/ictye/the_origin_of_magic/foundation/mixin/HUD/PlayerHudMixin.java b/src/main/java/com/ictye/the_origin_of_magic/foundation/mixin/HUD/PlayerHudMixin.java index 3195fde..c206e0a 100644 --- a/src/main/java/com/ictye/the_origin_of_magic/foundation/mixin/HUD/PlayerHudMixin.java +++ b/src/main/java/com/ictye/the_origin_of_magic/foundation/mixin/HUD/PlayerHudMixin.java @@ -11,6 +11,8 @@ import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.ModifyArg; +import org.spongepowered.asm.mixin.injection.Slice; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(InGameHud.class) @@ -28,4 +30,16 @@ public abstract class PlayerHudMixin extends DrawableHelper{ private void renderStatusBars(MatrixStack matrices, CallbackInfo ci){ MagicLevelHud.renderThirstHud(matrices, client, this.getCameraPlayer(), ticks); } + + // 提高氣泡的位置 + @ModifyArg(method = "renderStatusBars", + at = @At(value = "INVOKE",target = "Lnet/minecraft/client/gui/hud/InGameHud;drawTexture(Lnet/minecraft/client/util/math/MatrixStack;IIIIII)V"), + index = 2, + slice = @Slice( + from = @At(value = "INVOKE",target = "Lnet/minecraft/entity/player/PlayerEntity;getMaxAir()I"), + to = @At(value = "INVOKE",target = "Lnet/minecraft/util/profiler/Profiler;pop()V") + )) + private int modifyAirBarPosition(int par2) { + return par2 - 12; + } } diff --git a/src/main/java/com/ictye/the_origin_of_magic/utils/Vec3d_Util.java b/src/main/java/com/ictye/the_origin_of_magic/utils/Vec3d_Util.java index 7a11c28..da343d5 100644 --- a/src/main/java/com/ictye/the_origin_of_magic/utils/Vec3d_Util.java +++ b/src/main/java/com/ictye/the_origin_of_magic/utils/Vec3d_Util.java @@ -16,5 +16,21 @@ public static Vec3d getLookVec(LivingEntity player, double length) { return vec.normalize().multiply(length); } + + public static Vec3d RodriguesRotation(Vec3d vec, double angle, Vec3d axis){ + + double x = vec.x; + double y = vec.y; + double z = vec.z; + + double sinAngle = Math.sin(angle); + double cosAngle = Math.cos(angle); + + double rx = (axis.x * (1 - cosAngle)) + (axis.x * axis.x * (1 - cosAngle)) + (axis.z * sinAngle); + double ry = (axis.y * (1 - cosAngle)) + (axis.y * axis.y * (1 - cosAngle)) + (axis.z * sinAngle); + double rz = (axis.z * (1 - cosAngle)) + (axis.x * axis.y * sinAngle) + (axis.z * axis.z * (1 - cosAngle)); + + return new Vec3d(x * rx + y * ry + z * rz, x * ry + y * rz + z * rx, x * rz + y * rx + z * ry); + } } diff --git a/src/main/resources/assets/the_origin_of_magic/logo.png b/src/main/resources/assets/the_origin_of_magic/logo.png index f454f5a..c56579e 100644 Binary files a/src/main/resources/assets/the_origin_of_magic/logo.png and b/src/main/resources/assets/the_origin_of_magic/logo.png differ diff --git a/src/main/resources/assets/the_origin_of_magic/textures/gui/magic_power_image.png b/src/main/resources/assets/the_origin_of_magic/textures/gui/magic_power_image.png index 45410f9..eac93b3 100644 Binary files a/src/main/resources/assets/the_origin_of_magic/textures/gui/magic_power_image.png and b/src/main/resources/assets/the_origin_of_magic/textures/gui/magic_power_image.png differ