Giter Club home page Giter Club logo

minecraftbyexample's Introduction

MinecraftByExample [1.16.4]

The purpose of MinecraftByExample is to give simple working examples of the important concepts in Minecraft and Forge. If you're anything like me, a good code example is worth several screens of waffling explanation, and can very quickly explain the key concepts. I also find it much easier to adapt and debug something that already works, than to have to synthesize something from scratch and spend hours trying to discover the missing bit of information I didn't know about.

I've tried to keep the code simple and obvious and to resist the urge to be clever. The examples might not be the most efficient or succinct implementation, I've deliberately left the optimization to you.

Each example is split up to be totally independent of all the others. The only part of the code which is common to more than one example is the MinecraftByExample class.

If you want more information and explanatory text about the concepts, the following links might be useful:

For earlier versions, see the relevant GitHub branch:

If you are updating from previous forge versions, you will probably find this link and this link very helpful. For better or for worse, MCP decided to rename a very large number of classes (eg all Blocks Blockxxx --> xxxxBlock, etc) so this might save you a stack of time. If you use IntelliJ, you might find these xml mapping files useful too

List of examples

See here for pictures of what each example looks like in-game.

Blocks

  • MBE01 - a simple cube
  • MBE02 - a block with a more complicated shape
  • MBE03 - two types of blocks which vary their appearance / shape:
    a block (coloured signpost) with multiple variants- four colours, can be placed facing in four directions
    a block (3D Web) with multiple parts (multipart) similar to a vanilla fence.
  • MBE04 - dynamically created block models
    a camouflage ("secret door") block which dynamically changes its appearance to match adjacent blocks - uses IBlockModel.getQuads(), ModelBakeEvent, IForgeBakedModel and IModelData
    an "altimeter" block which shows the block altitude (y coordinate) on the side in digital display - as camouflage block but uses programmatic generation of quads
  • MBE05 - multilayer block (lantern block with transparent glass) with animated flame texture
  • MBE06 - several different types of block which use redstone
  • MBE08 - how to add a creative tab for organising your custom blocks / items

Items

  • MBE10 - a simple item
  • MBE11 - an item with multiple variants - rendered using multiple models and multiple layers
  • MBE12 - an item that stores extra information in NBT, also illustrates the "in use" animation similar to drawing a bow
  • MBE15 - a chessboard item with 1 - 64 pieces; uses ItemOverrideList.getModelWithOverrides(), IBlockModel.getQuads() and onModelBakeEvent()

TileEntities

  • MBE20 - using a tile entity to store information about a block - also shows examples of using NBT storage
  • MBE21 - using the TileEntityRenderer to render unusual shapes or animations

Containers (Inventories)

  • MBE30 - a simple container for storing items in the world - similar to a Chest
  • MBE31 - a functional container such as a Furnace or Crafting Table
  • MBE32 - an item (bag of flowers) which can store other items inside it. Also shows how to use Capability

Recipes (Crafting/Furnace)

  • MBE35 - some typical example crafting recipes and furnace (smelting) recipes

Commands

  • MBE45 - custom commands

Particles - particle effects

  • MBE50 - shows how to use vanilla Particles; also how to generate your own custom Particles

Network

  • MBE60 - send network messages between client and server

Capabilities

  • MBE65 - define new Capabilities and attach them to vanilla objects

Testing tools

  • MBE75 - a tool to help you automate testing of your classes in-game.

Entities and Models

  • MBE80 - Shows the basics of Models (eg PigModel), model parameters adjustable in real time using commands
  • MBE81 - Projectile Entities (eg snowballs, arrows)

Miscellaneous Debugging Tools

  • DebuggingTools- This package is a bunch of functions and tools that I use occasionally, mostly for debugging

