-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(魔法釋放系統和StdMagic及其實體): 修改了魔法相关类和方法,添加了限制器接口和实体效果限制器。
- Loading branch information
1 parent
30de9fe
commit 6e23b9c
Showing
8 changed files
with
21 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
src/main/java/com/ictye/the_origin_of_magic/Contents/AllItem.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 6 additions & 2 deletions
8
.../Magics/Limiters/HoglinEntityLimiter.java → ...Magics/Limiters/HostileEntityLimiter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,19 @@ | ||
package com.ictye.the_origin_of_magic.foundation.Entitys.Magics.Limiters; | ||
|
||
import net.minecraft.entity.mob.HoglinEntity; | ||
import net.minecraft.entity.mob.ZombieEntity; | ||
import net.minecraft.util.hit.BlockHitResult; | ||
import net.minecraft.util.hit.EntityHitResult; | ||
import net.minecraft.util.hit.HitResult; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
public class HoglinEntityLimiter extends StdMagicLimiter { | ||
public class HostileEntityLimiter extends StdMagicLimiter { | ||
@Override | ||
public boolean canEffect(@Nullable EntityHitResult entityHitResult, @Nullable HitResult hitResult, @Nullable BlockHitResult blockHitResult) { | ||
// 判斷是否為亡靈生物 | ||
return super.canEffect(entityHitResult, hitResult, blockHitResult) && entityHitResult.getEntity() != null && entityHitResult.getEntity() instanceof HoglinEntity; | ||
if (entityHitResult != null) { | ||
return entityHitResult.getEntity() instanceof ZombieEntity; | ||
} | ||
return false; | ||
} | ||
} |
3 changes: 2 additions & 1 deletion
3
...ava/com/ictye/the_origin_of_magic/foundation/Entitys/Magics/Limiters/StdMagicLimiter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 7 additions & 3 deletions
10
...ictye/the_origin_of_magic/foundation/Items/Magic/LimiterItem/UndeadEntityLimiterItem.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,21 @@ | ||
package com.ictye.the_origin_of_magic.foundation.Items.Magic.LimiterItem; | ||
|
||
import com.ictye.the_origin_of_magic.foundation.Entitys.Magics.Limiters.HoglinEntityLimiter; | ||
import com.ictye.the_origin_of_magic.foundation.Entitys.Magics.Limiters.HostileEntityLimiter; | ||
import com.ictye.the_origin_of_magic.foundation.Entitys.Magics.Limiters.StdMagicLimiter; | ||
import com.ictye.the_origin_of_magic.foundation.Entitys.Magics.StdMagicInterface; | ||
import com.ictye.the_origin_of_magic.foundation.Entitys.Magics.StdThrownMagic; | ||
import net.minecraft.entity.EntityType; | ||
import net.minecraft.entity.player.PlayerEntity; | ||
import net.minecraft.world.World; | ||
|
||
public class UndeadEntityLimiterItem extends StdLimiterItem{ | ||
public UndeadEntityLimiterItem(Settings settings, EntityType<StdThrownMagic> entityType) { | ||
super(settings, entityType); | ||
} | ||
|
||
|
||
@Override | ||
public StdMagicLimiter getMagic() { | ||
return new HoglinEntityLimiter(); | ||
public StdMagicInterface getMagic(PlayerEntity user, World world, float exolisionRate, int hartRate) { | ||
return new HostileEntityLimiter(); | ||
} | ||
} |