Skip to content

Commit

Permalink
feat: 新增零刻魔法和魔法球,但是这个魔法球未免有点太弹了()
Browse files Browse the repository at this point in the history
  • Loading branch information
northgreen committed Apr 28, 2024
1 parent c875db8 commit 97b81ac
Show file tree
Hide file tree
Showing 42 changed files with 254 additions and 104 deletions.
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// 1.19.2 2024-04-27T21:43:20.5506987 Language
e20b0ea5b300d1f01ca66c6725d1e0c00be855ef assets\the_origin_of_magic\lang\en_us.json
// 1.19.2 2024-04-28T22:48:00.5462027 Language
60fc1c17293eabeb679d8e91fb8244d3101fa2ec assets\the_origin_of_magic\lang\en_us.json
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// 1.19.2 2024-04-27T21:43:20.5476236 Block Loot Tables
// 1.19.2 2024-04-28T22:48:00.5402056 Block Loot Tables
fe57f13449a11436bbede8c37e01bd0d1cd87191 data\the_origin_of_magic\loot_tables\blocks\magic_workbench.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// 1.19.2 2024-04-27T21:43:20.5441261 Models
// 1.19.2 2024-04-28T22:48:00.5427039 Models
e61b535cd7ab658695681160ffbc526e0b8655f4 assets\the_origin_of_magic\models\item\magic_bullet_with_trigger.json
982fb2d3ae94989d61be6d49ebcac381af5d841b assets\the_origin_of_magic\models\item\magic_energy_throw_boll.json
6e0df2c99a9c005ddce1ec13cf27aff50ee1081f assets\the_origin_of_magic\models\item\magic_bullet_with_time_trigger.json
02d3ff4716d16f7c5a4dd4432d1b98f744a13f02 assets\the_origin_of_magic\models\item\blood_essence.json
105ea751d9d55fefa41f158e8e462c2e69f451ed assets\the_origin_of_magic\models\item\magic_life_time_up.json
Expand All @@ -12,6 +13,7 @@ f54d22f024ca8dbc5f81e759c90de28d15c18b17 assets\the_origin_of_magic\models\item\
ddf4e605ac73f757f76bbfe39d60312b7042e7d9 assets\the_origin_of_magic\models\item\hostile_entity_limiter.json
43e2c3caac7463f02d4048ca73f166772b1e1cb3 assets\the_origin_of_magic\models\item\magic_life_time_down.json
14f7b54096acc0b1b7b588d72bd80df62d566018 assets\the_origin_of_magic\models\item\earth_magic_element.json
da82fc5eab993db4c28ef8696169be167f60350e assets\the_origin_of_magic\models\item\null_magic.json
da16015585e364c4561b91a3b83056d8c3646d1c assets\the_origin_of_magic\models\item\gold_magic_element.json
1dce304afb036f29cfc41d921aca0fd0bb0e8f7a assets\the_origin_of_magic\models\item\ray_magic.json
681374800d5b4991c2e8d6304781b89089bd379c assets\the_origin_of_magic\models\item\poison_magic.json
Expand Down
2 changes: 2 additions & 0 deletions src/main/generated/assets/the_origin_of_magic/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@
"item.the_origin_of_magic.magic_bullet_with_time_trigger": "Magic Bullet With Time Trigger",
"item.the_origin_of_magic.magic_bullet_with_trigger": "Magic Bullet With Trigger",
"item.the_origin_of_magic.magic_core": "Magic Core",
"item.the_origin_of_magic.magic_energy_throw_boll": "Magic Energy Throw Boll",
"item.the_origin_of_magic.magic_life_time_down": "Magic Life Time Down",
"item.the_origin_of_magic.magic_life_time_up": "Magic Life Time Up",
"item.the_origin_of_magic.nature_magic_element": "Nature Magic Element",
"item.the_origin_of_magic.null_magic": "Null Magic",
"item.the_origin_of_magic.poison_magic": "Poison Magic",
"item.the_origin_of_magic.ray_magic": "Ray Magic",
"item.the_origin_of_magic.ray_magic.effect.fire_resistance": "Fire resistance Ray Magic",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "the_origin_of_magic:item/null_magic"
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.ictye.the_origin_of_magic.Contents;

