Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add IEntityArrow and IEntityThrowable
- Loading branch information
1 parent
e010885
commit 4659794
Showing
14 changed files
with
258 additions
and
15 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
58 changes: 58 additions & 0 deletions
58
CraftTweaker2-API/src/main/java/crafttweaker/api/entity/IEntityArrow.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,58 @@ | ||
package crafttweaker.api.entity; | ||
|
||
import crafttweaker.annotations.ZenRegister; | ||
import stanhebben.zenscript.annotations.*; | ||
|
||
@ZenClass("crafttweaker.entity.IEntityArrow") | ||
@ZenRegister | ||
public interface IEntityArrow extends IEntity { | ||
|
||
@ZenMethod | ||
@ZenSetter("damage") | ||
IEntityArrow setDamage(double damage); | ||
|
||
@ZenMethod | ||
@ZenGetter("damage") | ||
double getDamage(); | ||
|
||
@ZenMethod | ||
@ZenSetter("critical") | ||
IEntityArrow setIsCritical(boolean critical); | ||
|
||
@ZenMethod | ||
@ZenGetter("critical") | ||
boolean getIsCritical(); | ||
|
||
@ZenMethod | ||
@ZenSetter("knockbackStrength") | ||
IEntityArrow setKnockbackStrength(int knockbackStrength); | ||
|
||
@ZenMethod | ||
@ZenGetter("shake") | ||
int arrowShake(); | ||
|
||
@ZenMethod | ||
@ZenSetter("shooter") | ||
IEntityArrow setShooter(IEntity shooter); | ||
|
||
@ZenMethod | ||
@ZenGetter("shooter") | ||
IEntity getShooter(); | ||
|
||
@ZenMethod | ||
@ZenGetter("pickupStatus") | ||
String getPickupStatus(); | ||
|
||
@ZenMethod | ||
@ZenSetter("pickupStatus") | ||
IEntityArrow setPickupStatus(String pickupStatus); | ||
|
||
@ZenMethod | ||
IEntityArrow setPickupDisallowed(); | ||
|
||
@ZenMethod | ||
IEntityArrow setPickupAllowed(); | ||
|
||
@ZenMethod | ||
IEntityArrow setPickupCreativeOnly(); | ||
} |
16 changes: 16 additions & 0 deletions
16
CraftTweaker2-API/src/main/java/crafttweaker/api/entity/IEntityThrowable.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,16 @@ | ||
package crafttweaker.api.entity; | ||
|
||
import crafttweaker.annotations.ZenRegister; | ||
import stanhebben.zenscript.annotations.*; | ||
|
||
@ZenClass("crafttweaker.entity.IEntityThrowable") | ||
@ZenRegister | ||
public interface IEntityThrowable extends IEntity { | ||
|
||
@ZenGetter("thrower") | ||
IEntityLivingBase getThrower(); | ||
|
||
@ZenMethod | ||
@ZenGetter("shake") | ||
int throwableShake(); | ||
} |
12 changes: 12 additions & 0 deletions
12
CraftTweaker2-API/src/main/java/crafttweaker/api/entity/IProjectile.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,12 @@ | ||
package crafttweaker.api.entity; | ||
|
||
import crafttweaker.annotations.ZenRegister; | ||
import stanhebben.zenscript.annotations.*; | ||
|
||
@ZenClass("crafttweaker.entity.IProjectile") | ||
@ZenRegister | ||
public interface IProjectile { | ||
|
||
@ZenMethod | ||
void shoot(double x, double y, double z, float velocity, float inaccuracy); | ||
} |
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: 2 additions & 2 deletions
4
CraftTweaker2-API/src/main/java/crafttweaker/api/event/ProjectileImpactThrowableEvent.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
98 changes: 98 additions & 0 deletions
98
CraftTweaker2-MC1120-Main/src/main/java/crafttweaker/mc1120/entity/MCEntityArrow.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,98 @@ | ||
package crafttweaker.mc1120.entity; | ||
|
||
import javax.annotation.Nullable; | ||
|
||
import crafttweaker.api.entity.IEntity; | ||
import crafttweaker.api.entity.IEntityArrow; | ||
import crafttweaker.api.entity.IProjectile; | ||
import crafttweaker.api.minecraft.CraftTweakerMC; | ||
import net.minecraft.entity.projectile.EntityArrow; | ||
import net.minecraft.entity.projectile.EntityArrow.PickupStatus; | ||
|
||
public class MCEntityArrow extends MCEntity implements IEntityArrow, IProjectile { | ||
private final EntityArrow entityArrow; | ||
|
||
public MCEntityArrow(EntityArrow entityArrow) { | ||
super(entityArrow); | ||
this.entityArrow = entityArrow; | ||
} | ||
|
||
@Override | ||
public void shoot(double x, double y, double z, float velocity, float inaccuracy) { | ||
entityArrow.shoot(x, y, z, velocity, inaccuracy); | ||
} | ||
|
||
@Override | ||
public IEntityArrow setDamage(double damage) { | ||
entityArrow.setDamage(damage); | ||
return (IEntityArrow) entityArrow; | ||
} | ||
|
||
@Override | ||
public double getDamage() { | ||
return entityArrow.getDamage(); | ||
} | ||
|
||
@Override | ||
public IEntityArrow setIsCritical(boolean critical) { | ||
entityArrow.setIsCritical(critical); | ||
return (IEntityArrow) entityArrow; | ||
} | ||
|
||
@Override | ||
public boolean getIsCritical() { | ||
return entityArrow.getIsCritical(); | ||
} | ||
|
||
@Override | ||
public IEntityArrow setKnockbackStrength(int knockbackStrength) { | ||
entityArrow.setKnockbackStrength(knockbackStrength); | ||
return (IEntityArrow) entityArrow; | ||
} | ||
|
||
@Override | ||
public int arrowShake() { | ||
return entityArrow.arrowShake; | ||
} | ||
|
||
@Override | ||
@Nullable | ||
public IEntity getShooter() { | ||
return CraftTweakerMC.getIEntity(entityArrow.shootingEntity); | ||
} | ||
|
||
@Override | ||
public IEntityArrow setShooter(IEntity shooter) { | ||
entityArrow.shootingEntity = CraftTweakerMC.getEntity(shooter); | ||
return (IEntityArrow) entityArrow; | ||
} | ||
|
||
@Override | ||
public String getPickupStatus() { | ||
return String.valueOf(entityArrow.pickupStatus); | ||
} | ||
|
||
@Override | ||
public IEntityArrow setPickupStatus(String pickupStatus) { | ||
PickupStatus.valueOf(pickupStatus); | ||
return (IEntityArrow) entityArrow; | ||
} | ||
|
||
@Override | ||
public IEntityArrow setPickupDisallowed() { | ||
entityArrow.pickupStatus = EntityArrow.PickupStatus.DISALLOWED; | ||
return (IEntityArrow) entityArrow; | ||
} | ||
|
||
@Override | ||
public IEntityArrow setPickupAllowed() { | ||
entityArrow.pickupStatus = EntityArrow.PickupStatus.ALLOWED; | ||
return (IEntityArrow) entityArrow; | ||
} | ||
|
||
@Override | ||
public IEntityArrow setPickupCreativeOnly() { | ||
entityArrow.pickupStatus = EntityArrow.PickupStatus.CREATIVE_ONLY; | ||
return (IEntityArrow) entityArrow; | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
CraftTweaker2-MC1120-Main/src/main/java/crafttweaker/mc1120/entity/MCEntityThrowable.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,34 @@ | ||
package crafttweaker.mc1120.entity; | ||
|
||
import javax.annotation.Nullable; | ||
|
||
import crafttweaker.api.entity.IEntityLivingBase; | ||
import crafttweaker.api.entity.IEntityThrowable; | ||
import crafttweaker.api.entity.IProjectile; | ||
import crafttweaker.api.minecraft.CraftTweakerMC; | ||
import net.minecraft.entity.projectile.EntityThrowable; | ||
|
||
public class MCEntityThrowable extends MCEntity implements IEntityThrowable, IProjectile { | ||
private final EntityThrowable entityThrowable; | ||
|
||
public MCEntityThrowable(EntityThrowable entityThrowable) { | ||
super(entityThrowable); | ||
this.entityThrowable = entityThrowable; | ||
} | ||
|
||
@Override | ||
public void shoot(double x, double y, double z, float velocity, float inaccuracy) { | ||
entityThrowable.shoot(x, y, z, velocity, inaccuracy); | ||
} | ||
|
||
@Override | ||
@Nullable | ||
public IEntityLivingBase getThrower() { | ||
return CraftTweakerMC.getIEntityLivingBase(entityThrowable.getThrower()); | ||
} | ||
|
||
@Override | ||
public int throwableShake() { | ||
return entityThrowable.throwableShake; | ||
} | ||
} |
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