Safer Endest Pearls (#71)

This commit is contained in:
Nikolay S. authored and GitHub committed 2026-01-27 10:56:09 -05:00
1 parent 3c098fe87b
commit c980b36e91
10 files changed
+104 -66

No files matched your search

@@ -12,6 +12,8 @@ public class Config {
public static boolean endStone = true;
public static boolean bedrockBreaker = true;
public static boolean boringFood = false;
public static boolean endestGriefing = true;
public static boolean endestTileGriefing = true;
public static boolean fractured = false;
public static boolean fast = true;
public static boolean stepUp = true;
@@ -81,6 +83,19 @@ public class Config {
boringFood,
"Enable to keep the Ultimate Stew and Cosmic Meatballs from grabbing more ingredients")
.getBoolean(false);
endestGriefing = conf
.get(
"general",
"Endest Pearl Griefing",
endestGriefing,
"When enabled, the endest pearl will destroy blocks around the location it hits.")
.getBoolean();
endestTileGriefing = conf.get(
"general",
"Endest Pearl Tile-Entity Griefing",
endestTileGriefing,
"When disabled, the Endest Pearl will never break any tile entities, no matter their blast resistance.")
.getBoolean();
fractured = conf
.get(
"general",
@@ -158,5 +173,4 @@ public class Config {
conf.save();
}
}
}
@@ -1,7 +1,7 @@
package fox.spiteful.avaritia.compat.botania;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
@@ -67,8 +67,10 @@ public class PageLudicrousRecipe extends PageRecipe {
if (shapelessRecipe) {
((GuiScreen) gui).drawTexturedModalRect(iconX, iconY, 240, 0, 16, 16);
if (mx >= iconX && my >= iconY && mx < iconX + 16 && my < iconY + 16) RenderHelper
.renderTooltip(mx, my, Arrays.asList(StatCollector.translateToLocal("botaniamisc.shapeless")));
if (mx >= iconX && my >= iconY && mx < iconX + 16 && my < iconY + 16) RenderHelper.renderTooltip(
mx,
my,
Collections.singletonList(StatCollector.translateToLocal("botaniamisc.shapeless")));
iconY += 20;
}
@@ -79,8 +81,10 @@ public class PageLudicrousRecipe extends PageRecipe {
if (oreDictRecipe) {
((GuiScreen) gui).drawTexturedModalRect(iconX, iconY, 240, 16, 16, 16);
if (mx >= iconX && my >= iconY && mx < iconX + 16 && my < iconY + 16) RenderHelper
.renderTooltip(mx, my, Arrays.asList(StatCollector.translateToLocal("botaniamisc.oredict")));
if (mx >= iconX && my >= iconY && mx < iconX + 16 && my < iconY + 16) RenderHelper.renderTooltip(
mx,
my,
Collections.singletonList(StatCollector.translateToLocal("botaniamisc.oredict")));
}
GL11.glDisable(GL11.GL_BLEND);
}
@@ -94,8 +98,7 @@ public class PageLudicrousRecipe extends PageRecipe {
}
public void renderCraftingRecipe(IGuiLexiconEntry gui, IRecipe recipe) {
if (recipe instanceof ExtremeShapedRecipe) {
ExtremeShapedRecipe shaped = (ExtremeShapedRecipe) recipe;
if (recipe instanceof ExtremeShapedRecipe shaped) {
for (int y = 0; y < shaped.recipeHeight; y++) for (int x = 0; x < shaped.recipeWidth; x++)
renderItemAtLudicrousGridPos(gui, x, y, shaped.recipeItems[y * shaped.recipeWidth + x], true);
@@ -103,8 +106,7 @@ public class PageLudicrousRecipe extends PageRecipe {
oreDictRecipe = true;
} else if (recipe instanceof ExtremeShapelessRecipe) {
shapelessRecipe = true;
} else if (recipe instanceof ShapelessOreRecipe) {
ShapelessOreRecipe shapeless = (ShapelessOreRecipe) recipe;
} else if (recipe instanceof ShapelessOreRecipe shapeless) {
drawGrid: {
for (int y = 0; y < 3; y++) for (int x = 0; x < 3; x++) {
@@ -3,7 +3,6 @@ package fox.spiteful.avaritia.entity;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.command.IEntitySelector;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
@@ -11,52 +10,17 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.DamageSource;
import net.minecraft.util.Vec3;
import net.minecraft.world.Explosion;
import net.minecraft.world.World;
import fox.spiteful.avaritia.Config;
public class EntityGapingVoid extends Entity {
public static final int maxLifetime = 186;
public static double collapse = .95;
public static double suckrange = 20.0;
public static final IEntitySelector sucklector = new IEntitySelector() {
@Override
public boolean isEntityApplicable(Entity ent) {
if (ent instanceof EntityPlayer) {
EntityPlayer p = (EntityPlayer) ent;
if (p.capabilities.isCreativeMode && p.capabilities.isFlying) {
return false;
}
}
return true;
}
};
public static final IEntitySelector nomlector = new IEntitySelector() {
@Override
public boolean isEntityApplicable(Entity ent) {
if (!(ent instanceof EntityLivingBase)) {
return false;
}
if (ent instanceof EntityPlayer) {
EntityPlayer p = (EntityPlayer) ent;
if (p.capabilities.isCreativeMode) {
return false;
}
} else if (ent instanceof EntityImmortalItem) {
return false;
}
return true;
}
};
public EntityGapingVoid(World world) {
super(world);
this.isImmuneToFire = true;
@@ -120,7 +84,10 @@ public class EntityGapingVoid extends Entity {
this.posX + suckrange,
this.posY + suckrange,
this.posZ + suckrange);
List<Entity> sucked = this.worldObj.selectEntitiesWithinAABB(Entity.class, suckzone, sucklector);
List<Entity> sucked = this.worldObj.selectEntitiesWithinAABB(
Entity.class,
suckzone,
ent -> !(ent instanceof EntityPlayer p && p.capabilities.isCreativeMode && p.capabilities.isFlying));
double radius = getVoidScale(age) * 0.5;
@@ -145,6 +112,8 @@ public class EntityGapingVoid extends Entity {
}
}
if (this.worldObj.isRemote) return;
// om nom nom
double nomrange = radius * 0.95;
AxisAlignedBB nomzone = AxisAlignedBB.getBoundingBox(
@@ -154,8 +123,18 @@ public class EntityGapingVoid extends Entity {
this.posX + nomrange,
this.posY + nomrange,
this.posZ + nomrange);
List<EntityLivingBase> nommed = this.worldObj
.selectEntitiesWithinAABB(EntityLivingBase.class, nomzone, nomlector);
List<EntityLivingBase> nommed = this.worldObj.selectEntitiesWithinAABB(EntityLivingBase.class, nomzone, ent -> {
if (!(ent instanceof EntityLivingBase)) {
return false;
}
if (ent instanceof EntityPlayer p) {
return !p.capabilities.isCreativeMode;
}
return true;
});
for (EntityLivingBase nommee : nommed) {
double dx = this.posX - nommee.posX;
@@ -171,7 +150,7 @@ public class EntityGapingVoid extends Entity {
}
// every half second, SMASH STUFF
if (age % 10 == 0) {
if (Config.endestGriefing && age % 10 == 0) {
int bx = (int) Math.floor(this.posX);
int by = (int) Math.floor(this.posY);
int bz = (int) Math.floor(this.posZ);
@@ -194,6 +173,11 @@ public class EntityGapingVoid extends Entity {
if (dist <= nomrange && !this.worldObj.isAirBlock(lx, ly, lz)) {
Block b = this.worldObj.getBlock(lx, ly, lz);
int meta = this.worldObj.getBlockMetadata(lx, ly, lz);
if (!Config.endestTileGriefing && this.worldObj.getTileEntity(lx, ly, lz) != null) {
continue;
}
float resist = b.getExplosionResistance(
this,
this.worldObj,
@@ -203,6 +187,7 @@ public class EntityGapingVoid extends Entity {
this.posX,
this.posY,
this.posZ);
if (resist <= 10.0) {
b.dropBlockAsItemWithChance(worldObj, lx, ly, lz, meta, 0.9f, 0);
this.worldObj.setBlockToAir(lx, ly, lz);
@@ -255,7 +240,9 @@ public class EntityGapingVoid extends Entity {
}
@Override
public boolean canBeCollidedWith() {
return false;
public boolean func_145774_a(Explosion explosionIn, World worldIn, int x, int y, int z, Block blockIn,
float unused) {
// Can the final explosion break this block?
return Config.endestGriefing && (Config.endestTileGriefing || worldIn.getTileEntity(x, y, z) == null);
}
}