Jump to content


Forge Modder
  • Posts

  • Joined

  • Last visited

Everything posted by Failender

  1. I need the library "reflections" for something I am triing. unfortunately minecraft crashes with an exception, once i add the library to my project. Is there something I can do to prevent the crash? build.gradle buildscript { repositories { jcenter() maven { url = "http://files.minecraftforge.net/maven" } } dependencies { classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT' } } apply plugin: 'net.minecraftforge.gradle.forge' //Only edit below this line, the above code adds and enables the necessary things for Forge to be setup. version = "1.0" group = "com.yourname.modid" // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = "modid" sourceCompatibility = targetCompatibility = '1.8' // Need this here so eclipse task generates correctly. compileJava { sourceCompatibility = targetCompatibility = '1.8' } repositories { mavenLocal() } minecraft { version = "1.12.2-" runDir = "run" // the mappings can be changed at any time, and must be in the following format. // snapshot_YYYYMMDD snapshot are built nightly. // stable_# stables are built at the discretion of the MCP team. // Use non-default mappings at your own risk. they may not always work. // simply re-run your setup task after changing the mappings to update your workspace. mappings = "snapshot_20171003" // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable. } dependencies { compile group: 'org.reflections', name: 'reflections', version: '0.9.10' // compile project(':easymods') // you may put jars on which you depend on in ./libs // or you may define them like so.. //compile "some.group:artifact:version:classifier" //compile "some.group:artifact:version" // real examples //compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env //compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env // the 'provided' configuration is for optional dependencies that exist at compile-time but might not at runtime. //provided 'com.mod-buildcraft:buildcraft:6.0.8:dev' // the deobf configurations: 'deobfCompile' and 'deobfProvided' are the same as the normal compile and provided, // except that these dependencies get remapped to your current MCP mappings //deobfCompile 'com.mod-buildcraft:buildcraft:6.0.8:dev' //deobfProvided 'com.mod-buildcraft:buildcraft:6.0.8:dev' // for more info... // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html // http://www.gradle.org/docs/current/userguide/dependency_management.html } processResources { // this will ensure that this task is redone when the versions change. inputs.property "version", project.version inputs.property "mcversion", project.minecraft.version // replace stuff in mcmod.info, nothing else from(sourceSets.main.resources.srcDirs) { include 'mcmod.info' // replace version and mcversion expand 'version': project.version, 'mcversion': project.minecraft.version } // copy everything else except the mcmod.info from(sourceSets.main.resources.srcDirs) { exclude 'mcmod.info' } } Crash: Exception in thread "main" java.lang.IncompatibleClassChangeError: Class com.google.common.base.Functions$IdentityFunction does not implement the requested interface java.util.function.Function at net.minecraftforge.server.console.log4j.TerminalConsoleAppender.formatEvent(TerminalConsoleAppender.java:184) at net.minecraftforge.server.console.log4j.TerminalConsoleAppender.append(TerminalConsoleAppender.java:178) at org.apache.logging.log4j.core.config.AppenderControl.tryCallAppender(AppenderControl.java:156) at org.apache.logging.log4j.core.config.AppenderControl.callAppender0(AppenderControl.java:129) at org.apache.logging.log4j.core.config.AppenderControl.callAppenderPreventRecursion(AppenderControl.java:120) at org.apache.logging.log4j.core.config.AppenderControl.callAppender(AppenderControl.java:84) at org.apache.logging.log4j.core.config.LoggerConfig.callAppenders(LoggerConfig.java:448) at org.apache.logging.log4j.core.config.LoggerConfig.processLogEvent(LoggerConfig.java:433) at org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:417) at org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:403) at org.apache.logging.log4j.core.config.AwaitCompletionReliabilityStrategy.log(AwaitCompletionReliabilityStrategy.java:63) at org.apache.logging.log4j.core.Logger.logMessage(Logger.java:146) at org.apache.logging.log4j.spi.AbstractLogger.logMessageSafely(AbstractLogger.java:2091) at org.apache.logging.log4j.spi.AbstractLogger.logMessage(AbstractLogger.java:1988) at org.apache.logging.log4j.spi.AbstractLogger.logIfEnabled(AbstractLogger.java:1960) at org.apache.logging.log4j.spi.AbstractLogger.info(AbstractLogger.java:1297) at net.minecraftforge.gradle.GradleStartCommon.parseArgs(GradleStartCommon.java:176) at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:78) at GradleStart.main(GradleStart.java:25)
  2. why arent you extending the EntityFallingBlock..? I see a lot of copy pasta from that entity. Extend the entity and override what you need to
  3. you can easyly compare using stack.getItem == Stone
  4. get the EntrySet of the furnaceRecipes. get the iterator. while(iterator.hasNext) get the iterator item if item.value is stone iterator.remove easy.
  5. If he is iterating over the entry set and checking if the VALUE is stone then he will remove all recipes that have stone as output that will also catch modded recipes if he is calling it AFTER modded recipes are added.
  6. Aaaah I see. FurnaceRecipes is a map, I remembered it as a list. That means that you need use the getSmeltingList.entrySet.iterator. You can than use that iterator to remove every entrance where value == stone
  7. oh okay. i made that up out of my mind. give me a sec ill look into it
  8. This is just pseudo code you will need to make it java urself recipes = Furnaceripes.instance.getList foreach(recipe in recipes) { if(recipe.output == stone) remove recipe } remember that you cant remove stuff while iterating over it with foreach so you will need to use the iterator methods
  9. I am 99% sure, yes. I dont know, because I didnt looked into it, but if you know java you know that this needs to be true, because if a class overriding / implementing a method it needs to follow the signature of the method it is overriding / implementing, and obfuscating is nothing but a simple rename, the files still need to follow the rules of java.
  10. Your code looks way cleaner than mine Thank you! Found the error, it was me only opening the GUI on Client-Side so yeah. Just me beeing stupid.
  11. Hey everyone, I am working on a custom GuiContainer in 1.11. I know that my problem is related to adding Slots to the Container. I added the code for my Custom Container, if you think the problem is elsewhere I will post related files public class ContainerBackpack extends Container{ private final int HOTBAR_SLOT_COUNT = 9; private final int PLAYER_INVENTORY_ROW_COUNT = 3; private final int PLAYER_INVENTORY_COLUMN_COUNT = 9; private final int PLAYER_INVENTORY_SLOT_COUNT = PLAYER_INVENTORY_COLUMN_COUNT * PLAYER_INVENTORY_ROW_COUNT; private final int VANILLA_SLOT_COUNT = HOTBAR_SLOT_COUNT + PLAYER_INVENTORY_SLOT_COUNT; private final int VANILLA_FIRST_SLOT_INDEX = 0; private final int TE_INVENTORY_FIRST_SLOT_INDEX = VANILLA_FIRST_SLOT_INDEX + VANILLA_SLOT_COUNT; private final int TE_INVENTORY_SLOT_COUNT = 27; public ContainerBackpack(IItemHandler itemHandler, EntityPlayer player) { this.itemHandler = itemHandler; for (int l = 0; l < 3; ++l) { for (int j1 = 0; j1 < 9; ++j1) { this.addSlotToContainer(new SlotItemHandler(itemHandler, j1 + l * 9, 8 + j1 * 18, 18 + l * 18)); } } for (int i = 9; i < player.inventory.getSizeInventory()-5; i++) { addSlotToContainer(new Slot(player.inventory, i, 8 + i % 9 * 18, 61 + 18 * (i / 9))); } } @Override public boolean canInteractWith(EntityPlayer playerIn) { return true; } public static ContainerBackpack build(EntityPlayer player, World world, int x, int y, int z) { ItemStack stack; if(x == 0) { stack = player.getHeldItem(EnumHand.MAIN_HAND); } else { stack = player.getHeldItem(EnumHand.OFF_HAND); } IItemHandler handler = stack.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null); return new ContainerBackpack(handler,player); } @Override public ItemStack transferStackInSlot(EntityPlayer playerIn, int index) { Slot sourceSlot = (Slot)inventorySlots.get(index); if (sourceSlot == null || !sourceSlot.getHasStack()) return null; ItemStack sourceStack = sourceSlot.getStack(); ItemStack copyOfSourceStack = sourceStack.copy(); if (index >= VANILLA_FIRST_SLOT_INDEX && index < VANILLA_FIRST_SLOT_INDEX + VANILLA_SLOT_COUNT) { // This is a vanilla container slot so merge the stack into the tile inventory if (!mergeItemStack(sourceStack, TE_INVENTORY_FIRST_SLOT_INDEX, TE_INVENTORY_FIRST_SLOT_INDEX + TE_INVENTORY_SLOT_COUNT, false)){ return null; } } else if (index >= TE_INVENTORY_FIRST_SLOT_INDEX && index < TE_INVENTORY_FIRST_SLOT_INDEX + TE_INVENTORY_SLOT_COUNT) { // This is a TE slot so merge the stack into the players inventory if (!mergeItemStack(sourceStack, VANILLA_FIRST_SLOT_INDEX, VANILLA_FIRST_SLOT_INDEX + VANILLA_SLOT_COUNT, false)) { return null; } } else { System.err.print("Invalid slotIndex:" + index); return null; } if (sourceStack.getCount() == 0) { sourceSlot.putStack(null); } else { sourceSlot.onSlotChanged(); } return copyOfSourceStack; } } Greetz Failender
  12. and how am i supposed to get the MinecraftServer? The getter method is not static.
  13. PlayerList has no static getter method. Most of the methods calling stuff on the PlayerList are doing so by using the MinecraftServer::getPlayerList (sadly I dont really see a way to obtain the MinecraftServer Instance either, all the classes I see using it get it via constructor) So yeah. I searched for it otherwise I wouldnt be asking, maybe im just tarded
  14. Hey there, Im just not sure how to send a message to all players on the server and could use a hint in the right direction Greetz Failender
  15. https://github.com/MinecraftForge/Documentation/compare/master...BusyBeever:patch-1
  16. http://lmgtfy.com/?q=java+reflection But reflection is not a good topic if you arent solid in the basics of java. But thats up 2 you
  17. not exactly true @Choonster. You can just register the event handler in the constructor of your main class! public ProgressingPlayer() { MinecraftForge.EVENT_BUS.register(new RegisterEventHandler()); } I guess thats true Draco! Item.getItemFromBlock returns the block for air.. I fixxed it using this way, I am not sure if there is any better feel free to correct me @SubscribeEvent public void registerModels(ModelRegistryEvent event) { registerItem(learnscroll); registerBlock(blockkitchen); registerBlock(blockforge); } @SubscribeEvent public void registerItems(RegistryEvent.Register<Item> event) { event.getRegistry().registerAll(learnscroll); event.getRegistry().registerAll(blockItems); blockItems = null; } @SubscribeEvent public void registerBlocks(RegistryEvent.Register<Block> event) { registerAll(event, blockkitchen, blockforge); } private ItemBlock[] blockItems; private void registerAll(RegistryEvent.Register<Block> event,Block... blocks ) { blockItems = new ItemBlock[blocks.length]; event.getRegistry().registerAll(blocks); for (int i = 0; i < blocks.length; i++) { blockItems[i] = new ItemBlock(blocks[i]); blockItems[i].setRegistryName(blocks[i].getRegistryName()); } } private void registerItem(Item item) { ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory")); } private void registerBlock(Block block) { ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block), 0, new ModelResourceLocation(block.getRegistryName(),"inventory")); }
  18. Hey everyone, I am having problems with the new way of registering blocks. I can register items just fine, but blocks seem to fail (I get no console error, but my blocks are not appearing in my creative tab, nor can I give them to player via eventhandler) Registering the blocks (the events are getting called, I double checked that) @SubscribeEvent public void registerBlocks(RegistryEvent.Register<Block> event) { event.getRegistry().registerAll(blockkitchen); } @SubscribeEvent public void registerModels(ModelRegistryEvent event) { registerBlock(blockkitchen); } private void registerBlock(Block block) { ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block), 0, new ModelResourceLocation(block.getRegistryName(),"inventory")); } Important parts of the block class public class BlockKitchen extends ProgressingBlock{ public BlockKitchen() { super(Material.PISTON, "blockkitchen"); } } public class ProgressingBlock extends Block { public ProgressingBlock(Material materialIn, String name) { super(materialIn); setRegistryName(name); setUnlocalizedName(name); setCreativeTab(ProgressingPlayer.CREATIVE_TAB); } } assets/progressingplayer/blockstates/blockkitchen.json { "variants": { "normal": { "model": "progressingplayer:blockkitchen" } } } assets/progressingplayer/models/block/blockkitchen.json { "parent": "block/cube_all", "textures": { "all": "progressingplayer:blocks/blockkitchen" } } assets/progressingplayer/models/item/blockkitchen.json { "parent":"progressingplayer:block/blockkitchen", "display": { "thirdperson": { "rotation": [ 10, -45, 170 ], "translation": [ 0, 1.5, -2.75 ], "scale": [ 0.375, 0.375, 0.375 ] } } } texture is under assets/progressingplayer/textures/blocks/blockkitchen.json Any help is appreciated! Greetz, failender
  19. first of all. If you want to listen to events you should be doing that inside an event listener class (if you dont know what im talking about google minecraft event handling you will find enough information there) You are using the EntityJoinWorld event. Which is the wrong event for listening for the impact of an arrow.. I dont even think there is such an event in forge. I was coding sth similar once, and I remember that I had to use the event for updating entities (LivingUpdateEvent), check if the arrow is inside an block (I see the EntityArrow class now has the property inTile, you will need reflection to access the private field) if that is != null you can create an explosion at the position of the arrow. Although I am not sure if using reflection is the right thing for something that isnt that experienced in java Greetz Failender
  20. Well.. I dont know what exactly happened with the graphic, I fixxed it now, thanks x) The error message is.. A bit unclear. Thanks for the patience!
  21. https://github.com/BusyBeever/ProgressingPlayer Model-JSON https://github.com/BusyBeever/ProgressingPlayer/blob/master/src/main/resources/assets/progressingplayer/models/item/learnscroll.json Item-Texture https://github.com/BusyBeever/ProgressingPlayer/blob/master/src/main/resources/assets/progressingplayer/textures/items/learnscroll.png Registry-Event-Handler https://github.com/BusyBeever/ProgressingPlayer/blob/master/src/main/java/de/busybeever/progressingplayer/event/RegistryEventHandler.java Main-Class https://github.com/BusyBeever/ProgressingPlayer/blob/master/src/main/java/de/busybeever/progressingplayer/ProgressingPlayer.java Thanks for taking a look!
  22. └───assets └───progressingplayer │ ├───models │ │ │ └───item │ learnscroll.json │ └───textures │ └───items learnscroll.png Thats exactly where its located.
  • Create New...

Important Information

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