use of com.wuest.prefab.structures.gui.GuiStructure in project MC-Prefab by Brian-Wuest.
the class StructureItem method RegisterGui.
protected void RegisterGui(Class<?> classToRegister) {
try {
GuiStructure userInterface = (GuiStructure) classToRegister.newInstance();
ClientProxy.ModGuis.put(this, userInterface);
} catch (InstantiationException | IllegalAccessException e) {
e.printStackTrace();
}
}
use of com.wuest.prefab.structures.gui.GuiStructure in project MC-Prefab by Brian-Wuest.
the class ClientEventHandler method checkIfStackIsCorrectGui.
public static boolean checkIfStackIsCorrectGui(StructureTagMessage.EnumStructureConfiguration currentConfiguration, ItemStack stack) {
GuiStructure mainHandGui = ClientProxy.ModGuis.get(stack.getItem());
mainHandGui.init();
if (currentConfiguration == mainHandGui.configurationEnum) {
if (currentConfiguration == StructureTagMessage.EnumStructureConfiguration.Basic) {
ItemBasicStructure item = (ItemBasicStructure) stack.getItem();
BasicStructureConfiguration.EnumBasicStructureName basicStructureName = ((BasicStructureConfiguration) StructureRenderHandler.currentConfiguration).basicStructureName;
return item.structureType == basicStructureName;
} else {
return true;
}
}
return false;
}
use of com.wuest.prefab.structures.gui.GuiStructure in project MC-Prefab by Brian-Wuest.
the class ClientProxy method openGuiForItem.
@Override
public void openGuiForItem(UseOnContext itemUseContext) {
for (Map.Entry<StructureItem, GuiStructure> entry : ClientProxy.ModGuis.entrySet()) {
if (entry.getKey() == itemUseContext.getItemInHand().getItem()) {
GuiStructure screen = entry.getValue();
screen.pos = itemUseContext.getClickedPos();
Minecraft.getInstance().setScreen(screen);
}
}
}
Aggregations