Fix problem with classloading. Fixes #2008

This commit is contained in:
raoulvdberge
2018-09-23 12:38:34 +02:00
parent 6a3a8e52d7
commit fef4155f2c
2 changed files with 17 additions and 10 deletions

View File

@@ -0,0 +1,15 @@
package com.raoulvdberge.refinedstorage.gui;
import com.raoulvdberge.refinedstorage.gui.control.SideButtonCrafterMode;
import com.raoulvdberge.refinedstorage.tile.data.TileDataParameterClientListener;
public class TileDataParameterClientListenerCrafter implements TileDataParameterClientListener<Boolean> {
@Override
public void onChanged(boolean initial, Boolean hasRoot) {
if (!hasRoot) {
GuiBase.executeLater(GuiCrafter.class, gui -> {
gui.addSideButton(new SideButtonCrafterMode(gui));
});
}
}
}

View File

@@ -1,9 +1,7 @@
package com.raoulvdberge.refinedstorage.tile;
import com.raoulvdberge.refinedstorage.apiimpl.network.node.NetworkNodeCrafter;
import com.raoulvdberge.refinedstorage.gui.GuiBase;
import com.raoulvdberge.refinedstorage.gui.GuiCrafter;
import com.raoulvdberge.refinedstorage.gui.control.SideButtonCrafterMode;
import com.raoulvdberge.refinedstorage.gui.TileDataParameterClientListenerCrafter;
import com.raoulvdberge.refinedstorage.tile.data.TileDataParameter;
import net.minecraft.network.datasync.DataSerializers;
import net.minecraft.util.EnumFacing;
@@ -18,13 +16,7 @@ import javax.annotation.Nullable;
public class TileCrafter extends TileNode<NetworkNodeCrafter> {
public static final TileDataParameter<String, TileCrafter> NAME = new TileDataParameter<>(DataSerializers.STRING, NetworkNodeCrafter.DEFAULT_NAME, t -> t.getNode().getName());
public static final TileDataParameter<Integer, TileCrafter> MODE = new TileDataParameter<>(DataSerializers.VARINT, NetworkNodeCrafter.CrafterMode.IGNORE.ordinal(), t -> t.getNode().getMode().ordinal(), (t, v) -> t.getNode().setMode(NetworkNodeCrafter.CrafterMode.getById(v)));
public static final TileDataParameter<Boolean, TileCrafter> HAS_ROOT = new TileDataParameter<>(DataSerializers.BOOLEAN, false, t -> t.getNode().getRootContainerNotSelf().isPresent(), null, (t, hasRoot) -> {
if (!hasRoot) {
GuiBase.executeLater(GuiCrafter.class, gui -> {
gui.addSideButton(new SideButtonCrafterMode(gui));
});
}
});
private static final TileDataParameter<Boolean, TileCrafter> HAS_ROOT = new TileDataParameter<>(DataSerializers.BOOLEAN, false, t -> t.getNode().getRootContainerNotSelf().isPresent(), null, (t, v) -> new TileDataParameterClientListenerCrafter().onChanged(t, v));
public TileCrafter() {
dataManager.addWatchedParameter(NAME);