Skip to content

Commit

Permalink
perf: ⚡remove IE Orevein map villagers
Browse files Browse the repository at this point in the history
They caused 1-3 seconds load and sell Ore Vein places, which already easy and fast to obtain with a drill.
  • Loading branch information
Krutoy242 committed Jun 19, 2024
1 parent ed6c46c commit 1cf9765
Show file tree
Hide file tree
Showing 4 changed files with 174 additions and 0 deletions.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
@@ -2,75 +2,22 @@
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
- * blusunrize.immersiveengineering.api.DimensionChunkCoords
- * blusunrize.immersiveengineering.api.tool.ExcavatorHandler
- * blusunrize.immersiveengineering.api.tool.ExcavatorHandler$MineralWorldInfo
- * blusunrize.immersiveengineering.common.IEContent
- * blusunrize.immersiveengineering.common.util.IELogger
- * blusunrize.immersiveengineering.common.util.ItemNBTHelper
* net.minecraft.entity.IMerchant
* net.minecraft.entity.passive.EntityVillager$ITradeList
* net.minecraft.entity.passive.EntityVillager$PriceInfo
- * net.minecraft.init.Items
- * net.minecraft.item.Item
- * net.minecraft.item.ItemMap
- * net.minecraft.item.ItemStack
- * net.minecraft.util.math.BlockPos
- * net.minecraft.village.MerchantRecipe
* net.minecraft.village.MerchantRecipeList
- * net.minecraft.world.World
- * net.minecraft.world.storage.MapData
- * net.minecraft.world.storage.MapDecoration$Type
*/
package blusunrize.immersiveengineering.common.util;

-import blusunrize.immersiveengineering.api.DimensionChunkCoords;
-import blusunrize.immersiveengineering.api.tool.ExcavatorHandler;
-import blusunrize.immersiveengineering.common.IEContent;
-import blusunrize.immersiveengineering.common.util.IELogger;
-import blusunrize.immersiveengineering.common.util.ItemNBTHelper;
import java.util.Random;
import net.minecraft.entity.IMerchant;
import net.minecraft.entity.passive.EntityVillager;
-import net.minecraft.init.Items;
-import net.minecraft.item.Item;
-import net.minecraft.item.ItemMap;
-import net.minecraft.item.ItemStack;
-import net.minecraft.util.math.BlockPos;
-import net.minecraft.village.MerchantRecipe;
import net.minecraft.village.MerchantRecipeList;
-import net.minecraft.world.World;
-import net.minecraft.world.storage.MapData;
-import net.minecraft.world.storage.MapDecoration;

