Jump to content
Search In
  • More options...
Find results that contain...
Find results in...


  • Posts

  • Joined

  • Last visited

Everything posted by zennyrpg

  1. Welp. Just checked and I'm on, that's over a year old. Wow, guess its time to upgrade! Thank you for the reply and link
  2. I want to disable crop trampling. The two relevant pieces of code are: BlockFarmland.class /** * Block's chance to react to a living entity falling on it. */ public void onFallenUpon(World worldIn, BlockPos pos, Entity entityIn, float fallDistance) { if (!worldIn.isRemote && entityIn.canTrample(worldIn, this, pos, fallDistance)) // Forge: Move logic to Entity#canTrample { this.turnToDirt(worldIn, pos); } super.onFallenUpon(worldIn, pos, entityIn, fallDistance); } Entity.class public boolean canTrample(World world, Block block, BlockPos pos, float fallDistance) { return world.rand.nextFloat() < fallDistance - 0.5F && this instanceof EntityLivingBase && (this instanceof EntityPlayer || world.getGameRules().getBoolean("mobGriefing")) && this.width * this.width * this.height > 0.512F; } The only way I can think of to turn off trampling globally is to create a new subclass Entity for every Entity in the game, override the canTrample method, and then replace all the default spawns with my new subclass. This... seems like a bad idea. (Maybe there is an easier way, but I don't see any place here for a global override) I suggest adding an event to onFallenUpon. First fire the TrampledEvent where it could be set to Result.Deny. If left on Result.Default, it would call the Entity.canTrample method to produce the default behavior. This would allow for not only global overrides, but also more detailed behavior like allowing/denying based off what's growing.
  3. @Choonster You are absolutely right, it was non-static. Thank you for the explanation!
  4. @Draco18s Thanks. It actually works as is, weirdly? But I think you are right that that is the proper way to specify the json so I'll experiment with changing it. ---- So I figured out what was wrong. Apparently, @Mod.EventBusSubscriber subscribes the class to registerBlocks(RegistryEvent.Register<Block> event) and registerItems(RegistryEvent.Register<Item> event) but not registerModels(ModelRegistryEvent event). So registerModels was not being called. I had to MinecraftForge.EVENT_BUS.register(this) in preInit to get registerModels to fire. Of course this should be broken up into separate classes and all that jazz for a real mod, but the toy implementation works now.
  5. Hey I'm doing something similar. I have a RenderFoo.java class and I used to do this in 1.10.2: public void worldLoad(Load event) { if (event.getWorld().isRemote) { RenderFoo render = new RenderFoo(Minecraft.getMinecraft().getRenderManager(), new ModelFoo(), 0.7F); Minecraft.getMinecraft().getRenderManager().entityRenderMap.put(Foo.class, render); } } But now in 1.12 (I think this works for 1.11?): if (event.getSide().isClient()) { RenderingRegistry.registerEntityRenderingHandler(Foo.class, RenderFoo::new); Inside of public void preInit(FMLPreInitializationEvent event)
  6. Does ModelRegistryEvent get called on the server? I would think it would never fire on the server so this code would be safe.
  7. @jonesto95 Deleting assets/examplemod/models/item/exampleblock.json didn't fix this. I'm not sure if i need that file, but its not what is causing this problem. I looked at the link and its way too complicated for what i'm trying to do. I'm not trying to write a whole generic model loading system. I just want one block to show up skinned, which is why I made this toy project. As far as I can tell, I'm already doing everything I need to do. I'm 1) registering the block in registerBlocks 2) registering the item in registerItems 3) registering the item's model in registerModels This is all according to http://mcforge.readthedocs.io/en/latest/concepts/registries/ Do you know what step I could be missing?
  8. So I'm upgrading from 1.10.2 and I'm getting the missing purple/black texture for all my blocks. I've tried to follow all the guides/ examples for registering blocks/ items, but I'm clearly missing some key part? I created an example mod to distill my problem down. Could someone point out why the textures are missing from this block? ExampleMod.java @Mod(modid = ExampleMod.MODID, version = ExampleMod.VERSION) @Mod.EventBusSubscriber public class ExampleMod { public static final String MODID = "examplemod"; public static final String VERSION = "1.0"; public static ExampleBlock exampleBlock; @EventHandler public void preInit(FMLPreInitializationEvent event) { exampleBlock = new ExampleBlock(); exampleBlock.setRegistryName(MODID, "exampleblock"); } @SubscribeEvent public void registerBlocks(RegistryEvent.Register<Block> event) { event.getRegistry().register(exampleBlock); } @SubscribeEvent public static void registerItems(RegistryEvent.Register<Item> event) { event.getRegistry().register(new ItemBlock(exampleBlock).setRegistryName(exampleBlock.getRegistryName())); } @SubscribeEvent public void registerModels(ModelRegistryEvent event) { ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(exampleBlock), 0, new ModelResourceLocation(exampleBlock.getRegistryName(),"inventory")); } } ExampleBlock.java public class ExampleBlock extends BlockClay { protected ExampleBlock() { super(); this.setUnlocalizedName("exampleblock"); } } assets/examplemod/blockstates/exampleblock.json { "variants": { "normal": { "model": "examplemod:exampleblock" } } } assets/examplemod/models/block/exampleblock.json { "parent": "block/cube_all", "textures": { "all": "examplemod:blocks/exampleblock" } } assets/examplemod/models/item/exampleblock.json { "parent": "examplemod:block/exampleblock", "display": { "thirdperson": { "rotation": [ 10, -45, 170 ], "translation": [ 0, 1.5, -2.75 ], "scale": [ 0.375, 0.375, 0.375 ] } } } I have the texture saved at assets/examplemod/textures/blocks/exampleblock.png
  9. I searched, but couldn't find an issue for this. I do have a few of my own mods installed on the server, but they in no way touch the map code. I actually found the issue in a bug tracker for some server http://jira.ginever.net/browse/AMC-416 . So, I constructed a map fine but when I right clicked to activate it, I get the following error. Here's the rest of the details it spit out:
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.