Jump to content

Noxxous

Members
  • Posts

    48
  • Joined

  • Last visited

Everything posted by Noxxous

  1. I think he means extend the potion class but I'm not 100% sure
  2. Hi, Currently I am trying to change the player's dimension on right click by doing: "context.getPlayer().changeDimension([Nether Server World goes here])" which I know this is based upon PlayerEntity and context.getPlayer() just calls the PlayerEntity... It's just that the problem is, this is as far I've got and I've tried to use RegistryKeys but I've given up on that and I am thinking of using the ITeleporter after using the context: level and I've using that but my game just crashes. Please help. What do I do?
  3. Hi, sorry I didn't get back to you. I have already created a GUI that isn't great but it opens on right click and I have even put on some redstone detection to allow to charge (repair my item) and I think I want a container because this explanation says that it has progress bar which I assume means it is tickable... I haven't been doing coding a for a while because I have had things going on https://greyminecraftcoder.blogspot.com/2020/04/containers-1144.html
  4. Hey guys, I have been trying to Google this for a couple of hours but I can't find anything on making a GUI and everything I have found is mostly outdated. I was more wondering if anyone has any links to good tutorials or maybe some information on Forge/Minecraft's API. This is everything I felt I needed to say
  5. No it isn't possible but you could make your own redstone and you can use Redstone repeaters or you could edit Minecraft's source code
  6. Will do. Thank you
  7. How do I make it a tutorial?
  8. Hi, I am giving you code that lets you let the block do something when you switch it on with Redstone. It is of course for 1.16 but can updated with the same principles. You just have to code in the actions or statements into "onRedstoneActivated". This will work if the redstone is already on and you place it where to signal is leading towards being used in "onPlace". There is example code in here that is optional and can be deleted... I have taged it with "optional" package com.blakegale.test; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.entity.EntityType; import net.minecraft.entity.SpawnReason; import net.minecraft.util.DamageSource; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.server.ServerWorld; public class DemonBlock extends Block { public DemonBlock(Properties properties) { super(properties); } //Being used as the redstone detection method @Override public void neighborChanged(BlockState state, World world, BlockPos pos, Block block, BlockPos pos_2, boolean Boolean) { if (redstoneIsActivated(world, pos)) { onRedstoneActivated(world, pos, block, Boolean); } } //Also being used as Redstone Detection except it automatically switches on when you place the block down @Override public void onPlace(BlockState state, World world, BlockPos pos, BlockState state_2, boolean Boolean) { if (redstoneIsActivated(world, pos)) { onRedstoneActivated(world, pos, state.getBlock(), Boolean); } } //if redstone signal is activated private boolean redstoneIsActivated(World world, BlockPos pos) { if (world.hasNeighborSignal(pos)) { return true; } return false; } //All of the block actions/statements when turned on by Redstone protected static final void onRedstoneActivated (World world, BlockPos pos, Block block, boolean Boolean) { /* * actual body of statements, of when block is activated by Redstone */ //example code, optional killAllPlayers (world, pos); //example code, optional EntityType.WITHER.spawn(((ServerWorld) world), null, null, new BlockPos(pos.getX(), pos.getY()+1, pos.getZ()), SpawnReason.COMMAND, Boolean, Boolean); } //The thing that kills all the players. This method is optional protected static final void killAllPlayers(World world, BlockPos pos) { for (int i = 0; i < world.players().size(); i++) { world.players().get(i).hurt((new DamageSource("activatingtheblock")).bypassArmor(), Float.MAX_VALUE); } } } This is just the block class name and package importations, with the constructor. This is created by creating the class, adding "extend Block", and creating a new instance of this in wherever you instantiate and register your block items and variables package com.blakegale.test; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.entity.EntityType; import net.minecraft.entity.SpawnReason; import net.minecraft.util.DamageSource; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.server.ServerWorld; public class DemonBlock extends Block { public DemonBlock(Properties properties) { super(properties); } This code is activated when anything around it is changed. The if statement checks the neighbouring blocks if it is being powered by redstone and then calls the "onRedstoneIsActivated" method //Being used as the redstone detection method @Override public void neighborChanged(BlockState state, World world, BlockPos pos, Block block, BlockPos pos_2, boolean Boolean) { if (redstoneIsActivated(world, pos)) { onRedstoneActivated(world, pos, block, Boolean); } } Same story with this one but is activated as soon as it is placed and is used to automatically switch on if there's already redstone activated and will activate the actions show down below. You don't need this, lots things like iron doors don't turn on automatically do actions if you place them down next to activated Redstone Signal, instead of turning them on after they've been placed //Also being used as Redstone Detection except it automatically switches on when you place the block down @Override public void onPlace(BlockState state, World world, BlockPos pos, BlockState state_2, boolean Boolean) { if (redstoneIsActivated(world, pos)) { onRedstoneActivated(world, pos, state.getBlock(), Boolean); } } This one is the method is the one that is called when it's checking if it's being activated by redstone, if it does have a signal it will return true and that "true" will be used by the if statement to activate the code that does all the actions when it is turned off. After that is "return false;" which is the default and so will turn off the if statement and won't work //if redstone signal is activated private boolean redstoneIsActivated(World world, BlockPos pos) { if (world.hasNeighborSignal(pos)) { return true; } return false; } This is the actual actions code method and will do whatever you want and is being called by the first two previous methods //All of the block actions/statements when turned on by Redstone protected static final void onRedstoneActivated (World world, BlockPos pos, Block block, boolean Boolean) { /* * actual body of statements, of when block is activated by Redstone */ //example code, optional killAllPlayers (world, pos); //example code, optional EntityType.WITHER.spawn(((ServerWorld) world), null, null, new BlockPos(pos.getX(), pos.getY()+1, pos.getZ()), SpawnReason.COMMAND, Boolean, Boolean); } This statement (underneath the comments) calls a method that will kill all the player. You don't need it //example code, optional killAllPlayers (world, pos); Like this: //The thing that kills all the players. This method is optional protected static final void killAllPlayers(World world, BlockPos pos) { for (int i = 0; i < world.players().size(); i++) { world.players().get(i).hurt((new DamageSource("activatingtheblock")).bypassArmor(), Float.MAX_VALUE); } } What it does is it gets an array or the code equivalent of a list of information and gets the "size()" or how many players are listed on the server This: //example code, optional EntityType.WITHER.spawn(((ServerWorld) world), null, null, new BlockPos(pos.getX(), pos.getY()+1, pos.getZ()), SpawnReason.COMMAND, Boolean, Boolean); takes the EntityType "Wither" and spawns it in the world. You don't need this either
  9. Ok it's fine I just changed the modid in the JSON file
  10. Ok I fixed that issue by lengthening my modid. That seemed to do the trick but there's one other error [07:01:31] [Client thread/ERROR] [FML.TEXTURE_ERRORS]: +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= [07:01:31] [Client thread/ERROR] [FML.TEXTURE_ERRORS]: The following texture errors were found. [07:01:31] [Client thread/ERROR] [FML.TEXTURE_ERRORS]: ================================================== [07:01:31] [Client thread/ERROR] [FML.TEXTURE_ERRORS]: DOMAIN minecraft [07:01:31] [Client thread/ERROR] [FML.TEXTURE_ERRORS]: -------------------------------------------------- [07:01:31] [Client thread/ERROR] [FML.TEXTURE_ERRORS]: domain minecraft is missing 1 texture [07:01:31] [Client thread/ERROR] [FML.TEXTURE_ERRORS]: domain minecraft has 3 locations: [07:01:31] [Client thread/ERROR] [FML.TEXTURE_ERRORS]: unknown resourcepack type net.minecraft.client.resources.DefaultResourcePack : Default [07:01:31] [Client thread/ERROR] [FML.TEXTURE_ERRORS]: unknown resourcepack type net.minecraft.client.resources.LegacyV2Adapter : FMLFileResourcePack:Forge Mod Loader [07:01:31] [Client thread/ERROR] [FML.TEXTURE_ERRORS]: unknown resourcepack type net.minecraft.client.resources.LegacyV2Adapter : FMLFileResourcePack:Minecraft Forge [07:01:31] [Client thread/ERROR] [FML.TEXTURE_ERRORS]: ------------------------- [07:01:31] [Client thread/ERROR] [FML.TEXTURE_ERRORS]: The missing resources for domain minecraft are: [07:01:31] [Client thread/ERROR] [FML.TEXTURE_ERRORS]: textures/items/angel.png [07:01:31] [Client thread/ERROR] [FML.TEXTURE_ERRORS]: ------------------------- [07:01:31] [Client thread/ERROR] [FML.TEXTURE_ERRORS]: No other errors exist for domain minecraft [07:01:31] [Client thread/ERROR] [FML.TEXTURE_ERRORS]: ================================================== [07:01:31] [Client thread/ERROR] [FML.TEXTURE_ERRORS]: +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
  11. package com.blake.cloudmod; import net.minecraft.item.Item; public class CommonProxy { public void registerItemRenderer (Item item, int meta, String id) {} }
  12. package com.blake.cloudmod; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemAnvilBlock; import net.minecraft.item.ItemAppleGold; import net.minecraftforge.client.model.ModelLoader; public class ClientProxy extends CommonProxy { //this appears to be the issue public void registerItemRenderer (Item item, int meta, String id) { ModelLoader.setCustomModelResourceLocation (item, meta, new ModelResourceLocation(item.getRegistryName(), id)); } } package com.blake.cloudmod.util.handlers; import com.blake.cloudmod.init.Items; import com.blake.cloudmod.util.IHasModel; import net.minecraft.item.Item; import net.minecraftforge.client.event.ModelRegistryEvent; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.fml.common.Mod.EventBusSubscriber; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; @EventBusSubscriber public class RegistryHandler { @SubscribeEvent public static void onItemRegister(RegistryEvent.Register<Item> event) { event.getRegistry().registerAll(Items.ITEMS.toArray(new Item[0])); } @SubscribeEvent public static void onModelRegister(ModelRegistryEvent event) { for (Item item : Items.ITEMS) { if (item instanceof IHasModel) { ((IHasModel)item).registerModels(); } } } } package com.blake.cloudmod.init.items; import com.blake.cloudmod.mainClass; import com.blake.cloudmod.init.Items; import com.blake.cloudmod.util.IHasModel; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; public class ItemBase extends Item implements IHasModel { public ItemBase(String name) { setUnlocalizedName(name); setRegistryName(name); setCreativeTab(CreativeTabs.MISC); Items.ITEMS.add(this); } //this method is loaded @Override public void registerModels() { mainClass.proxy.registerItemRenderer(this, 0, "inventory"); } }
  13. I'm trying to Render my Item but my code throws an exception. [06:13:42] [Client thread/ERROR] [FML]: Exception loading model for variant minecraft:hello#inventory for item "d:hello", normal location exception: net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model minecraft:item/hello with loader VanillaLoader.INSTANCE, skipping at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:161) ~[ModelLoaderRegistry.class:?] at net.minecraftforge.client.model.ModelLoader.loadItemModels(ModelLoader.java:302) ~[ModelLoader.class:?] at net.minecraft.client.renderer.block.model.ModelBakery.loadVariantItemModels(ModelBakery.java:175) ~[ModelBakery.class:?] at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:151) ~[ModelLoader.class:?] at net.minecraft.client.renderer.block.model.ModelManager.onResourceManagerReload(ModelManager.java:28) [ModelManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.registerReloadListener(SimpleReloadableResourceManager.java:121) [SimpleReloadableResourceManager.class:?] at net.minecraft.client.Minecraft.init(Minecraft.java:560) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:422) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_212] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_212] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_212] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_212] at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_212] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_212] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_212] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_212] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?] at GradleStart.main(GradleStart.java:25) [start/:?] Caused by: java.io.FileNotFoundException: minecraft:models/item/hello.json at net.minecraft.client.resources.FallbackResourceManager.getResource(FallbackResourceManager.java:69) ~[FallbackResourceManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SimpleReloadableResourceManager.java:65) ~[SimpleReloadableResourceManager.class:?] at net.minecraft.client.renderer.block.model.ModelBakery.loadModel(ModelBakery.java:334) ~[ModelBakery.class:?] at net.minecraftforge.client.model.ModelLoader.access$1400(ModelLoader.java:115) ~[ModelLoader.class:?] at net.minecraftforge.client.model.ModelLoader$VanillaLoader.loadModel(ModelLoader.java:861) ~[ModelLoader$VanillaLoader.class:?] at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:157) ~[ModelLoaderRegistry.class:?] ... 20 more [06:13:42] [Client thread/ERROR] [FML]: Exception loading model for variant minecraft:hello#inventory for item "d:hello", blockstate location exception: net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model minecraft:hello#inventory with loader VariantLoader.INSTANCE, skipping at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:161) ~[ModelLoaderRegistry.class:?] at net.minecraftforge.client.model.ModelLoader.loadItemModels(ModelLoader.java:296) ~[ModelLoader.class:?] at net.minecraft.client.renderer.block.model.ModelBakery.loadVariantItemModels(ModelBakery.java:175) ~[ModelBakery.class:?] at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:151) ~[ModelLoader.class:?] at net.minecraft.client.renderer.block.model.ModelManager.onResourceManagerReload(ModelManager.java:28) [ModelManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.registerReloadListener(SimpleReloadableResourceManager.java:121) [SimpleReloadableResourceManager.class:?] at net.minecraft.client.Minecraft.init(Minecraft.java:560) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:422) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_212] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_212] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_212] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_212] at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_212] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_212] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_212] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_212] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?] at GradleStart.main(GradleStart.java:25) [start/:?] Caused by: net.minecraft.client.renderer.block.model.ModelBlockDefinition$MissingVariantException at net.minecraft.client.renderer.block.model.ModelBlockDefinition.getVariant(ModelBlockDefinition.java:83) ~[ModelBlockDefinition.class:?] at net.minecraftforge.client.model.ModelLoader$VariantLoader.loadModel(ModelLoader.java:1175) ~[ModelLoader$VariantLoader.class:?] at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:157) ~[ModelLoaderRegistry.class:?] ... 20 more { "parent": "item/generated", "textures": { "layer0": "d:item/angel" } } I have created the code. It seems to be isolated to the custom resource location. "d" is my modid, and "angel" is a png. I'm honestly at my wit's end trying to find what's wrong with the code. It doesn't seem to want to load the JSON file.
  14. Please reply to this one. Crafting Recipes?
  15. Ok the material changing helped. Thanks
  16. Hi, I am trying to use 'setHarvestLevel("pickaxe", 3)' in my block constructor but nothing seems to be working. It does render but I am legitimately out of ideas, what might I be doing wrong as I do not get error messages yet will be able harvest it with my fist.
  17. I did that because of the smallness of the code I wanted to put in there. I didn't want to show a whole class just a bit of code
  18. @Mod.EventBusSubscriber needs to be at the top of the class, before declaration and the subscribe event needs to be a static. Other than that, this is the smallest you can get it and it is good because you don't need to create another class for the items. Thanks, you helped me get to understand this
  19. Ok, so I have been spending all day trying to code in an Item and it seems to work but when I check miscellaneous tab, it just doesn't show up. I don't know what I am doing wrong, no crash reports, nothing. What am I doing wrong? Please help. Thank you
×
×
  • Create New...

Important Information

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