Usage

  • You can browse directly in GitHub, or alternatively, download it as a zip and browse it locally.

  • If you want to install it and compile it, the basic steps for beginners are:

    1. Download the project as a zip.
    2. Unzip it to an appropriate folder on your computer, such as My Documents. (Or, if you know how to fork a project on GitHub and import it into a local git repository, you can do that instead)
    3. Look at Forge's README.txt file in this folder and follow the instructions to import it into Eclipse or IntelliJ IDEA.
    4. Use the gradle task runClient to run or debug the project.

How to compile and run:

  1. Execute gradle task runClient to test the client installation or
  2. Execute gradle task runServer to test the dedicated server installation. (The first time you run this task it will exit without starting the server. You then need to edit the eula.txt file in the run directory, and execute runServer again.)

If You're Still Confused

Head over here if this didn't make sense to you (check comments for differences with latest versions of IDEA).

With thanks to these helpful folks: alvaropp, yooksi, Brandon3035, twrightsman (greekphysique), Nephroid, Herbix, and Shadowfacts

Licence Info:

This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.

In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

For more information, please refer to http://unlicense.org/

minecraftbyexample's People

Contributors

alvaropp avatar anielsen001 avatar basti1302 avatar daveawb avatar dealingwith avatar dovahofkiin avatar matshou avatar mrbitsage avatar mukkuzzz avatar shadowfacts avatar sirendii avatar thegreyghost avatar vladh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

minecraftbyexample's Issues

Need advice on how to make a minigame-style plugin

I am a professional game developer, but new to minecraft modding. I'm trying to help my kids make some ideas of theirs come to reality.

I was very glad to find this repository with great examples on how to get started on modding. But unfortunately none of the examples seem to fit with the kinds of ideas that we have, so I was hoping for a bit of advice on where to get started. We want to make some kind of a minigame, so what I am looking for is a way to add on my own "update loop" where our minigame can contain its own logic. Most of the samples here seem to revolve around creating new types of entities/blocks/recipes for the game which have a specific pattern to them, but it is not clear to me what the correct pattern is for adding in general-purpose code that runs all of the time in the background.

Here are some of the kinds of things I was thinking we would want the mod to be able to do:

  • Allow several players to connect and join a minigame
  • Present messages on each users screen so they know the state of the minigame (e.g. whether they have joined, what their current score is, etc.)
  • Being able to teleport players to a new location and programmatically create some kind of arena
  • Trading -- some way to alter the contents of players inventory

We are hoping to make this run on a server where several clients can connect and I don't think we actually need to create new block types etc, so possibly the mod we want to make will be server-only. (We play on hypixel, and the minigames on there don't seem to require a client side mod, they all work just by connecting to their server). I have heard of Bukkit, which seems like it is an alternative way to create server-only mods, but Forge seems like it is more flexible and i get the impression it is more recent/modern, so it would be the way to go even if we were only doing something server side.

Are there any samples you can point me to of how to create a mod/server like in my examples above? Are there are samples like that in this repo that I missed? Or other resources elsewhere?

I have already looked at the forge documentation, but it seems a bit slim and I couldn't find any direct answers there for my questions. I have also done a lot of googling and reading random forums populated by 12 year olds that banter back and forth without arriving at helpful conclusions.

Apologies if this is not the right forum for this question, I just thought I would ask since you have excellent tutorials and you seem to know what is going on.

Updated mappings

Hi,
First off, thank you for your great examples, learned a lot of it.
A little remark on your 1.11 branch. You're explaining the use of itemStack.func_190926_b() (for example) and that it will change in the future. It already is changed. You only need to update your mappings in the build.gradle file to something more recent. In the latest mappings all itemStack changes are properly named to increase, decrease, ItemStack.EMPTY and so on.

It could save everyone some time to read, write and understand the code.

MBE05 not working in Forge 2759 (Model not loading/blockstate not found)

Seems like MBE05 isn't working properly in Forge 2759 (and I assume later versions too).

At first I thought I was going mad and doing something wrong, after a day or so of debugging I eventually cloned MBE and had the exact same issue on there too.

