Clear network registry on world unload

This commit is contained in:
Raoul Van den Berge
2016-06-22 22:24:44 +02:00
parent d47aac44ba
commit 47f631585a
7 changed files with 28 additions and 3 deletions

View File

@@ -17,7 +17,7 @@ group = "refinedstorage"
archivesBaseName = "refinedstorage"
minecraft {
version = "1.9.4-12.17.0.1968"
version = "1.9.4-12.17.0.1969"
runDir = "run"
useDepAts = true
mappings = "snapshot_20160518"
@@ -30,7 +30,7 @@ repositories {
}
dependencies {
deobfCompile "mezz.jei:jei_1.9.4:3.4.+"
deobfCompile "mezz.jei:jei_1.9.4:3.6.+"
}
processResources {

View File

@@ -27,4 +27,9 @@ public class NetworkMasterEventHandler {
public void onWorldLoad(WorldEvent.Load e) {
NetworkMasterSavedData.getOrLoad(e.getWorld());
}
@SubscribeEvent
public void onWorldUnload(WorldEvent.Unload e) {
NetworkMasterRegistry.clear();
}
}

View File

@@ -35,4 +35,8 @@ public class NetworkMasterRegistry {
public static Map<BlockPos, NetworkMaster> get(int dimension) {
return NETWORKS.get(dimension);
}
public static void clear() {
NETWORKS.clear();
}
}

View File

@@ -15,6 +15,7 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import refinedstorage.RefinedStorage;
@@ -83,7 +84,11 @@ public class BlockController extends BlockBase {
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
if (!world.isRemote) {
player.openGui(RefinedStorage.INSTANCE, RefinedStorageGui.CONTROLLER, world, pos.getX(), pos.getY(), pos.getZ());
if (((TileController) world.getTileEntity(pos)).getNetwork() == null) {
player.addChatComponentMessage(new TextComponentTranslation("misc.refinedstorage:no_network"));
} else {
player.openGui(RefinedStorage.INSTANCE, RefinedStorageGui.CONTROLLER, world, pos.getX(), pos.getY(), pos.getZ());
}
}
return true;

View File

@@ -3,6 +3,8 @@ package refinedstorage.jei;
import mezz.jei.api.recipe.IRecipeHandler;
import mezz.jei.api.recipe.IRecipeWrapper;
import javax.annotation.Nonnull;
public class SoldererRecipeHandler implements IRecipeHandler<SoldererRecipeWrapper> {
@Override
public Class<SoldererRecipeWrapper> getRecipeClass() {
@@ -14,6 +16,12 @@ public class SoldererRecipeHandler implements IRecipeHandler<SoldererRecipeWrapp
return SoldererRecipeCategory.ID;
}
@Nonnull
@Override
public String getRecipeCategoryUid(@Nonnull SoldererRecipeWrapper recipe) {
return SoldererRecipeCategory.ID;
}
@Override
public IRecipeWrapper getRecipeWrapper(SoldererRecipeWrapper recipe) {
return recipe;

View File

@@ -43,6 +43,7 @@ public class TileImporter extends TileSlave implements ICompareConfig, IModeConf
@Override
public void updateSlave() {
System.out.println("Update: " + System.currentTimeMillis());
IItemHandler handler = RefinedStorageUtils.getItemHandler(getFacingTile(), getDirection().getOpposite());
if (getFacingTile() instanceof TileDiskDrive || handler == null) {

View File

@@ -55,6 +55,8 @@ misc.refinedstorage:clear=Clear
misc.refinedstorage:cancel_all=Cancel All
misc.refinedstorage:priority=Priority
misc.refinedstorage:no_network=This Controller isn't associated with any storage network. If you just upgraded to 0.7.17, this is absolutely normal. In that case, a simple one-time break and replace should fix the issue.
sidebutton.refinedstorage:compare.1=Compare Damage
sidebutton.refinedstorage:compare.2=Compare NBT