Skip to content

Commit

Permalink
Fixed Village Names Compat regarding Blacksmith Chest
Browse files Browse the repository at this point in the history
  • Loading branch information
GregoriusT committed Jun 24, 2023
1 parent 26b791f commit 58565ff
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 12 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ Nothing (I tend to only add finished Stuff to the Changelog).


6.16.02: (Not released yet)
[FIXED] Village Names should no longer crash with the Blacksmith Chest.
[CHANGED] Wooden Barrels and Plastic Canisters can now have decorative nonfunctional Covers attached to them. Now you can put Hazard Stickers on them, lol.
[CHANGED] Blacksmith Loot Chest is now made of Meteoric Steel instead of regular Steel, unless Village Names is installed.
[ADDED] Drain Covers can now partially drain GT Fluids.


Expand Down
1 change: 1 addition & 0 deletions src/main/java/gregapi/data/CS.java
Original file line number Diff line number Diff line change
Expand Up @@ -1994,6 +1994,7 @@ public static class ModIDs {
, LOSTBOOKS = "LostBooks"
, LOOTBAGS = "lootbags"
, EUREKA = "eureka"
, VN4 = "VillageNames"

, UB = "UndergroundBiomes"
, COG = "CustomOreGen"
Expand Down
1 change: 1 addition & 0 deletions src/main/java/gregapi/data/MD.java
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ public class MD {
, LOSTBOOKS = new ModData(ModIDs.LOSTBOOKS , "Lost Books")
, LOOTBAGS = new ModData(ModIDs.LOOTBAGS , "Lootbags")
, EUREKA = new ModData(ModIDs.EUREKA , "Eureka")
, VN4 = new ModData(ModIDs.VN4 , "Village Names")

, UB = new ModData(ModIDs.UB , "Underground Biomes")
, COG = new ModData(ModIDs.COG , "Custom Ore Generation")
Expand Down
7 changes: 5 additions & 2 deletions src/main/java/gregtech/loaders/c/Loader_Loot.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2022 GregTech-6 Team
* Copyright (c) 2023 GregTech-6 Team
*
* This file is part of GregTech.
*
Expand All @@ -20,6 +20,7 @@
package gregtech.loaders.c;

import gregapi.data.IL;
import gregapi.data.MD;
import gregapi.data.MT;
import gregapi.data.OP;
import gregapi.util.ST;
Expand All @@ -40,12 +41,14 @@ public class Loader_Loot implements Runnable {
public void run() {
new ChestGenHooksChestReplacer(ChestGenHooks.DUNGEON_CHEST , 32745);
new ChestGenHooksChestReplacer(ChestGenHooks.MINESHAFT_CORRIDOR , 500);
new ChestGenHooksChestReplacer(ChestGenHooks.VILLAGE_BLACKSMITH , 10);
new ChestGenHooksChestReplacer(ChestGenHooks.STRONGHOLD_LIBRARY , 508);
new ChestGenHooksChestReplacer(ChestGenHooks.STRONGHOLD_CROSSING , 509);
new ChestGenHooksChestReplacer(ChestGenHooks.STRONGHOLD_CORRIDOR , 510);
new ChestGenHooksChestReplacer(ChestGenHooks.PYRAMID_DESERT_CHEST, 2);
new ChestGenHooksChestReplacer(ChestGenHooks.PYRAMID_JUNGLE_CHEST, 502);
if (!MD.VN4.mLoaded)
new ChestGenHooksChestReplacer(ChestGenHooks.VILLAGE_BLACKSMITH , 24);


addLoot(ChestGenHooks.BONUS_CHEST , 2, 8,16, IL.Bottle_Purple_Drink.get(1));
addLoot(ChestGenHooks.BONUS_CHEST , 5, 8,16, IL.Bottle_Glue.get(1));
Expand Down
20 changes: 10 additions & 10 deletions src/main/java/gregtech/worldgen/ChestGenHooksChestReplacer.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2021 GregTech-6 Team
* Copyright (c) 2023 GregTech-6 Team
*
* This file is part of GregTech.
*
Expand All @@ -19,14 +19,6 @@

package gregtech.worldgen;

import static gregapi.data.CS.*;

import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Random;

import gregapi.block.multitileentity.MultiTileEntityRegistry;
import gregapi.util.UT;
import net.minecraft.init.Blocks;
Expand All @@ -37,6 +29,14 @@
import net.minecraft.world.World;
import net.minecraftforge.common.ChestGenHooks;

import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Random;

import static gregapi.data.CS.*;

/**
* @author Gregorius Techneticies
*/
Expand Down Expand Up @@ -109,7 +109,7 @@ protected ItemStack[] generateChestContent(Random aRandom, IInventory aInventory
// XYZ and check if the Block we replace is a regular Chest.
int aX = ((TileEntityChest)aInventory).xCoord, aY = ((TileEntityChest)aInventory).yCoord, aZ = ((TileEntityChest)aInventory).zCoord;
if (Blocks.chest != aWorld.getBlock(aX, aY, aZ)) return generateChestContent2(aRandom, aInventory);
// Does my Registry exist?
// Does Greg's Registry exist?
MultiTileEntityRegistry tRegistry = MultiTileEntityRegistry.getRegistry("gt.multitileentity");
if (tRegistry == null) return generateChestContent2(aRandom, aInventory);
// Grab the Chests Facing.
Expand Down

0 comments on commit 58565ff

Please sign in to comment.