Everything posted by Choonster
-
[1.12] new registry system example / tutorial
@Mod.EventBusSubscriber registers the Class with the event bus, so only static @SubscribeEvent methods will be called. Your RegistryEvent.Register handlers in CommonProxy and ClientProxy are non-static, so they will never be called. There's no need to handle Block/Item registration in your proxies, do it in common classes (e.g. DMBlocks/DMItems). There's no reason to have a common proxy class, since proxies are for sided code. Common code belongs in your @Mod class or other common classes. Always annotate override methods with @Override so you get a compilation error if they don't actually override/implement a super method.
-
How to get a spawn egg as item?
An Item instance only represents an item type, in this case the spawn egg. To store any more data (e.g. the entity spawned by the egg), you need the metadata/NBT of an ItemStack. You create an ItemStack with the NBT data required to spawn a "thewizardmod.MiniZombie" entity but then immediately discard it by returning the Item from the method rather than the ItemStack. Which version of Minecraft are you using? If you're using 1.9-1.11.2, ItemMonsterPlacer.applyEntityIdToItemStack is a client-only method that can't be used from common code. If you're using 1.11+, "thewizardmod.MiniZombie" is in the wrong format for a mod entity's registry name; it's a ResourceLocation so it should be lowercase and in the format "modid:entity_name".
-
damagedBlocks field was changed?
The Forge documentation is community maintained and so far nobody has suggested or written any documentation on reflection. If you create an issue or PR in the documentation repository, this may be added. You're still only checking the MCP name, you need to supply both the MCP and SRG names for reflection to work inside and outside of the development environment.
-
Liquid Renderer
You need to use the forge:fluid model. Use Forge's blockstates format to set the "fluid" custom property to the name of your Fluid. I use this blockstates file to define the models for my mod's fluid Blocks/ItemBlocks and these methods to register them.
-
Property Direction problem.
Post the new blockstates file and FML log.
-
damagedBlocks field was changed?
The only methods you need are ReflectionHelper.findField and ReflectionHelper.findMethod, which replace Class#getDeclaredField and Class#getDeclaredMethod respectively. The parameters of ReflectionHelper.findField are fairly obvious and the parameters of ReflectionHelper.findMethod are documented in its doc comment.
-
damagedBlocks field was changed?
It doesn't look like there were any changes to the field between 1.12 and 1.12.1. Which environment did the error occur in? If it was outside of the development environment, it happened because you didn't check for the SRG name of a field (you check the MCP name twice). You should use Forge's ReflectionHelper class instead of the Class methods when reflecting Vanilla fields/methods as it allows you to supply both the SRG and MCP names of the field/method instead of requiring you to manually check both. You should also look up the Field/Method object once and store it in a field instead of looking it up every time as this is the slowest part of reflection. I recommend doing this in the initialiser of a private static final field.
-
When I try to open the Forge Launcher to install in Minecraft it does not open!
It will be a file with the same name as the installer in the same directory as it.
-
Property Direction problem.
The x and y properties in blockstates files can only rotate the model in increments of 90°, but your is_on=true,facing=east variant tries to rotate the model by 99°. This causes the NullPointerException in the TRSRTransformation constructor.
-
Mod writing help
FMLServerStartedEvent is fired when the server starts. TickEvent.ServerTickEvent is fired twice per tick while the server is running (once at the start with Phase.START, once at the end with Phase.END). PlayerEvent.PlayerLoggedInEvent is fired when a player logs in. FMLServerStoppedEvent is fired when the server starts. FMLServerStartedEvent and FMLServerStoppedEvent are FML lifecycle events, so you subscribe to them using @Mod.EventHandler in your @Mod class (like FMLPreInitializationEvent). TickEvent.ServerTickEvent and PlayerEvent.PlayerLoggedInEvent are regular events, so you subscribe to them using @SubscribeEvent in a class registered with the Forge event bus (either manually or with @Mod.EventBusSubscriber). To run Python files, you'll need to use something like Jython.
-
Can download forge, but doesn't appear in launcher
Have you scrolled all the way to the bottom of the versions list when creating/editing a launcher profile?
-
[1.12.1] Crafting with water bottle, return empty bottle
Item#setContainerItem sets the container item for that Item instance globally, which means it now returns that item in every recipe rather than just yours. This probably isn't what you want to do. Either specify the recipe in a JSON file (recommended) or specify it in code, don't do both.
-
[1.12.1] Crafting with water bottle, return empty bottle
You'll need a custom recipe type that implements IRecipe#getRemainingItems to return a list of remaining items, using the container item (ForgeHooks.getContainerItem) for every slot except the one with the potion in it, which you'll use an empty bottle for instead. I recommend extending ShapedRecipes or ShapedOreRecipes so you don't have to re-implement everything yourself. To use this new recipe type from JSON recipe files, you'll need to create a class that implements IRecipeFactory to parse the recipe from the supplied JSON object. Specify this factory class in your recipes/_factories.json file. Look at the CraftingHelper.init method to see the IRecipeFactory implementations for the Vanilla and Forge recipe types.
-
How do you make your mod able to run in multiple versions in mcmod.info?
Set @Mod#acceptedMinecraftVersions to the range of Minecraft versions your mod can run on. The version range format is documented in the doc comment of the VersionRange.createFromVersionSpec method.
-
[1.12] Getting itemstacks in inventory from client-side TESR?
You'd need to send your own packet to sync the dropper's inventory contents with the clients tracking it. There's no event fired when the inventory contents change, so you'd need to check every loaded dropper every tick to see if any of its inventory contents have changed since last tick. You should maintain a cache of each dropper's inventory contents using a custom capability. The dropper and other vanilla inventories are synced through Containers, since the inventory contents only need to be known on the client side when a player has the GUI open. This won't work for your purposes since you need to know the inventory contents at all times to render them on the block.
-
[1.12] Getting itemstacks in inventory from client-side TESR?
The client and server each have their own copy of the TileEntity, only the server-side TileEntity loads and saves the inventory from NBT. If you want access to the inventory on the client side, you need to sync it with the TileEntity's update packet and update tag.
-
[1.12.1] Implementation of an API (Baubles)
You probably need to refresh your IDE project. I think the way to do this for Eclipse is by re-running the eclipse Gradle task. If you were using IDEA, you'd just click the Refresh all Gradle Projects button in its Gradle window.
-
[1.12.1] Implementation of an API (Baubles)
Yes. You don't have to, I only have them there because my buildscript uses those variables. I do recommend doing something similar in your own buildscript. Yes, the source code from the repository will be linked to the JAR in your IDE.
-
[1.12.1] Implementation of an API (Baubles)
Yes, once you've done that you don't need to manually download the Baubles JAR. Make sure you actually define the baubles_version variable somewhere (e.g. in gradle.properties). This is the tag or commit ID that you want to depend on.
-
[1.12.1] How would I prevent 'cascading worldgen lag' during worldgen
Look at the net.minecraft.world.gen package for Minecraft's world generation classes. Structures like the Stronghold, Mineshaft and Nether Fortress are in the net.minecraft.world.gen.structure package.
-
[1.12.1] Implementation of an API (Baubles)
You can use any Git repository (like Baubles) as a Maven dependency through JitPack. I do this in my mod here. You can also use CurseForge as a Maven repository through its API (see the Maven section).
-
[1.7.10][1.11.2]First Person 3D items with animations
Forge can load animations from B3D models, yes. You still need an Animation State Machine file that tells Forge about the clips, states, etc. I haven't used the system myself, you'll need to look at the examples I linked to see how things are done.
-
[1.7.10][1.11.2]First Person 3D items with animations
If Blender can export its models and animations to the B3D format, you should be able to use them in Forge. Otherwise you'll need to export to JSON models and animation files. You tell the Animation State Machine for the model when to transition to each state, the animation files tell it how to animate each transition.
-
[1.7.10][1.11.2]First Person 3D items with animations
It will work anywhere the model is rendered. The animation system doesn't let you change the position of the player's arms, though.
-
Is there a limit to the Fluid Registry?
It looks like there's no explicit limit, so the limit is probably Integer.MAX_VALUE.
IPS spam blocked by CleanTalk.