Merge branch 'master' into replace-universium

This commit is contained in:
Martin Robertz authored and GitHub committed 2026-02-06 19:49:05 +01:00
commit 6c39bc1aad
15 files changed
+180 -87

No files matched your search

@@ -79,6 +79,7 @@ public class Avaritia {
public void endGame(FMLPostInitializationEvent event) {
Compat.compatify();
Gregorizer.balance();
Config.postLoadConfigs();
if (Config.craftingOnly) return;
Mincer.countThoseCalories();
Achievements.achieve();
@@ -1,7 +1,9 @@
package fox.spiteful.avaritia;
import java.io.File;
import java.util.ArrayList;
import net.minecraft.entity.EntityLivingBase;
import net.minecraftforge.common.config.Configuration;
import org.apache.logging.log4j.Level;
@@ -12,8 +14,12 @@ 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 String[] skeletonTypes = { "net.minecraft.entity.monster.EntitySkeleton" };
public static final ArrayList<Class<? extends EntityLivingBase>> skeletons = new ArrayList<>();
public static boolean stepUp = true;
public static boolean thaumic = true;
@@ -81,6 +87,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",
@@ -93,6 +112,13 @@ public class Config {
"Gotta Go Fast",
fast,
"Disable if the Infinity Boots' speed boost is too ridiculous").getBoolean(true);
skeletonTypes = conf
.get(
"general",
"Skeleton Types",
skeletonTypes,
"The list of class names of entities that count as skeletons for the Skullfire Sword.")
.getStringList();
stepUp = conf
.get("general", "Boots step up", stepUp, "Disable if the Infinity Boots' step assist is annoying")
.getBoolean(true);
@@ -159,4 +185,19 @@ public class Config {
}
}
public static void postLoadConfigs() {
skeletons.clear();
for (String className : skeletonTypes) {
try {
Class<?> clazz = Class.forName(className);
skeletons.add(clazz.asSubclass(EntityLivingBase.class));
} catch (ClassNotFoundException | ClassCastException e) {
Lumberjack.logger.warn(
"The \"Skeleton Types\" config contains the class name \"{}\", which does not represent a killable entity.",
className);
}
}
}
}
@@ -10,7 +10,6 @@ import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.monster.EntitySkeleton;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
@@ -104,7 +103,7 @@ public class LudicrousEvents {
&& ToolHelper.hammerdrops.containsKey(event.harvester)
&& ToolHelper.hammerdrops.get(event.harvester) != null) {
ArrayList<ItemStack> garbage = new ArrayList<ItemStack>();
ArrayList<ItemStack> garbage = new ArrayList<>();
for (ItemStack drop : event.drops) {
if (isGarbage(drop)) garbage.add(drop);
}
@@ -127,8 +126,8 @@ public class LudicrousEvents {
public static void extraLuck(HarvestDropsEvent event, int mult) {
if (event.block.getMaterial() == Material.rock) {
List<ItemStack> adds = new ArrayList<ItemStack>();
List<ItemStack> removals = new ArrayList<ItemStack>();
List<ItemStack> adds = new ArrayList<>();
List<ItemStack> removals = new ArrayList<>();
for (ItemStack drop : event.drops) {
if (drop.getItem() != Item.getItemFromBlock(event.block) && !(drop.getItem() instanceof ItemBlock)) {
drop.stackSize = Math.min(drop.stackSize * mult, drop.getMaxStackSize());
@@ -195,8 +194,7 @@ public class LudicrousEvents {
@SubscribeEvent
public void onGetHurt(LivingHurtEvent event) {
if (!(event.entityLiving instanceof EntityPlayer)) return;
EntityPlayer player = (EntityPlayer) event.entityLiving;
if (!(event.entityLiving instanceof EntityPlayer player)) return;
if (player.getHeldItem() != null && player.getHeldItem().getItem() == LudicrousItems.infinity_sword
&& player.isUsingItem())
event.setCanceled(true);
@@ -205,9 +203,8 @@ public class LudicrousEvents {
@SubscribeEvent
public void onAttacked(LivingAttackEvent event) {
if (!(event.entityLiving instanceof EntityPlayer)) return;
if (!(event.entityLiving instanceof EntityPlayer player)) return;
if (event.source.getEntity() != null && event.source.getEntity() instanceof EntityPlayer) return;
EntityPlayer player = (EntityPlayer) event.entityLiving;
if (player.getHeldItem() != null && player.getHeldItem().getItem() == LudicrousItems.infinity_sword
&& player.isUsingItem())
event.setCanceled(true);
@@ -216,9 +213,7 @@ public class LudicrousEvents {
@SubscribeEvent
public void onLivingDrops(LivingDropsEvent event) {
if (event.recentlyHit && event.entityLiving instanceof EntitySkeleton
&& event.source.getEntity() instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) event.source.getEntity();
if (event.recentlyHit && event.source.getEntity() instanceof EntityPlayer player && isSkeleton(event)) {
if (player.getHeldItem() != null && player.getHeldItem().getItem() == LudicrousItems.skull_sword) {
// ok, we need to drop a skull then.
if (event.drops.isEmpty()) {
@@ -229,6 +224,7 @@ public class LudicrousEvents {
for (int i = 0; i < event.drops.size(); i++) {
EntityItem drop = event.drops.get(i);
ItemStack stack = drop.getEntityItem();
if (stack.getItem() == Items.skull) {
if (stack.getItemDamage() == 1) {
skulls++;
@@ -248,6 +244,10 @@ public class LudicrousEvents {
}
}
private static boolean isSkeleton(LivingDropsEvent event) {
return Config.skeletons.contains(event.entityLiving.getClass());
}
@SubscribeEvent
public void diggity(BreakSpeed event) {
if (event.entityPlayer.getHeldItem() != null) {
@@ -259,7 +259,7 @@ public class LudicrousEvents {
event.newSpeed *= 5;
if (held.getTagCompound() != null) {
if (held.getTagCompound().getBoolean("hammer") || held.getTagCompound().getBoolean("destroyer")) {
event.newSpeed *= 0.5;
event.newSpeed *= 0.5f;
}
}
}
@@ -289,8 +289,7 @@ public class LudicrousEvents {
@SubscribeEvent
public void onDeath(LivingDeathEvent event) {
if (event.entityLiving instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) event.entityLiving;
if (event.entityLiving instanceof EntityPlayer player) {
if (LudicrousItems.isInfinite(player) && !event.source.getDamageType().equals("infinity")) {
event.setCanceled(true);
player.setHealth(player.getMaxHealth());
@@ -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);
}
}
@@ -70,7 +70,7 @@ public class ItemMatterCluster extends Item implements ICosmicRenderItem {
tooltip.add(
clustertag.getInteger(MAINCOUNTTAG) + "/"
+ MAX_CAPACITY
+ Math.max(MAX_CAPACITY, clustertag.getInteger(MAINCOUNTTAG))
+ " "
+ StatCollector.translateToLocal("tooltip.matter_cluster.counter"));
tooltip.add("");
@@ -93,6 +93,7 @@ public class ItemMatterCluster extends Item implements ICosmicRenderItem {
}
} else {
tooltip.add(EnumChatFormatting.DARK_GRAY + StatCollector.translateToLocal("tooltip.matter_cluster.desc"));
tooltip.add(EnumChatFormatting.DARK_GRAY + StatCollector.translateToLocal("tooltip.matter_cluster.desc3"));
tooltip.add(
EnumChatFormatting.DARK_GRAY.toString() + EnumChatFormatting.ITALIC
+ StatCollector.translateToLocal("tooltip.matter_cluster.desc2"));
@@ -126,7 +127,7 @@ public class ItemMatterCluster extends Item implements ICosmicRenderItem {
itemlist.remove(0);
}
if (currentTotal == MAX_CAPACITY) {
if (currentTotal >= MAX_CAPACITY) {
ItemStack cluster = makeCluster(currentItems);
clusters.add(cluster);
@@ -155,6 +156,18 @@ public class ItemMatterCluster extends Item implements ICosmicRenderItem {
return cluster;
}
public static ItemStack makeCluster(ItemStack input) {
HashMap<ItemStackWrapper, Integer> map = new HashMap<>();
ItemStack input2 = input.copy();
input2.stackSize = 1;
map.put(new ItemStackWrapper(input2), input.stackSize);
ItemStack cluster = new ItemStack(LudicrousItems.matter_cluster);
setClusterData(cluster, map, input.stackSize);
return cluster;
}
public static Map<ItemStackWrapper, Integer> getClusterData(ItemStack cluster) {
if (!cluster.hasTagCompound() || !cluster.getTagCompound().hasKey(MAINTAG)) {
return new HashMap<>();
@@ -186,7 +199,7 @@ public class ItemMatterCluster extends Item implements ICosmicRenderItem {
}
public static boolean isClusterFull(ItemStack cluster) {
return getClusterSize(cluster) == MAX_CAPACITY;
return getClusterSize(cluster) >= MAX_CAPACITY;
}
public static void setClusterData(ItemStack stack, Map<ItemStackWrapper, Integer> data, int count) {
@@ -212,7 +225,7 @@ public class ItemMatterCluster extends Item implements ICosmicRenderItem {
int donorcount = getClusterSize(donor);
int recipientcount = getClusterSize(recipient);
if (donorcount == 0 || donorcount == MAX_CAPACITY || recipientcount == MAX_CAPACITY) {
if (donorcount == 0 || donorcount >= MAX_CAPACITY || recipientcount >= MAX_CAPACITY) {
return;
}
@@ -255,6 +268,9 @@ public class ItemMatterCluster extends Item implements ICosmicRenderItem {
@Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
// Do nothing for super critical clusters
if (getClusterSize(stack) > MAX_CAPACITY) return stack;
if (!world.isRemote) {
List<ItemStack> drops = ToolHelper.collateMatterClusterContents(ItemMatterCluster.getClusterData(stack));
@@ -275,7 +291,7 @@ public class ItemMatterCluster extends Item implements ICosmicRenderItem {
@Override
public IIcon getMaskTexture(ItemStack stack, EntityPlayer player) {
int count = getClusterSize(stack);
if (count == MAX_CAPACITY) {
if (count >= MAX_CAPACITY) {
return cosmicIconFull;
}
return cosmicIcon;
@@ -284,13 +300,13 @@ public class ItemMatterCluster extends Item implements ICosmicRenderItem {
@Override
public float getMaskMultiplier(ItemStack stack, EntityPlayer player) {
int count = getClusterSize(stack);
return count / (float) MAX_CAPACITY;
return Math.min(1f, count / (float) MAX_CAPACITY);
}
@Override
public IIcon getIcon(ItemStack stack, int pass) {
int count = getClusterSize(stack);
if (count == MAX_CAPACITY) {
if (count >= MAX_CAPACITY) {
return iconFull;
}
return super.getIcon(stack, pass);
@@ -307,6 +323,9 @@ public class ItemMatterCluster extends Item implements ICosmicRenderItem {
if (count == MAX_CAPACITY) {
return super.getUnlocalizedName(stack) + ".full";
}
if (count > MAX_CAPACITY) {
return super.getUnlocalizedName(stack) + ".veryfull";
}
return super.getUnlocalizedName(stack);
}
}
@@ -130,7 +130,14 @@ public class ToolHelper {
ItemStack drop = blk
.getPickBlock(raytraceFromEntity(world, player, true, 10), world, x, y, z, player);
if (drop == null) drop = new ItemStack(blk, 1, meta);
dropItem(drop, world, x, y, z);
List<ItemStack> drops = hammerdrops.get(player);
if (drops != null) {
drops.add(drop);
} else {
dropItem(drop, world, x, y, z);
}
}
blk.harvestBlock(world, player, x, y, z, localMeta);
}