Add Item Burning to Fire Attacks

This commit is contained in:
Kam committed 2025-03-19 17:46:12 -04:00
1 parent cac5a53997
commit 353d90a00a
4 files changed
+21 -7

No files matched your search

+7 -3
View File
@@ -43,7 +43,7 @@ public class DataStats {
public float pDamage = 4;
public int pImpact = 0, pSize = 5, pSpeed = 10, pArea = 0, pDur = 5;
public boolean pPhysics = true, pXlr8 = false, pGlows = false, pExplode = false;
public boolean pRender3D = false, pSpin = false, pStick = false;
public boolean pRender3D = false, pSpin = false, pStick = false, pBurnItem = false;
public EnumPotionType pEffect = EnumPotionType.None;
public EnumParticleType pTrail = EnumParticleType.None;
public ScriptParticle pCustom = new ScriptParticle("");
@@ -114,6 +114,8 @@ public class DataStats {
compound.setBoolean("ProjectilesKeepTerrain", projectilesKeepTerrain);
if(pTrail == EnumParticleType.Custom)
compound.setTag("pCustom", pCustom.writeToNBT());
if(pEffect == EnumPotionType.Fire)
compound.setBoolean("pBurnItem", pBurnItem);
compound.setBoolean("ImmuneToFire", immuneToFire);
compound.setBoolean("PotionImmune", potionImmune);
@@ -178,9 +180,11 @@ public class DataStats {
fireSound = compound.getString("FiringSound");
aimType = compound.getByte("AimType");
projectilesKeepTerrain = compound.getBoolean("ProjectilesKeepTerrain");
if(pTrail == EnumParticleType.Custom){
if(pTrail == EnumParticleType.Custom)
pCustom = ScriptParticle.fromNBT(compound.getCompoundTag("pCustom"));
}
if(pEffect == EnumPotionType.Fire)
pBurnItem = compound.getBoolean("pBurnItem");
immuneToFire = compound.getBoolean("ImmuneToFire");
potionImmune = compound.getBoolean("PotionImmune");
drowningType = compound.getInteger("DrowningType");
@@ -74,13 +74,17 @@ public class SubGuiNpcProjectiles extends SubGuiInterface implements ITextfieldL
if (stats.pEffect != EnumPotionType.None) {
int internalY = y + 30;
addLabel(new GuiNpcLabel(50, "gui.time", guiLeft + 210, internalY + 5));
addTextField(new GuiNpcTextField(5, this, fontRendererObj, guiLeft + 280, internalY, 40, 20, stats.potionDuration + ""));
addTextField(new GuiNpcTextField(5, this, fontRendererObj, guiLeft + 330, internalY, 52, 20, stats.potionDuration + ""));
getTextField(5).integersOnly = true;
getTextField(5).setMinMaxDefault(1, Integer.MAX_VALUE, 5);
if (stats.potionType != EnumPotionType.Fire) {
if (stats.pEffect != EnumPotionType.Fire) {
internalY += 30;
addLabel(new GuiNpcLabel(70, "stats.amplify", guiLeft + 210, internalY + 5));
addButton(new GuiButtonBiDirectional(10, guiLeft + 280, internalY, 52, 20, new String[]{"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10"}, stats.pEffAmp));
} else {
internalY += 30;
addLabel(new GuiNpcLabel(100, "stats.burnItem", guiLeft + 210, internalY + 5));
addButton(new GuiNpcButtonYesNo(100, guiLeft + 330, internalY, 52, 20, stats.pBurnItem));
}
}
@@ -161,6 +165,10 @@ public class SubGuiNpcProjectiles extends SubGuiInterface implements ITextfieldL
if (button.id == 10) {
stats.pEffAmp = button.getValue();
}
if (button.id == 100) {
stats.pBurnItem = (button.getValue() == 1);
initGui();
}
if (button.id == 66) {
close();
}
@@ -90,6 +90,7 @@ public class EntityProjectile extends EntityThrowable {
public boolean destroyTerrain = true;
public int explosiveRadius = 0;
public EnumPotionType effect = EnumPotionType.None;
public boolean burnItem = true;
public int duration = 5;
public int amplify = 0;
public int accuracy = 60;
@@ -235,10 +236,9 @@ public class EntityProjectile extends EntityThrowable {
this.rotationPitch -= 20;
}
}
if (this.effect == EnumPotionType.Fire && !this.inGround)
if (this.effect == EnumPotionType.Fire && !this.inGround && this.burnItem)
this.setFire(1);
Block block = this.worldObj.getBlock(this.xTile, this.yTile, this.zTile);
if ((this.isArrow() || this.sticksToWalls()) && block != null) {
@@ -801,6 +801,7 @@ public class EntityProjectile extends EntityThrowable {
this.explosive = stats.pExplode;
this.explosiveRadius = stats.pArea;
this.effect = stats.pEffect;
this.burnItem = stats.pBurnItem;
this.duration = stats.pDur;
this.amplify = stats.pEffAmp;
this.setParticleEffect(stats.pTrail);