import com.ictye.the_origin_of_magic.foundation.Entitys.Magics.*;
import com.ictye.the_origin_of_magic.foundation.Entitys.Magics.MagicInterfaces.StdMagic.StdThrownMagic;
import com.ictye.the_origin_of_magic.foundation.Entitys.Magics.StdMagic.*;
import com.ictye.the_origin_of_magic.infrastructure.Renders.MagicsRender.MagicRender;
import com.ictye.the_origin_of_magic.the_origin_of_magic;
import net.fabricmc.api.EnvType;
Expand Down Expand Up @@ -67,14 +68,23 @@ public class AllEntity {


public static final EntityType<StdThrownMagic> MAGIC_BULLET_WITH_TIME_TRIGGER_ENTITY_TYPE = the_origin_of_magic.MOD_REGISTRATE.entityBuilder(
FabricEntityTypeBuilder
.<StdThrownMagic>create(SpawnGroup.MISC, MagicBulletWithTimeTrigger::new)
FabricEntityTypeBuilder .<StdThrownMagic>create(SpawnGroup.MISC, MagicBulletWithTimeTrigger::new)
.dimensions(EntityDimensions.fixed(0.25F, 0.25F))
.trackRangeBlocks(4).trackedUpdateRate(10)
.build(),
"magic_bullet_with_time_trigger"
);

public static final EntityType<StdThrownMagic> MAGIC_ENERGY_THROW_BOLL_ENTITY_TYPE = the_origin_of_magic.MOD_REGISTRATE.entityBuilder(
FabricEntityTypeBuilder
.<StdThrownMagic>create(SpawnGroup.MISC, MagicEnergyThrowBoll::new)
.dimensions(EntityDimensions.fixed(0.25F, 0.25F))
.trackRangeBlocks(4).trackedUpdateRate(10)
.build(),
"magic_energy_throw_boll"
);


/**
* 注冊魔法實體渲染器
*/
Expand All @@ -87,5 +97,6 @@ public static void regEntityRenderer(){
EntityRendererRegistry.register(POISON_RAY_MAGIC_ENTITY_TYPE, MagicRender::new);
EntityRendererRegistry.register(MAGIC_BULLET_WITH_TRIGGER_ENTITY_TYPE, MagicRender::new);
EntityRendererRegistry.register(MAGIC_BULLET_WITH_TIME_TRIGGER_ENTITY_TYPE, MagicRender::new);
EntityRendererRegistry.register(MAGIC_ENERGY_THROW_BOLL_ENTITY_TYPE, MagicRender::new);
}
}
44 changes: 36 additions & 8 deletions src/main/java/com/ictye/the_origin_of_magic/Contents/AllItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

import com.ictye.the_origin_of_magic.foundation.Items.Magic.CorrectionMagic.MagicLIfeTimeDownItem;
import com.ictye.the_origin_of_magic.foundation.Items.Magic.CorrectionMagic.MagicLifeTimeUpItem;
import com.ictye.the_origin_of_magic.foundation.Items.Magic.*;
import com.ictye.the_origin_of_magic.foundation.Items.Magic.CorrectionMagic.NullMagicItem;
import com.ictye.the_origin_of_magic.foundation.Items.Magic.LimiterItem.UndeadEntityLimiterItem;
import com.ictye.the_origin_of_magic.foundation.Items.Magic.StdMagic.*;
import com.ictye.the_origin_of_magic.foundation.Items.Staff.DeadwoodStaff;
import com.ictye.the_origin_of_magic.foundation.Items.Staff.TestStaff;
import com.ictye.the_origin_of_magic.infrastructure.ModRegistrate;
Expand Down Expand Up @@ -87,7 +88,6 @@ public class AllItem {
new FabricItemSettings()
.maxCount(1)
.group(TheOriginOfMagicItemGroup)
.maxDamage(100)
.rarity(Rarity.COMMON),
null
);
Expand All @@ -101,7 +101,6 @@ public class AllItem {
new FabricItemSettings()
.maxCount(1)
.group(TheOriginOfMagicItemGroup)
.maxDamage(100)
.rarity(Rarity.COMMON),
AllEntity.POISON_RAY_MAGIC_ENTITY_TYPE
);
Expand All @@ -114,7 +113,6 @@ public class AllItem {
new FabricItemSettings()
.maxCount(1)
.group(TheOriginOfMagicItemGroup)
.maxDamage(100)
.rarity(Rarity.COMMON),
AllEntity.MAGIC_BULLET_ENTITY_TYPE
);
Expand All @@ -127,7 +125,6 @@ public class AllItem {
new FabricItemSettings()
.maxCount(1)
.group(TheOriginOfMagicItemGroup)
.maxDamage(100)
.rarity(Rarity.COMMON),
AllEntity.MAGIC_BULLET_WITH_TRIGGER_ENTITY_TYPE
);
Expand All @@ -140,11 +137,26 @@ public class AllItem {
new FabricItemSettings()
.maxCount(1)
.group(TheOriginOfMagicItemGroup)
.maxDamage(100)
.rarity(Rarity.COMMON),
AllEntity.MAGIC_BULLET_WITH_TIME_TRIGGER_ENTITY_TYPE
);


