Jump to content

Meldexun

Members
  • Posts

    184
  • Joined

  • Last visited

Everything posted by Meldexun

  1. So i want to render a water texture when there is no block near my block. Currently i have a TileEntitySpecialRenderer which renders a block of water at the position of my block. But when the it renders the model of my block is hidden. I mean when standing inside the block i can see the model and the water but from the outside i can only see the water. That's the TileEntitySpecialRenderer : And a pictures how it currently looks like:
  2. Hello, I have a moving sound but i'm wondering how to correctly start it and restart/resume it when it's stopped. Currently i have this: @SubscribeEvent public static void updateUnderwaterAmbience(ClientTickEvent event) { if (event.phase == Phase.START) { Minecraft mc = Minecraft.getMinecraft(); if (mc.world != null) { SoundHandler soundHandler = mc.getSoundHandler(); if (!soundHandler.isSoundPlaying(SoundEventHandler.underwaterSound)) { SoundEventHandler.underwaterSound = new UnderwaterAmbientSound(mc.player); soundHandler.playSound(SoundEventHandler.underwaterSound); } } } }
  3. Well that's 1.12.2 not 1.10.2. Also when lowercasing the names of the fields it works as well as annotating the fields but leaving them uppercase doesn't work.
  4. Probably naming the fields with lowercase letters is the key. But i already added an ObjectHolder annotation to my fields so i will stay with that.
  5. After some testing it seems like i have to annotate every field with @ObjectHolder. Also looking at Choonster's TestMod3 i saw that he also annotated every field.
  6. Sure. Here it is: @ObjectHolder(BetterDiving.MOD_ID) public class ModItems { public static final Item TITANIUM = null; public static final Item COPPER_ORE = null; public static final Item SILVER_ORE = null; public static final Item LEAD = null; public static final Item GOLD = null; @EventBusSubscriber public static class ItemRegistrationHandler { public static final List<Item> ITEMS = new ArrayList<Item>(); @SubscribeEvent public static void registerItems(RegistryEvent.Register<Item> event) { final Item[] items = { setItemName(new Item(), "titanium"), setItemName(new Item(), "copper_ore"), setItemName(new Item(), "silver_ore"), setItemName(new Item(), "lead"), setItemName(new Item(), "gold") }; IForgeRegistry<Item> registry = event.getRegistry(); for (Item item : items) { registry.register(item); ITEMS.add(item); } } private static Item setItemName(Item item, String name) { return setItemNameAndTab(item, name, BetterDiving.TAB_BETTER_DIVING); } private static Item setItemNameAndTab(Item item, String name, @Nullable CreativeTabs tab) { return item.setUnlocalizedName(name).setRegistryName(BetterDiving.MOD_ID, name).setCreativeTab(tab); } } }
  7. Hello, I annotated my items class with @ObjectHolder(MOD_ID). But it isn't injecting the item objects into the fields. Does the ObjectHolder annotation only work for classes as of 1.12.2?
  8. Hello, I have an item and i attach a ItemStackHandler capability to it. But i have some weird behaviour going on when using it in creative mode (it's a creative mode only item...). Duplication: 1. Right click to open the inventory, place items inside and close it. 2. Right click again to open the inventory, take the items and close it. 3. Press E to open the normal inventory and drop the item to the world. (only when dropping from creative inventory) 4. Pick up the item and open the inventory. 5. You will find the items in it again... Deletion: 1. Right click to open the inventory, place items inside and close it. 2. Press E to open the normal inventory and drop the item to the world. (only when dropping from creative inventory) 3. Pick up the item and open the inventory. 4. You will find no items in it... Github: https://github.com/Meldexun/ChocolateQuestRepoured/tree/master/src/main/java/com/teamcqr/chocolatequestrepoured Direct links to classes on github: Item class: ItemBadge.java Capability provider class: CapabilityItemStackHandlerProvider.java Gui handler class: GuiHandler.java Container class: ContainerBadge.java Gui class: GuiBadge.java Thank you in advance for your help.
  9. Iirc in 1.12.2 there is an item limit and you still recommend creating 20 items. Can't this cause issues? I thought only in MC 1.13 and newer i should create 20 items.
  10. Yeah i knew how it works with blockstates but i thought it may also work with items. So i just registered a item model with the metadata of 16 and it seems to work ingame. This is what i have done: @SubscribeEvent public static void registerItemModels(ModelRegistryEvent event) { registerCustomItemModel(ModItems.DUNGEON_PLACER, 16, ModItems.DUNGEON_PLACER.getRegistryName().toString() + "_d" + 16, "inventory"); } private static void registerCustomItemModel(Item item, int meta, String modelLocation, String variant) { ModelLoader.setCustomModelResourceLocation(item, meta, new ModelResourceLocation(modelLocation, variant)); } Is there any reason not to do this?
  11. Hello, So i basically want to create a item with 20 different models. 1. First of all when creating a ModelResourceLocation what is the use of the variant parameter (when registering a item model)? 2. I have a capability added to my item. Can i somehow change the model of the item depending on the capability? The meta won't really work because i need more than 16 models.
  12. I want every 5 seconds to randomly rotate my entity. So i added this to my entity class: @Override public void onUpdate() { if (!world.isRemote && world.getTotalWorldTime() % 100 == 0) { this.rotationYaw = world.rand.nextFloat() * 360F; } System.out.println(this.rotationYaw); } But the problem is that the rotation is not synced correctly with the client. It gives me 2 different rotations. Any idea why it doesn't sync correcly?
  13. Guess i will make 4 recipes for now since i want to make a custom workbench in the future. Thanks for the help.
  14. Hi there, I want to add a recipe for a custom item. To craft it you need a titanium ingot and a silver ingot. But i also want that you can use a ore instead of a ingot. So how can i achieve that? Do i have to make 4 recipes (1: t-ingot and s-ingot, 2: t-ore and s-ingot, 3: t-ingot and s-ore, 4: t-ore and s-ore)?
  15. I think it's not working because when creating your ArmorMaterial in your ModItems class you pass Reference.MOD_ID + ":steel_ingot" as the texture name. So minecraft searches in your assets/MOD_ID/textures/models/armor folder for steel_ingot_layer_1.png and steel_ingot_layer_2.png But i don't think that are your texture file names.
  16. I would like to make a flashlight item. But before starting i would like to know if it will work to create a item with a custom model and custom shader. I have read https://mcforge.readthedocs.io/en/latest/models/advanced/introduction/ and So will i be able to create a flashlight with this which lights up other blocks?
  17. With this you are trying to register your event handler twice. You probably want to take a look at the docs: https://mcforge.readthedocs.io/en/latest/events/intro/ This deletes the item stack you are holding with your cursor. Just use EntityPlayer.closeScreen(). Also when you set your inventory hotkey to TAB then with your code the inventory will get closed immediately after opening. Because the key input event gets called once on the key press and once on the key release (and also multiple times as long as you hold the key). This can be checked in the event with the KeyInputEvent.getAction() method (returns 1 for the key press action, 0 for the key release action and 2 for the key repeat action). But note that when you open the inventory with the InventoryHotKey the KeyInputEvent is fired for the key press action ( and depending on how long you hold the key also the key repeat action) and after that for the key release action. But when you are in the inventory and press the InventoryHotKey then the KeyInputEvent is only fired for (depending on how long you hold the key also the key repeat action and ) the key release action.
  18. I noticed when there are multiple break speed events it can get buggy. What i mean is the first break speed event sets the new speed to the original speed * 0.5F. Then the second event tries to do something similar. For example it sets the new speed to the original speed * 1.3F. The problem is that both events take the original speed as basis. So when the original speed is 1 then the new speed would be 1.3 but the correct value would be 0.65. So i should always take the new speed as my base value and do my calculation. And then set the new speed to my calculated speed. But if another mod has a break speed event which is fired after my event and it uses the original speed as a base value then my calculations are completely ignored. What can i do to prevent this? Setting the event prioriy to low or lowest is the only thing that i can think of.
  19. In Forge 1.13.2 the IRecipeSerializer class doesn't extend IForgeRegistryEntry. So can it even work in 1.13.2? It seems like i should just skip Forge 1.13.2 and work in Forge 1.14.4 since 1.13 is not getting updated currently.
  20. So i have a json recipe and it is loading but i want to add a condition to it. So i tried to do like in 1.12. But it gives me this error com.google.gson.JsonSyntaxException: Unknown condition type: recipes_and_more:golden_apple This is my recipe file: And my _factories file: And my condition class:
  21. Since my first attempt isn't working i would use the HarvestCheck event. You only need to check if the block is netherrack and set the success to true.
  22. Block.setHarvestLevel Nvm i thought this would work but it can only remove the need of a high level pickaxe but not of a pickaxe at all.
  23. Despite the fact that you aren't event using the @SideOnly annotation you are trying to register your event handler twice. Once with the @ Mod.EventBusSubscriber annotation and once with the MinecraftForge.EVENT_BUS.register method. You should read in the documentation how to register event handlers: https://mcforge.readthedocs.io/en/latest/events/intro/
  24. How should i do this? Or where should i start looking because i never worked with shaders.
×
×
  • Create New...

Important Information

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