-
Posts
56 -
Joined
-
Last visited
Everything posted by _Bedrockbreaker_
-
[1.15.2] How to add a camera zoom like vanilla bow on aim?
_Bedrockbreaker_ replied to Torq's topic in Modder Support
The link you posted is invalid, and I can't find any relevant repo from that github account. -
[1.15.2] How to add a camera zoom like vanilla bow on aim?
_Bedrockbreaker_ replied to Torq's topic in Modder Support
Looking at some old (1.12.2) code from redstoneflux, I traced its fov changes back to cofhcore. In there, they subscribe to the FOVUpdateEvent, and test if the active itemstack's item is an instance of their modded bow. The event given by the subscription has a method to setNewFov, where they take the current fov, and subtract off (the bow's "progress" (how far the bow is pulled back) squared, times an arbitrary modifier, aka "zoom"). Hopefully this transfers over to 1.15 more easily, but even if it doesn't, that should at least provide some more insight about what to do. related links: FOVUpdateEvent: https://github.com/CoFH/CoFHCore/blob/dbab6db4bfa90dd0a4bb801330620dc34a0392a9/src/main/java/cofh/core/proxy/EventHandlerClient.java Bow: https://github.com/CoFH/CoFHCore/blob/1.12/src/main/java/cofh/core/item/tool/ItemBowCore.java -
Try looking at the vanilla code for tall flowers or even the door. I'm sure those will provide enough information to be helpful. Their code shouldn't be specific to being a normal plant or door.
-
[1.14.4] Forcing client to update mouse slot contents
_Bedrockbreaker_ replied to _Bedrockbreaker_'s topic in Modder Support
I'm not trying to. I know that the actual moving of the itemstacks should be server-side. I'm pretty sure that the PlayerContainerEvent is server-side, which should mean that the attached listener operates server-side as well (at least I think it is). As far as I've tested, the server thinks the items are correct, but the client hasn't been notified that the changes have occured, hence the visual glitch of supposed duplicated items. But upon updating their inventory, everything appears correctly. ... After quickly adding a println, the PlayerContainerEvent is indeed server-side. -
[1.14.4] Forcing client to update mouse slot contents
_Bedrockbreaker_ replied to _Bedrockbreaker_'s topic in Modder Support
Aaand, that confirms my suspicion of really bad, jank code. In Events.java, I subscribe to the open container event, and attach a new listener to the container (the "InventorySwap" listener). Inside that, I override the sendSlotContents method, which fires any time a slot in the container changes. Whenever the slot contents changes, I set the container slot to the mouse's new stack (which was the container's old stack), and the mouse's slot to the container's new stack (which was the mouse's old stack.) This effectively prevents me from picking anything up, since the stacks are put back to where they were. I also save a copy of the changed container's slot id, because when I put the container's stack back to where it was, it fires the sendSlotContents event again, and I need to check to make sure that I'm not firing my code twice. Since I'm obviously doing about nothing correctly, what should I be doing instead? -
[1.14.4] Forcing client to update mouse slot contents
_Bedrockbreaker_ replied to _Bedrockbreaker_'s topic in Modder Support
I guess I probably should've realized that beforehand. I've simplified the code down to the bare minimum, (which still describes the exact behavior which I mentioned.) I realize I'm probably doing something jank and not good, but I'm not sure what. //Events.java @SubscribeEvent public static void onContainerOpen(PlayerContainerEvent.Open event) { listener = new InventorySwap(event.getPlayer()); event.getContainer().addListener(listener); } //InventorySwap.java private PlayerEntity player; private int slot; public InventoryFluidSwap(PlayerEntity player) { this.player = player; } @Override public void sendSlotContents(Container containerToSend, int slotInd, ItemStack stack) { if (player.inventory.getItemStack().isEmpty() || stack.isEmpty()) return; // Makes sure that this doesn't fire its own event again. if (this.slot != slotInd) { this.slot = slotInd; } else { this.slot= -1; return; } containerToSend.putStackInSlot(slotInd, player.inventory.getItemStack()); player.inventory.setItemStack(stack); } -
I have a certain event called whenever a player ctrl+clicks two fluid tanks in an inventory to swap their contents. When the player does so, the tank they had in their mouse slot stays in their mouse slot, and the tank in the inventory/chest/whatever stays in the inventory (but their contents are swapped, obviously). However, the client visually looks like it has a duplicated chest-tank in the mouse, until you put it in a slot and pick it up again, by which it realizes something has changed and correctly shows the original mouse-tank with its contents swapped. (the chest-tank the entire time is always correct.) Is there a way to force the client to realize this earlier?
-
Looking at my own logs, yeah you're right. I just assumed the other log was needed due to the incompleteness of the provided one. Reading over the provided debug log, Pantosh joins a server and the chat appears to be working, which means everything loads at least correctly, though the log cuts off there. After looking at the crash log, I see Optifine, and the crash resulting from a rendering error. Try removing Optifine and see how that handles.
-
The file you linked is not the correct file; please provide the crash log file, where it can be found in the crash-reports folder.
-
[1.14.4] Rendering Placed Block Into Gui
_Bedrockbreaker_ replied to _Bedrockbreaker_'s topic in Modder Support
Sorry if I seem incompetent, but how would I use BlockRendererDispatcher? I understand how to get a block's blockstate, but the BRD class (for short) doesn't give my any methods I can use in the render method for the gui (unless I'm blind), and I can't get a BRD from the blockstate (or at least I think I can't due to my limited testing). -
[1.14.4] Rendering Placed Block Into Gui
_Bedrockbreaker_ replied to _Bedrockbreaker_'s topic in Modder Support
After further testing, I can get the ItemStack of a block from BlockState#getBlock().getPickBlock(). This leads to some side effects, such as the cauldron rendering as its item form, and certain modded blocks which don't override getPickBlock() correctly may return an empty ItemStack. However, this is good enough for my use case. -
I have my own custom gui which is called when a player hits a block. For my testing purposes, it renders any time a player hits a block, but will be later refined to any time a fluid tank is hit with an held fluid tank item. As such, I think I can guarantee that the player will be hitting a TileEntity when the Gui is rendered (if this is relevant to rendering the block). When the Gui is constructed, I pass it the block's position. Inside the gui, I would like to render the block, but I'm afraid I don't really know how. I see the methods for rendering an ItemStack into the gui, but I'm not sure if you can even get the ItemStack from a placed block. Preferably, I would like to also render the block's tooltip (as if were an item) over the rendered image, but the method for rendering tooltips also needs an ItemStack.
-
[1.12] Preventing crafting item from taking damage.
_Bedrockbreaker_ replied to _Bedrockbreaker_'s topic in Modder Support
Oh. That should probably help. Yeah, just changed my class to extend from Item, and not ItemTool, then just set the max durability in the constructor. Worked fine. Yeah, but the item is somewhat medium-difficult to make, and it only has 16 uses. Just makes it easier for the player not to be "oh that sucks. Now I have to make one again." And onLeftClickEntity passes the "hit" event, but returning true does nothing, and returning false makes the entity never take damage, or even act if it ever got punched. -
I have a working crafting item (a filter of sorts, specifically. Used to filter gunpowder into sulfur) that takes damage upon using it in a crafting recipe. The only problem is that it also takes damage upon mining a block, or hitting an entity. What can disable that? Would it be a simple method to override? I can't find any if there is.
-
[1.12.2] Generating New crops in Villages
_Bedrockbreaker_ replied to _Bedrockbreaker_'s topic in Modder Support
Okay, got the structure working exactly how I wanted it to. Thanks for the help! -
[1.12.2] Generating New crops in Villages
_Bedrockbreaker_ replied to _Bedrockbreaker_'s topic in Modder Support
Alright, got my code to work, and after several hours of debugging, I realized that the second for loop in the double for loop in the addComponentParts section was checking the first variable, meaning that it would get stuck trying to increase j to basically infinity. much fun was had. After that was done, I finally got it to generate, and now I just have to get the numbers right on where the crops actually spawn. The only problem now is that beet roots don't seem to like the "age" property, and the game crashes if I try to set their age. Is there a solution, or am I going to have to not spawn beetroots at all? -
[1.12.2] Generating New crops in Villages
_Bedrockbreaker_ replied to _Bedrockbreaker_'s topic in Modder Support
My main class doesn't seem to be liking that. Keeps saying that it cannot be resolved or is not a field. The MapGenStructureIO thing seems to work though. And I think this works for checking the biome. world.getBiome(new BlockPos(sBoundingBox.minX, sBoundingBox.minY, sBoundingBox.minZ) . I think. I did get a bit lost in your example code, as I didn't realize that you had both a "cloud house" and "cloud village". Kept getting confused. Still confused, I will post links to my github, with links to related files. Nothing is printed to the console, which means that villageCropPeppers is never even being ran. This leads me to believe that is is VillagerRegistry.instance().registerVillageCreationHandler(Reference.MODVILLAGEREGISTER); 's fault, (I have commented it out, as it errors), because that part needs to be ran. Otherwise, I think I am good. think -
[1.12.2] Generating New crops in Villages
_Bedrockbreaker_ replied to _Bedrockbreaker_'s topic in Modder Support
Taking a look at Binnies Trees, seems to do almost the same think Actually Additions does. The only difference is that binnie creates a building, then populates the crops with any of the vanilla crops, or theirs. Actually additions just populates it with their own crops, because they have about 4 different types. So I am thinking, that overriding any crops on world gen isn't going to be the answer, but generating a new building. Both mod's code provides enough detail on how to create a farm module, and register it. However, I don't see a reference to how that building is generated. There is a class in each mod that implements VillagerRegistry.IVillageCreationHandler . But none of the classes seem to be called by anything. Are they called from VillagerRegistry.IVillageCreationHandler , or is there something that I am missing? What would be the "correct" way of spawning the structures only in deserts? -
I just got really curious as to what the different "rankings" of users are. Mine I know is "tree puncher" and I have seen others, such as "reality controller". Is there a list I could see? And what causes a user to go up rankings? (Besides the special ones. Like "forge modder" obviously.)
-
I have a crop that works, (only problem is that is that is outputs Exception loading model for variant rtap:croppeppers#inventory for item "minecraft:air" on load time) I want it generate in the village farm land module-thingies though. I know Actually Additions does this, and its code seems to generate an entirely "new" building for their crops. I was wondering if I could just replace some of the existing crops with my crops. (Honestly, generating a new building isn't something I wouldn't do, and I am wondering if it would be the better option.) I don't know how to begin starting on this type of thing, so any help is appreciated. Bonus points if the plant can only generate in desert villages.
-
[1.12.2] Inserting Loot tables
_Bedrockbreaker_ replied to _Bedrockbreaker_'s topic in Modder Support
Alright, I am pretty sure registering loot tables doesn't need be not static, so I am just going to leave it like that. However, I still don't understand what the new error means. Can anyone help me figure out what went wrong, and would there be any more information that I would need to give to help solve this? EDIT: After some testing, it turns out the forge seems to hate registering the loot table inside the LootTableLoadEvent. So, I got the problem fixed. Thanks for your help! -
[1.12.2] Inserting Loot tables
_Bedrockbreaker_ replied to _Bedrockbreaker_'s topic in Modder Support
Alright, thanks for the help so far. I didn't know my class had to be static, so thanks for that. However, now that the loot table class actually runs, I get an error on trying to enter a world. The only thing is, the error never references a part of my mod's code, and only says this: So..... I honestly have no idea what went wrong. I haven't changed the class, So the spoiler in the first post is still accurate. -
[1.12.2] Inserting Loot tables
_Bedrockbreaker_ replied to _Bedrockbreaker_'s topic in Modder Support
*facepalms* No I have not. However, typing MinecraftForge.EVENT_BUS.register(ModLootTables.class); Into any of "init stages" of my main mod class, doesn't seem to do anything (I have a different event bus register for entity interact). Nothing is still printed to the console. As for @Draco18s's comment, If I am to understand the file correctly, the many addItemToTable s essentially do the same thing, but with added arguments for each one. The actual part where the item is added is line 116, which takes newPool from line 106 which takes a ton of arguments, which would be originally defined in the loot table json, but is instead defined with lines 88-104. I think that is how that works. I still do have a question as to what "name" does when adding a loot pool. Is it a unique identifier for the pool? If I am injecting a json into a table, does it have to be the "name" specified from inside the json? Also at line 104, can I replace LootEntryItem with LootEntryTable to substitute an Item for a json? -
I already tried looking at the documentation for injecting loot tables into vanilla ones, and I still can't figure it out, even after looking through Botania's code that uses it. I have a basic ModLootTables file with I just want to add a drop to the ocelot's death loot table. However, the System.out.println parts never actually send anything to the console, making me feel like the class is never running. I don't think I need to reference the class in any other place out side of itself, but I still don't quite know how the event system works. The loot table json itself is valid and located in loot_tables/inject/ocelot.json
-
Okay. What should I do then, If I don't intend on owning a website dedicated to my mod? When I first started modding, the tutorials I followed always had com.something.examplemod. So I didn't know anything was wrong. As for @jabelar, I finally understood what to do after looking through your code and got my mod working again. Thanks for the help!