-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
68 additions
and
133 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,53 @@ | ||
package com.github.kill05; | ||
|
||
import com.github.kill05.blocks.architectstation.ArchitectTableTileEntity; | ||
import com.github.kill05.blocks.architectstation.inventory.ArchitectStationGuiFactory; | ||
import com.github.kill05.blocks.architectstation.inventory.part.PartModeContainer; | ||
import com.github.kill05.blocks.architectstation.inventory.part.PartModeGui; | ||
import com.github.kill05.blocks.architectstation.inventory.tool.ToolModeContainer; | ||
import com.github.kill05.blocks.architectstation.inventory.tool.ToolModeGui; | ||
import com.github.kill05.packet.PacketSetTableOutput; | ||
import net.minecraft.client.entity.player.EntityPlayerSP; | ||
import net.minecraft.client.gui.GuiScreen; | ||
import net.minecraft.core.entity.player.EntityPlayer; | ||
import net.minecraft.core.player.inventory.Container; | ||
import net.minecraft.server.entity.player.EntityPlayerMP; | ||
import org.jetbrains.annotations.NotNull; | ||
import turniplabs.halplibe.helper.gui.GuiHelper; | ||
import turniplabs.halplibe.helper.gui.factory.block.TileGuiFactory; | ||
import turniplabs.halplibe.helper.gui.registered.RegisteredGui; | ||
|
||
public class ArchitectGuis { | ||
|
||
public static final RegisteredGui PART_MODE = GuiHelper.registerServerGui(ArchitectTools.MOD_ID, "part_mode", new TileGuiFactory<ArchitectTableTileEntity>() { | ||
public static final RegisteredGui PART_MODE = GuiHelper.registerServerGui(ArchitectTools.MOD_ID, "part_mode", new ArchitectStationGuiFactory() { | ||
@Override | ||
public @NotNull GuiScreen createGui(@NotNull RegisteredGui gui, @NotNull EntityPlayerSP player, @NotNull ArchitectTableTileEntity tile) { | ||
return new PartModeGui(tile, player); | ||
} | ||
|
||
@Override | ||
public @NotNull Container createContainer(@NotNull RegisteredGui gui, @NotNull EntityPlayerMP player, @NotNull ArchitectTableTileEntity tile) { | ||
player.playerNetServerHandler.sendPacket(new PacketSetTableOutput(tile.getSelectedPart())); | ||
return new PartModeContainer(tile, player); | ||
} | ||
|
||
@Override | ||
public void onButtonPress(@NotNull RegisteredGui gui, @NotNull EntityPlayer player, int buttonId) { | ||
|
||
public RegisteredGui getNextGui() { | ||
return TOOL_MODE; | ||
} | ||
}); | ||
|
||
public static final RegisteredGui TOOL_MODE = GuiHelper.registerServerGui(ArchitectTools.MOD_ID, "tool_mode", new TileGuiFactory<ArchitectTableTileEntity>() { | ||
public static final RegisteredGui TOOL_MODE = GuiHelper.registerServerGui(ArchitectTools.MOD_ID, "tool_mode", new ArchitectStationGuiFactory() { | ||
@Override | ||
public @NotNull GuiScreen createGui(@NotNull RegisteredGui gui, @NotNull EntityPlayerSP player, @NotNull ArchitectTableTileEntity tile) { | ||
return new ToolModeGui(tile, player); | ||
} | ||
|
||
@Override | ||
public @NotNull Container createContainer(@NotNull RegisteredGui gui, @NotNull EntityPlayerMP player, @NotNull ArchitectTableTileEntity tile) { | ||
player.playerNetServerHandler.sendPacket(new PacketSetTableOutput(tile.getSelectedTool())); | ||
return new ToolModeContainer(tile, player); | ||
} | ||
|
||
@Override | ||
public RegisteredGui getNextGui() { | ||
return PART_MODE; | ||
} | ||
}); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
.../java/com/github/kill05/blocks/architectstation/inventory/ArchitectStationGuiFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.github.kill05.blocks.architectstation.inventory; | ||
|
||
import com.github.kill05.blocks.architectstation.ArchitectTableTileEntity; | ||
import com.github.kill05.items.IArchitectItem; | ||
import net.minecraft.core.entity.player.EntityPlayer; | ||
import org.jetbrains.annotations.NotNull; | ||
import turniplabs.halplibe.helper.gui.factory.block.TileGuiFactory; | ||
import turniplabs.halplibe.helper.gui.registered.RegisteredGui; | ||
|
||
public interface ArchitectStationGuiFactory extends TileGuiFactory<ArchitectTableTileEntity> { | ||
|
||
RegisteredGui getNextGui(); | ||
|
||
@Override | ||
default void onButtonClick(@NotNull RegisteredGui gui, @NotNull EntityPlayer player, @NotNull EntityPlayer clicker, int buttonId) { | ||
if(!(player.craftingInventory instanceof ArchitectStationContainer<?> container)) return; | ||
|
||
if(buttonId == container.getModeValues().size()) { | ||
if(player != clicker) return; | ||
getNextGui().open(player, container.getTile()); | ||
return; | ||
} | ||
|
||
setSelected(container, buttonId); | ||
} | ||
|
||
private static <T extends IArchitectItem> void setSelected(ArchitectStationContainer<T> container, int buttonId) { | ||
boolean inBounds = buttonId >= 0 && buttonId < container.getModeValues().size(); | ||
container.setSelected(inBounds ? container.getModeValues().get(buttonId) : null); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 0 additions & 69 deletions
69
src/main/java/com/github/kill05/packet/PacketSetTableOutput.java
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.