-
Posts
444 -
Joined
-
Last visited
-
Days Won
5
Everything posted by kiou.23
-
How To Add A Survival Inventory Tab like Galacticraft?
kiou.23 replied to chrizz's topic in Modder Support
create your own topic, don't comment on one that has been dead for 2 years and a half and say what version you're developing in -
I'm pretty sure that you could override the Container#slotClick method, it handles what happens when, well, you click on a slot... the logic for it is quite obfuscated and confusing however... so there may be a better way to do it EDIT: If I'm not mistaken, the code between lines 290 and 342 of the Container class are the ones which handles when the player is holding an ItemStack, and clicks on a slot of the container
-
I'm pretty sure you need to specify the namespace of the type, so "minecraft:item" instead of just "item" plus, you should ask for help with modding under Modder Support, not General Discussion
-
I encourage you to look at the code for the BlockStateProvider class and the simpleBlock method, see the helper functions and what they call internally simpleBlock simply defines a model for a Block regardless of blockstate. so if it is a grass block that you want to make: it doesn't have a block state, you use the simpleBlock method if you only give the simpleBlock one parameter, a block, it generates a model with all faces with the same texture if that's not what you want tho, you can pass a custom model as the second parameter you can call models() to get the default BlockModelProvider, it has a bunch of methods for the common model files the one that you want is the BlockModelProvider#cubeBottomTop()
-
[main/FATAL] [ne.mi.fo.la.MavenVersionAdapter/]: Failed to parse version spec [1.16.5) org.apache.maven.artifact.versioning.InvalidVersionSpecificationException: Single version must be surrounded by []: [1.16.5) This is the line telling you the error, [1.16.5) is not a valid version range Look at section 7.3 on the documentation: https://docs.oracle.com/middleware/1212/core/MAVEN/maven_version.htm#MAVEN402 it tells you how to write a semantically valid version range
-
and why are you initializing the ItemStackHandler in a method? that would make it so every call to get the handler would return a new handler, instead of the same handler you don't need to override insertItem and extractItem, just call them from the your block method... get the TE at the blockpos, from there it's simple as Die said, please learn Java and OOP
-
hoppers use the capability, so they are getting the ItemStackHandler you are returning in getCapability to add an item to the ItemStackHandler you can use ItemStackHandler#setStackInSlot, or ItemStackHandler#insertItem to get something you can use ItemStackHandler#extractItem plus, I don't think you need to lazily load the ItemStackHandler
-
gradlew genEclipseRuns stuck at 88% [Solved]
kiou.23 replied to jonathanpecany's topic in Modder Support
it's not that bad, modding felt impossible when I started too, but the modularity that it has makes it much easier to handle nope, those classes are read-only, you can add comments to your own code tho plus lots of the methods have javadocs too -
gradlew genEclipseRuns stuck at 88% [Solved]
kiou.23 replied to jonathanpecany's topic in Modder Support
you don't need to read ALL the code, just the parts that concern your needs plus the forge docs has information on all the fundamentals that you need, such as registries, events, capabilities... from there you kind of have to figure things out for yourself... by reading the minecraft source code, or other mods source codes there are a lot of example mods out there aimed at helping begginers this is one that helped me a lot: https://github.com/TheGreyGhost/MinecraftByExample and if you can't figure out how to do something, you can always ask for help in the forum or in the discord -
to build a mod you need to run the build gradle task
-
it depends on how you want this chest to work. don't worry too much about the read, write, and onChunkUnload methods, they do not concern your block or TE logic. the preferred interface to store Items is an IItemHandler, with the default implementation of the ItemStackHandler but if the amount is arbitrary, and it may only hold one type of item, you could store an Item reference, and an integer that tells the amount of the item in the TE. you'd have to think about when the ItemStack has nbt tho...
-
these methods aren't static, you need to call them on an instance, the Minecraft instance has an instance of MainWindow edit: actually, the RenderGameOverlayEvent also has the MainWindow if you're also quite new to programming, you may want to take some time learn some Object Oriented Programming concepts
-
read and write methods are not for that, they are called when the chunk is loading or unloading, and you use it to save the TE data to a permanent format that can be stored in a file
-
the getTileEntity, gets the TileEntity at a position. you can then use this TileEntity why are you checking if it is BlockPos in an if statement?
-
the read and write methods are use for nbt serialization, so that the game can save the data when the player closes the game. the write method has a CompoundNBT as a parameter, you can write to it using CompoundNBT#put. create a static final String in your TE class, to be the "key" of the data you want to keep, something like "inventory" (this will be the tag for referencing the inventory in NBT) then you can call put, give it this tag, and then give it the inventory. you can use ItemStackHandler#serializeNBT to get an nbt object, that you can put in the tag in the read method, you get the nbt that you saved in the write method. call nbt.getCompound(), to get an nbt object that you saved, using the string you saved it at. then use ItemStackHandler#deserializeNBT, to recover the data from the nbt into the TE data. this may sound a bit complex, so here's an example: private static final String INVENTORY_TAG = "inventory"; private static final String CHARGE_TIME_LEFT_TAG = "chargeTimeLeft"; private static final String CHARGE_TAG = "charge"; private static final String MAX_CHARGE_TAG = "maxCharge"; private static final String CHARGING_TAG = "charging"; @Override public CompoundNBT write(CompoundNBT nbt) { super.write(nbt); nbt.put(INVENTORY_TAG, this.inventory.serializeNBT()); nbt.putShort(CHARGE_TIME_LEFT_TAG, this.chargeTimeLeft); nbt.putShort(CHARGE_TAG, this.charge); nbt.putShort(MAX_CHARGE_TAG, this.maxCharge); nbt.putBoolean(CHARGING_TAG, this.charging); return nbt; } @Override public void read(BlockState state, CompoundNBT nbt) { super.read(state, nbt); this.inventory.deserializeNBT(nbt.getCompound(INVENTORY_TAG)); this.chargeTimeLeft = nbt.getShort(CHARGE_TIME_LEFT_TAG); this.charge = nbt.getShort(CHARGE_TAG); this.maxCharge = nbt.getShort(MAX_CHARGE_TAG); this.charging = nbt.getBoolean(CHARGING_TAG); }
-
[1.15.2] Loading does not end when using a specific Properties
kiou.23 replied to Zemelua's topic in Modder Support
I'm not sure I understood what you mean by this... could you elaborate? -
[1.15.2] Loading does not end when using a specific Properties
kiou.23 replied to Zemelua's topic in Modder Support
getQuads receive an IModelData parameter, which is the return value in getModelData. getModelData has the world, blockstate, and blockpos you can override it and return the data you need through a ModelDataMap. I'm not sure, however, if you need to store those values in either blockstate or a tile entity. since they're only relevant to the client, and you can calculate them on getModelData (for optimization you could cache the data in the BakedModel, and have a boolean blockstate in the block which tells wether or not you need to update the cached value) EDIT: I just realized that this topic is for 1.15, not 1.16. I'm not sure if the interfaces are the same... but I don't think they should be much different (my bad) -
[1.15.2] Loading does not end when using a specific Properties
kiou.23 replied to Zemelua's topic in Modder Support
Okay, so I assume that you want connected textures what was the purpose of the Combination3x3 Enum, that I know assume you moved to a Tile Entity? -
[1.15.2] Loading does not end when using a specific Properties
kiou.23 replied to Zemelua's topic in Modder Support
Okay, what is it that you want your block to be able to do? seems like it's an xy problem: https://xyproblem.info/ -
[1.16.5] Animated model (possible with json models)
kiou.23 replied to Nyko's topic in Modder Support
there is no json file, the model is defined in the class itself look at the Bell TER constructor -
[1.16.4] Removing water in world generation
kiou.23 replied to verticalegg's topic in Modder Support
I think that you could listen to the BiomeLoadingEvent, and then simply remove the Lake Feature from the biomes -
in the onBlockActivated override, you have access to the position and to the world, you can call World#getTileEntity, to get the TE at the pos of the block, make sure it's your TE, and have a in the TE class that you can call that adds the item to the TE's inventory
-
You'll want to register a tile entity, in it you can have a field for the inventory, by instantiating an ItemStackHandler you'll want to bind it to a block, by overriding hasTileEntity (to return true) and createTileEntity (to call create on the instance of the tile entity that you registered) to open the gui when the player right clicks you'll need to call NetworkHooks.openGui, and pass an INamedContainerProvider, which you can implement in the tile entity (for the container provider you'll just need to make createMenu to return a new instance of a Container) so you'll also need to register a container, in it you'll add the slots corresponding to the player inventory, and your tile entity inventory and lastly you'll need a containerScreen for the gui you can see some example here: https://github.com/TheGreyGhost/MinecraftByExample/tree/master/src/main/java/minecraftbyexample/mbe30_inventory_basic
-
[1.16.5] Animated model (possible with json models)
kiou.23 replied to Nyko's topic in Modder Support
not a json file, a java class https://mcforge.readthedocs.io/en/latest/tileentities/tesr/