Jump to content

derf6060

Forge Modder
  • Posts

    57
  • Joined

  • Last visited

Everything posted by derf6060

  1. That might be your problem. I'm currently using version 12.18.2.2107 which is the version that I did my testing with. I did receive the error message but I wasn't rubber banning back to the same location with the test example I created. I think it could be a forge bug cause the issue. Try updating to the latest version of forge and I think it should because when I compared your code to my code they look almost identical for the exception you are store your location an items nbt and my was hard-coded. I think its a forge bug so updating forge should fix the issue.
  2. That depends on what version of mc your using.
  3. Hmm, that's very strange. I got something minimalist version working on my end. This seem of topic but what version of forge are you using?
  4. Well the old method has one major problem. If you had model variants you would have to explicitly register them with ModelBakery. The new method automatically registers all moddles with the ModelBakery which is fine. The old method also had issues if you called it in pre initialization method which either didn't load the models or other strange issues like the client blowing up on me one or twice because I didn't put them in the Initialization phase. Thats pretty much sums up the differences between the old way and the new way.
  5. Ok I figured it out. You need to call it in both the client and server. That means remove the if(!world.isRemove) {} then that error will stop. Here is my example. @Override public void onEntityCollidedWithBlock(World world, BlockPos pos, IBlockState state, Entity entity) { super.onEntityCollidedWithBlock(world, pos, state, entity); if(!world.isRemote) { if(entity instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) entity; BlockPos npos = pos.add(25, 1.0, 0); player.velocityChanged = true; player.setPositionAndUpdate(npos.getX(), npos.getY(), npos.getZ()); } } } @Override public void onEntityWalk(World world, BlockPos pos, Entity entity) { // TODO Auto-generated method stub super.onEntityWalk(world, pos, entity); //if(!world.isRemote) { if(entity instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) entity; BlockPos npos = pos.add(25, 1.0, 0); player.velocityChanged = true; player.setPositionAndUpdate(npos.getX(), npos.getY(), npos.getZ()); } //} } However, I ran into a weird problem with the onEntityCollidedWithBlock event. It was firing so I used the onEntityWalk even and it worked.
  6. I'm working on a simple example with on of my blocks to see why real fast...
  7. Its sound like a client server sync issue to me. After looking at your code you are call it both on the client and server which causes sync issue. Try wrapping your block with if(!world.isRemove) { ... } and try again. This will call that line of code on the server only.
  8. lol, oh yes there will be problems if you call the old way in pre initialization for example the client exploding or models not loading correctly. That pretty all the issues I ran into while using the old method of loading them models. The method is just the opposite. Its needs to be handled in pre initialization with the added benefit of adding information the the ModelBakery too. So you don't have to worry about variants it is already handled for you for the most part lol.
  9. After looking at the source code for EntityRegistry it would seem that you could do it if you want to... The MobID simple affects the lookupModSpawn method in the EntityRegistry that searchs for a Mob when the mob is being spawned.
  10. Have you tryed and changed this property "player.velocityChanged=true"
  11. Try flipping the normal's your model in the modeling package you are using. If it was an OpenGL texture issue then the model would be either white with a gradient from the normals or it would have another textured being displayed on the mesh because glBindTexture(GL_TEXTURE_2D, ...) wasn't passed zero to unbind the texture.
  12. Oh lol when I changed to it all item models didn't load so don't call that method during the initialization stage. It defers the model registration before initialization stage happens so make sure to pass all model information during pre initiliaztion stage lol.
  13. I'm actually using forge 1.10.2 and it works fine. Also I took a look at the ModelLoader to see what it is doing. It stores all of its values into 2 maps and defers the registration. After the initialization stages (I'm not real sure what stages it could be after or before post) forge calls onRegisterItems which registers both maps to ItemModelMesher. That a pretty nice and clean way to handle it. I'm going to change over thanks for the explanation.
  14. What issues does getItemModelMesher() have over ModelLoader.setCustomModelResourceLocation. I've used getItemModelMesher since 1.8 came out and I have not had any issues with it so far.
  15. Cool it worked thanks for help Choonster. I'm going to mark this as solved Edit: Thanks for the link to mcforge documentation. I didn't know there was an official documentation for forge. Thanks again.
  16. Thanks for the reply. I'm going to try this and see if it works.
  17. I'm have a problem with "gradlew setupDecompWorkspace". For some reason it stalls in decompileMc task. Initial setupDecompWorkspace ################################################# ForgeGradle 2.1-SNAPSHOT-9e8f067 https://github.com/MinecraftForge/ForgeGradle ################################################# Powered by MCP unknown http://modcoderpack.com by: Searge, ProfMobius, Fesh0r, R4wk, ZeuX, IngisKahn, bspkrs ################################################# :deobfCompileDummyTask :deobfProvidedDummyTask :getVersionJson :extractUserdev UP-TO-DATE :extractDependencyATs SKIPPED :extractMcpData SKIPPED :extractMcpMappings SKIPPED :genSrgs SKIPPED :downloadClient SKIPPED :downloadServer SKIPPED :splitServerJar SKIPPED :mergeJars SKIPPED :deobfMcSRG SKIPPED :decompileMc FAILED FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':decompileMc'. > Java heap space * Try: Run with --stacktrace option to get the stack trace. Run with --info or --d opti on to get more log output. BUILD FAILED Total time: 10 mins 12.96 secs Here is the stacktrace for second round of setupDecompWorkspace. org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':decompileMc'. at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46) at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35) at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64) at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58) at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:52) at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52) at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53) at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43) at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:203) at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:185) at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:62) at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:50) at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:25) at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:110) at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37) at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37) at org.gradle.execution.DefaultBuildExecuter.access$000(DefaultBuildExecuter.java:23) at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:43) at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32) at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37) at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:30) at org.gradle.initialization.DefaultGradleLauncher$4.run(DefaultGradleLauncher.java:155) at org.gradle.internal.Factories$1.create(Factories.java:22) at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90) at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:52) at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:152) at org.gradle.initialization.DefaultGradleLauncher.access$200(DefaultGradleLauncher.java:33) at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:100) at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:94) at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90) at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:62) at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:94) at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:83) at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:94) at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28) at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35) at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:43) at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:28) at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:77) at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:47) at org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.execute(DaemonUsageSuggestingBuildActionExecuter.java:51) at org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.execute(DaemonUsageSuggestingBuildActionExecuter.java:28) at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:43) at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:170) at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:237) at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:210) at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:35) at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24) at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:206) at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169) at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33) at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22) at org.gradle.launcher.Main.doAction(Main.java:33) at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45) at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:54) at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:35) at org.gradle.launcher.GradleMain.main(GradleMain.java:23) at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:30) at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:127) at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61) Caused by: java.lang.OutOfMemoryError: Java heap space at org.jetbrains.java.decompiler.util.DataInputFullStream.<init>(DataInputFullStream.java:25) at org.jetbrains.java.decompiler.struct.attr.StructGeneralAttribute.stream(StructGeneralAttribute.java:115) at org.jetbrains.java.decompiler.struct.attr.StructLocalVariableTableAttribute.initContent(StructLocalVariableTableAttribute.java:45) at org.jetbrains.java.decompiler.struct.StructMember.readAttribute(StructMember.java:92) at org.jetbrains.java.decompiler.struct.StructMethod.readAttribute(StructMethod.java:110) at org.jetbrains.java.decompiler.struct.StructMember.readAttributes(StructMember.java:57) at org.jetbrains.java.decompiler.struct.StructMethod.readAttribute(StructMethod.java:105) at org.jetbrains.java.decompiler.struct.StructMember.readAttributes(StructMember.java:57) at org.jetbrains.java.decompiler.struct.StructMethod.<init>(StructMethod.java:78) at org.jetbrains.java.decompiler.struct.StructClass.<init>(StructClass.java:116) at org.jetbrains.java.decompiler.struct.StructClass.<init>(StructClass.java:75) at org.jetbrains.java.decompiler.struct.StructContext.addArchive(StructContext.java:167) at org.jetbrains.java.decompiler.struct.StructContext.addSpace(StructContext.java:100) at org.jetbrains.java.decompiler.struct.StructContext.addSpace(StructContext.java:78) at org.jetbrains.java.decompiler.main.decompiler.BaseDecompiler.addSpace(BaseDecompiler.java:36) at net.minecraftforge.gradle.tasks.ApplyFernFlowerTask.applyFernFlower(ApplyFernFlowerTask.java:98) at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75) at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.doExecute(AnnotationProcessingTaskFactory.java:226) at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:219) at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:208) at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:585) at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:568) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46) at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35) at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64) From the stack trace it seems that its giving me an OutOfMemoryError from the heap. The only class I found in here that related to ForgeGradle is ApplyFernFlowerTask which I'm guessing is the task that runs the decompiler. I'm not real sure what to do...
  18. Thanks for the post. It boosted my understanding of the relationship between Forge, MCP, and Minecraft. I would fix the ItemAxe class and post a PR to forge, however, I'm having a issue with "gradlew setupDecompWorkspace" were it locks up during the decompiling process. Right now my hands are tide at due to this issue I'm having.
  19. I have a mod and I want to make sure that my custom enchantment can be applied to axes, even mod added ones. How would I do that under your solution, sir? The best solution for this simply play the waiting game for 1.9. The problem isn't forge but MCP. I thing MCP only releases binaries so there isn't a way to fix it through forge this time. Until MCP releases a new snap shot to forge the best solution is to wait.
  20. From what you've stated I'll assume that it's on MCP side and mark this as solved.
  21. I updated to forge 1804 for the 1.9 line and the ItemAxe class is still giving me "Array out of Bounds" exception when doing my port of my mod. After creating the temporary ItemAxeCustom class I probably figured out why its doing this error. In the ItemTool class, it needs both a ToolMaterial and a Set<Block> class to be passed to its constructor. This means that the ItemAxe constructor is Iterating through that Set<Block> class for some reason and going over the allocated space on it which results in this error. This is what I'm speculating.
  22. The two json class that you should extends is... item/generated class { "parent": "item/generated" } and the handheld class { "parent": "item/handheld" } The only difference between these class json classes is that "item/generated" is a basic item with a simple orientation while "item/handheld" is used for tools, sword, or some item that the player can hold in each hand.
  23. Here's my implementation of the ItemAxe class. I tried my best to be as general as possible so it can work in any project. I hope the ItemAxe class for 1.9 gets fix pretty soon . ItemAxeCustom: import java.util.HashSet; import java.util.Iterator; import java.util.Set; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemTool; /** * This is an implementation of the ItemAxe. This class was created * due to a bug in ItemAxe that results in an "Array out of Bound" * exception in the constructor. * * Note: You don't need permission from me to use this code. Just use it * if your having the same problem I'm having. * @author derf6060 */ public class ItemAxeCustom extends ItemTool { // A holder object for the tool material private ToolMaterial material = null; // This is a list of private static Set<Block> blocks = null; /** * This initializes the ItemAxeCustom object. * @param ToolMaterial material */ public ItemAxeCustom(ToolMaterial material) { super(material, getEffectedBlocks()); this.material = material; } /** * This create a list of vanilla blocks that the custom * axe can be used on. * @return Set<Block> */ private static Set<Block> getEffectedBlocks() { // TODO Auto-generated method stub if(blocks == null) { blocks = new HashSet<Block>(); // Arcacia blocks.add(Blocks.acacia_door); blocks.add(Blocks.acacia_fence); blocks.add(Blocks.acacia_fence_gate); blocks.add(Blocks.acacia_stairs); // Birch blocks.add(Blocks.birch_door); blocks.add(Blocks.birch_fence); blocks.add(Blocks.birch_fence_gate); blocks.add(Blocks.birch_stairs); // Dark Oak blocks.add(Blocks.dark_oak_door); blocks.add(Blocks.dark_oak_fence); blocks.add(Blocks.dark_oak_fence_gate); blocks.add(Blocks.dark_oak_stairs); // Jungle blocks.add(Blocks.jungle_door); blocks.add(Blocks.jungle_fence); blocks.add(Blocks.jungle_fence_gate); blocks.add(Blocks.jungle_stairs); // Oak blocks.add(Blocks.oak_door); blocks.add(Blocks.oak_fence); blocks.add(Blocks.oak_fence_gate); blocks.add(Blocks.oak_stairs); // Spruce blocks.add(Blocks.spruce_door); blocks.add(Blocks.spruce_fence); blocks.add(Blocks.spruce_fence_gate); blocks.add(Blocks.spruce_stairs); // Logs blocks.add(Blocks.log); blocks.add(Blocks.log2); // Leaves blocks.add(Blocks.leaves); blocks.add(Blocks.leaves2); // Planks blocks.add(Blocks.planks); // Crafting Table blocks.add(Blocks.crafting_table); // Pumkin blocks.add(Blocks.pumpkin); // Lit Pumkin blocks.add(Blocks.lit_pumpkin); // Vines blocks.add(Blocks.vine); // Melon blocks.add(Blocks.melon_block); } return blocks; } /** * This check if the block can be mined by the custom axe * @param ItemStack stack * @param IBlockState state * @return */ private boolean checkStrVsBlock(ItemStack stack, IBlockState state) { boolean b = false; // Check Block List that the axe can mine... Iterator<Block> it = blocks.iterator(); while(it.hasNext()) { Block block = it.next(); if(block == state.getBlock()) { b = true; break; } } // Check Materials Material material = state.getMaterial(); // Added in harvest tool and harvest level return b || material == Material.wood || material == Material.plants || material == Material.vine || (((state.getBlock().getHarvestTool(state) != null && state.getBlock().getHarvestTool(state).equals("axe"))? true : false) && state.getBlock().getHarvestLevel(state) <= this.material.getHarvestLevel()); } @Override public float getStrVsBlock(ItemStack stack, IBlockState state) { // TODO Auto-generated method stub return (!checkStrVsBlock(stack, state))? super.getStrVsBlock(stack, state) : this.material.getEfficiencyOnProperMaterial(); } } There is a small issue with this class because it makes axes really fast lol. Edit: Small little update to make sure that it mines blocks that is assigned to the "axe" class and make sure the block is at the right level to be mined. Removed test code, and fixed some spelling.
×
×
  • Create New...

Important Information

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