Moved open method to Sky Chest Container.
This commit is contained in:
@@ -86,12 +86,8 @@ public class BlockSkyChest extends AEBaseTileBlock<TileSkyChest>
|
|||||||
if (tile == null) {
|
if (tile == null) {
|
||||||
return ActionResultType.PASS;
|
return ActionResultType.PASS;
|
||||||
}
|
}
|
||||||
INamedContainerProvider container = new SimpleNamedContainerProvider((wnd, p, pl) -> new ContainerSkyChest(wnd, p, tile), getNameTextComponent());
|
|
||||||
NetworkHooks.openGui((ServerPlayerEntity) player, container, buf -> {
|
|
||||||
buf.writeBlockPos(pos);
|
|
||||||
});
|
|
||||||
|
|
||||||
// FIXME Platform.openGUI( player, this.getTileEntity( w, pos ), AEPartLocation.fromFacing(hit.getFace()), GuiBridge.GUI_SKYCHEST );
|
ContainerSkyChest.open((ServerPlayerEntity) player, tile, getNameTextComponent());
|
||||||
}
|
}
|
||||||
|
|
||||||
return ActionResultType.SUCCESS;
|
return ActionResultType.SUCCESS;
|
||||||
|
|||||||
@@ -27,10 +27,15 @@ import net.minecraft.entity.player.PlayerInventory;
|
|||||||
import appeng.container.AEBaseContainer;
|
import appeng.container.AEBaseContainer;
|
||||||
import appeng.container.slot.SlotNormal;
|
import appeng.container.slot.SlotNormal;
|
||||||
import appeng.tile.storage.TileSkyChest;
|
import appeng.tile.storage.TileSkyChest;
|
||||||
|
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||||
import net.minecraft.inventory.container.ContainerType;
|
import net.minecraft.inventory.container.ContainerType;
|
||||||
|
import net.minecraft.inventory.container.INamedContainerProvider;
|
||||||
|
import net.minecraft.inventory.container.SimpleNamedContainerProvider;
|
||||||
import net.minecraft.network.PacketBuffer;
|
import net.minecraft.network.PacketBuffer;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.text.ITextComponent;
|
||||||
|
import net.minecraftforge.fml.network.NetworkHooks;
|
||||||
|
|
||||||
|
|
||||||
public class ContainerSkyChest extends AEBaseContainer
|
public class ContainerSkyChest extends AEBaseContainer
|
||||||
@@ -66,6 +71,14 @@ public class ContainerSkyChest extends AEBaseContainer
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void open(ServerPlayerEntity player, TileSkyChest tile, ITextComponent title) {
|
||||||
|
BlockPos pos = tile.getPos();
|
||||||
|
INamedContainerProvider container = new SimpleNamedContainerProvider(
|
||||||
|
(wnd, p, pl) -> new ContainerSkyChest(wnd, p, tile), title
|
||||||
|
);
|
||||||
|
NetworkHooks.openGui(player, container, pos);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onContainerClosed( final PlayerEntity par1PlayerEntity )
|
public void onContainerClosed( final PlayerEntity par1PlayerEntity )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -487,6 +487,7 @@ public enum GuiBridge
|
|||||||
if( this.type.isItem() )
|
if( this.type.isItem() )
|
||||||
{
|
{
|
||||||
final ItemStack it = player.inventory.getCurrentItem();
|
final ItemStack it = player.inventory.getCurrentItem();
|
||||||
|
it.getCapability()
|
||||||
if( !it.isEmpty() && it.getItem() instanceof IGuiItem )
|
if( !it.isEmpty() && it.getItem() instanceof IGuiItem )
|
||||||
{
|
{
|
||||||
final Object myItem = ( (IGuiItem) it.getItem() ).getGuiObject( it, w, pos );
|
final Object myItem = ( (IGuiItem) it.getItem() ).getGuiObject( it, w, pos );
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import appeng.block.storage.BlockSkyChest;
|
|||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
import net.minecraft.inventory.container.IContainerProvider;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.network.PacketBuffer;
|
import net.minecraft.network.PacketBuffer;
|
||||||
import net.minecraft.tileentity.IChestLid;
|
import net.minecraft.tileentity.IChestLid;
|
||||||
|
|||||||
@@ -82,6 +82,9 @@ import java.util.*;
|
|||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
import net.minecraftforge.registries.ForgeRegistries;
|
import net.minecraftforge.registries.ForgeRegistries;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author AlgorithmX2
|
* @author AlgorithmX2
|
||||||
@@ -312,7 +315,7 @@ public class Platform
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
//
|
|
||||||
// public static void openGUI(@Nonnull final PlayerEntity p, @Nullable final TileEntity tile, @Nullable final AEPartLocation side, @Nonnull final GuiBridge type )
|
// public static void openGUI(@Nonnull final PlayerEntity p, @Nullable final TileEntity tile, @Nullable final AEPartLocation side, @Nonnull final GuiBridge type )
|
||||||
// {
|
// {
|
||||||
// if( isClient() )
|
// if( isClient() )
|
||||||
@@ -320,6 +323,8 @@ public class Platform
|
|||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
|
// tile.getCapability(AEProtectedGui.class, side.getFacing())
|
||||||
|
//
|
||||||
// int x = (int) p.getPosX();
|
// int x = (int) p.getPosX();
|
||||||
// int y = (int) p.getPosY();
|
// int y = (int) p.getPosY();
|
||||||
// int z = (int) p.getPosZ();
|
// int z = (int) p.getPosZ();
|
||||||
|
|||||||
Reference in New Issue
Block a user