Logs:

[02:55:46] [main/ERROR] [FML]: Exception loading model for variant minecraftbyexample:mbe05_block_3d_web_statemapper_name#normal for blockstate "minecraftbyexample:mbe05_block_3d_web_registry_name"
net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model minecraftbyexample:mbe05_block_3d_web_statemapper_name#normal with loader VariantLoader.INSTANCE, skipping
	at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:161) ~[ModelLoaderRegistry.class:?]
	at net.minecraftforge.client.model.ModelLoader.registerVariant(ModelLoader.java:235) ~[ModelLoader.class:?]
	at net.minecraft.client.renderer.block.model.ModelBakery.loadBlock(ModelBakery.java:153) ~[ModelBakery.class:?]
	at net.minecraftforge.client.model.ModelLoader.loadBlocks(ModelLoader.java:223) ~[ModelLoader.class:?]
	at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:150) ~[ModelLoader.class:?]
	at net.minecraft.client.renderer.block.model.ModelManager.onResourceManagerReload(ModelManager.java:28) [ModelManager.class:?]
	at net.minecraft.client.resources.SimpleReloadableResourceManager.registerReloadListener(SimpleReloadableResourceManager.java:121) [SimpleReloadableResourceManager.class:?]
	at net.minecraft.client.Minecraft.init(Minecraft.java:559) [Minecraft.class:?]
	at net.minecraft.client.Minecraft.run(Minecraft.java:421) [Minecraft.class:?]
	at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_161]
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_161]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_161]
	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_161]
	at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]
	at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_161]
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_161]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_161]
	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_161]
	at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]
	at GradleStart.main(GradleStart.java:25) [start/:?]
Caused by: java.lang.NullPointerException: Model minecraftbyexample:block/smartmodel/webmodel returned null as default state
	at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:864) ~[guava-21.0.jar:?]
	at net.minecraftforge.client.model.ModelLoader$WeightedRandomModel.<init>(ModelLoader.java:673) ~[ModelLoader$WeightedRandomModel.class:?]
	at net.minecraftforge.client.model.ModelLoader$VariantLoader.loadModel(ModelLoader.java:1176) ~[ModelLoader$VariantLoader.class:?]
	at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:157) ~[ModelLoaderRegistry.class:?]
	... 21 more

image

As a sanity check I also installed Forge 2491, which this guide was made with - it all works absolutely fine in there. Looking through the Forge changelog this looks like a likely culprit, but I'll test further tomorrow:

