Jump to content

MistaOmega

Members
  • Posts

    89
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by MistaOmega

  1. Perhaps check the code for other minecraft commands to see if that's possible, for example the GiveCommand class Or even write your own command
  2. The error is in the LightningChannellerScreen class on the render method is there anything in there that's not updated to support 3 slots?
  3. @warjortAgain your advice was invaluable, thank you, it was a good idea to think of a new method Here's how I've done it: A generic ore rarities class will allow the addition of any resource location, you can assign a 0-1 rarity value A random number gen will give me a random number of up to 6 decimal points of precision, this means the lowest value is 0.000001 Rarity is handled by having these categories of ores, entered into a selection pool based on the value, say the number is 0.1, anything with a value greater than 0.1 is entered into the pool, and an item selected at random. This allows for a good rarity distribution and I've left a copy of my "RarityItem" class here for your viewing displeasure. This class aims to have json support for adding different mods to the system later without having to define them in-code. This class also has versatility in using forge ore prefixes, or exact resource locations package mistaomega.belladonna.lib.helpers; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.material.MaterialColor; import java.math.BigDecimal; /** * Helper class to handle rarity for random resource generation * You must have an impl class that defines rarities for each item. * TODO This class supports JSON based imports which can be used to define custom ores that aren't by default included * This uses BigDecimal, When using the values use the {@link BigDecimal#doubleValue()} method to get the double back * This can also use material colors to add the ability to add a color-based rarity modifier if required */ public class RarityItem { public final ResourceLocation resourceLocation; public final BigDecimal weighting; public final MaterialColor MaterialColor; public RarityItem(String resourceEnd, BigDecimal weighting, MaterialColor MaterialColor){ this(new ResourceLocation("forge", resourceEnd), weighting, MaterialColor); } public RarityItem(String resourceEnd, double weighting, MaterialColor MaterialColor){ this(new ResourceLocation("forge", resourceEnd), BigDecimal.valueOf(weighting), MaterialColor); } public RarityItem(ResourceLocation resourceLocation, RarityType weighting, MaterialColor MaterialColor){ this(resourceLocation, BigDecimal.valueOf(weighting.getValue()), MaterialColor); } public RarityItem(String resourceEnd, RarityType weighting, MaterialColor MaterialColor){ this(new ResourceLocation("forge", resourceEnd), BigDecimal.valueOf(weighting.getValue()), MaterialColor); } public RarityItem(ResourceLocation resourceLocation, BigDecimal weighting, MaterialColor MaterialColor){ if(weighting.doubleValue() > 1d || weighting.doubleValue() < 0d || weighting.scale() > 6){ throw new IllegalArgumentException("Weighting not in correct ranges: 0 - 1"); } this.resourceLocation = resourceLocation; this.weighting = weighting; this.MaterialColor = MaterialColor; } /** * Rarity type works on a floating point selection between 0 and 1 * The category is selected based on the value being less than or equal to the weighting, * E.G 0.652, selects up to a common item, 0.011 selects up to an ultra rare item. * Note that the logic behind this simply adds the item to the loot table per operation, if the value is 0.000001, all ores can be selected * But there is no guarantee it will be an "Impossibly rare" item */ public enum RarityType{ BASIC(1), COMMON(0.8), RARE(0.5), VERY_RARE(0.2), ULTRA_RARE(0.1), STUPID_RARE(0.01), IMPOSSIBLY_RARE(0.000005); private final double value; RarityType(double value) { this.value = value; } public double getValue() { return value; } } } And here is the current staus of my impl class: package mistaomega.belladonna.recipe; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.material.MaterialColor; import java.util.ArrayList; import java.util.List; import mistaomega.belladonna.lib.helpers.RarityItem; public class OreRarityImpl { public static List<RarityItem> OreRarities = new ArrayList<>(); public static void init(boolean extras){ //region vanilla ores OreRarities.add(new RarityItem("ores/coal", RarityItem.RarityType.BASIC, MaterialColor.COLOR_LIGHT_GRAY)); OreRarities.add(new RarityItem("ores/copper", RarityItem.RarityType.BASIC, MaterialColor.COLOR_ORANGE)); OreRarities.add(new RarityItem("ores/iron", RarityItem.RarityType.COMMON, MaterialColor.COLOR_LIGHT_GRAY)); OreRarities.add(new RarityItem("ores/gold", RarityItem.RarityType.RARE, MaterialColor.GOLD)); OreRarities.add(new RarityItem("ores/lapis", RarityItem.RarityType.RARE, MaterialColor.COLOR_BLUE)); OreRarities.add(new RarityItem("ores/diamond", RarityItem.RarityType.VERY_RARE, MaterialColor.COLOR_LIGHT_BLUE)); OreRarities.add(new RarityItem("ores/emerald", RarityItem.RarityType.VERY_RARE, MaterialColor.COLOR_GREEN)); OreRarities.add(new RarityItem("ores/netherite_scrap", RarityItem.RarityType.ULTRA_RARE, MaterialColor.COLOR_BLACK)); //endregion //region mekanism OreRarities.add(new RarityItem("ores/osmium", RarityItem.RarityType.COMMON, MaterialColor.COLOR_LIGHT_GRAY)); OreRarities.add(new RarityItem("ores/tin", RarityItem.RarityType.COMMON, MaterialColor.COLOR_LIGHT_GRAY)); OreRarities.add(new RarityItem("ores/uranium", RarityItem.RarityType.VERY_RARE, MaterialColor.COLOR_LIGHT_GREEN)); OreRarities.add(new RarityItem("ores/fluorite", RarityItem.RarityType.RARE, MaterialColor.SNOW)); OreRarities.add(new RarityItem("ores/lead", RarityItem.RarityType.COMMON, MaterialColor.COLOR_BLUE)); //endregion //region MythicBotany OreRarities.add(new RarityItem(new ResourceLocation("mythicbotany:elementium_ore"), RarityItem.RarityType.VERY_RARE, MaterialColor.COLOR_PINK)); OreRarities.add(new RarityItem(new ResourceLocation("mythicbotany:dragonstone_ore"), RarityItem.RarityType.ULTRA_RARE, MaterialColor.COLOR_PINK)); //endregion //region Thermal OreRarities.add(new RarityItem("ores/cinnabar", RarityItem.RarityType.RARE, MaterialColor.COLOR_RED)); OreRarities.add(new RarityItem("ores/niter", RarityItem.RarityType.RARE, MaterialColor.SNOW)); OreRarities.add(new RarityItem("ores/silver", RarityItem.RarityType.RARE, MaterialColor.COLOR_LIGHT_GRAY)); OreRarities.add(new RarityItem("ores/nickel", RarityItem.RarityType.COMMON, MaterialColor.COLOR_YELLOW)); OreRarities.add(new RarityItem("ores/sulfur", RarityItem.RarityType.COMMON, MaterialColor.COLOR_YELLOW)); //endregion } private void initExtrasFromFile(){ } }
  4. Don't comment it out, walk through it, if you're certain it's a dependency, look here: dependencies { minecraft "net.minecraftforge:forge:${forge_version}" annotationProcessor "org.spongepowered:mixin:${mixin_version}:processor" //compileOnly fg.deobf("blusunrize.immersiveengineering:ImmersiveEngineering:${ie_version}") //runtimeOnly fg.deobf("blusunrize.immersiveengineering:ImmersiveEngineering:${ie_version}") compileOnly fg.deobf("mezz.jei:jei-${jei_version}:api") runtimeOnly fg.deobf("mezz.jei:jei-${jei_version}") runtimeOnly fg.deobf("curse.maven:configured-457570:${configured_version}") runtimeOnly fg.deobf("curse.maven:terraforged-363820:3451426") //runtimeOnly ("com.sk89q.worldedit:worldedit-core:${world_edit_version}") //runtimeOnly fg.deobf("com.sk89q.worldedit:worldedit-forge-mc${world_edit_mc_version}:${world_edit_version}") runtimeOnly fg.deobf("mekanism:Mekanism:${mekanism_version}")// core runtimeOnly fg.deobf("mekanism:Mekanism:${mekanism_version}:generators")// Mekanism: Generators } There's your dependency tree. Make sure you have those in your mod folder when you start it up Commenting out random bits of code could well cause an issue elsewhere, which you need to check for, which means looking over this code a bit more, it's to do with STRUCTURE_PIECE. So, what is it? when is it made? why is it needed? Is this erroring function's result used elsewhere in the code? Use your debugger. Don't just comment out code without checking what it's used for first.
  5. Carryon is what is firing that crash. However, I can see you have optifine installed, it loves to break stuff so try it without Optifine, if there's still an issue report it to the maker of Carryon
  6. Getting hold of that context, I'm not sure, I'd have to look way deeper into it, stopping the infinite loop should be as simple as doing an if to check if the renderer is an instanceof ExpressivePlayerRenderer, if it is, don't cancel
  7. I'm not immediately sure, as I haven't done anything like that before, but it seems to me that you're potentially answering your own question: Create a new player renderer that extends PlayerRenderer, replace the model for your own and then inside the event, cancel the current one and spawn a new event in it's place. Using your own renderer as the PlayerRenderer perhaps? The pre event you subscribe to needs the following: public Pre(Player player, PlayerRenderer renderer, float partialTick, PoseStack poseStack, MultiBufferSource multiBufferSource, int packedLight) { super(player, renderer, partialTick, poseStack, multiBufferSource, packedLight); } send everything through, most of which you can steal from the original event before the cancellation, and fire away... I hope? Oh yeah, you can fire an event like this: net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderPlayerEvent.Pre(player, renderer, partialTick, poseStack, multiBufferSource, packedLight)); Again, I'm not sure if this is recommended, safe or anything, but it's where I'd start
  8. BlockHitResult contains the getDirection method, which returns the direction of the hit result, which should help you. Subscribe to the PlayerInteractEvent.RightClickBlock and have a little look, you might find something of use there...
  9. It's looking for a field called STRUCTURE_PIECE here: net.tardis.mod.world.structures.TStructures.registerStructurePiece(TStructures.java:173) ~[tardis:1.5.4] {re:classloading}, so go to that file, at the registerStructurePiece function on line 173 and see what's going on You're using IntelliJ, it's got one of the most powerful debugging tools available, use it to your advantage. whack a breakpoint on the function and have a see what's going on.
  10. You joke, but it's actually a pretty reasonable error That's pretty good as far as errors go, it tells you what exactly is null, and what function caused it, from there you just create a breakpoint before it's called and watch to see what's missing. Could have something like this lmao:
  11. Thank you for that remarkably thorough and detailed answer. Gotta tell me how you got so good lmao I'll attempt that kind of work around and have a deep dive into it to see if I can pull anything off. Thank you again!
  12. HitResults can be used to get where you're looking, get the block from there
  13. Don't do all that new list stuff, all that casting and so on is bound to make an error, also, call your super first // add list to super super.fillItemList(list); // Add itemstacks to list list.add(new ItemStack(Items.OAK_LOG)); list.add(new ItemStack(Items.OAK_WOOD)); list.add(new ItemStack(Items.STRIPPED_OAK_LOG)); list.add(new ItemStack(Items.STRIPPED_OAK_WOOD)); // sort list List<Item> definedOrder = Arrays.asList(Items.OAK_LOG.asItem(), Items.OAK_WOOD.asItem(), Items.STRIPPED_OAK_LOG.asItem(), Items.STRIPPED_OAK_WOOD.asItem()); Comparator<ItemStack> tabSorter;tabSorter = Ordering.explicit(definedOrder).onResultOf(ItemStack::getItem); list.sort(tabSorter); this should do it, after testing it shows up with what you want
  14. Because you're not pushing anything into the super. The super looks like it wants a NonNullList of ItemStacks. So create a list of ItemStacks, you can create an ItemStack with an item via: ItemStack stack = new ItemStack(Items.OBSIDIAN); Then I'd send that list that you make into the super.fillItemList. list.sort only serves to modify the order of the list, you need to ensure that what you create and manipulate you send to the super. If you're unsure what super is for, refer to this link here: https://www.w3schools.com/java/ref_keyword_super.asp
  15. Your directory that you're calling doesn't contain a prepared gradle, or no build.gradle at all Try reloading your gradle project, on that image @Kosh sent, it's that little flowing circle button on the left side, if that fails, close intelliJ and reopen it, and open it in the folder which contains your build.gradle file and it should jump to life It will take a moment, so keep an eye on the bottom right progress bar Well done for choosing IntelliJ, kings use it only
  16. Have a look in ForgeEventFactory, and look at usages, ItemBow for example will give you some guidance
  17. 'myItemA' would be the item reference you want. So obsidian would be: Item i = Items.OBSIDIAN;
  18. Regardless I guess, if you want to fire an event. forge has a ForgeEventFactory class you can create events from.
  19. Why not use a InputEvent.KeyInputEvent instead of a tick event to check if your key was pressed?
  20. Yeah, I'd check to see what tick that you're referencing during this block: else if (FoodUtils.isBone(stack)) { Minecraft.getInstance().setScreen(new WolfFoodConfigScreen(this)); stack.shrink(1); return InteractionResult.SUCCESS; } add a level.IsClientSide() check before setting that screen so that when the server side tick passes through that function, it is ignored
  21. Line 522: java.lang.IllegalStateException: Rendersystem called from wrong thread Screens are client side only, so make sure you're opening the screen from the client
  22. Hi all o/ I'm working on a miner that generates ores from the void, much like the Void Miners from ETech. ETech is closed source, so I haven't been able to see how that developer handled ore generation in a way that kept to the rarities of certain ores, or if it even did it at all. So far I have used Tags.Blocks.ORES on all the registered blocks in ForgeRegisteries to get a complete list of forge ores, from here I am unsure how to get there rarities, this being, how commonly they spawn underground I plan to use this value as a modifier during random selection, much like a loot table with each ore having a percentage chance of being selected. Most of this is determined during world generation, but I am unsure if there's a way to work backwards, or if these ores may contain properties that determine spawn rarity, nothing in the OreBlock class gave this away. If this is possible, or if anyone has any good information regarding this, please let me know, thank you.
  23. Ayy glad to hear it! Good solve
  24. Usually when I get error like this I attempt the build gradle again, and then the "genIntelliJruns". if not I usually go and make a new project and move my files over after the fact. Might I also recommend this plugin: https://plugins.jetbrains.com/plugin/8327-minecraft-development It helps to get you started if you're having a rough time getting set up xo
  25. Set this up just as so, with the method being called from the constructor and it works perfectly, thank you again ❤️ private void trackProcess(){ final GrinderTile grinderTile = (GrinderTile) tileEntity; trackInt(new IntReferenceHolder() { @Override public int get() { return (int) grinderTile.getPowerRequirement(); } @Override public void set(int intIn) { grinderTile.setPowerRequirement(intIn); } }); trackInt(new IntReferenceHolder() { @Override public int get() { return grinderTile.getBurnTime(); } @Override public void set(int intIn) { grinderTile.setBurnTime(intIn); } }); }
×
×
  • Create New...

Important Information

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