Run DataFixer on the Chest's and Shulker Boxes, and fix the conflicting recipes reguarding the shulker upgrades. Closes #115, #117

This commit is contained in:
alexbegt 2018-02-17 12:38:11 -05:00
parent 2e1612dc85
commit 5a9c3d77df
10 changed files with 44 additions and 13 deletions

View File

@ -16,9 +16,13 @@ import cpw.mods.ironchest.common.CommonProxy;
import cpw.mods.ironchest.common.lib.BlockLists; import cpw.mods.ironchest.common.lib.BlockLists;
import cpw.mods.ironchest.common.network.MessageCrystalChestSync; import cpw.mods.ironchest.common.network.MessageCrystalChestSync;
import cpw.mods.ironchest.common.network.MessageCrystalShulkerSync; import cpw.mods.ironchest.common.network.MessageCrystalShulkerSync;
import cpw.mods.ironchest.common.tileentity.chest.TileEntityIronChest;
import cpw.mods.ironchest.common.tileentity.shulker.TileEntityIronShulkerBox;
import cpw.mods.ironchest.common.util.MissingMappingsHandler; import cpw.mods.ironchest.common.util.MissingMappingsHandler;
import cpw.mods.ironchest.common.util.OcelotsSitOnChestsHandler; import cpw.mods.ironchest.common.util.OcelotsSitOnChestsHandler;
import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.CompoundDataFixer;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.Mod.Instance; import net.minecraftforge.fml.common.Mod.Instance;
@ -74,6 +78,15 @@ public class IronChest
packetHandler.registerMessage(MessageCrystalShulkerSync.Handler.class, MessageCrystalShulkerSync.class, messageId++, Side.CLIENT); packetHandler.registerMessage(MessageCrystalShulkerSync.Handler.class, MessageCrystalShulkerSync.class, messageId++, Side.CLIENT);
BlockLists.createShulkerItemList(); BlockLists.createShulkerItemList();
registerDataFixes();
} }
public void registerDataFixes()
{
CompoundDataFixer dataFixer = FMLCommonHandler.instance().getDataFixer();
TileEntityIronChest.registerFixesChest(dataFixer);
TileEntityIronShulkerBox.registerFixesShulkerBox(dataFixer);
}
} }

View File

@ -35,6 +35,9 @@ import net.minecraft.util.EnumFacing;
import net.minecraft.util.ITickable; import net.minecraft.util.ITickable;
import net.minecraft.util.NonNullList; import net.minecraft.util.NonNullList;
import net.minecraft.util.SoundCategory; import net.minecraft.util.SoundCategory;
import net.minecraft.util.datafix.DataFixer;
import net.minecraft.util.datafix.FixTypes;
import net.minecraft.util.datafix.walkers.ItemStackDataLists;
import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.AxisAlignedBB;
import net.minecraftforge.common.util.Constants; import net.minecraftforge.common.util.Constants;
import net.minecraftforge.fml.common.network.NetworkRegistry.TargetPoint; import net.minecraftforge.fml.common.network.NetworkRegistry.TargetPoint;
@ -630,4 +633,9 @@ public class TileEntityIronChest extends TileEntityLockableLoot implements ITick
{ {
this.topStacks = topStacks; this.topStacks = topStacks;
} }
public static void registerFixesChest(DataFixer fixer)
{
fixer.registerWalker(FixTypes.BLOCK_ENTITY, new ItemStackDataLists(TileEntityIronChest.class, new String[] { "Items" }));
}
} }

View File

@ -43,6 +43,9 @@ import net.minecraft.util.EnumFacing;
import net.minecraft.util.ITickable; import net.minecraft.util.ITickable;
import net.minecraft.util.NonNullList; import net.minecraft.util.NonNullList;
import net.minecraft.util.SoundCategory; import net.minecraft.util.SoundCategory;
import net.minecraft.util.datafix.DataFixer;
import net.minecraft.util.datafix.FixTypes;
import net.minecraft.util.datafix.walkers.ItemStackDataLists;
import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.AxisAlignedBB;
import net.minecraftforge.fml.common.network.NetworkRegistry.TargetPoint; import net.minecraftforge.fml.common.network.NetworkRegistry.TargetPoint;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
@ -185,7 +188,8 @@ public class TileEntityIronShulkerBox extends TileEntityLockableLoot implements
int compressedIdx = 0; int compressedIdx = 0;
mainLoop: for (int i = 0; i < this.getSizeInventory(); i++) mainLoop:
for (int i = 0; i < this.getSizeInventory(); i++)
{ {
ItemStack itemStack = this.getItems().get(i); ItemStack itemStack = this.getItems().get(i);
@ -228,7 +232,8 @@ public class TileEntityIronShulkerBox extends TileEntityLockableLoot implements
this.hadStuff = true; this.hadStuff = true;
Collections.sort(tempCopy, new Comparator<ItemStack>() { Collections.sort(tempCopy, new Comparator<ItemStack>()
{
@Override @Override
public int compare(ItemStack stack1, ItemStack stack2) public int compare(ItemStack stack1, ItemStack stack2)
{ {
@ -792,4 +797,9 @@ public class TileEntityIronShulkerBox extends TileEntityLockableLoot implements
{ {
CLOSED, OPENING, OPENED, CLOSING; CLOSED, OPENING, OPENED, CLOSING;
} }
public static void registerFixesShulkerBox(DataFixer fixer)
{
fixer.registerWalker(FixTypes.BLOCK_ENTITY, new ItemStackDataLists(TileEntityIronShulkerBox.class, new String[] { "Items" }));
}
} }

View File

@ -7,8 +7,8 @@
], ],
"type": "forge:ore_shaped", "type": "forge:ore_shaped",
"pattern": [ "pattern": [
"MGM", "GG",
"GSG", "MSM",
"MGM" "MGM"
], ],
"key": { "key": {

View File

@ -11,8 +11,8 @@
], ],
"type": "forge:ore_shaped", "type": "forge:ore_shaped",
"pattern": [ "pattern": [
"MMM",
"MSM", "MSM",
"MMM",
"MMM" "MMM"
], ],
"key": { "key": {

View File

@ -1,8 +1,8 @@
{ {
"type": "forge:ore_shaped", "type": "forge:ore_shaped",
"pattern": [ "pattern": [
"GGG",
"GSG", "GSG",
"GGG",
"GGG" "GGG"
], ],
"key": { "key": {

View File

@ -1,8 +1,8 @@
{ {
"type": "forge:ore_shaped", "type": "forge:ore_shaped",
"pattern": [ "pattern": [
"MMM",
"MGM", "MGM",
"MMM",
"MMM" "MMM"
], ],
"key": { "key": {

View File

@ -1,9 +1,9 @@
{ {
"type": "forge:ore_shaped", "type": "forge:ore_shaped",
"pattern": [ "pattern": [
"GGG", "GMG",
"MSM", "GSG",
"GGG" "GMG"
], ],
"key": { "key": {
"M": { "M": {

View File

@ -1,8 +1,8 @@
{ {
"type": "forge:ore_shaped", "type": "forge:ore_shaped",
"pattern": [ "pattern": [
"MMM",
"MSM", "MSM",
"MMM",
"MMM" "MMM"
], ],
"key": { "key": {

View File

@ -7,8 +7,8 @@
], ],
"type": "forge:ore_shaped", "type": "forge:ore_shaped",
"pattern": [ "pattern": [
"MGM", "MSM",
"GSG", "GGG",
"MGM" "MGM"
], ],
"key": { "key": {