Build 1.12.2-14.23.3.2695:
	bs2609:
		Change composite models to fetch quads from submodels using full context
		(#4809)

Hopefully you can get it updated, but someone could at least tell me what needs to be changed it'd be very useful!

Thanks

[mbe15_item_dynamic_item_model] Generated BakeQuads don`t have correct normal int in vertexInt[]

If you look carefully, you will find that the diamond block on the chess board is actually darker than what it is supposed to be. I use some of the code in that example, for block rendering is completely fine, but when it comes to item rendering, the model looks too dark. After read though the source code of Minecraft and Forge, I realize that the seventh int returned by vertexToInts() should not always be zero. That int represents an normal vector, but in packed form: ?? ZZ YY XX, it is used by OpenGL to calculate lighting.
See calculatePackedNormal() in my code for some idea about how to calc that int value:

You just need to pass coordinate of all four vertexes to the function, be careful, don`t change the order of vertexes, otherwise the result is unpredictable!

[1.15/1.16] Item Inventory example bugged

I used the Item Inventory code from your tutorial as a base for Inventory Pets Chest and Feed Bag pets, but then ran into a nasty and unsolved issue:
MinecraftForge/MinecraftForge#4594

Basically, using any inventory item with similar functionality when on a server in creative mode clears the contents of the itemstack inventory. I would remove this example since it has caused significant frustration from players, and does not look like will be solved anytime soon by Minecraft or Forge.

Since you've written this tutorial, all of the above mods, including Botania, have rewritten their code completely as a result.

[Suggestion] Multiblock Structures

I am currently attempting to add a custom modeled block into the game, but I came across an issue. Apparently, you cannot add in blocks larger than the 1x1x1 format without it being some sort of multiblock like doors and grass.

Basically just another model example, but for "large blocks" if you will with all of the voxel shapes and... things.

MBE50 not working for me. No particles

Hi. This set of examples is great. It is helping so much. Though I seem to be having a problem with MBE50. No p[articles are showing. I do have the video set to "Particles All"

Bitwise operation value in mbe11_item_variants > ItemsVariants

Hi. I was looking at your ItemsVariants class for the bitwise operations to get/set metadata and I noticed that you were using 0x07 for the upper 2 bits of data (fullnessBits):

  @Override
  public String getItemStackDisplayName(ItemStack stack)
  {
    String s = ("" + I18n.translateToLocal(this.getUnlocalizedName(stack) + ".name")).trim();  // this is depecrated, but I don't know what replaces it...
    int metadata = stack.getMetadata();
    int fullnessBits = (metadata >> 2) & 0x07;
    EnumBottleFullness fullness = EnumBottleFullness.byMetadata(fullnessBits);
    s += "(" + fullness.getDescription() + ")";
    return s;
  }

But this is unnecessary, as you could use 0x03 as you did for the lower 2 bits in the getUnlocalizedName() method, since you right-shifted the bits:

  public String getUnlocalizedName(ItemStack stack)
  {
    int metadata = stack.getMetadata();
    int contentsBits = metadata & 0x03;
    int fullnessBits = (metadata >> 2) & 0x07;

    EnumBottleContents contents = EnumBottleContents.byMetadata(contentsBits);
    return super.getUnlocalizedName() + "." + contents.getName();
  }

1.10.2 final and 12.18.3.2185

Hi. First, awesome tutorial!

I use 1-10-2final branch. I see that "1.10.2-12.18.1.2011" forge is used. I see that most mods are against "12.18.3.2185". If I changed version in build.gradle build failed. I was trying to change mapping to "stable_29" (following by info at http://export.mcpbot.bspk.rs) but it didn't help.

I have still a lot of errors:

.../MinecraftByExample/build/sources/main/java/minecraftbyexample/mbe06_redstone/input/TileEntityRedstoneColouredLamp.java:48: error: cannot find symbol
      worldObj.checkLightFor(EnumSkyBlock.BLOCK, pos);
      ^
  symbol:   variable worldObj
  location: class TileEntityRedstoneColouredLamp
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
41 errors
1 warning
:compileJava FAILED

I'm new in modding. Do you have any idea what I screwed up? Can I use official forge for 1.10.2?

Tutorial 01-1.12.2. Not picking lang name

Hello, and sorry if this is not the proper place to post this. I was following your nice tutorial to start on modded minecraft. I was able to complete the first task, except for the language file. I am following the example step by step, but I changed the names a bit so that I can learn better what's going on.

The thing is I am registering the simple block as

blockSimple =new BlockSimple();
blockSimple.setUnlocalizedName("xfbe01_block_simple");
blockSimple.setRegistryName("xfbe01_block_simple");
ForgeRegistries.BLOCKS.register(blockSimple);
// We also need to create and register an ItemBlock for this block otherwise it won't appear in the inventory
itemBlockSimple = new ItemBlock(blockSimple);
itemBlockSimple.setRegistryName(blockSimple.getRegistryName());
ForgeRegistries.ITEMS.register(itemBlockSimple);

So the corresponding lang file (en_US.lang) contains:

tile.xfbe01_block_simple.name=XFBE01 Block Simple

No errors appear when I run minecraft, it's simply that the displayed name of the block is tile.xfbe01_block_simple.name.
I've checked that the language is set to english (US), I've tried with different names... I've tried in Linux and in Windows... but I never get to pick up the name provided in the lang file.

Do you have any idea on this? You can see my whole file structure at https://github.com/Xaunther/XauntherFBE. I just ran out of ideas to solve it...

Thanks!

Suggestion for 1.12.2

Could you please add an example for importing obj (wavefront)custom block ?

Thanks in advance

Multiple Redstone inputs from sides too

I'm making something which needs 3 inputs. I'm wondering about extending Comparator.

  1. Is it possible to just "tint" with colour the inbuilt one and override the output generation?
  2. If I have to make a new one another way, how do I get the side input? For example, copying the Redstone meter?
  3. Is there any texture resources to start making something similar to a built-in comparator?

Threaded rendering issue in MBE05

As far as I know there are more than one threads rendering the world. But in MBE05, there's only one CompositeModel instance. Since handleBlockState always returns this, different blocks affect each other when rendered in different threads. For example:

  • Thread 1 is rendering one block at A position. Call handleBlockState.
  • Thread 2 is rendering another block at B position. Call handleBlockState.
  • Thread 1 continue rendering. Call getGeneralQuads. Here, states of block at B position is saved, but rendered at A position.

Solution:
Although it costs more space, a new IBakedModel should be returned by handleBlockState, I suppose.

To many errors in 1.10.2 version

When I added the source from the 1.10.2 branch to my workspace, I found that there were a lot of errors in it.
For example, Minecraft#thePlayer is used instead of Minecraft#player, theWorld instead world.
In 1.11.2 there is no such branch.

[SECURITY] Releases are built/executed/released in the context of insecure/untrusted code

CWE-829: Inclusion of Functionality from Untrusted Control Sphere

The build files indicate that this project is resolving dependencies over HTTP instead of HTTPS. Any of these artifacts could have been MITM to maliciously compromise them and infect the build artifacts that were produced. Additionally, if any of these JAR files were compromised, any developers using these could continue to be infected past updating to fix this.

maven { url = "http://files.minecraftforge.net/maven" }

This vulnerability has a CVSS v3.0 Base Score of 8.1/10
https://nvd.nist.gov/vuln-metrics/cvss/v3-calculator?vector=AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H

This isn't just theoretical; POC code exists already to maliciously compromise jar file inflight.

See:

To fix: Update your build.gradle so that artifacts are resolved over HTTPS instead of HTTP.

It seems like this is actually a pretty big issue across the entire Modded Minecraft Ecosystem because there seem to be a lot of mods using this project as a starter structure for their own:

BlockRedstoneColouredLamp doesn't cope with redstone "just passing by"

The BlockRedstoneColouredLamp works fine with any redstone that runs straight to the Lamp. Just like the ordinary RedstoneLamp. But redstone "passing by" visually connects to the lamp but in fact doesn't affect the lamp. Redstone "just passing by" also has no effect on regulat RedstoneLamps. But unlike BlockRedstoneColouredLamp they don't make the redstone attach to it visually in that case.

Imho the BlockRedstoneColouredLamp should not return true on canConnectRedstone at all. This way its visual representation would not wrongly suggest that it connects to passing redstone.

MBE runs in gradle runClient but not as standalone mod

I'm new to modding, so this may be something stupid. I can clone and build MBE such that it will run using gradlew runClient just fine. If I copy the build/libs/minecraftbyexample-1.12.2a.jar and put it into my minecraft/mods directory then minecraft crashes with this error:


---- Minecraft Crash Report ----
// This is a token for 1 free hug. Redeem at your nearest Mojangsta: [~~HUG~~]

Time: 3/26/18 5:19 PM
Description: There was a severe problem during mod loading that has caused the game to fail

net.minecraftforge.fml.common.LoaderExceptionModCrash: Caught exception from Minecraft By Example (minecraftbyexample)
Caused by: java.lang.NoSuchFieldError: ROCK
	at minecraftbyexample.mbe01_block_simple.BlockSimple.<init>(BlockSimple.java:28)
	at minecraftbyexample.mbe01_block_simple.StartupCommon.preInitCommon(StartupCommon.java:46)
	at minecraftbyexample.CommonProxy.preInit(CommonProxy.java:20)
	at minecraftbyexample.ClientOnlyProxy.preInit(ClientOnlyProxy.java:21)
	at minecraftbyexample.MinecraftByExample.preInit(MinecraftByExample.java:80)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:606)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:91)
	at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:150)
	at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:76)
	at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399)
	at com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:71)
	at com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:116)
	at com.google.common.eventbus.EventBus.post(EventBus.java:217)
	at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:278)
	at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:256)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:91)
	at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:150)
	at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:76)
	at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399)
	at com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:71)
	at com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:116)
	at com.google.common.eventbus.EventBus.post(EventBus.java:217)
	at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:148)
	at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:602)
	at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:270)
	at net.minecraft.client.Minecraft.func_71384_a(Minecraft.java:466)
	at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:377)
	at net.minecraft.client.main.Main.main(SourceFile:123)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
	at net.minecraft.launchwrapper.Launch.main(Launch.java:28)


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- System Details --
Details:
	Minecraft Version: 1.12.2
	Operating System: Linux (amd64) version 4.4.0-116-generic
	Java Version: 1.8.0_161, Oracle Corporation
	Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
	Memory: 128660176 bytes (122 MB) / 281636864 bytes (268 MB) up to 1060372480 bytes (1011 MB)
	JVM Flags: 5 total; -Xmx1G -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:-UseAdaptiveSizePolicy -Xmn128M
	IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
	FML: MCP 9.42 Powered by Forge 14.23.2.2611 6 mods loaded, 6 mods active
	States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored

	| State | ID                 | Version      | Source                         | Signature                                |
	|:----- |:------------------ |:------------ |:------------------------------ |:---------------------------------------- |
	| UCH   | minecraft          | 1.12.2       | minecraft.jar                  | None                                     |
	| UCH   | mcp                | 9.42         | minecraft.jar                  | None                                     |
	| UCH   | FML                | 8.0.99.99    | forge-1.12.2-14.23.2.2611.jar  | e3c3d50c7c986df74c645c0ac54639741c90a557 |
	| UCH   | forge              | 14.23.2.2611 | forge-1.12.2-14.23.2.2611.jar  | e3c3d50c7c986df74c645c0ac54639741c90a557 |
	| UCH   | mercurius_updater  | 1.0          | MercuriusUpdater-1.12.2.jar    | None                                     |
	| UCE   | minecraftbyexample | 1.12.2a      | minecraftbyexample-1.12.2a.jar | None                                     |

	Loaded coremods (and transformers): 
	GL info: ' Vendor: 'Intel Open Source Technology Center' Version: '3.0 Mesa 17.2.8' Renderer: 'Mesa DRI Intel(R) Haswell Mobile '

