Jump to content

MistaOmega

Members
  • Posts

    89
  • Joined

  • Last visited

  • Days Won

    2

MistaOmega last won the day on November 11

MistaOmega had the most liked content!

1 Follower

Converted

  • Gender
    Male
  • URL
    https://github.com/MistaOmega
  • Location
    UK

Recent Profile Visitors

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

MistaOmega's Achievements

Stone Miner

Stone Miner (3/8)

11

Reputation

  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
×
×
  • Create New...

Important Information

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