-
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.
feat(entitys and limiter and magics): 增加限制器功能
我們希望能有限制攻擊的東西 Closes 沒有經過驗證,不一定好使 [skip ci]
- Loading branch information
1 parent
a3ec711
commit 30de9fe
Showing
14 changed files
with
98 additions
and
42 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
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
15 changes: 15 additions & 0 deletions
15
...com/ictye/the_origin_of_magic/foundation/Entitys/Magics/Limiters/HoglinEntityLimiter.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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.ictye.the_origin_of_magic.foundation.Entitys.Magics.Limiters; | ||
|
||
import net.minecraft.entity.mob.HoglinEntity; | ||
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 { | ||
@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; | ||
} | ||
} |
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
4 changes: 4 additions & 0 deletions
4
src/main/java/com/ictye/the_origin_of_magic/foundation/Entitys/Magics/StdMagicInterface.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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package com.ictye.the_origin_of_magic.foundation.Entitys.Magics; | ||
|
||
public interface StdMagicInterface { | ||
} |
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
11 changes: 7 additions & 4 deletions
11
...java/com/ictye/the_origin_of_magic/foundation/Items/Magic/LimiterItem/StdLimiterItem.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,18 +1,21 @@ | ||
package com.ictye.the_origin_of_magic.foundation.Items.Magic.LimiterItem; | ||
|
||
import com.ictye.the_origin_of_magic.foundation.Entitys.Magics.StdMagic; | ||
import com.ictye.the_origin_of_magic.foundation.Entitys.Magics.Limiters.StdMagicLimiter; | ||
import com.ictye.the_origin_of_magic.foundation.Entitys.Magics.StdThrownMagic; | ||
import com.ictye.the_origin_of_magic.foundation.Items.Magic.StdMagicItem; | ||
import net.minecraft.entity.EntityType; | ||
import net.minecraft.entity.player.PlayerEntity; | ||
import net.minecraft.world.World; | ||
|
||
public class StdLimiterItem extends StdMagicItem { | ||
public StdLimiterItem(Settings settings, EntityType<StdMagic> entityType) { | ||
public abstract class StdLimiterItem extends StdMagicItem { | ||
public StdLimiterItem(Settings settings, EntityType<StdThrownMagic> entityType) { | ||
super(settings, entityType); | ||
} | ||
|
||
@Override | ||
public StdMagic getMagic(PlayerEntity user, World world, float exolisionRate, int hartRate) { | ||
public StdThrownMagic getMagic(PlayerEntity user, World world, float exolisionRate, int hartRate) { | ||
return null; | ||
} | ||
|
||
public abstract StdMagicLimiter getMagic(); | ||
} |
17 changes: 17 additions & 0 deletions
17
...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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
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.StdMagicLimiter; | ||
import com.ictye.the_origin_of_magic.foundation.Entitys.Magics.StdThrownMagic; | ||
import net.minecraft.entity.EntityType; | ||
|
||
public class UndeadEntityLimiterItem extends StdLimiterItem{ | ||
public UndeadEntityLimiterItem(Settings settings, EntityType<StdThrownMagic> entityType) { | ||
super(settings, entityType); | ||
} | ||
|
||
@Override | ||
public StdMagicLimiter getMagic() { | ||
return new HoglinEntityLimiter(); | ||
} | ||
} |
9 changes: 5 additions & 4 deletions
9
src/main/java/com/ictye/the_origin_of_magic/foundation/Items/Magic/StdMagicItem.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,18 +1,19 @@ | ||
package com.ictye.the_origin_of_magic.foundation.Items.Magic; | ||
|
||
import com.ictye.the_origin_of_magic.foundation.Entitys.Magics.StdMagic; | ||
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.item.Item; | ||
import net.minecraft.world.World; | ||
|
||
public abstract class StdMagicItem extends Item { | ||
|
||
private final EntityType<StdMagic> magicEntityType; | ||
public StdMagicItem(Settings settings, EntityType<StdMagic> entityType) { | ||
private final EntityType<StdThrownMagic> magicEntityType; | ||
public StdMagicItem(Settings settings, EntityType<StdThrownMagic> entityType) { | ||
super(settings); | ||
this.magicEntityType = entityType; | ||
} | ||
|
||
abstract public StdMagic getMagic(PlayerEntity user, World world,float exolisionRate,int hartRate); | ||
abstract public StdMagicInterface getMagic(PlayerEntity user, World world, float exolisionRate, int hartRate); | ||
} |
12 changes: 6 additions & 6 deletions
12
src/main/java/com/ictye/the_origin_of_magic/foundation/Items/Magic/TestMagicEntityItem.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,21 +1,21 @@ | ||
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.StdMagic; | ||
import com.ictye.the_origin_of_magic.foundation.Entitys.Magics.TestMagic; | ||
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; | ||
|
||
public class TestMagicEntityItem extends StdMagicItem { | ||
|
||
private final EntityType<StdMagic> magicEntityType = AllEntity.TEST_MAGIC_ENTITY_TYPE; | ||
public TestMagicEntityItem(Settings settings, EntityType<StdMagic> entityType) { | ||
private final EntityType<StdThrownMagic> magicEntityType = AllEntity.TEST_MAGIC_ENTITY_TYPE; | ||
public TestMagicEntityItem(Settings settings, EntityType<StdThrownMagic> entityType) { | ||
super(settings, entityType); | ||
} | ||
|
||
@Override | ||
public StdMagic getMagic(PlayerEntity user, World world,float exolisionRate,int hartRate) { | ||
return new TestMagic(magicEntityType,user,world,exolisionRate); | ||
public StdThrownMagic getMagic(PlayerEntity user, World world, float exolisionRate, int hartRate) { | ||
return new TestThrownMagic(magicEntityType,user,world,exolisionRate); | ||
} | ||
} |
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
6 changes: 6 additions & 0 deletions
6
src/main/resources/assets/the_origin_of_magic/models/item/hoglin_entity_limiter.json
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"parent": "item/generated", | ||
"textures": { | ||
"layer0": "the_origin_of_magic:item/hoglin_entity_limiter" | ||
} | ||
} |
Binary file added
BIN
+191 Bytes
...in/resources/assets/the_origin_of_magic/textures/item/hoglin_entity_limiter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.