For reference, I verified the versions of the minecraft when I run using gradle:

Details:
        Minecraft Version: 1.12.2
        Operating System: Linux (amd64) version 4.4.0-116-generic
        Java Version: 1.8.0_161, Oracle Corporation
        Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
        Memory: 235144128 bytes (224 MB) / 549453824 bytes (524 MB) up to 1808269312 bytes (1724 MB)
        JVM Flags: 0 total; 
        IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
        FML: 
        Loaded coremods (and transformers): 
        GL info: ' Vendor: 'Intel Open Source Technology Center' Version: '3.0 Mesa 17.2.8' Renderer: 'Mesa DRI Intel(R) Haswell Mobile '
[06:03:18] [main/INFO] [FML]: MinecraftForge v14.23.0.2491 Initialized

Suggestion: Convert Notes.txt to README.md

Changing from .txt to one of the github-supported rich rendering formats like .md will make the notes easier to read and (probably) more pleasing to search engines. Furthermore, if you name the files README.md, github will auto-render it beneath the directory's file list as people browse the repo on the website.

I'd be willing to help with the conversion/formatting (as a pull request) if you approve a plan.

[Error] Unexpected error 1.16.4

I build your project and tested it with this1.16.4-forge-35.1.0 Forge Version.
After a while i run in that Error net.minecraftforge.fml.common.ObfuscationReflectionHelper$UnableToFindFieldException caused by java.lang.NoSuchFieldException: world.

