Jump to content

Lexjp

Members
  • Posts

    6
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Lexjp's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Unfortunately no change, I've read through a couple classes and haven't seen an obvious flag, would there be a way to do this by calling player.getAbilities.loadSaveData(pCompound)? I'm not sure what the pCompound would be if this were to work... EDIT: Pretty sure this won't work as the loadSaveData method only sets this.walkingspeed which already shows the correct value The other strange thing I saw was a method /** * Sends the player's abilities to the server (if there is one). */ public void onUpdateAbilities() { } had no idea why there was nothing actually in the method?
  2. When the below code runs in game adding/removing a piece of bronze armor will change the players FOV, however the speed change only applies if you leave the game and rejoin. How is it possible to dynamically change the speed as the player adds/removes pieces of bronze armor? @SubscribeEvent public void onPlayerTick(TickEvent.PlayerTickEvent event) { Player player = event.player; Iterable<ItemStack> slots = player.getArmorSlots(); final int[] bronzeArmourItemCount = {0}; slots.forEach(itemStack -> { if (itemStack.is(ModItems.BRONZE_BOOTS.get()) || itemStack.is(ModItems.BRONZE_LEGGINGS.get()) || itemStack.is(ModItems.BRONZE_CHESTPLATE.get()) || itemStack.is(ModItems.BRONZE_HELMET.get())) { bronzeArmourItemCount[0]++; } }); if (bronzeArmourItemCount[0] != lastBronzeArmourItemCount) { player.getAbilities().setWalkingSpeed((float) (0.1+bronzeArmourItemCount[0]*0.075)); lastBronzeArmourItemCount = bronzeArmourItemCount[0]; } }
  3. I am trying to enable/disable ore generation using a config file / data generators. Is it possible to do the gradle runData command when the client runs? Currently to change my settings I need to delete the generated data folder.
  4. I'm a bit lost on how to use the datapack to disable ore gen / recipes. Any resources you could point me to?
  5. Hi, I've created a couple items, recipes, and blocks that I would like to be able to enable and disable with my mod config. How do I disable these in a clean way? I'm unsure what the best practice here would be, and particularly lost on how to disable recipes. Would love a point in the right direction Simplified versions of my implementation of config/registers are below if useful ModBlocks.Java public static final RegistryObject<Block> TIN_ORE_DEEPSLATE = registerBlock("tin_ore_deepslate", () -> new DropExperienceBlock(BlockBehaviour .Properties.of(Material.STONE) .strength(3f) .requiresCorrectToolForDrops(), UniformInt.of(3,7))); private static <T extends Block> RegistryObject<T> registerBlock(String name, Supplier<T> block) { RegistryObject<T> toReturn = BLOCKS.register(name, block); registerBlockItem(name, toReturn); return toReturn; } private static <T extends Block> RegistryObject<Item> registerBlockItem(String name, RegistryObject<T> block) { return ModItems.ITEMS.register(name, () -> new BlockItem(block.get(), new Item.Properties())); } public static void register(IEventBus eventBus) { BLOCKS.register(eventBus); } ModItems.java public static final RegistryObject<Item> TIN_RAW = ITEMS.register("tin_raw", () -> new Item(new Item.Properties())); public static void register(IEventBus eventBus) { ITEMS.register(eventBus); } main IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus(); ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, GrassblockEssentialsCommonConfig.SPEC, "mymod-common.toml"); ModItems.register(modEventBus); ModBlocks.register(modEventBus); modEventBus.addListener(this::commonSetup); MinecraftForge.EVENT_BUS.register(this); modEventBus.addListener(this::addCreative); commonconfig public class CommonConfig { public static final ForgeConfigSpec.Builder BUILDER = new ForgeConfigSpec.Builder(); public static final ForgeConfigSpec SPEC; public static final ForgeConfigSpec.ConfigValue<Boolean> TIN_ENABLED; static{ BUILDER.push("My Mod Config"); TIN_ENABLED = BUILDER.comment("Enable Ore Types").define("Tin Enabled", true); BUILDER.pop(); SPEC = BUILDER.build(); } }
  6. I'm working on a mod (think like the morph mod and origins - 1 morph the whole game related to your origin) and I need to render custom player models for this to work. I am assuming currently that I have to cancel RenderPlayerEvent.pre and render my own models in place of the player. However I am concerned about compatibility with other mods. Are there any libraries, tools, methods etc that I should be looking into to help ensure my mod can be played with many others? Thanks!
×
×
  • Create New...

Important Information

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