Skip to content

Commit

Permalink
Run DataFixer on the Chest's and Shulker Boxes, and fix the conflicti…
Browse files Browse the repository at this point in the history
…ng recipes reguarding the shulker upgrades. Closes progwml6#115, progwml6#117
  • Loading branch information
alexbegt committed Feb 17, 2018
1 parent 2e1612d commit 5a9c3d7
Show file tree
Hide file tree
Showing 10 changed files with 44 additions and 13 deletions.
13 changes: 13 additions & 0 deletions src/main/java/cpw/mods/ironchest/IronChest.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,13 @@
import cpw.mods.ironchest.common.lib.BlockLists;
import cpw.mods.ironchest.common.network.MessageCrystalChestSync;
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.OcelotsSitOnChestsHandler;
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.EventHandler;
import net.minecraftforge.fml.common.Mod.Instance;
Expand Down Expand Up @@ -74,6 +78,15 @@ public void init(FMLInitializationEvent event)
packetHandler.registerMessage(MessageCrystalShulkerSync.Handler.class, MessageCrystalShulkerSync.class, messageId++, Side.CLIENT);

BlockLists.createShulkerItemList();

registerDataFixes();
}

public void registerDataFixes()
{
CompoundDataFixer dataFixer = FMLCommonHandler.instance().getDataFixer();

TileEntityIronChest.registerFixesChest(dataFixer);
TileEntityIronShulkerBox.registerFixesShulkerBox(dataFixer);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
import net.minecraft.util.ITickable;
import net.minecraft.util.NonNullList;
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.minecraftforge.common.util.Constants;
import net.minecraftforge.fml.common.network.NetworkRegistry.TargetPoint;
Expand Down Expand Up @@ -630,4 +633,9 @@ public void receiveMessageFromServer(NonNullList<ItemStack> topStacks)
{
this.topStacks = topStacks;
}

public static void registerFixesChest(DataFixer fixer)
{
fixer.registerWalker(FixTypes.BLOCK_ENTITY, new ItemStackDataLists(TileEntityIronChest.class, new String[] { "Items" }));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@
import net.minecraft.util.ITickable;
import net.minecraft.util.NonNullList;
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.minecraftforge.fml.common.network.NetworkRegistry.TargetPoint;
import net.minecraftforge.fml.relauncher.Side;
Expand Down Expand Up @@ -185,7 +188,8 @@ protected void sortTopStacks()

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);

Expand Down Expand Up @@ -228,7 +232,8 @@ protected void sortTopStacks()

this.hadStuff = true;

Collections.sort(tempCopy, new Comparator<ItemStack>() {
Collections.sort(tempCopy, new Comparator<ItemStack>()
{
@Override
public int compare(ItemStack stack1, ItemStack stack2)
{
Expand Down Expand Up @@ -792,4 +797,9 @@ public static enum AnimationStatus
{
CLOSED, OPENING, OPENED, CLOSING;
}

public static void registerFixesShulkerBox(DataFixer fixer)
{
fixer.registerWalker(FixTypes.BLOCK_ENTITY, new ItemStackDataLists(TileEntityIronShulkerBox.class, new String[] { "Items" }));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
],
"type": "forge:ore_shaped",
"pattern": [
"MGM",
"GSG",
"GG",
"MSM",
"MGM"
],
"key": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
],
"type": "forge:ore_shaped",
"pattern": [
"MMM",
"MSM",
"MMM",
"MMM"
],
"key": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"type": "forge:ore_shaped",
"pattern": [
"GGG",
"GSG",
"GGG",
"GGG"
],
"key": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"type": "forge:ore_shaped",
"pattern": [
"MMM",
"MGM",
"MMM",
"MMM"
],
"key": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"type": "forge:ore_shaped",
"pattern": [
"GGG",
"MSM",
"GGG"
"GMG",
"GSG",
"GMG"
],
"key": {
"M": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"type": "forge:ore_shaped",
"pattern": [
"MMM",
"MSM",
"MMM",
"MMM"
],
"key": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
],
"type": "forge:ore_shaped",
"pattern": [
"MGM",
"GSG",
"MSM",
"GGG",
"MGM"
],
"key": {
Expand Down

0 comments on commit 5a9c3d7

Please sign in to comment.