Does I miss something? Or is this version still in development?

The full crash-log.

Camo block does not work on other camo blocks

If you try to make a wall with the camo blocks, the camo block does not show the other camo block's disguise. For example. If i place 1 stone and place a camo block on that, it turns to stone. But if i add ANOTHER camo block on the one i placed, the default stone texture is placed....

Recipe JSON files are in the wrong spot for at least 1.15.2

One thing I want to make clear: this is a great resource and it's extremely helpful for someone getting into modding. The only other version I've modded successfully is 1.7.10 and this is a great resource to get started on modern versions.

But back on track: recipe JSON files should be in resources\data\modname\recipes. At the moment, in the repository the folder is in the assets folder.

Pixel format not accelerated

Thanks for putting this together...
This is the first time building/running the project...

With Windows 10, Getting this error:

[11:59:28] [main/ERROR]: Couldn't set pixel format
org.lwjgl.LWJGLException: Pixel format not accelerated

I can run normal Minecraft 1.12.2 on this computer.

Attached is entire console.
console.txt
Thanks

1.11.2 compatibility - mbe11_item_variants/ItemVariants.java

Just FYI - Testing with 1.11.2 beta build (13.20.0.2227) the method signature for getSubItems changed to be a NonNullList:
public void getSubItems(Item itemIn, CreativeTabs tab, NonNullList<ItemStack> subItems)

