diff --git a/gradle.properties b/gradle.properties index 1e277e9..92062e9 100644 --- a/gradle.properties +++ b/gradle.properties @@ -39,9 +39,33 @@ remoteMappings = https\://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/co # `./gradlew runClient --username=AnotherPlayer`, or configuring this command in your IDE. developmentEnvironmentUserName = Developer -# Enables using modern Java syntax (up to version 17) via Jabel, while still targeting JVM 8. -# See https://github.com/bsideup/jabel for details on how this works. -enableModernJavaSyntax = true +# Enables modern Java syntax support. Valid values: +# - false: No modern syntax, Java 8 only +# - jabel: Jabel syntax-only support, compiles to J8 bytecode +# - jvmDowngrader: Full modern Java via JVM Downgrader (syntax + stdlib APIs) +# - modern: Native modern Java bytecode, no downgrading +enableModernJavaSyntax = jabel + +# If set, ignores the above setting and compiles with the given toolchain. This may cause unexpected issues, +# and should *not* be used in most situations. -1 disables this. +# forceToolchainVersion = -1 + +# Target JVM version for JVM Downgrader bytecode downgrading. +# Only used when enableModernJavaSyntax = jvmDowngrader +# downgradeTargetVersion = 8 + +# Comma-separated list of Java versions for multi-release jar support (JVM Downgrader only). +# Classes will be available in META-INF/versions/N/ for each version N in this list. +# Default: "21,25" (J25+ gets native classes, J21-24 gets partial downgrade, J8-20 gets full downgrade). +# jvmDowngraderMultiReleaseVersions = 21,25 + +# Specifies how JVM Downgrader API stubs are provided. Options: +# - shade: Shade minimized stubs into the jar +# - gtnhlib: GTNHLib provides stubs at runtime (adds version constraint) +# - external: Another dependency provides stubs (no constraint, no warning) +# - (empty): Warning reminding you to configure stubs +# Note: 'shade' option requires you to verify license compliance, see: https://github.com/unimined/JvmDowngrader/blob/main/LICENSE.md +# jvmDowngraderStubsProvider = # Enables injecting missing generics into the decompiled source code for a better coding experience. # Turns most publicly visible List, Map, etc. into proper List, Map types. @@ -209,3 +233,6 @@ curseForgeRelations = # This is meant to be set in $HOME/.gradle/gradle.properties. # ideaCheckSpotlessOnBuild = true +# Non-GTNH properties +org.gradle.configuration-cache = true +org.gradle.parallel = true diff --git a/gradle/gradle-daemon-jvm.properties b/gradle/gradle-daemon-jvm.properties new file mode 100644 index 0000000..5b9a1a3 --- /dev/null +++ b/gradle/gradle-daemon-jvm.properties @@ -0,0 +1,12 @@ +#This file is generated by updateDaemonJvm +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/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/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/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 1b33c55..f8e1ee3 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index d4081da..23449a2 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index 23d15a9..adff685 100755 --- a/gradlew +++ b/gradlew @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright © 2015-2021 the original authors. +# Copyright © 2015 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -114,7 +114,6 @@ case "$( uname )" in #( NONSTOP* ) nonstop=true ;; esac -CLASSPATH="\\\"\\\"" # Determine the Java command to use to start the JVM. @@ -172,7 +171,6 @@ fi # For Cygwin or MSYS, switch paths to Windows format before running java if "$cygwin" || "$msys" ; then APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) - CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) JAVACMD=$( cygpath --unix "$JAVACMD" ) @@ -212,7 +210,6 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ - -classpath "$CLASSPATH" \ -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ "$@" diff --git a/gradlew.bat b/gradlew.bat index db3a6ac..c4bdd3a 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -70,11 +70,10 @@ goto fail :execute @rem Setup the command line -set CLASSPATH= @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* :end @rem End local scope for the variables with windows NT shell diff --git a/settings.gradle b/settings.gradle index e883289..32896c7 100644 --- a/settings.gradle +++ b/settings.gradle @@ -17,7 +17,7 @@ pluginManagement { } plugins { - id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.48' + 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); } } diff --git a/src/main/java/fox/spiteful/avaritia/items/ItemMatterCluster.java b/src/main/java/fox/spiteful/avaritia/items/ItemMatterCluster.java index ac280fb..2d95e3d 100644 --- a/src/main/java/fox/spiteful/avaritia/items/ItemMatterCluster.java +++ b/src/main/java/fox/spiteful/avaritia/items/ItemMatterCluster.java @@ -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 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 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 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 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); } } diff --git a/src/main/java/fox/spiteful/avaritia/items/tools/ToolHelper.java b/src/main/java/fox/spiteful/avaritia/items/tools/ToolHelper.java index 4b2391d..ac4e44a 100644 --- a/src/main/java/fox/spiteful/avaritia/items/tools/ToolHelper.java +++ b/src/main/java/fox/spiteful/avaritia/items/tools/ToolHelper.java @@ -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 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); } diff --git a/src/main/resources/assets/avaritia/lang/en_US.lang b/src/main/resources/assets/avaritia/lang/en_US.lang index 8b17c8c..701a6e0 100644 --- a/src/main/resources/assets/avaritia/lang/en_US.lang +++ b/src/main/resources/assets/avaritia/lang/en_US.lang @@ -43,6 +43,7 @@ item.avaritia_fracturedore.name=Unknown Fractured Ore item.avaritia_fracturedore.prefix=Fractured item.avaritia_mattercluster.name=Matter Cluster item.avaritia_mattercluster.full.name=Critical Matter Cluster +item.avaritia_mattercluster.veryfull.name=Super-Critical Matter Cluster item.morvinabox.name=Morv-In-A-Box (WIP)(WILL LIGHT YOU ON FIRE) item.avaritia.comb.nerfed.name=Nerfed Comb item.avaritia.comb.cosmic.name=Cosmic Comb @@ -83,6 +84,7 @@ tooltip.starfuel.desc=The light of the cosmos in a convenient chunk of earth tooltip.skullfire_sword.desc=Beheads skeletons and scorches them black. tooltip.matter_cluster.desc=Right click to deconstruct. tooltip.matter_cluster.desc2=Hold SHIFT for contents. +tooltip.matter_cluster.desc3=Use a Matter Cluster Decompressor for large clusters. tooltip.matter_cluster.counter=items tooltip.morvinabox.desc=Instant housing tooltip.morvinabox.subdesc=In Canada, Morvy comes in bags.