cptcorndog
Members-
Posts
7 -
Joined
-
Last visited
Everything posted by cptcorndog
-
Yup, on it, just thought I was missing something obvious for it to be otherwise
-
Thank you that's exactly what I've done. For some reason, the forge example is making the subcategory class private which makes it more cumbersome to access from main code
-
Trying to figure out best way to access Config file variables from code when subcategories are used... (using @Config annotation per Forge). Below is their example of how to make subcategories, however, there seems to be some access issues with this @Config(modid = "modid") public class Configs { public static SubCategory subcat = new SubCategory(); private static class SubCategory { public boolean someBool; public int relatedInt; } } Anyone have a good example of how they are doing this using the @config way Thanks all!
-
Out of curiosity and desire to have not only working but well-written code, wondering the best way to implement IGuiHandler while respecting sidedness The below code works (but only with a @SideOnly annotation in TileEntity when run on dedicated server). If not using annotation will throw: java.lang.RuntimeException: Attempted to load class net/minecraft/client/gui/inventory/GuiContainer for invalid side SERVER I have currently implemented my IGuiHandler as: public class GuiHandler implements IGuiHandler { @Nullable @Override public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { BlockPos pos = new BlockPos(x, y, z); TileEntity te = world.getTileEntity(pos); if (te instanceof IGuiTile) { return ((IGuiTile) te).createContainer(player); } return null; } @Nullable @Override public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { BlockPos pos = new BlockPos(x, y, z); TileEntity te = world.getTileEntity(pos); if (te instanceof IGuiTile) { return ((IGuiTile) te).createGui(player); } return null; } } IGuiTile public interface IGuiTile { Container createContainer(EntityPlayer player); GuiContainer createGui(EntityPlayer player); } and my Tile Entity subclass has the following implementation: @Override public Container createContainer(EntityPlayer player) { return new ContainerFurnace(player.inventory, this); } @SideOnly(Side.CLIENT) @Override public GuiContainer createGui(EntityPlayer player) { return new GuiFurnace(this, new ContainerFurnace(player.inventory, this)); } ps. above code was largely from a Mcjty tutorial as I was learning, and his didn't use the @SideOnly. I don't think he ran his on dedicated server during the tutorial to find this error... Thanks all!
-
What's the proper way to register a tileEntity?
cptcorndog replied to MrDireball's topic in Modder Support
I believe it needs to be a ResourceLocation instead of just a String e.g., GameRegistry.registerTileEntity(DataTileEntity.class, new ResourceLocation(Reference.MOD_ID + ".data_block")); -
[1.12.2] Can't find IItemHandler isItemValid
cptcorndog replied to cptcorndog's topic in Modder Support
The latter is what I'm trying to accomplish but Eclipse is raising an error when I try to override this method, and when I search through ItemStackHandler and IItemHandler I don't see this method declaration... -
Other sources have suggested overriding the isItemValid method of IItemHandler to check if an item can be placed in a slot (e.g., only allow smeltable items in a furnace). I don't see this method available in documentation Should I be performing this check inside an overridden insertItem method instead? Thanks! brand new to modding so bear with me