Since this method does not currently have the @Override attribute, the build did not flag an error when I tried to build with1.11.2 - but the item variants did not show up in the creative inventory since getSubItems was not correctly overriden.

Recommend adding the @Override attribute, to force an error if someone tries to build with 1.11.2, at least until such time as you choose to update your code to 1.11.2?

Cammo block

Is there a way that de cammo block base model also can rotated on the blockstate facing?
I have a block with the same behaviour but diffrent base model that is rotatable.

[Minor] Copper Texture has a slight model bug

The copper texture has a 3 pixels in the top right that are not fully transparent which causes you to see through the texture from the side when being rendered in minecraft when following the 1.10.2 tutorial.

Erasing those 3 pixels fixed the model issue pretty easily. I learned something about minecraft textures I didn't know so I'm a bit happy about this 'bug'. =P

1.12.2 mbe05 not working

Example 05, the dynamic web model, seems to not work in branch 1.12.2 (and probably other earlier branches). When i place the block it just appears as the purple-black missing model block, the item in inventory is appearing normally tough (the cobweb icon).

I checked the code multiple times, and everything seems fine, but unless i am missing something, there is no such models/block/smartblock/webmodel file in your assets folder, a path which is referenced in block_3d_web_statemapper_name.json as the model path, and is also referenced in the code of ModelLoader3DWeb class.

So, what is this "webmodel" file supposed to contain? I even tried creating that file myself but still the problem in game persists. I am not even sure why you would have to make a reference to this smartmodel/webmodel file in the statemapper, so because of that missing file in your repository i got very confused. Maybe it got accidentally deleted? If not then i have got no clue how to solve the issue, because the code is identical to yours. Any idea how to solve that?
Cheers

Mob creation and spawing? Can you point me in the right direction?

I am pretty sure you have this, I am just not sure what classes. I looked at Entities and Models and tried to look at those classes but I am a bit lost and now doubting if I am in the right spot.

For reference I am new to this and trying to learn so I am sorry if I was in the right place just not understanding.

