-
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.
- Улучшен интелект
- Loading branch information
Showing
11 changed files
with
252 additions
and
40 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
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
33 changes: 33 additions & 0 deletions
33
src/main/java/com/reider745/behavior/entities/formats/tags/components/BurnsInDaylight.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,33 @@ | ||
package com.reider745.behavior.entities.formats.tags.components; | ||
|
||
import com.reider745.behavior.entities.ComponentsTag; | ||
import com.reider745.behavior.entities.CustomEntity; | ||
import com.reider745.behavior.entities.EntityContentFactory; | ||
import com.zhekasmirnov.horizon.runtime.logger.Logger; | ||
import org.json.JSONObject; | ||
|
||
public class BurnsInDaylight extends ComponentsTag implements IUpdateEntity { | ||
@Override | ||
public String getNameTag() { | ||
return "minecraft:burns_in_daylight"; | ||
} | ||
|
||
@Override | ||
public void load(EntityContentFactory factory, Object json) { | ||
if(json instanceof JSONObject){ | ||
factory.addUpdate(new BurnsInDaylight()); | ||
}else | ||
Logger.warning("Not support BurnsInDaylight "+json.getClass()); | ||
} | ||
|
||
@Override | ||
public void onUpdate(CustomEntity entity) { | ||
if (entity.level.shouldMobBurn(entity)) { | ||
if (entity.armor == null || entity.armor[0] == null) { | ||
entity.setOnFire(100); | ||
} else if (entity.armor[0].getId() == 0) { | ||
entity.setOnFire(100); | ||
} | ||
} | ||
} | ||
} |
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 |
---|---|---|
|
@@ -4,4 +4,5 @@ | |
|
||
public interface IUpdateEntity { | ||
void onUpdate(CustomEntity entity); | ||
default int getPriority(){return 0;} | ||
} |
21 changes: 21 additions & 0 deletions
21
src/main/java/com/reider745/behavior/entities/formats/tags/components/PushableComponent.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,21 @@ | ||
package com.reider745.behavior.entities.formats.tags.components; | ||
|
||
import com.reider745.behavior.entities.ComponentsTag; | ||
import com.reider745.behavior.entities.EntityContentFactory; | ||
import com.zhekasmirnov.horizon.runtime.logger.Logger; | ||
import org.json.JSONObject; | ||
|
||
public class PushableComponent extends ComponentsTag { | ||
@Override | ||
public String getNameTag() { | ||
return "minecraft:pushable"; | ||
} | ||
|
||
@Override | ||
public void load(EntityContentFactory factory, Object json) { | ||
if(json instanceof JSONObject object){ | ||
factory.isPushable = object.optBoolean("is_pushable", true); | ||
}else | ||
Logger.warning("Not support MovementComponent "+json.getClass()); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
...com/reider745/behavior/entities/formats/tags/components/attack/HurtByTargetComponent.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,22 @@ | ||
package com.reider745.behavior.entities.formats.tags.components.attack; | ||
|
||
import com.reider745.behavior.entities.ComponentsTag; | ||
import com.reider745.behavior.entities.EntityContentFactory; | ||
import com.zhekasmirnov.horizon.runtime.logger.Logger; | ||
import org.json.JSONObject; | ||
|
||
public class HurtByTargetComponent extends ComponentsTag { | ||
@Override | ||
public String getNameTag() { | ||
return "minecraft:behavior.hurt_by_target"; | ||
} | ||
|
||
@Override | ||
public void load(EntityContentFactory factory, Object json) { | ||
if(json instanceof JSONObject){ | ||
//TODO: Not support priority | ||
factory.isHurtByTarget = true; | ||
}else | ||
Logger.warning("Not support FireImmuneComponent "+json.getClass()); | ||
} | ||
} |
Oops, something went wrong.