public static final Item MAGIC_ENERGY_THROW_BOLL_ITEM = the_origin_of_magic.MOD_REGISTRATE.itemBuilder(
MagicEnergyThrowBollItem::new,
"magic_energy_throw_boll",
"Magic Energy Throw Boll",
Models.GENERATED,
new FabricItemSettings()
.maxCount(1)
.group(TheOriginOfMagicItemGroup)
.rarity(Rarity.COMMON),
AllEntity.MAGIC_ENERGY_THROW_BOLL_ENTITY_TYPE
);

/**
* 魔法时间增加
*/
public static final Item MAGIC_LIFE_TIME_UP = the_origin_of_magic.MOD_REGISTRATE.itemBuilder(
MagicLifeTimeUpItem::new,
"magic_life_time_up",
Expand All @@ -153,11 +165,13 @@ public class AllItem {
new FabricItemSettings()
.maxCount(1)
.group(TheOriginOfMagicItemGroup)
.maxDamage(100)
.rarity(Rarity.COMMON),
null
);

/**
* 魔法时间降低
*/
public static final Item MAGIC_LIFE_TIME_DOWN = the_origin_of_magic.MOD_REGISTRATE.itemBuilder(
MagicLIfeTimeDownItem::new,
"magic_life_time_down",
Expand All @@ -166,7 +180,21 @@ public class AllItem {
new FabricItemSettings()
.maxCount(1)
.group(TheOriginOfMagicItemGroup)
.maxDamage(100)
.rarity(Rarity.COMMON),
null
);

/**
* 零刻魔法
*/
public static final Item NULL_MAGIC = the_origin_of_magic.MOD_REGISTRATE.itemBuilder(
NullMagicItem::new,
"null_magic",
"Null Magic",
Models.GENERATED,
new FabricItemSettings()
.maxCount(1)
.group(TheOriginOfMagicItemGroup)
.rarity(Rarity.COMMON),
null
);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.ictye.the_origin_of_magic.foundation.Entitys.Magics.CorrectionMagic;

import com.ictye.the_origin_of_magic.foundation.Entitys.Magics.MagicInterfaces.StdCastInterface;

public class NullMagic extends StdAttrMagic{
@Override
public void onUse(StdCastInterface magic) {
magic.setAge(0);
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.ictye.the_origin_of_magic.foundation.Entitys.Magics;
package com.ictye.the_origin_of_magic.foundation.Entitys.Magics.MagicInterfaces.StdMagic;

import com.ictye.the_origin_of_magic.foundation.Entitys.Magics.MagicInterfaces.StdCastInterface;
import net.minecraft.entity.player.PlayerEntity;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.ictye.the_origin_of_magic.foundation.Entitys.Magics;
package com.ictye.the_origin_of_magic.foundation.Entitys.Magics.MagicInterfaces.StdMagic;

import com.ictye.the_origin_of_magic.foundation.Entitys.Magics.EffectMagic.StdEffectMagic;
import com.ictye.the_origin_of_magic.foundation.Entitys.Magics.Limiters.StdMagicLimiter;
Expand Down Expand Up @@ -29,7 +29,7 @@
import java.util.ArrayList;
import java.util.List;

public abstract class StdThrownMagic extends ProjectileEntity implements FlyingItemEntity,StdCastInterface {
public abstract class StdThrownMagic extends ProjectileEntity implements FlyingItemEntity, StdCastInterface {

protected PRDRandom prdRandom;

Expand All @@ -43,7 +43,7 @@ public abstract class StdThrownMagic extends ProjectileEntity implements FlyingI
*/
private List<StdCastInterface> additionMagicList = new ArrayList<>();

private List<StdEffectMagic> effectMagicList = new ArrayList<>();
private final List<StdEffectMagic> effectMagicList = new ArrayList<>();

/**
* 添加法術效果
Expand All @@ -56,7 +56,7 @@ public void addEffect(StdEffectMagic effectMagic) {
/**
* 限制器列表
*/
private List<StdMagicLimiter> limiters = new ArrayList<>();
private final List<StdMagicLimiter> limiters = new ArrayList<>();

/**
* 添加監聽
Expand All @@ -72,12 +72,12 @@ public void addLimiter(StdMagicLimiter limiter){
protected float explosionRate;

public float getExplosionRate() {
return explosionRate;
return Math.min(explosionRate,1);
}

protected int lit = 15;

protected int age = 0;
protected int ageCount = 0;

private int ageRate = 1;

Expand Down Expand Up @@ -109,12 +109,14 @@ public float getMagicRate() {
return magicRate;
}

protected int totalAge = 200;

public int getAge(){
return 200;
return totalAge;
}

public void setAge(int age) {
this.age = age;
this.totalAge = age;
}

public void setAgeRate(int ageRate) {
Expand Down Expand Up @@ -320,7 +322,6 @@ public void tick() {
this.updateRotation();
if (this.isTouchingWater()) {
for (int i = 0; i < 4; ++i) {
float g = 0.25f;
this.world.addParticle(ParticleTypes.BUBBLE, d - vec3d.x * 0.25, e - vec3d.y * 0.25, f - vec3d.z * 0.25, vec3d.x, vec3d.y, vec3d.z);
}
h = 0.8f;
Expand All @@ -336,8 +337,8 @@ public void tick() {
}
this.setPosition(d, e, f);

age++;
if (age>=getAge() * Math.min(this.ageRate,1)){
ageCount++;
if (ageCount >=getAge() * Math.min(this.ageRate,1)){
if(ageCast){
if(!world.isClient){
castAddiMagic();
Expand Down Expand Up @@ -383,11 +384,6 @@ public MagicSetting Setting(){

@SuppressWarnings("UnusedReturnValue")
public class MagicSetting{
public MagicSetting age(int a){
age = a;
return this;
}

public MagicSetting ageRate(int a){
ageRate = a;
return this;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.ictye.the_origin_of_magic.foundation.Entitys.Magics;
package com.ictye.the_origin_of_magic.foundation.Entitys.Magics.StdMagic;

import com.ictye.the_origin_of_magic.Contents.AllItem;
import com.ictye.the_origin_of_magic.foundation.Entitys.Magics.MagicInterfaces.StdMagic.StdThrownMagic;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.item.ItemStack;
Expand All @@ -14,16 +15,11 @@
* 爆炸法術
*/
public class ExplosionThrownMagic extends StdThrownMagic {

private float explosionRate;

@Override
protected boolean isWaterSlowDown() {
return true;
}

//////////////////////
//構造器(們?)
public ExplosionThrownMagic(EntityType<? extends StdThrownMagic> entityType, World world) {
super(entityType, world);
this.explosionRate = 1.0F;
Expand All @@ -33,7 +29,6 @@ public ExplosionThrownMagic(EntityType<? extends StdThrownMagic> type, LivingEnt
super(type, owner, world);
this.explosionRate = 1.0F;
}
/////////////////////

@Override
protected void collision(HitResult hitResult) {
Expand All @@ -51,9 +46,9 @@ public void remove(RemovalReason reason) {
Vec3d pos = this.getPos();
if(reason != RemovalReason.KILLED){
if(prdRandom!=null && prdRandom.getBool()){
this.world.createExplosion(this, pos.getX(), pos.getY(), pos.getZ(), 5.0F * explosionRate, Explosion.DestructionType.BREAK);
this.world.createExplosion(this, pos.getX(), pos.getY(), pos.getZ(), 5.0F * getExplosionRate(), Explosion.DestructionType.BREAK);
}else {
this.world.createExplosion(this, pos.getX(), pos.getY(), pos.getZ(), 3.0F * explosionRate, Explosion.DestructionType.BREAK);
this.world.createExplosion(this, pos.getX(), pos.getY(), pos.getZ(), 3.0F * getExplosionRate(), Explosion.DestructionType.BREAK);
}
}
super.remove(reason);
Expand All @@ -68,17 +63,11 @@ public ItemStack getStack() {
public void tick() {
super.tick();
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);
}
}

@Override
public void setAge(int age) {
this.age = age;
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.ictye.the_origin_of_magic.foundation.Entitys.Magics;
package com.ictye.the_origin_of_magic.foundation.Entitys.Magics.StdMagic;

import com.ictye.the_origin_of_magic.Contents.AllParticle;
import com.ictye.the_origin_of_magic.foundation.Entitys.Magics.MagicInterfaces.StdMagic.StdThrownMagic;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.damage.DamageSource;
Expand All @@ -9,7 +10,7 @@
import net.minecraft.util.hit.EntityHitResult;
import net.minecraft.world.World;

public class MagicBullet extends StdThrownMagic{
public class MagicBullet extends StdThrownMagic {
public MagicBullet(EntityType<? extends StdThrownMagic> entityType, World world) {
super(entityType, world);
}
Expand Down
Loading

0 comments on commit 97b81ac

Please sign in to comment.