Jump to content

Elrol_Arrowsend

Members
  • Posts

    182
  • Joined

  • Last visited

Everything posted by Elrol_Arrowsend

  1. Managed to figure out what the issue was. Turns out that at some point the code for configs changed, and when you register them, you now need the file name as well. I also updated my forge version, not sure which of these fixed it but I am betting it was the former. Anyway, when you register your config, make sure to change this: ModLoadingContext.get().registerConfig(ModConfig.Type.SERVER, Config.server_config); Config.loadConfig(Config.server_config, FMLPaths.CONFIGDIR.get().resolve("server-utils.toml").toString()); to this: ModLoadingContext.get().registerConfig(ModConfig.Type.SERVER, Config.server_config, "server-utils.toml"); Config.loadConfig(Config.server_config, FMLPaths.CONFIGDIR.get().resolve("server-utils.toml").toString());
  2. Still have not been able to fix the issue, is there something I am doing wrong?
  3. I am not sure what the issue is. The config loads, the values are used and everything works, the only thing that doesn't is when I change the file, then relaunch minecraft, the values that are loaded are the default ones, and not the same as the hard config file. I hope that made sense, and this is a link to the updated code: https://github.com/Elrol/Server-Utilities/tree/master/src/main/java/com/github/elrol/ElrolsUtilities/config the files that I added for the config, are Config.Java and CommandConfig.java And its loaded from the main() in Main.java Any help is appreciated
  4. Alright, well thanks for the help, but the file itself would be more to store configurations made while ingame. So this should work perfectly well, I may change how it works later on, but for now its more of a personal project for a server im hosting for like 2 people. XD
  5. Basically what I am making is a config file that is world dependent so that wouldn't work I dont think.
  6. I am looking to save a json for use in my mod. And since it will contain information realting to the specific game/server I would need to save the file in different locations for each, or change my json to have different trees for each save. I think the easiest way would just be to change the file location, but if I cant, then I would want to get the name of the singleplayer worlds, to seperate the json files. Any help is appreciated.
  7. The name kind of says it all, I don't know how I would go about attaching a lead. Any help on this would be awesome.
  8. Worked like a charm. Changed it to the following and it worked. @Mod.EventBusSubscriber(bus=Mod.EventBusSubscriber.Bus.FORGE) public class EntityInteractHandler { @SubscribeEvent public static void onEntityInteract(EntityInteract event) { } }
  9. Alright, is that for both of them or do they need to be in different event handlers?
  10. I am looking to find out either what event I need to subscribe to, or whatever is wrong with my current code. I am looking to find what event is fired when the player right clicks on the minecarts. The one that I currently have, has a print method that will print out that the player clicked on an entity, but that is not firing when I test it. The code that I have is as follows: @Mod.EventBusSubscriber(bus=Mod.EventBusSubscriber.Bus.MOD) public static class RegistryEvents { @SubscribeEvent public static void onBlocksRegistry(final RegistryEvent.Register<Block> blockRegistryEvent) { // register a new block here LOGGER.info("HELLO from Register Block"); } @SubscribeEvent public static void onEntityInteract(EntityInteractSpecific event) { LOGGER.info("Right clicked an entity"); } } this is in the main file that has the @Mod. I also know that the event handler is registered, since the first print method that is ran when the block registry is loaded is printed to the console.
  11. Ah, alright, makes sense then. I will see if I can get it working tomorrow. Thanks for the help, I will post back here when I get something drummed up.
  12. Ok, im not sure I am following, I have the player, and this event, but how do I add a collision box to it? @SubscribeEvent public void onChunkEnter(EntityEvent.EnteringChunk event) { if(event.getEntity() instanceof EntityPlayerMP) { EntityPlayerMP player = (EntityPlayerMP)event.getEntity(); ChatMethods.error(player, "You can not go that way!"); } }
  13. How would I use the GetCollisionBoxes to do that, The event I was looking at was when an entity entered a chunk?
  14. I am trying to keep a player out of a certain area of the map, and the method I was using wasn't going to work. The event I was using cant be cancled so it would tell me that they entered the area but would not stop them from doing so. What would be the best way to do this?
  15. This was going to be for a forge plugin that I am working on, but went with the not annotation based config instead. There wouldnt be a GUI to change it since the clients cant run the mod. Thanks though lol.
  16. I am using the annotations to make a config. The file is made, but when I try to change the file, nothing happens. @Config(modid = PluginInfo.PLUGINID, name = "safari_config", type = Type.INSTANCE) public class GeneralConfig { @Name("General Options") public static General general = new General(); @Name("Safari Bounds") public static SafariBounds bounds = new SafariBounds(); public static class General { public String name = "name"; } public static class SafariBounds { @Name("MaxCoords") @Comment("A list of the maximum coords of a selection") public static List<BlockPos> maxValues = new ArrayList<BlockPos>(); @Name("MinCoords") @Comment("A list of the minimum coords of a selection") public static List<BlockPos> minValues = new ArrayList<BlockPos>(); } public static void addRegion(List<BlockPos> bounds) { List<BlockPos> max = SafariBounds.maxValues; List<BlockPos> min = SafariBounds.minValues; max.add(bounds.get(0)); min.add(bounds.get(1)); SafariBounds.maxValues = max; SafariBounds.minValues = min; } } I am sure that I am doing something wrong, so if you can help me out that would be awesome. -Edit- I have the addRegion() running to change the config and no errors are thrown, but no changes are made.
  17. It seems to be working, thanks a ton as always!
  18. Am am trying to check when a player presses certain buttons, however, my event acts like its not registered. I know the method is being called that registers it, but when I press a key the debug method doesnt fire off. KeyPressHandler: @SideOnly(value=Side.CLIENT) @SubscribeEvent public void onKeyPress(InputEvent.KeyInputEvent event) { System.out.println("Key Pressed"); EntityPlayerSP player = Minecraft.getMinecraft().player; World world = player.world; int blockX = MathHelper.floor(((double)player.posX)); int blockY = MathHelper.floor((double)(player.posY - 0.2 - (double)player.height)) + 3; int blockZ = MathHelper.floor(((double)player.posX)); if (Minecraft.getMinecraft().gameSettings.keyBindSneak.isPressed()) { Methods.descendFloor(world, (EntityPlayer)player, blockX, blockY, blockZ); return; } if (Minecraft.getMinecraft().gameSettings.keyBindJump.isPressed()) { Methods.ascendFloor(world, (EntityPlayer)player, blockX, blockY, blockZ); return; } } ElevatorMain#registerHandler(): public static void registerHandler() { System.out.println("Registering Handlers"); MinecraftForge.EVENT_BUS.register(new KeyPressHandler()); } The registerHandler method is being called in the init of the main class. It prints to console "Registering Handlers" but the "Key Pressed" print is not sent to console and none of that code acts like it is working. I assume that I am either missing something or doing something wrong, please feel free to point out my mistakes.
  19. Alright well since I have some framework set up to make vanilla blocks easily then that's what I will do. Thanks!
  20. Well, I don't want all vanilla blocks to be unbreakable, just ones that I have generated by my multiblocks (so that players cant break the walls and skip to the end of the dungeon)
  21. I am trying to make vanilla blocks unbreakable, I have tried doing this in 3 ways, only one of which was successful. The ways that I have tried have been doing this are 1) Getting a list of all the properties on a block, then cycling through the list, and setting the value to the new block state. This returns an error with the IBlockState#withProperty(); method where it says the arguments are wrong. IBlockState newState = block.getDefaultState(); existingState.getProperties().forEach((key, value) -> { newState.withProperty(key, value); }); 2) I have tried adding my own PropertyBool to keep track of blocks that are unbreakable, and have a structure apply them to the blocks that it places. This however throws an error because the BlockStateContainer does not have them already added to it. Both of these things led to me returning to what I started with, and just make custom blocks, pointing to Minecraft models so that they look identical to the vanilla counterparts and adding resistance and making them unbreakable. Which is the only thing that worked, And I just think that there should be a way to accomplish what I am seeking to achieve without doubling all the blocks in Minecraft. If anyone is able to help out with this small issue that would be wonderful, I look forward to hearing from you in the morning.
  22. So, my GUI Factory works in every way except that it doesn't save the config when it is edited, when I modify the config it loads up and takes effect, but when I use the gui nothing changes, and the gui will show that it changed, even though the actual file has not. Here is the GitHub. Any help would be wonderful, I tried building the mod and testing outside the workspace, and its still did not change the config. Im assuming its just me overlooking some part of my code, and an extra pair of eyes always does wonders.
  23. Did not see that the first time around. Thanks so much. Back to coding lol.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.