Fix project setup
This commit is contained in:
@@ -1,81 +1,81 @@
|
||||
package exopandora.worldhandler.gui.category;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import exopandora.worldhandler.Main;
|
||||
import exopandora.worldhandler.gui.content.Content;
|
||||
import exopandora.worldhandler.gui.content.Contents;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.registry.RegistryNamespaced;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class Category
|
||||
{
|
||||
public static final RegistryNamespaced<ResourceLocation, Category> REGISTRY = new RegistryNamespaced<ResourceLocation, Category>();
|
||||
|
||||
private final List<Content> contents;
|
||||
|
||||
public Category()
|
||||
{
|
||||
this.contents = new ArrayList<Content>();
|
||||
}
|
||||
|
||||
public Category(List<Content> contents)
|
||||
{
|
||||
this.contents = contents;
|
||||
}
|
||||
|
||||
public Category(Content... contents)
|
||||
{
|
||||
this.contents = Arrays.asList(contents);
|
||||
}
|
||||
|
||||
public Category add(Content content)
|
||||
{
|
||||
this.contents.add(content);
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<Content> getContents()
|
||||
{
|
||||
return this.contents;
|
||||
}
|
||||
|
||||
public int getSize()
|
||||
{
|
||||
return this.contents.size();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Content getContent(int index)
|
||||
{
|
||||
return this.contents.get(index);
|
||||
}
|
||||
|
||||
public static void registerCategories()
|
||||
{
|
||||
registerCategory(0, "main", new Category(Contents.MAIN, Contents.CONTAINERS, Contents.MULTIPLAYER));
|
||||
registerCategory(1, "entities", new Category(Contents.SUMMON, Contents.PLAYSOUND));
|
||||
registerCategory(2, "items", new Category(Contents.CUSTOM_ITEM, Contents.ENCHANTMENT));
|
||||
registerCategory(3, "blocks", new Category(Contents.EDIT_BLOCKS, Contents.SIGN_EDITOR, Contents.NOTE_EDITOR));
|
||||
registerCategory(4, "world", new Category(Contents.WORLD_INFO, Contents.GAMERULES, Contents.RECIPES));
|
||||
registerCategory(5, "player", new Category(Contents.PLAYER, Contents.EXPERIENCE, Contents.ADVANCEMENTS));
|
||||
registerCategory(6, "scoreboard", new Category(Contents.SCOREBOARD_OBJECTIVES, Contents.SCOREBOARD_TEAMS, Contents.SCOREBOARD_PLAYERS));
|
||||
}
|
||||
|
||||
private static void registerCategory(int id, String textualID, Category category)
|
||||
{
|
||||
registerCategory(id, new ResourceLocation(Main.MODID, textualID), category);
|
||||
}
|
||||
|
||||
private static void registerCategory(int id, ResourceLocation textualID, Category category)
|
||||
{
|
||||
REGISTRY.register(id, textualID, category);
|
||||
}
|
||||
}
|
||||
package exopandora.worldhandler.gui.category;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import exopandora.worldhandler.Main;
|
||||
import exopandora.worldhandler.gui.content.Content;
|
||||
import exopandora.worldhandler.gui.content.Contents;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.registry.RegistryNamespaced;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class Category
|
||||
{
|
||||
public static final RegistryNamespaced<ResourceLocation, Category> REGISTRY = new RegistryNamespaced<ResourceLocation, Category>();
|
||||
|
||||
private final List<Content> contents;
|
||||
|
||||
public Category()
|
||||
{
|
||||
this.contents = new ArrayList<Content>();
|
||||
}
|
||||
|
||||
public Category(List<Content> contents)
|
||||
{
|
||||
this.contents = contents;
|
||||
}
|
||||
|
||||
public Category(Content... contents)
|
||||
{
|
||||
this.contents = Arrays.asList(contents);
|
||||
}
|
||||
|
||||
public Category add(Content content)
|
||||
{
|
||||
this.contents.add(content);
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<Content> getContents()
|
||||
{
|
||||
return this.contents;
|
||||
}
|
||||
|
||||
public int getSize()
|
||||
{
|
||||
return this.contents.size();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Content getContent(int index)
|
||||
{
|
||||
return this.contents.get(index);
|
||||
}
|
||||
|
||||
public static void registerCategories()
|
||||
{
|
||||
registerCategory(0, "main", new Category(Contents.MAIN, Contents.CONTAINERS, Contents.MULTIPLAYER));
|
||||
registerCategory(1, "entities", new Category(Contents.SUMMON));
|
||||
registerCategory(2, "items", new Category(Contents.CUSTOM_ITEM, Contents.ENCHANTMENT));
|
||||
registerCategory(3, "blocks", new Category(Contents.EDIT_BLOCKS, Contents.SIGN_EDITOR, Contents.NOTE_EDITOR));
|
||||
registerCategory(4, "world", new Category(Contents.WORLD_INFO, Contents.GAMERULES, Contents.RECIPES));
|
||||
registerCategory(5, "player", new Category(Contents.PLAYER, Contents.EXPERIENCE, Contents.ADVANCEMENTS));
|
||||
registerCategory(6, "scoreboard", new Category(Contents.SCOREBOARD_OBJECTIVES, Contents.SCOREBOARD_TEAMS, Contents.SCOREBOARD_PLAYERS));
|
||||
}
|
||||
|
||||
private static void registerCategory(int id, String textualID, Category category)
|
||||
{
|
||||
registerCategory(id, new ResourceLocation(Main.MODID, textualID), category);
|
||||
}
|
||||
|
||||
private static void registerCategory(int id, ResourceLocation textualID, Category category)
|
||||
{
|
||||
REGISTRY.register(id, textualID, category);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,115 +1,114 @@
|
||||
package exopandora.worldhandler.gui.content;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import exopandora.worldhandler.Main;
|
||||
import exopandora.worldhandler.gui.button.persistence.ButtonValues;
|
||||
import exopandora.worldhandler.gui.content.impl.ContentAdvancements;
|
||||
import exopandora.worldhandler.gui.content.impl.ContentButcher;
|
||||
import exopandora.worldhandler.gui.content.impl.ContentChangeWorld;
|
||||
import exopandora.worldhandler.gui.content.impl.ContentContainers;
|
||||
import exopandora.worldhandler.gui.content.impl.ContentContinue;
|
||||
import exopandora.worldhandler.gui.content.impl.ContentCustomItem;
|
||||
import exopandora.worldhandler.gui.content.impl.ContentEditBlocks;
|
||||
import exopandora.worldhandler.gui.content.impl.ContentEnchantment;
|
||||
import exopandora.worldhandler.gui.content.impl.ContentExperience;
|
||||
import exopandora.worldhandler.gui.content.impl.ContentGamerules;
|
||||
import exopandora.worldhandler.gui.content.impl.ContentMain;
|
||||
import exopandora.worldhandler.gui.content.impl.ContentMultiplayer;
|
||||
import exopandora.worldhandler.gui.content.impl.ContentNoteEditor;
|
||||
import exopandora.worldhandler.gui.content.impl.ContentPlayer;
|
||||
import exopandora.worldhandler.gui.content.impl.ContentPlaysound;
|
||||
import exopandora.worldhandler.gui.content.impl.ContentPotions;
|
||||
import exopandora.worldhandler.gui.content.impl.ContentRecipes;
|
||||
import exopandora.worldhandler.gui.content.impl.ContentScoreboardObjectives;
|
||||
import exopandora.worldhandler.gui.content.impl.ContentScoreboardPlayers;
|
||||
import exopandora.worldhandler.gui.content.impl.ContentScoreboardTeams;
|
||||
import exopandora.worldhandler.gui.content.impl.ContentSignEditor;
|
||||
import exopandora.worldhandler.gui.content.impl.ContentSummon;
|
||||
import exopandora.worldhandler.gui.content.impl.ContentWorldInfo;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.registry.RegistryNamespaced;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public abstract class Content implements IContent
|
||||
{
|
||||
public static final RegistryNamespaced<ResourceLocation, Content> REGISTRY = new RegistryNamespaced<ResourceLocation, Content>();
|
||||
|
||||
public static void registerContents()
|
||||
{
|
||||
//MAIN
|
||||
registerContent(0, "main", new ContentMain());
|
||||
registerContent(1, "containers", new ContentContainers());
|
||||
registerContent(2, "multiplayer", new ContentMultiplayer());
|
||||
|
||||
//ENTITIES
|
||||
registerContent(3, "summon", new ContentSummon());
|
||||
registerContent(21, "playsound", new ContentPlaysound());
|
||||
|
||||
//ITEMS
|
||||
registerContent(5, "custom_item", new ContentCustomItem());
|
||||
registerContent(4, "enchantment", new ContentEnchantment());
|
||||
|
||||
//BLOCKS
|
||||
registerContent(6, "edit_blocks", new ContentEditBlocks());
|
||||
registerContent(7, "sign_editor", new ContentSignEditor());
|
||||
registerContent(8, "note_editor", new ContentNoteEditor());
|
||||
|
||||
//WORLD
|
||||
registerContent(9, "world", new ContentWorldInfo());
|
||||
registerContent(10, "gamerules", new ContentGamerules());
|
||||
registerContent(11, "recipes", new ContentRecipes());
|
||||
|
||||
//PLAYER
|
||||
registerContent(12, "player", new ContentPlayer());
|
||||
registerContent(13, "experience", new ContentExperience());
|
||||
registerContent(14, "advancements", new ContentAdvancements());
|
||||
|
||||
//SCOREBOARD
|
||||
registerContent(15, "scoreboard_objectives", new ContentScoreboardObjectives());
|
||||
registerContent(16, "scoreboard_teams", new ContentScoreboardTeams());
|
||||
registerContent(17, "scoreboard_players", new ContentScoreboardPlayers());
|
||||
|
||||
//MISC
|
||||
registerContent(18, "change_world", new ContentChangeWorld());
|
||||
registerContent(19, "continue", new ContentContinue());
|
||||
|
||||
//NO CATEGORY
|
||||
registerContent(20, "potions", new ContentPotions());
|
||||
registerContent(21, "butcher", new ContentButcher());
|
||||
}
|
||||
|
||||
private static void registerContent(int id, String textualID, Content content)
|
||||
{
|
||||
registerContent(id, new ResourceLocation(Main.MODID, textualID), content);
|
||||
}
|
||||
|
||||
private static void registerContent(int id, ResourceLocation textualID, Content content)
|
||||
{
|
||||
REGISTRY.register(id, textualID, content);
|
||||
}
|
||||
|
||||
private Map<Object, ButtonValues> persistence;
|
||||
|
||||
public <T> ButtonValues<T> getPersistence(Object id)
|
||||
{
|
||||
if(this.persistence == null)
|
||||
{
|
||||
this.persistence = new HashMap<Object, ButtonValues>();
|
||||
}
|
||||
|
||||
if(this.persistence.containsKey(id))
|
||||
{
|
||||
return this.persistence.get(id);
|
||||
}
|
||||
|
||||
ButtonValues<T> values = new ButtonValues<T>();
|
||||
|
||||
this.persistence.put(id, values);
|
||||
|
||||
return values;
|
||||
}
|
||||
}
|
||||
package exopandora.worldhandler.gui.content;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import exopandora.worldhandler.Main;
|
||||
import exopandora.worldhandler.gui.button.persistence.ButtonValues;
|
||||
import exopandora.worldhandler.gui.content.impl.ContentAdvancements;
|
||||
import exopandora.worldhandler.gui.content.impl.ContentButcher;
|
||||
import exopandora.worldhandler.gui.content.impl.ContentChangeWorld;
|
||||
import exopandora.worldhandler.gui.content.impl.ContentContainers;
|
||||
import exopandora.worldhandler.gui.content.impl.ContentContinue;
|
||||
import exopandora.worldhandler.gui.content.impl.ContentCustomItem;
|
||||
import exopandora.worldhandler.gui.content.impl.ContentEditBlocks;
|
||||
import exopandora.worldhandler.gui.content.impl.ContentEnchantment;
|
||||
import exopandora.worldhandler.gui.content.impl.ContentExperience;
|
||||
import exopandora.worldhandler.gui.content.impl.ContentGamerules;
|
||||
import exopandora.worldhandler.gui.content.impl.ContentMain;
|
||||
import exopandora.worldhandler.gui.content.impl.ContentMultiplayer;
|
||||
import exopandora.worldhandler.gui.content.impl.ContentNoteEditor;
|
||||
import exopandora.worldhandler.gui.content.impl.ContentPlayer;
|
||||
import exopandora.worldhandler.gui.content.impl.ContentPlaysound;
|
||||
import exopandora.worldhandler.gui.content.impl.ContentPotions;
|
||||
import exopandora.worldhandler.gui.content.impl.ContentRecipes;
|
||||
import exopandora.worldhandler.gui.content.impl.ContentScoreboardObjectives;
|
||||
import exopandora.worldhandler.gui.content.impl.ContentScoreboardPlayers;
|
||||
import exopandora.worldhandler.gui.content.impl.ContentScoreboardTeams;
|
||||
import exopandora.worldhandler.gui.content.impl.ContentSignEditor;
|
||||
import exopandora.worldhandler.gui.content.impl.ContentSummon;
|
||||
import exopandora.worldhandler.gui.content.impl.ContentWorldInfo;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.registry.RegistryNamespaced;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public abstract class Content implements IContent
|
||||
{
|
||||
public static final RegistryNamespaced<ResourceLocation, Content> REGISTRY = new RegistryNamespaced<ResourceLocation, Content>();
|
||||
|
||||
public static void registerContents()
|
||||
{
|
||||
//MAIN
|
||||
registerContent(0, "main", new ContentMain());
|
||||
registerContent(1, "containers", new ContentContainers());
|
||||
registerContent(2, "multiplayer", new ContentMultiplayer());
|
||||
|
||||
//ENTITIES
|
||||
registerContent(3, "summon", new ContentSummon());
|
||||
|
||||
//ITEMS
|
||||
registerContent(5, "custom_item", new ContentCustomItem());
|
||||
registerContent(4, "enchantment", new ContentEnchantment());
|
||||
|
||||
//BLOCKS
|
||||
registerContent(6, "edit_blocks", new ContentEditBlocks());
|
||||
registerContent(7, "sign_editor", new ContentSignEditor());
|
||||
registerContent(8, "note_editor", new ContentNoteEditor());
|
||||
|
||||
//WORLD
|
||||
registerContent(9, "world", new ContentWorldInfo());
|
||||
registerContent(10, "gamerules", new ContentGamerules());
|
||||
registerContent(11, "recipes", new ContentRecipes());
|
||||
|
||||
//PLAYER
|
||||
registerContent(12, "player", new ContentPlayer());
|
||||
registerContent(13, "experience", new ContentExperience());
|
||||
registerContent(14, "advancements", new ContentAdvancements());
|
||||
|
||||
//SCOREBOARD
|
||||
registerContent(15, "scoreboard_objectives", new ContentScoreboardObjectives());
|
||||
registerContent(16, "scoreboard_teams", new ContentScoreboardTeams());
|
||||
registerContent(17, "scoreboard_players", new ContentScoreboardPlayers());
|
||||
|
||||
//MISC
|
||||
registerContent(18, "change_world", new ContentChangeWorld());
|
||||
registerContent(19, "continue", new ContentContinue());
|
||||
|
||||
//NO CATEGORY
|
||||
registerContent(20, "potions", new ContentPotions());
|
||||
registerContent(21, "butcher", new ContentButcher());
|
||||
}
|
||||
|
||||
private static void registerContent(int id, String textualID, Content content)
|
||||
{
|
||||
registerContent(id, new ResourceLocation(Main.MODID, textualID), content);
|
||||
}
|
||||
|
||||
private static void registerContent(int id, ResourceLocation textualID, Content content)
|
||||
{
|
||||
REGISTRY.register(id, textualID, content);
|
||||
}
|
||||
|
||||
private Map<Object, ButtonValues> persistence;
|
||||
|
||||
public <T> ButtonValues<T> getPersistence(Object id)
|
||||
{
|
||||
if(this.persistence == null)
|
||||
{
|
||||
this.persistence = new HashMap<Object, ButtonValues>();
|
||||
}
|
||||
|
||||
if(this.persistence.containsKey(id))
|
||||
{
|
||||
return this.persistence.get(id);
|
||||
}
|
||||
|
||||
ButtonValues<T> values = new ButtonValues<T>();
|
||||
|
||||
this.persistence.put(id, values);
|
||||
|
||||
return values;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,91 +1,89 @@
|
||||
package exopandora.worldhandler.gui.content;
|
||||
|
||||
import exopandora.worldhandler.Main;
|
||||
import exopandora.worldhandler.gui.content.impl.ContentContinue;
|
||||
import exopandora.worldhandler.gui.content.impl.abstr.ContentChild;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class Contents
|
||||
{
|
||||
public static final Content MAIN;
|
||||
public static final Content CONTAINERS;
|
||||
public static final Content MULTIPLAYER;
|
||||
|
||||
public static final Content SUMMON;
|
||||
public static final Content PLAYSOUND;
|
||||
|
||||
public static final Content CUSTOM_ITEM;
|
||||
public static final Content ENCHANTMENT;
|
||||
|
||||
public static final Content EDIT_BLOCKS;
|
||||
public static final Content SIGN_EDITOR;
|
||||
public static final Content NOTE_EDITOR;
|
||||
|
||||
public static final Content WORLD_INFO;
|
||||
public static final Content GAMERULES;
|
||||
public static final Content RECIPES;
|
||||
|
||||
public static final Content PLAYER;
|
||||
public static final Content EXPERIENCE;
|
||||
public static final Content ADVANCEMENTS;
|
||||
|
||||
public static final Content SCOREBOARD_OBJECTIVES;
|
||||
public static final Content SCOREBOARD_TEAMS;
|
||||
public static final Content SCOREBOARD_PLAYERS;
|
||||
|
||||
public static final ContentChild CHANGE_WORLD;
|
||||
public static final ContentContinue CONTINUE;
|
||||
|
||||
public static final ContentChild POTIONS;
|
||||
public static final ContentChild BUTCHER;
|
||||
|
||||
static
|
||||
{
|
||||
MAIN = Contents.getRegisteredContainer("main");
|
||||
CONTAINERS = Contents.getRegisteredContainer("containers");
|
||||
MULTIPLAYER = Contents.getRegisteredContainer("multiplayer");
|
||||
|
||||
SUMMON = Contents.getRegisteredContainer("summon");
|
||||
PLAYSOUND = Contents.getRegisteredContainer("playsound");
|
||||
|
||||
CUSTOM_ITEM = Contents.getRegisteredContainer("custom_item");
|
||||
ENCHANTMENT = Contents.getRegisteredContainer("enchantment");
|
||||
|
||||
EDIT_BLOCKS = Contents.getRegisteredContainer("edit_blocks");
|
||||
SIGN_EDITOR = Contents.getRegisteredContainer("sign_editor");
|
||||
NOTE_EDITOR = Contents.getRegisteredContainer("note_editor");
|
||||
|
||||
WORLD_INFO = Contents.getRegisteredContainer("world");
|
||||
GAMERULES = Contents.getRegisteredContainer("gamerules");
|
||||
RECIPES = Contents.getRegisteredContainer("recipes");
|
||||
|
||||
PLAYER = Contents.getRegisteredContainer("player");
|
||||
EXPERIENCE = Contents.getRegisteredContainer("experience");
|
||||
ADVANCEMENTS = Contents.getRegisteredContainer("advancements");
|
||||
|
||||
SCOREBOARD_OBJECTIVES = Contents.getRegisteredContainer("scoreboard_objectives");
|
||||
SCOREBOARD_TEAMS = Contents.getRegisteredContainer("scoreboard_teams");
|
||||
SCOREBOARD_PLAYERS = Contents.getRegisteredContainer("scoreboard_players");
|
||||
|
||||
CHANGE_WORLD = Contents.getRegisteredContainer("change_world");
|
||||
CONTINUE = Contents.getRegisteredContainer("continue");
|
||||
|
||||
POTIONS = Contents.getRegisteredContainer("potions");
|
||||
BUTCHER = Contents.getRegisteredContainer("butcher");
|
||||
}
|
||||
|
||||
private static <T extends Content> T getRegisteredContainer(String name)
|
||||
{
|
||||
Content content = Content.REGISTRY.getObject(new ResourceLocation(Main.MODID, name));
|
||||
|
||||
if(content == null)
|
||||
{
|
||||
throw new IllegalStateException("Invalid Container requested: " + name);
|
||||
}
|
||||
|
||||
return (T) content;
|
||||
}
|
||||
package exopandora.worldhandler.gui.content;
|
||||
|
||||
import exopandora.worldhandler.Main;
|
||||
import exopandora.worldhandler.gui.content.impl.ContentContinue;
|
||||
import exopandora.worldhandler.gui.content.impl.abstr.ContentChild;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class Contents
|
||||
{
|
||||
public static final Content MAIN;
|
||||
public static final Content CONTAINERS;
|
||||
public static final Content MULTIPLAYER;
|
||||
|
||||
public static final Content SUMMON;
|
||||
|
||||
public static final Content CUSTOM_ITEM;
|
||||
public static final Content ENCHANTMENT;
|
||||
|
||||
public static final Content EDIT_BLOCKS;
|
||||
public static final Content SIGN_EDITOR;
|
||||
public static final Content NOTE_EDITOR;
|
||||
|
||||
public static final Content WORLD_INFO;
|
||||
public static final Content GAMERULES;
|
||||
public static final Content RECIPES;
|
||||
|
||||
public static final Content PLAYER;
|
||||
public static final Content EXPERIENCE;
|
||||
public static final Content ADVANCEMENTS;
|
||||
|
||||
public static final Content SCOREBOARD_OBJECTIVES;
|
||||
public static final Content SCOREBOARD_TEAMS;
|
||||
public static final Content SCOREBOARD_PLAYERS;
|
||||
|
||||
public static final ContentChild CHANGE_WORLD;
|
||||
public static final ContentContinue CONTINUE;
|
||||
|
||||
public static final ContentChild POTIONS;
|
||||
public static final ContentChild BUTCHER;
|
||||
|
||||
static
|
||||
{
|
||||
MAIN = Contents.getRegisteredContainer("main");
|
||||
CONTAINERS = Contents.getRegisteredContainer("containers");
|
||||
MULTIPLAYER = Contents.getRegisteredContainer("multiplayer");
|
||||
|
||||
SUMMON = Contents.getRegisteredContainer("summon");
|
||||
|
||||
CUSTOM_ITEM = Contents.getRegisteredContainer("custom_item");
|
||||
ENCHANTMENT = Contents.getRegisteredContainer("enchantment");
|
||||
|
||||
EDIT_BLOCKS = Contents.getRegisteredContainer("edit_blocks");
|
||||
SIGN_EDITOR = Contents.getRegisteredContainer("sign_editor");
|
||||
NOTE_EDITOR = Contents.getRegisteredContainer("note_editor");
|
||||
|
||||
WORLD_INFO = Contents.getRegisteredContainer("world");
|
||||
GAMERULES = Contents.getRegisteredContainer("gamerules");
|
||||
RECIPES = Contents.getRegisteredContainer("recipes");
|
||||
|
||||
PLAYER = Contents.getRegisteredContainer("player");
|
||||
EXPERIENCE = Contents.getRegisteredContainer("experience");
|
||||
ADVANCEMENTS = Contents.getRegisteredContainer("advancements");
|
||||
|
||||
SCOREBOARD_OBJECTIVES = Contents.getRegisteredContainer("scoreboard_objectives");
|
||||
SCOREBOARD_TEAMS = Contents.getRegisteredContainer("scoreboard_teams");
|
||||
SCOREBOARD_PLAYERS = Contents.getRegisteredContainer("scoreboard_players");
|
||||
|
||||
CHANGE_WORLD = Contents.getRegisteredContainer("change_world");
|
||||
CONTINUE = Contents.getRegisteredContainer("continue");
|
||||
|
||||
POTIONS = Contents.getRegisteredContainer("potions");
|
||||
BUTCHER = Contents.getRegisteredContainer("butcher");
|
||||
}
|
||||
|
||||
private static <T extends Content> T getRegisteredContainer(String name)
|
||||
{
|
||||
Content content = Content.REGISTRY.getObject(new ResourceLocation(Main.MODID, name));
|
||||
|
||||
if(content == null)
|
||||
{
|
||||
throw new IllegalStateException("Invalid Container requested: " + name);
|
||||
}
|
||||
|
||||
return (T) content;
|
||||
}
|
||||
}
|
||||
@@ -1,470 +0,0 @@
|
||||
package exopandora.worldhandler.gui.content.impl;
|
||||
|
||||
import java.nio.FloatBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.Stack;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import org.lwjgl.BufferUtils;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.util.vector.Vector3f;
|
||||
|
||||
import exopandora.worldhandler.gui.button.GuiButtonWorldHandler;
|
||||
import exopandora.worldhandler.gui.category.Categories;
|
||||
import exopandora.worldhandler.gui.category.Category;
|
||||
import exopandora.worldhandler.gui.container.Container;
|
||||
import exopandora.worldhandler.gui.content.Content;
|
||||
import exopandora.worldhandler.gui.content.Contents;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.inventory.GuiInventory;
|
||||
import net.minecraft.client.model.ModelBox;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.client.renderer.entity.RenderLiving;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityList;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
public class ContentPlaysound extends Content
|
||||
{
|
||||
@Override
|
||||
public void initButtons(Container container, int x, int y)
|
||||
{
|
||||
container.add(new GuiButtonWorldHandler(0, x, y + 96, 114, 20, I18n.format("gui.worldhandler.generic.back")));
|
||||
container.add(new GuiButtonWorldHandler(1, x + 118, y + 96, 114, 20, I18n.format("gui.worldhandler.generic.backToGame")));
|
||||
|
||||
container.add(new GuiButtonWorldHandler(2, x + 118 / 2, y + 72, 114, 20, "Test"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(Container container, GuiButton button)
|
||||
{
|
||||
if(button.id == 2)
|
||||
{
|
||||
try
|
||||
{
|
||||
GlStateManager.pushMatrix();
|
||||
FloatBuffer buffer = BufferUtils.createFloatBuffer(16);
|
||||
buffer.clear();
|
||||
buffer.put(new float[] {1, 0, 0, 1,
|
||||
0, 1, 0, 0,
|
||||
0, 0, 1, 0,
|
||||
0, 0, 0, 0});
|
||||
buffer.rewind();
|
||||
|
||||
System.out.println("-----------------");
|
||||
for(int x = 0; x < buffer.capacity(); x++)
|
||||
{
|
||||
if(x % 4 == 0 && x > 0)
|
||||
{
|
||||
System.out.println();
|
||||
}
|
||||
System.out.printf("%02.2f ", buffer.get(x));
|
||||
}
|
||||
System.out.println();
|
||||
|
||||
GL11.glLoadMatrix(buffer);
|
||||
GlStateManager.matrixMode(GL11.GL_MODELVIEW);
|
||||
|
||||
GlStateManager.rotate(90, 0, 1, 0);
|
||||
// GlStateManager.translate(1, 1, 1);
|
||||
|
||||
float[] array = new float[buffer.capacity()];
|
||||
GlStateManager.getFloat(GL11.GL_MODELVIEW_MATRIX, buffer);
|
||||
buffer.get(array);
|
||||
|
||||
System.out.println("-----------------");
|
||||
for(int x = 0; x < array.length; x++)
|
||||
{
|
||||
if(x % 4 == 0 && x > 0)
|
||||
{
|
||||
System.out.println();
|
||||
}
|
||||
System.out.printf("%02.2f ", array[x]);
|
||||
}
|
||||
System.out.println();
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Vector3f low = null;
|
||||
private Vector3f high = null;
|
||||
|
||||
@Override
|
||||
public void drawScreen(Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
int width = x + 232 / 2;
|
||||
int height = y + 50;
|
||||
|
||||
container.drawRect(width - 20, height - 40, width + 20, height, 0xFFFFFFFF);
|
||||
|
||||
Class<? extends Entity> entityClass = EntityList.getClass(new ResourceLocation("witch"));
|
||||
|
||||
try
|
||||
{
|
||||
Entity entity = EntityList.newEntity(entityClass, Minecraft.getMinecraft().world);
|
||||
// entity.ticksExisted++;
|
||||
|
||||
// if(entity instanceof EntityLiving)
|
||||
// {
|
||||
// ((EntityLiving) entity).onInitialSpawn(new DifficultyInstance(EnumDifficulty.NORMAL, 0, 0, 0), null);
|
||||
// }
|
||||
|
||||
if(entity instanceof EntityLivingBase)
|
||||
{
|
||||
int maxWidth = 40;
|
||||
int maxHeight = 40;
|
||||
|
||||
int xScale = 0;
|
||||
int yScale = 0;
|
||||
|
||||
Render<? extends Entity> render = Minecraft.getMinecraft().getRenderManager().entityRenderMap.get(entity.getClass());
|
||||
|
||||
if(render instanceof RenderLiving)
|
||||
{
|
||||
final RenderLiving living = (RenderLiving) render;
|
||||
living.getMainModel().setRotationAngles(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 1.0F, entity);
|
||||
|
||||
System.out.println("--------------");
|
||||
|
||||
this.high = new Vector3f(Float.MIN_VALUE, Float.MIN_VALUE, Float.MIN_VALUE);
|
||||
this.low = new Vector3f(Float.MAX_VALUE, Float.MAX_VALUE, Float.MAX_VALUE);
|
||||
|
||||
this.iterateModel(this.getBaseModels(living.getMainModel().boxList), new Stack(), vectors ->
|
||||
{
|
||||
for(int i = 0; i < vectors.length; i++)
|
||||
{
|
||||
this.low = new Vector3f(Math.min(this.low.x, vectors[i].x), Math.min(this.low.y, vectors[i].y), Math.min(this.low.z, vectors[i].z));
|
||||
this.high = new Vector3f(Math.max(this.high.x, vectors[i].x), Math.max(this.high.y, vectors[i].y), Math.max(this.high.z, vectors[i].z));
|
||||
}
|
||||
});
|
||||
|
||||
// System.out.println(this.high.y - this.low.y);
|
||||
|
||||
float widthInBlocks = Math.abs(this.high.x - this.low.x) / 16;
|
||||
float heightInBlocks = Math.abs(this.high.y - this.low.y) / 16;
|
||||
|
||||
// System.out.println("Height: " + heightInBlocks);
|
||||
// System.out.println("Ent: " + entity.height);
|
||||
// System.out.println("High: " + this.high);
|
||||
// System.out.println("Low: " + this.low);
|
||||
|
||||
xScale = MathHelper.floor(maxWidth / widthInBlocks);
|
||||
yScale = MathHelper.floor(maxHeight / heightInBlocks);
|
||||
}
|
||||
|
||||
// xScale = MathHelper.floor(maxWidth / entity.width);
|
||||
// yScale = MathHelper.floor(maxHeight / entity.height);
|
||||
|
||||
// System.out.println(low);
|
||||
// System.out.println(high);
|
||||
int scale = Math.min(xScale, yScale);
|
||||
int yAdjust = scale == xScale ? (maxHeight - scale) / 2 : 0;
|
||||
|
||||
// System.out.println(scale);
|
||||
GuiInventory.drawEntityOnScreen(width, height - yAdjust, scale, (float) width - mouseX, (float) height - mouseY - entity.getEyeHeight() * yScale - yAdjust, (EntityLivingBase) entity);
|
||||
}
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void iterateModel(List<ModelRenderer> list, Stack<ModelShifts> shifts, Consumer<Vector3f[]> consumer)
|
||||
{
|
||||
for(ModelRenderer model : list)
|
||||
{
|
||||
if(!model.isHidden)
|
||||
{
|
||||
if(model.showModel)
|
||||
{
|
||||
/*
|
||||
* offset = box width/height/depth
|
||||
* point = box offset x/y/z
|
||||
* rotation = rotation
|
||||
*/
|
||||
Vector3f modelOffset = new Vector3f(model.offsetX, model.offsetY, model.offsetZ);
|
||||
Vector3f modelRotationAngle = new Vector3f(model.rotateAngleX, model.rotateAngleY, model.rotateAngleZ);
|
||||
Vector3f modelRotationPoint = new Vector3f(model.rotationPointX, model.rotationPointY, model.rotationPointZ);
|
||||
|
||||
shifts.push(new ModelShifts(modelOffset, modelRotationAngle, modelRotationPoint));
|
||||
|
||||
if(model.childModels != null)
|
||||
{
|
||||
this.iterateModel(model.childModels, shifts, consumer);
|
||||
}
|
||||
|
||||
for(ModelBox box : model.cubeList)
|
||||
{
|
||||
if(box != null)
|
||||
{
|
||||
Vector3f[] vectors = new Vector3f[]
|
||||
{
|
||||
new Vector3f(box.posX1, box.posY1, box.posZ1),
|
||||
new Vector3f(box.posX2, box.posY1, box.posZ1),
|
||||
new Vector3f(box.posX2, box.posY1, box.posZ2),
|
||||
new Vector3f(box.posX1, box.posY1, box.posZ2),
|
||||
new Vector3f(box.posX1, box.posY2, box.posZ1),
|
||||
new Vector3f(box.posX2, box.posY2, box.posZ1),
|
||||
new Vector3f(box.posX2, box.posY2, box.posZ2),
|
||||
new Vector3f(box.posX1, box.posY2, box.posZ2)
|
||||
};
|
||||
|
||||
// System.out.println(shifts.size());
|
||||
|
||||
for(int x = 0; x < 2; x++)
|
||||
{
|
||||
for(ModelShifts shift : shifts)
|
||||
{
|
||||
this.translate(shift.getOffset(), x, vectors);
|
||||
// GlStateManager.translate(shift.getOffset().x, shift.getOffset().y, shift.getOffset().z);
|
||||
|
||||
if(shift.getAngle().equals(ORIGIN))
|
||||
{
|
||||
if(!shift.getPoint().equals(ORIGIN))
|
||||
{
|
||||
this.translate(shift.getPoint(), x, vectors);
|
||||
// GlStateManager.translate(shift.getPoint().x, shift.getPoint().y, shift.getPoint().z);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.translate(shift.getPoint(), x, vectors);
|
||||
// GlStateManager.translate(shift.getPoint().x, shift.getPoint().y, shift.getPoint().z);
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
FloatBuffer buffer = BufferUtils.createFloatBuffer(16);
|
||||
buffer.clear();
|
||||
this.loadMatrix(buffer, x, vectors);
|
||||
|
||||
if(shift.getAngle().y != 0.0F)
|
||||
{
|
||||
GlStateManager.rotate(-shift.getAngle().y * RADIANT, 0.0F, 0.0F, 1.0F);
|
||||
}
|
||||
|
||||
if(shift.getAngle().z != 0.0F)
|
||||
{
|
||||
GlStateManager.rotate(-shift.getAngle().z * RADIANT, 0.0F, 1.0F, 0.0F);
|
||||
}
|
||||
|
||||
if(shift.getAngle().x != 0.0F)
|
||||
{
|
||||
GlStateManager.rotate(-shift.getAngle().x * RADIANT, 1.0F, 0.0F, 0.0F);
|
||||
}
|
||||
|
||||
this.getMatrix(buffer, x, vectors);
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(Vector3f vec : vectors)
|
||||
{
|
||||
System.out.println(vec.x + "\t" + -vec.y + "\t" + vec.z);
|
||||
}
|
||||
|
||||
consumer.accept(vectors);
|
||||
}
|
||||
}
|
||||
|
||||
shifts.pop();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void translate(Vector3f translation, int vectorArrayIndex, Vector3f[] vectors)
|
||||
{
|
||||
int arrayPartLength = 4;
|
||||
int arrayPart = vectorArrayIndex * arrayPartLength;
|
||||
int arrayPartMax = arrayPart + arrayPartLength;
|
||||
|
||||
for(int y = arrayPart; y < arrayPartMax; y++)
|
||||
{
|
||||
Vector3f.add(vectors[y], translation, vectors[y]);
|
||||
}
|
||||
}
|
||||
|
||||
private void loadMatrix(FloatBuffer buffer, int vectorArrayIndex, Vector3f[] vectors)
|
||||
{
|
||||
GlStateManager.matrixMode(GL11.GL_MODELVIEW);
|
||||
|
||||
for(int y = 0; y < buffer.capacity(); y++)
|
||||
{
|
||||
final int index = vectorArrayIndex * 4 + y % 4;
|
||||
|
||||
if(y < 4)
|
||||
{
|
||||
buffer.put(vectors[index].x);
|
||||
}
|
||||
else if(y >= 4 && y < 8)
|
||||
{
|
||||
buffer.put(vectors[index].y);
|
||||
}
|
||||
else if(y >= 8 && y < 12)
|
||||
{
|
||||
buffer.put(vectors[index].z);
|
||||
}
|
||||
else
|
||||
{
|
||||
buffer.put(0);
|
||||
}
|
||||
}
|
||||
|
||||
buffer.rewind();
|
||||
GL11.glLoadMatrix(buffer);
|
||||
}
|
||||
|
||||
private void getMatrix(FloatBuffer buffer, int vectorArrayIndex, Vector3f[] vectors)
|
||||
{
|
||||
float[] array = new float[buffer.capacity()];
|
||||
GlStateManager.getFloat(GL11.GL_MODELVIEW_MATRIX, buffer);
|
||||
buffer.get(array);
|
||||
|
||||
for(int y = 0; y < array.length; y++)
|
||||
{
|
||||
final int index = vectorArrayIndex * 4 + y % 4;
|
||||
|
||||
if(y < 4)
|
||||
{
|
||||
vectors[index].x = array[y];
|
||||
}
|
||||
else if(y >= 4 && y < 8)
|
||||
{
|
||||
vectors[index].y = array[y];
|
||||
}
|
||||
else if(y >= 8 && y < 12)
|
||||
{
|
||||
vectors[index].z = array[y];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static final class ModelShifts
|
||||
{
|
||||
private final Vector3f offset;
|
||||
private final Vector3f angle;
|
||||
private final Vector3f point;
|
||||
|
||||
public ModelShifts(Vector3f offset, Vector3f angle, Vector3f point)
|
||||
{
|
||||
this.offset = offset;
|
||||
this.angle = angle;
|
||||
this.point = point;
|
||||
}
|
||||
|
||||
public Vector3f getOffset()
|
||||
{
|
||||
return this.offset;
|
||||
}
|
||||
|
||||
public Vector3f getAngle()
|
||||
{
|
||||
return this.angle;
|
||||
}
|
||||
|
||||
public Vector3f getPoint()
|
||||
{
|
||||
return this.point;
|
||||
}
|
||||
}
|
||||
|
||||
//TODO
|
||||
@Deprecated
|
||||
private void printGLMatrix()
|
||||
{
|
||||
FloatBuffer buffer = BufferUtils.createFloatBuffer(16);
|
||||
GL11.glGetFloat(GL11.GL_MODELVIEW_MATRIX, buffer);
|
||||
float[] array = new float[buffer.capacity()];
|
||||
buffer.get(array);
|
||||
|
||||
System.out.println();
|
||||
|
||||
for(int x = 0; x < buffer.capacity(); x += 4)
|
||||
{
|
||||
System.out.println(String.format("%02.2f %02.2f %02.2f %02.2f", array[x], array[x + 1], array[x + 2], array[x + 3]));
|
||||
}
|
||||
}
|
||||
|
||||
private static final float RADIANT = (float) (180F / Math.PI);
|
||||
private static final Vector3f ORIGIN = new Vector3f();
|
||||
|
||||
private List<ModelRenderer> getBaseModels(List<ModelRenderer> list)
|
||||
{
|
||||
Set<ModelRenderer> baseModels = this.getModels(list);
|
||||
baseModels.removeAll(this.getAllChildren(list));
|
||||
return new ArrayList<ModelRenderer>(baseModels);
|
||||
}
|
||||
|
||||
private Set<ModelRenderer> getAllChildren(List<ModelRenderer> list)
|
||||
{
|
||||
Set<ModelRenderer> result = new HashSet<ModelRenderer>();
|
||||
|
||||
for(ModelRenderer model : list)
|
||||
{
|
||||
if(model.childModels != null)
|
||||
{
|
||||
result.addAll(this.getModels(model.childModels));
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private Set<ModelRenderer> getModels(List<ModelRenderer> list)
|
||||
{
|
||||
Set<ModelRenderer> result = new HashSet<ModelRenderer>();
|
||||
|
||||
for(ModelRenderer model : list)
|
||||
{
|
||||
if(!result.contains(model))
|
||||
{
|
||||
result.add(model);
|
||||
}
|
||||
|
||||
if(model.childModels != null)
|
||||
{
|
||||
result.addAll(this.getModels(model.childModels));
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Category getCategory()
|
||||
{
|
||||
return Categories.ENTITIES;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle()
|
||||
{
|
||||
return "Playsound";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTabTitle()
|
||||
{
|
||||
return "Playsound";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Content getActiveContent()
|
||||
{
|
||||
return Contents.PLAYSOUND;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user