diff --git a/build.gradle b/build.gradle index fa88ae1be..2dc32c9f2 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,4 @@ -//version: 1671313514 +//version: 1673027205 /* DO NOT CHANGE THIS FILE! Also, you may replace this file at any time if there is an update available. @@ -46,7 +46,7 @@ buildscript { } dependencies { //Overwrite the current ASM version to fix shading newer than java 8 applicatations. - classpath 'org.ow2.asm:asm-debug-all-custom:5.0.3' + classpath 'org.ow2.asm:asm-debug-all-custom:5.0.3' classpath 'net.minecraftforge.gradle:ForgeGradle:1.2.13' } } @@ -319,9 +319,13 @@ if (file('addon.gradle').exists()) { apply from: 'repositories.gradle' configurations { - implementation.extendsFrom(shadowImplementation) // TODO: remove after all uses are refactored - implementation.extendsFrom(shadowCompile) - implementation.extendsFrom(shadeCompile) + // TODO: remove Compile after all uses are refactored to Implementation + for (config in [shadowImplementation, shadowCompile, shadeCompile]) { + compileClasspath.extendsFrom(config) + runtimeClasspath.extendsFrom(config) + testCompileClasspath.extendsFrom(config) + testRuntimeClasspath.extendsFrom(config) + } } repositories { @@ -350,7 +354,8 @@ dependencies { annotationProcessor('com.google.code.gson:gson:2.8.6') annotationProcessor('com.gtnewhorizon:gtnhmixins:2.1.3:processor') if (usesMixinDebug.toBoolean()) { - runtimeOnly('org.jetbrains:intellij-fernflower:1.2.1.16') + runtimeClasspath('org.jetbrains:intellij-fernflower:1.2.1.16') + testRuntimeClasspath('org.jetbrains:intellij-fernflower:1.2.1.16') } } if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) { diff --git a/src/main/java/chylex/hee/entity/item/EntityItemInstabilityOrb.java b/src/main/java/chylex/hee/entity/item/EntityItemInstabilityOrb.java index e09f9ce84..df7bf1b00 100644 --- a/src/main/java/chylex/hee/entity/item/EntityItemInstabilityOrb.java +++ b/src/main/java/chylex/hee/entity/item/EntityItemInstabilityOrb.java @@ -1,32 +1,17 @@ package chylex.hee.entity.item; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import net.minecraft.block.Block; -import net.minecraft.block.material.Material; -import net.minecraft.enchantment.EnchantmentProtection; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; -import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.DamageSource; -import net.minecraft.util.MathHelper; import net.minecraft.util.Vec3; -import net.minecraft.util.WeightedRandomChestContent; -import net.minecraft.world.ChunkPosition; import net.minecraft.world.Explosion; import net.minecraft.world.World; -import net.minecraftforge.common.ChestGenHooks; -import chylex.hee.HardcoreEnderExpansion; -import chylex.hee.entity.fx.FXType; -import chylex.hee.mechanics.orb.WeightedItem; -import chylex.hee.packets.PacketPipeline; -import chylex.hee.packets.client.C21EffectEntity; -import chylex.hee.system.util.BlockPosM; + +import java.util.HashMap; +import java.util.Map; public class EntityItemInstabilityOrb extends EntityItem{ public EntityItemInstabilityOrb(World world){ @@ -49,54 +34,12 @@ public EntityItemInstabilityOrb(World world, double x, double y, double z, ItemS @Override public void onUpdate(){ + /* Yeet */ super.onUpdate(); - - if (!worldObj.isRemote){ - age += 1+rand.nextInt(2+rand.nextInt(4))*rand.nextInt(3); - if (age >= 666)detonate(); - } - else{ - int chance = age/17-7; - for(int a = 0; a < Math.min(7,(chance <= 0 ? (rand.nextInt(Math.abs(chance)+1) == 0 ? 1 : 0) : chance)); a++){ - HardcoreEnderExpansion.fx.instability(this); - } - - if (rand.nextInt(3+Math.max(0,(int)((680F-age)/70F))) == 0)worldObj.playSound(posX,posY,posZ,"random.pop",0.15F+rand.nextFloat()*0.1F,0.7F+rand.nextFloat()*0.6F,false); - } } private void detonate() { - if (rand.nextInt(6) == 0) { - ExplosionOrb explosion = new ExplosionOrb(worldObj,this,posX,posY,posZ,0.1F); - explosion.doExplosionA(); - explosion.doExplosionB(true); - PacketPipeline.sendToAllAround(this,64D,new C21EffectEntity(FXType.Entity.ORB_EXPLOSION,posX,posY,posZ,0F,explosion.explosionSize)); - } else { - WeightedItem item = null; - String[] list = new String[]{ - ChestGenHooks.DUNGEON_CHEST, ChestGenHooks.BONUS_CHEST, ChestGenHooks.MINESHAFT_CORRIDOR, - ChestGenHooks.VILLAGE_BLACKSMITH, ChestGenHooks.PYRAMID_DESERT_CHEST, ChestGenHooks.PYRAMID_JUNGLE_CHEST, - ChestGenHooks.STRONGHOLD_LIBRARY, ChestGenHooks.STRONGHOLD_CORRIDOR - }; - - WeightedRandomChestContent[] content = ChestGenHooks.getItems(list[rand.nextInt(list.length)],rand); - if (content.length == 0) - return; - - ItemStack is = content[rand.nextInt(content.length)].theItemId; - item = new WeightedItem(is.getItem(),is.getItemDamage(),1); - - int meta = item.getDamageValues()[rand.nextInt(item.getDamageValues().length)]; - if (meta == 32767) - meta = 0; - - EntityItem entityitem = new EntityItem(worldObj,posX,posY,posZ,new ItemStack(item.getItem(),1,meta)); - entityitem.motionX = entityitem.motionY = entityitem.motionZ = 0D; - entityitem.delayBeforeCanPickup = 10; - worldObj.spawnEntityInWorld(entityitem); - - PacketPipeline.sendToAllAround(this,64D,new C21EffectEntity(FXType.Entity.ORB_TRANSFORMATION,posX,posY,posZ,0.25F,0.4F)); - } + /* Yeet */ setDead(); } @@ -131,95 +74,7 @@ public ExplosionOrb(World world, Entity sourceEntity, double x, double y, double @Override public void doExplosionA(){ - float explosionSizeBackup = explosionSize; - - HashSet affectedBlocks = new HashSet<>(); - double tempX, tempY, tempZ, distX, distY, distZ, totalDist; - BlockPosM testPos = new BlockPosM(); - - for(int x = 0; x < dist; ++x){ - for(int y = 0; y < dist; ++y){ - for(int z = 0; z < dist; ++z){ - if (x == 0 || x == dist-1 || y == 0 || y == dist-1 || z == 0 || z == dist-1){ - distX = (x/(dist-1F)*2F-1F); - distY = (y/(dist-1F)*2F-1F); - distZ = (z/(dist-1F)*2F-1F); - totalDist = Math.sqrt(distX*distX+distY*distY+distZ*distZ); - - distX /= totalDist; - distY /= totalDist; - distZ /= totalDist; - - float affectedDistance = explosionSize*(0.7F+worldObj.rand.nextFloat()*0.6F); - tempX = explosionX; - tempY = explosionY; - tempZ = explosionZ; - - for(float mp = 0.3F; affectedDistance > 0F; affectedDistance -= mp*0.75F){ - testPos.set(tempX,tempY,tempZ); - Block block = testPos.getBlock(worldObj); - - if (block.getMaterial() != Material.air){ - float resistance = exploder != null ? exploder.func_145772_a(this,worldObj,testPos.x,testPos.y,testPos.z,block) : block.getExplosionResistance(exploder,worldObj,testPos.x,testPos.y,testPos.z,explosionX,explosionY,explosionZ); - affectedDistance -= (resistance+0.3F)*mp; - } - - if (affectedDistance > 0F && (exploder == null || exploder.func_145774_a(this,worldObj,testPos.x,testPos.y,testPos.z,block,affectedDistance))){ - affectedBlocks.add(new ChunkPosition(testPos.x,testPos.y,testPos.z)); - } - - tempX += distX*mp; - tempY += distY*mp; - tempZ += distZ*mp; - } - } - } - } - } - - affectedBlockPositions.addAll(affectedBlocks); - explosionSize *= 2F; - - int minX = MathHelper.floor_double(explosionX-explosionSize-1D), maxX = MathHelper.floor_double(explosionX+explosionSize+1D); - int minY = MathHelper.floor_double(explosionY-explosionSize-1D), maxY = MathHelper.floor_double(explosionY+explosionSize+1D); - int minZ = MathHelper.floor_double(explosionZ-explosionSize-1D), maxZ = MathHelper.floor_double(explosionZ+explosionSize+1D); - - List entities = worldObj.getEntitiesWithinAABBExcludingEntity(exploder,AxisAlignedBB.getBoundingBox(minX,minY,minZ,maxX,maxY,maxZ)); - Vec3 locationVec = Vec3.createVectorHelper(explosionX,explosionY,explosionZ); - - for(int a = 0; a < entities.size(); ++a){ - Entity entity = entities.get(a); - double entityDist = entity.getDistance(explosionX,explosionY,explosionZ)/explosionSize; - - if (entityDist <= 1D){ - tempX = entity.posX-explosionX; - tempY = entity.posY+entity.getEyeHeight()-explosionY; - tempZ = entity.posZ-explosionZ; - totalDist = MathHelper.sqrt_double(tempX*tempX+tempY*tempY+tempZ*tempZ); - - if (totalDist != 0D){ - tempX /= totalDist; - tempY /= totalDist; - tempZ /= totalDist; - - double blastPower = (1D-entityDist)*worldObj.getBlockDensity(locationVec,entity.boundingBox); - - if (canDamageEntity(entity))entity.attackEntityFrom(DamageSource.setExplosionSource(this),((int)((blastPower*blastPower+blastPower)/2D*8D*explosionSize+1D))); - else continue; - - double knockbackMp = EnchantmentProtection.func_92092_a(entity,blastPower); - entity.motionX += tempX*knockbackMp; - entity.motionY += tempY*knockbackMp; - entity.motionZ += tempZ*knockbackMp; - - if (entity instanceof EntityPlayer){ - hurtPlayers.put((EntityPlayer)entity,Vec3.createVectorHelper(tempX*blastPower,tempY*blastPower,tempZ*blastPower)); - } - } - } - } - - explosionSize = explosionSizeBackup; + /* Yeet */ } @Override diff --git a/src/main/java/chylex/hee/mechanics/essence/handler/DragonEssenceHandler.java b/src/main/java/chylex/hee/mechanics/essence/handler/DragonEssenceHandler.java index a76316483..712793004 100644 --- a/src/main/java/chylex/hee/mechanics/essence/handler/DragonEssenceHandler.java +++ b/src/main/java/chylex/hee/mechanics/essence/handler/DragonEssenceHandler.java @@ -3,7 +3,10 @@ import java.util.IdentityHashMap; import java.util.List; import java.util.Map.Entry; +import java.util.Objects; import java.util.SortedSet; +import java.util.stream.IntStream; + import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.enchantment.Enchantment; @@ -204,16 +207,17 @@ else if (is.isItemEnchanted() && is.getItem() != Items.enchanted_book){ if (enchants == null || enchants.tagCount() == 0)return; for(int attempt = 0; attempt < 3; attempt++){ - WeightedList> list = new WeightedList<>(); - - for(int a = 0; a < enchants.tagCount(); a++){ - Enchantment e = Enchantment.enchantmentsList[enchants.getCompoundTagAt(a).getShort("id")]; - if (e == null)continue; - - list.add(ObjectWeightPair.of(e,e.getWeight())); - } + final WeightedList> list = new WeightedList<>(); + + final ObjectWeightPair[] eligibleEnchants = IntStream.range(0, enchants.tagCount()) + .mapToObj(i -> Enchantment.enchantmentsList[enchants.getCompoundTagAt(i).getShort("id")]) + .filter(Objects::nonNull) + .map(e -> ObjectWeightPair.of(e, e.getWeight())) + .toArray(ObjectWeightPair[]::new); + list.addAll((ObjectWeightPair[]) eligibleEnchants); + - if (list.isEmpty())continue; // the enchantments are no longer in the game + if (list.isEmpty()) continue; // the enchantments are no longer in the game Enchantment chosenEnchantment = list.getRandomItem(item.worldObj.rand).getObject(); diff --git a/src/main/java/chylex/hee/mechanics/orb/OrbAcquirableItems.java b/src/main/java/chylex/hee/mechanics/orb/OrbAcquirableItems.java index 84b053be3..e209cf380 100644 --- a/src/main/java/chylex/hee/mechanics/orb/OrbAcquirableItems.java +++ b/src/main/java/chylex/hee/mechanics/orb/OrbAcquirableItems.java @@ -1,170 +1,25 @@ package chylex.hee.mechanics.orb; + +import chylex.hee.system.util.ItemPattern; +import cpw.mods.fml.common.registry.GameRegistry; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; import java.util.List; -import java.util.Map.Entry; import java.util.Random; -import net.minecraft.block.Block; -import net.minecraft.block.BlockLiquid; -import net.minecraft.init.Blocks; -import net.minecraft.item.Item; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.CraftingManager; -import net.minecraft.item.crafting.FurnaceRecipes; -import net.minecraft.item.crafting.IRecipe; -import net.minecraft.item.crafting.ShapedRecipes; -import net.minecraft.item.crafting.ShapelessRecipes; -import net.minecraft.world.World; -import net.minecraft.world.biome.BiomeGenBase; -import net.minecraftforge.fluids.IFluidBlock; -import net.minecraftforge.oredict.ShapedOreRecipe; -import net.minecraftforge.oredict.ShapelessOreRecipe; -import org.apache.commons.lang3.ArrayUtils; -import chylex.hee.system.logging.Log; -import chylex.hee.system.logging.Stopwatch; -import chylex.hee.system.savedata.WorldDataHandler; -import chylex.hee.system.util.DragonUtil; -import chylex.hee.system.util.ItemPattern; -import cpw.mods.fml.common.registry.GameRegistry; public final class OrbAcquirableItems{ public static final WeightedItemList idList = new WeightedItemList(); public static final List blacklist = new ArrayList<>(); - private static String lastWorldIdentifier; - public static void initialize(boolean firstTime){ - Stopwatch.time("OrbAcquirableItems"); - - if (!firstTime){ - idList.clear(); - } - - for(BiomeGenBase biome:BiomeGenBase.getBiomeGenArray()){ - if (biome == null)continue; - else if (biome.biomeID >= 128)break; - - idList.add(new WeightedItem(biome.topBlock,0,34)); - idList.add(new WeightedItem(biome.fillerBlock,0,34)); - } - - for(Iterator> iter = FurnaceRecipes.smelting().getSmeltingList().entrySet().iterator(); iter.hasNext();){ - Entry entry = iter.next(); - - try{ - int weight = 30-(int)(7F*FurnaceRecipes.smelting().func_151398_b(entry.getValue())); // OBFUSCATED get experience amount - idList.add(new WeightedItem(entry.getKey().getItem(),0,weight)); - idList.add(new WeightedItem(entry.getValue().getItem(),0,weight)); - }catch(Throwable t){ - if (firstTime){ - Log.error("[HEE-ORB] Corrupted furnace recipe: $0 <= $1",toString(entry.getValue()),toString(entry.getKey())); - iter.remove(); - } - } - } - - for(Iterator iter = CraftingManager.getInstance().getRecipeList().iterator(); iter.hasNext();){ - IRecipe recipe = iter.next(); - Class cls = recipe.getClass(); - - try{ - if (cls == ShapedRecipes.class){ - ShapedRecipes shaped = (ShapedRecipes)recipe; - addItemToList(shaped.getRecipeOutput(),21-shaped.recipeWidth*2-shaped.recipeHeight*2); - for(ItemStack is:shaped.recipeItems)addItemToList(is,23-shaped.recipeWidth*2-shaped.recipeHeight*2); - } - else if (cls == ShapelessRecipes.class){ - addItemToList(recipe.getRecipeOutput(),24-recipe.getRecipeSize()*2); - for(ItemStack item:(List)((ShapelessRecipes)recipe).recipeItems)addItemToList(item,25-recipe.getRecipeSize()*2); - } - else if (cls == ShapedOreRecipe.class){ - ShapedOreRecipe shaped = (ShapedOreRecipe)recipe; - int amt = DragonUtil.getNonNullValues(shaped.getInput()).length; - - addItemToList(shaped.getRecipeOutput(),20-amt*2); - - for(Object obj:shaped.getInput()){ - if (obj instanceof ItemStack)addItemToList((ItemStack)obj,19-amt*2); - else if (obj instanceof ArrayList){ - ArrayList list = (ArrayList)obj; - int len = list.size(); - - for(ItemStack listObj:(ArrayList)list)addItemToList(listObj,Math.max(2,19-amt*2-((len-1)*3))); - } - } - } - else if (cls == ShapelessOreRecipe.class){ - int amt = recipe.getRecipeSize(); - - addItemToList(recipe.getRecipeOutput(),23-amt*2); - - for(Object obj:((ShapelessOreRecipe)recipe).getInput()){ - if (obj instanceof ItemStack)addItemToList((ItemStack)obj,24-amt*2); - else if (obj instanceof ArrayList){ - ArrayList list = (ArrayList)obj; - int len = list.size(); - - for(ItemStack listObj:(ArrayList)list)addItemToList(listObj,Math.max(2,24-amt*2-((len-1)*3))); - } - } - } - }catch(Throwable t){ - if (firstTime){ - if (cls == ShapedRecipes.class)Log.error("[HEE-ORB] Corrupted shaped recipe: $0 <= $1",toString(recipe.getRecipeOutput()),toString(((ShapedRecipes)recipe).recipeItems)); - else if (cls == ShapelessRecipes.class)Log.error("[HEE-ORB] Corrupted shapeless recipe: $0 <= $1",toString(recipe.getRecipeOutput()),toString(((ShapelessRecipes)recipe).recipeItems)); - else if (cls == ShapedOreRecipe.class)Log.error("[HEE-ORB] Corrupted shaped ore recipe: $0 <= $1",toString(recipe.getRecipeOutput()),toString(((ShapedOreRecipe)recipe).getInput())); - else if (cls == ShapelessOreRecipe.class)Log.error("[HEE-ORB] Corrupted shapeless ore recipe: $0 <= $1",toString(recipe.getRecipeOutput()),toString(((ShapelessOreRecipe)recipe).getInput())); - - iter.remove(); - } - } - } - - /* - * CLEANUP OF THINGS WE DON'T WANT + BLACKLIST - */ - - Item fire = Item.getItemFromBlock(Blocks.fire); - - for(Iterator iter = idList.iterator(); iter.hasNext();){ - WeightedItem weightedItem = iter.next(); - Item item = weightedItem.getItem(); - - if (item == fire){ - iter.remove(); - continue; - } - else if (item instanceof ItemBlock){ - Block block = Block.getBlockFromItem(item); - - if (block instanceof IFluidBlock || block instanceof BlockLiquid){ - iter.remove(); - continue; - } - } - - for(ItemPattern pattern:blacklist){ - if (weightedItem.runBlacklistPattern(pattern).getRight()){ - iter.remove(); - break; - } - } - } - - Stopwatch.finish("OrbAcquirableItems"); + /* yeet */ } public static WeightedItem getRandomItem(World world, Random rand){ - String identifier = WorldDataHandler.getWorldIdentifier(world); - - if (lastWorldIdentifier == null || !lastWorldIdentifier.equals(identifier)){ - lastWorldIdentifier = identifier; - initialize(false); - } - - return idList.getRandomItem(rand); + /* Yeet */ + return null; } private static String getModID(ItemStack is){ @@ -174,45 +29,5 @@ private static String getModID(ItemStack is){ return ""; } } - - private static void addItemToList(ItemStack is, int weight){ - if (is == null || is.hasTagCompound() || weight <= 0)return; - if (is.getItem() == null)is.isItemDamaged(); // throws NPE - - idList.add(new WeightedItem(is.getItem(),is.getItemDamage(),weight)); - } - - private static String toString(ItemStack is){ - if (is == null)return ""; - else if (is.getItem() == null)return ""; - else return "["+getModID(is)+"]"+(is.stackSize > 9 ? is.toString().substring(3).replace('@','/') : is.toString().substring(2)).replace('@','/'); - } - - private static String toString(List list){ - return toString(list.toArray()); - } - - private static String toString(Object[] array){ - Object[] newArray = new Object[array.length]; - - for(int a = 0; a < array.length; a++){ - if (array[a] == null)newArray[a] = ""; - else if (array[a] instanceof ItemStack)newArray[a] = toString((ItemStack)array[a]); - else if (array[a] instanceof Collection){ - Collection collection = (Collection)array[a]; - - if (collection.isEmpty())newArray[a] = ""; - else{ - Object obj = collection.iterator().next(); - if (obj instanceof ItemStack)newArray[a] = toString((ItemStack)obj)+"(ore)"; - else newArray[a] = ""; - } - } - else newArray[a] = ""; - } - - return ArrayUtils.toString(newArray).replace(",",", "); - } - private OrbAcquirableItems(){} } diff --git a/src/main/java/chylex/hee/system/collections/WeightedList.java b/src/main/java/chylex/hee/system/collections/WeightedList.java index 2266cd6d4..e4b928036 100644 --- a/src/main/java/chylex/hee/system/collections/WeightedList.java +++ b/src/main/java/chylex/hee/system/collections/WeightedList.java @@ -1,6 +1,7 @@ package chylex.hee.system.collections; import gnu.trove.map.hash.TObjectIntHashMap; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collection; import java.util.Random; import chylex.hee.HardcoreEnderExpansion; @@ -14,25 +15,24 @@ public class WeightedList extends ArrayList{ protected int totalWeight; public WeightedList(T...weightedItems){ - for(T item:weightedItems)add(item); + addAll(weightedItems); } public WeightedList(WeightedList weightedItemCollection){ - for(T item:weightedItemCollection)add(item); + this.addAll(weightedItemCollection); } @Override public boolean add(T obj){ - boolean b = super.add(obj); - recalculateWeight(); - return b; + totalWeight += obj.getWeight(); + return super.add(obj); } public WeightedList addAll(T[] objArray){ - for(T obj:objArray)super.add(obj); + for(T obj:objArray) super.add(obj); recalculateWeight(); return this; - } + } @Override public boolean addAll(Collection collection){ @@ -44,14 +44,16 @@ public boolean addAll(Collection collection){ @Override public T remove(int index){ T is = super.remove(index); - recalculateWeight(); + totalWeight -= is.getWeight(); return is; } @Override public boolean remove(Object o){ boolean b = super.remove(o); - recalculateWeight(); + if (b) { + totalWeight -= ((T)o).getWeight(); + } return b; } @@ -82,12 +84,14 @@ public T removeRandomItem(Random rand){ @Override public void run(String...args){ WeightedList> list = new WeightedList<>(); - list.add(ObjectWeightPair.of("A",50)); - list.add(ObjectWeightPair.of("B",25)); - list.add(ObjectWeightPair.of("C",10)); - list.add(ObjectWeightPair.of("D",5)); - list.add(ObjectWeightPair.of("E",5)); - list.add(ObjectWeightPair.of("F",1)); + list.addAll(Arrays.asList( + ObjectWeightPair.of("A", 50), + ObjectWeightPair.of("B",25), + ObjectWeightPair.of("C",10), + ObjectWeightPair.of("D",5), + ObjectWeightPair.of("E",5), + ObjectWeightPair.of("F",1) + )); TObjectIntHashMap freq = new TObjectIntHashMap<>(); for(int a = 0; a < 5000; a++)freq.adjustOrPutValue(list.getRandomItem(world.rand).getObject(),1,1); diff --git a/src/main/java/chylex/hee/world/feature/WorldGenBlob.java b/src/main/java/chylex/hee/world/feature/WorldGenBlob.java index 9609cc589..e7cb4ef4b 100644 --- a/src/main/java/chylex/hee/world/feature/WorldGenBlob.java +++ b/src/main/java/chylex/hee/world/feature/WorldGenBlob.java @@ -1,4 +1,5 @@ package chylex.hee.world.feature; +import java.util.Arrays; import java.util.List; import java.util.Random; import net.minecraft.init.Blocks; @@ -55,12 +56,9 @@ private enum BlobType{ typesFar = new WeightedList<>(); static{ - typesClose.add(ObjectWeightPair.of(BlobType.COMMON,50)); - typesClose.add(ObjectWeightPair.of(BlobType.UNCOMMON,7)); + typesClose.addAll(Arrays.asList(ObjectWeightPair.of(BlobType.COMMON, 50), ObjectWeightPair.of(BlobType.UNCOMMON,7))); - typesFar.add(ObjectWeightPair.of(BlobType.COMMON,42)); - typesFar.add(ObjectWeightPair.of(BlobType.UNCOMMON,7)); - typesFar.add(ObjectWeightPair.of(BlobType.RARE,1)); + typesFar.addAll(Arrays.asList(ObjectWeightPair.of(BlobType.COMMON,42), ObjectWeightPair.of(BlobType.UNCOMMON,7), ObjectWeightPair.of(BlobType.RARE,1))); BlobType.COMMON.patterns.addAll(new BlobPattern[]{ // basic random pattern diff --git a/src/main/java/chylex/hee/world/loot/WeightedLootList.java b/src/main/java/chylex/hee/world/loot/WeightedLootList.java index 91a8aeb22..ae4fc1271 100644 --- a/src/main/java/chylex/hee/world/loot/WeightedLootList.java +++ b/src/main/java/chylex/hee/world/loot/WeightedLootList.java @@ -11,7 +11,7 @@ public class WeightedLootList extends WeightedList{ private List itemPostProcessors = new ArrayList<>(); public WeightedLootList(LootItemStack...items){ - for(LootItemStack item:items)add(item); + addAll(items); } @Override diff --git a/src/main/java/chylex/hee/world/structure/island/biome/IslandBiomeBurningMountains.java b/src/main/java/chylex/hee/world/structure/island/biome/IslandBiomeBurningMountains.java index bd742b1c3..f79f3119b 100644 --- a/src/main/java/chylex/hee/world/structure/island/biome/IslandBiomeBurningMountains.java +++ b/src/main/java/chylex/hee/world/structure/island/biome/IslandBiomeBurningMountains.java @@ -1,4 +1,5 @@ package chylex.hee.world.structure.island.biome; +import java.util.Arrays; import java.util.Random; import net.minecraft.stats.Achievement; import chylex.hee.block.BlockEndstoneTerrain; @@ -27,13 +28,9 @@ public class IslandBiomeBurningMountains extends IslandBiomeBase{ protected IslandBiomeBurningMountains(int biomeID){ super(biomeID); - contentVariations.add(SCORCHING); - contentVariations.add(MINE); + contentVariations.addAll(Arrays.asList(SCORCHING, MINE)); - randomDeviations.add(EXCESSIVE_CINDER); - randomDeviations.add(SINGLE_LAVA_ONLY); - randomDeviations.add(LIMITED_ORES); - randomDeviations.add(DEEP_RESOURCE_PITS); + randomDeviations.addAll(Arrays.asList(EXCESSIVE_CINDER, SINGLE_LAVA_ONLY, LIMITED_ORES, DEEP_RESOURCE_PITS)); getSpawnEntries(SCORCHING).addAll(new SpawnEntry[]{ new SpawnEntry(EntityMobFireGolem.class,14,10), diff --git a/src/main/java/chylex/hee/world/structure/island/biome/IslandBiomeEnchantedIsland.java b/src/main/java/chylex/hee/world/structure/island/biome/IslandBiomeEnchantedIsland.java index 900a36d0c..f4859325e 100644 --- a/src/main/java/chylex/hee/world/structure/island/biome/IslandBiomeEnchantedIsland.java +++ b/src/main/java/chylex/hee/world/structure/island/biome/IslandBiomeEnchantedIsland.java @@ -1,4 +1,5 @@ package chylex.hee.world.structure.island.biome; +import java.util.Arrays; import java.util.List; import java.util.Random; import net.minecraft.entity.item.EntityItem; @@ -41,12 +42,9 @@ public class IslandBiomeEnchantedIsland extends IslandBiomeBase{ protected IslandBiomeEnchantedIsland(int biomeID){ super(biomeID); - contentVariations.add(HOMELAND); - contentVariations.add(LABORATORY); + contentVariations.addAll(Arrays.asList(HOMELAND, LABORATORY)); - randomDeviations.add(TALL_PILES); - randomDeviations.add(GOO_SWAMP); - randomDeviations.add(MORE_SHADOW_ORCHIDS); + randomDeviations.addAll(Arrays.asList(TALL_PILES, GOO_SWAMP, MORE_SHADOW_ORCHIDS)); getSpawnEntries(HOMELAND).addAll(new SpawnEntry[]{ new SpawnEntry(EntityMobEnderman.class,22,38), diff --git a/src/main/java/chylex/hee/world/structure/island/biome/IslandBiomeInfestedForest.java b/src/main/java/chylex/hee/world/structure/island/biome/IslandBiomeInfestedForest.java index ee2081414..ebd0f690a 100644 --- a/src/main/java/chylex/hee/world/structure/island/biome/IslandBiomeInfestedForest.java +++ b/src/main/java/chylex/hee/world/structure/island/biome/IslandBiomeInfestedForest.java @@ -1,4 +1,5 @@ package chylex.hee.world.structure.island.biome; +import java.util.Arrays; import java.util.Random; import net.minecraft.entity.monster.EntitySilverfish; import net.minecraft.stats.Achievement; @@ -27,11 +28,9 @@ public class IslandBiomeInfestedForest extends IslandBiomeBase{ protected IslandBiomeInfestedForest(int biomeID){ super(biomeID); - contentVariations.add(DEEP); - contentVariations.add(RAVAGED); + contentVariations.addAll(Arrays.asList(DEEP, RAVAGED)); - randomDeviations.add(TALL_TREES); - randomDeviations.add(MORE_THORNY_BUSHES); + randomDeviations.addAll(Arrays.asList(TALL_TREES, MORE_THORNY_BUSHES)); getSpawnEntries(DEEP).addAll(new SpawnEntry[]{ new SpawnEntry(EntitySilverfish.class,35,35),