diff --git a/gradle/gradle-daemon-jvm.properties b/gradle/gradle-daemon-jvm.properties index b30b550..5b9a1a3 100644 --- a/gradle/gradle-daemon-jvm.properties +++ b/gradle/gradle-daemon-jvm.properties @@ -1,12 +1,12 @@ #This file is generated by updateDaemonJvm -toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/df211d3c3eefdc408b462041881bc575/redirect +toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/fd88a209e0f18ca6eaf97d9fa9e45e01/redirect toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/b41931cf1e70bc8e08d7dd19c343ef00/redirect -toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/df211d3c3eefdc408b462041881bc575/redirect +toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/fd88a209e0f18ca6eaf97d9fa9e45e01/redirect toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/b41931cf1e70bc8e08d7dd19c343ef00/redirect -toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/46949723aaa20c7b64d7ecfed7207034/redirect -toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/d6690dfd71c4c91e08577437b5b2beb0/redirect -toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/df211d3c3eefdc408b462041881bc575/redirect -toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/b41931cf1e70bc8e08d7dd19c343ef00/redirect -toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/3cd7045fca9a72cd9bc7d14a385e594c/redirect +toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/7799fb2cb9f9eb382df2b8b6fb793b77/redirect +toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/99a42fd36e2e41c7c8ed49f423f49fdf/redirect +toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/fd88a209e0f18ca6eaf97d9fa9e45e01/redirect +toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/93aeea858331bd6bb00ba94759830234/redirect +toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/3087f28f30be41ab6818c16a488f5f8a/redirect toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/552c7bffe0370c66410a51c55985b511/redirect toolchainVersion=25 diff --git a/settings.gradle b/settings.gradle index a766eee..32896c7 100644 --- a/settings.gradle +++ b/settings.gradle @@ -17,7 +17,7 @@ pluginManagement { } plugins { - id 'com.gtnewhorizons.gtnhsettingsconvention' version '2.0.13' + id 'com.gtnewhorizons.gtnhsettingsconvention' version '2.0.18' } diff --git a/src/main/java/fox/spiteful/avaritia/Avaritia.java b/src/main/java/fox/spiteful/avaritia/Avaritia.java index 749fc93..e8f912a 100644 --- a/src/main/java/fox/spiteful/avaritia/Avaritia.java +++ b/src/main/java/fox/spiteful/avaritia/Avaritia.java @@ -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(); diff --git a/src/main/java/fox/spiteful/avaritia/Config.java b/src/main/java/fox/spiteful/avaritia/Config.java index 490fbcb..baf4bec 100644 --- a/src/main/java/fox/spiteful/avaritia/Config.java +++ b/src/main/java/fox/spiteful/avaritia/Config.java @@ -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> 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); + } + } + } } diff --git a/src/main/java/fox/spiteful/avaritia/LudicrousEvents.java b/src/main/java/fox/spiteful/avaritia/LudicrousEvents.java index 6734b4c..9d1577d 100644 --- a/src/main/java/fox/spiteful/avaritia/LudicrousEvents.java +++ b/src/main/java/fox/spiteful/avaritia/LudicrousEvents.java @@ -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 garbage = new ArrayList(); + ArrayList 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 adds = new ArrayList(); - List removals = new ArrayList(); + List adds = new ArrayList<>(); + List 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()); diff --git a/src/main/java/fox/spiteful/avaritia/compat/botania/PageLudicrousRecipe.java b/src/main/java/fox/spiteful/avaritia/compat/botania/PageLudicrousRecipe.java index 0a11b40..d8b6bf4 100644 --- a/src/main/java/fox/spiteful/avaritia/compat/botania/PageLudicrousRecipe.java +++ b/src/main/java/fox/spiteful/avaritia/compat/botania/PageLudicrousRecipe.java @@ -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++) { diff --git a/src/main/java/fox/spiteful/avaritia/entity/EntityGapingVoid.java b/src/main/java/fox/spiteful/avaritia/entity/EntityGapingVoid.java index f49cdaf..3bd4b5e 100644 --- a/src/main/java/fox/spiteful/avaritia/entity/EntityGapingVoid.java +++ b/src/main/java/fox/spiteful/avaritia/entity/EntityGapingVoid.java @@ -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 sucked = this.worldObj.selectEntitiesWithinAABB(Entity.class, suckzone, sucklector); + List 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 nommed = this.worldObj - .selectEntitiesWithinAABB(EntityLivingBase.class, nomzone, nomlector); + + List 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); } }