private static class IEVillagerHandler.OreveinMapForEmeralds
implements EntityVillager.ITradeList {
public EntityVillager.PriceInfo value;

public void func_190888_a(IMerchant merchant, MerchantRecipeList recipeList, Random random) {
- World world = merchant.func_190670_t_();
- BlockPos merchantPos = merchant.func_190671_u_();
- int cX = merchantPos.func_177958_n() >> 4;
- int cZ = merchantPos.func_177952_p() >> 4;
- DimensionChunkCoords chunkCoords = null;
- for (int i = 0; i < 8 && ExcavatorHandler.mineralCache.containsKey(chunkCoords = new DimensionChunkCoords(merchant.func_190670_t_().field_73011_w.getDimension(), cX + (random.nextInt(32) - 16) * 2, cZ + (random.nextInt(32) - 16) * 2)); ++i) {
- chunkCoords = null;
- }
- if (chunkCoords != null) {
- ExcavatorHandler.MineralWorldInfo mineralWorldInfo = ExcavatorHandler.getMineralWorldInfo((World)merchant.func_190670_t_(), chunkCoords, (boolean)true);
- if (mineralWorldInfo == null || mineralWorldInfo.mineral == null) {
- if (!world.field_72995_K) {
- IELogger.error((Object)("Null " + (mineralWorldInfo == null ? "WorldInfo" : "Mineral") + " on building Cartographer trade."));
- }
- return;
- }
- BlockPos blockPos = new BlockPos(chunkCoords.func_180334_c() + 8, 64, chunkCoords.func_180333_d() + 8);
- ItemStack itemstack = ItemMap.func_190906_a((World)world, (double)blockPos.func_177958_n(), (double)blockPos.func_177952_p(), (byte)1, (boolean)true, (boolean)true);
- ItemMap.func_190905_a((World)world, (ItemStack)itemstack);
- MapData.func_191094_a((ItemStack)itemstack, (BlockPos)blockPos, (String)"ie:coresample_treasure", (MapDecoration.Type)MapDecoration.Type.TARGET_POINT);
- itemstack.func_190924_f("item.immersiveengineering.map_orevein.name");
- ItemNBTHelper.setLore((ItemStack)itemstack, (String[])new String[]{mineralWorldInfo.mineral.name});
- recipeList.add((Object)new MerchantRecipe(new ItemStack(Items.field_151166_bC, 8 + random.nextInt(8)), new ItemStack((Item)IEContent.itemMetal), itemstack));
- }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
@@ -2,14 +2,10 @@
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
- * blusunrize.immersiveengineering.api.DimensionChunkCoords
* blusunrize.immersiveengineering.api.crafting.BlueprintCraftingRecipe
* blusunrize.immersiveengineering.api.tool.BulletHandler
- * blusunrize.immersiveengineering.api.tool.ExcavatorHandler
- * blusunrize.immersiveengineering.api.tool.ExcavatorHandler$MineralWorldInfo
* blusunrize.immersiveengineering.common.Config$IEConfig
* blusunrize.immersiveengineering.common.IEContent
- * blusunrize.immersiveengineering.common.util.IELogger
* blusunrize.immersiveengineering.common.util.IEVillagerHandler$EmeraldForItemstack
* blusunrize.immersiveengineering.common.util.IEVillagerHandler$ItemstackForEmerald
* blusunrize.immersiveengineering.common.util.IEVillagerHandler$RevolverPieceForEmeralds
@@ -20,18 +16,11 @@
* net.minecraft.entity.IMerchant
* net.minecraft.entity.passive.EntityVillager$ITradeList
* net.minecraft.entity.passive.EntityVillager$PriceInfo
- * net.minecraft.init.Items
* net.minecraft.item.EnumRarity
* net.minecraft.item.Item
- * net.minecraft.item.ItemMap
* net.minecraft.item.ItemStack
- * net.minecraft.util.math.BlockPos
- * net.minecraft.village.MerchantRecipe
* net.minecraft.village.MerchantRecipeList
- * net.minecraft.world.World
* net.minecraft.world.gen.structure.MapGenStructureIO
- * net.minecraft.world.storage.MapData
- * net.minecraft.world.storage.MapDecoration$Type
* net.minecraftforge.fml.common.registry.ForgeRegistries
* net.minecraftforge.fml.common.registry.GameRegistry$ObjectHolder
* net.minecraftforge.fml.common.registry.VillagerRegistry
@@ -42,13 +31,10 @@
*/
package blusunrize.immersiveengineering.common.util;

-import blusunrize.immersiveengineering.api.DimensionChunkCoords;
import blusunrize.immersiveengineering.api.crafting.BlueprintCraftingRecipe;
import blusunrize.immersiveengineering.api.tool.BulletHandler;
-import blusunrize.immersiveengineering.api.tool.ExcavatorHandler;
import blusunrize.immersiveengineering.common.Config;
import blusunrize.immersiveengineering.common.IEContent;
-import blusunrize.immersiveengineering.common.util.IELogger;
import blusunrize.immersiveengineering.common.util.IEVillagerHandler;
import blusunrize.immersiveengineering.common.util.ItemNBTHelper;
import blusunrize.immersiveengineering.common.world.VillageEngineersHouse;
@@ -56,18 +42,11 @@ import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.entity.IMerchant;
import net.minecraft.entity.passive.EntityVillager;
-import net.minecraft.init.Items;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
-import net.minecraft.item.ItemMap;
import net.minecraft.item.ItemStack;
-import net.minecraft.util.math.BlockPos;
-import net.minecraft.village.MerchantRecipe;
import net.minecraft.village.MerchantRecipeList;
-import net.minecraft.world.World;
import net.minecraft.world.gen.structure.MapGenStructureIO;
-import net.minecraft.world.storage.MapData;
-import net.minecraft.world.storage.MapDecoration;
import net.minecraftforge.fml.common.registry.ForgeRegistries;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.common.registry.VillagerRegistry;
@@ -139,30 +118,6 @@ public class IEVillagerHandler {
public EntityVillager.PriceInfo value;

public void func_190888_a(IMerchant merchant, MerchantRecipeList recipeList, Random random) {
- World world = merchant.func_190670_t_();
- BlockPos merchantPos = merchant.func_190671_u_();
- int cX = merchantPos.func_177958_n() >> 4;
- int cZ = merchantPos.func_177952_p() >> 4;
- DimensionChunkCoords chunkCoords = null;
- for (int i = 0; i < 8 && ExcavatorHandler.mineralCache.containsKey(chunkCoords = new DimensionChunkCoords(merchant.func_190670_t_().field_73011_w.getDimension(), cX + (random.nextInt(32) - 16) * 2, cZ + (random.nextInt(32) - 16) * 2)); ++i) {
- chunkCoords = null;
- }
- if (chunkCoords != null) {
- ExcavatorHandler.MineralWorldInfo mineralWorldInfo = ExcavatorHandler.getMineralWorldInfo((World)merchant.func_190670_t_(), chunkCoords, (boolean)true);
- if (mineralWorldInfo == null || mineralWorldInfo.mineral == null) {
- if (!world.field_72995_K) {
- IELogger.error((Object)("Null " + (mineralWorldInfo == null ? "WorldInfo" : "Mineral") + " on building Cartographer trade."));
- }
- return;
- }
- BlockPos blockPos = new BlockPos(chunkCoords.func_180334_c() + 8, 64, chunkCoords.func_180333_d() + 8);
- ItemStack itemstack = ItemMap.func_190906_a((World)world, (double)blockPos.func_177958_n(), (double)blockPos.func_177952_p(), (byte)1, (boolean)true, (boolean)true);
- ItemMap.func_190905_a((World)world, (ItemStack)itemstack);
- MapData.func_191094_a((ItemStack)itemstack, (BlockPos)blockPos, (String)"ie:coresample_treasure", (MapDecoration.Type)MapDecoration.Type.TARGET_POINT);
- itemstack.func_190924_f("item.immersiveengineering.map_orevein.name");
- ItemNBTHelper.setLore((ItemStack)itemstack, (String[])new String[]{mineralWorldInfo.mineral.name});
- recipeList.add((Object)new MerchantRecipe(new ItemStack(Items.field_151166_bC, 8 + random.nextInt(8)), new ItemStack((Item)IEContent.itemMetal), itemstack));
- }
}
}
}

0 comments on commit 1cf9765

Please sign in to comment.