Why is there no .gitignore file?

My deepest thanks to all of you for having created this! It is a big help in my minecraft modding endeavour! Though I must admitt that I am very surprised to see that you have no .gitignore file here. Isn't that a very important part of having your minecraft mod on Github? I have had many different suggestions on how I should go forward with the .gitignore file and I am unsure how to go forward...

I do know that having your mod on Github is by no means a requirement when it comes to modding but knowing how helpful I found looking at the mods here on Github I want to help others going through the same process.

All of your help would be deeply appreciated!

1.9: Changes to the register process for Blocks, ItemBlock etc?

This is a great resource you guys have setup here - props and thanks!

Any chance you'll be adding some updated things for 1.9? I'm especially stumped with how to deal with how you have to register Blocks and ItemBlocks separately and could use some help (or a point in the right direction).

Thanks and very nice work here again!

[Suggestion] How to add new potion effects

How to add new potion effects. There are a lot of examples of this being done in other mods but not really any tutorial resources on it, to my knowledge. It might help me and others to have it, if you think it's a good idea.

Array index out of bounds

I've read the Notes.txt but I don't understand this. Can someone help me? My IDE is Eclipse.

EDIT: Figured it out

A sideonly issue in MBE_60

Since MessageHandlerOnClient uses client only class Minecraft, it would throw a ClassNotFoundException in a dedicated server when MessageHandlerOnClient is loaded. But StartupCommon uses MessageHandlerOnClient. So I doubt whether these codes work on dedicated servers.

I would use different network registration at dedicated server and client. At client, I would use MBE60 codes:

simpleNetworkWrapper.registerMessage(MessageHandlerOnServer.class, AirstrikeMessageToServer.class,
                                          AIRSTRIKE_MESSAGE_ID, Side.SERVER);
simpleNetworkWrapper.registerMessage(MessageHandlerOnClient.class, TargetEffectMessageToClient.class,
                                          TARGET_EFFECT_MESSAGE_ID, Side.CLIENT);

While at a dedicated server, I would use this:

simpleNetworkWrapper.registerMessage(MessageHandlerOnServer.class, AirstrikeMessageToServer.class,
                                          AIRSTRIKE_MESSAGE_ID, Side.SERVER);
simpleNetworkWrapper.registerMessage(MessageHandlerOnServerButHandleClientMessage.class, TargetEffectMessageToClient.class,
                                          TARGET_EFFECT_MESSAGE_ID, Side.CLIENT);

And define MessageHandlerOnServerButHandleClientMessage:

public class MessageHandlerOnServerButHandleClientMessage implements IMessageHandler<TargetEffectMessageToClient, IMessage> {
  public IMessage onMessage(final TargetEffectMessageToClient message, MessageContext ctx) {
    throw new RuntimeException("Cannot handle TargetEffectMessageToClient at a dedicated server.");
  }
}

DistExecuter -> safeRunWhenOn

I was playing around with your examples to get a grip on changes to forge (I'm coming from 1.8, a lot has changed!). I noticed you're using runWhenOn to bind client only events. Now I'm not entirely sure why it's deprecated yet but I imagined it was due to the lack of refferant checks the original method had. I'm not very keen on the DistExecuter in general, I've had a brief look at the code and it seems super hacky but with the lack of any other methods to check sidedness in 1.16.x I guess it's what we've got.

That said, I've updated your examples to use safeRunWhenOn if that's something you'd prefer to use.

Texture Help!

@TheGreyGhost
I've looked at everything, nothing seems to be wrong but the textures. Purple and Black. I'm using Eclipse and I put my project on github for this purpose, please help as soon as possible. https://github.com/HXGamer/hogn.git <--- mod

What I've checked so far:
JSON: YES
Spelling:YES
Check pictures for corruption:YES
If above, I've checked it and made sure it's not the issue.
Here's the log: http://pastebin.com/PQMmuWx7

Please help, I've looked at everything

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.