Welcome, Guest. Please login or register

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - TheGreyGhost

Pages: [1] 2
1
Modder Support / ChestGenHooks; Loot Hooks -?
« on: December 21, 2016, 11:18:27 am »
Hi all

I'm porting some old 1.8 code to 1.10, and I'm stuck on ChestGenHooks.
I found this PR, which is pointing in the right direction, but then it is closed with "superceded".
https://github.com/MinecraftForge/MinecraftForge/pull/2543

Anyone know what it was superceded by?  i.e. how to add custom loot to vanilla chests?

cheers
  TGG

2
Support & Bug Reports / Personal messages on this forum - inboxes full?
« on: October 28, 2016, 11:50:11 am »
Howdy all

Twice in the last couple of days I've tried to respond to a newbie's PM and it's given me the error message
"PM could not be sent to '{username here}' as their inbox is full!"

Is this bug in the website code or just a coincidence?

-TGG

3
Suggestions / Annotation or Assert for thread correctness
« on: August 20, 2016, 12:49:03 am »
Howdy

After suffering a few sessions of debugging pain due to wrong side / wrong thread, I think it would be very helpful to add some sort of side / thread correctness checking to Forge - something that checks whether a method is being called from an unexpected thread, or at least gives an explicit cue.

Accessing client-side objects from the server side (or vica versa)
Calling methods from a side which is not used (for example - Item.onUpdate)
Rendering thread calling client thread code
Network thread calling client thread code or server thread code

The @SideOnly annotation in Forge helps a bit but isn't checked automatically (except by running the DedicatedServer and manually testing all code branches again), and it's also not suitable for decorating your own code with.

Some sort of static analysis with annotations would be best (during build, or during mod loading), but even a forge-provided assert method for coders would be very helpful.

If there is broad interest I can have a go at trying to produce something (advice on where to start would be very helpful since I don't have much experience with annotations)

-TGG

4
Hi

I have updated MinecraftByExample to work with 1.8.9.  Actually not many changes were required; a couple of tessellator functions, ModelLoader and some vanilla name changes.

See here https://github.com/TheGreyGhost/MinecraftByExample

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' worth 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
synthesise something from scratch and spend hours trying to discover the missing bit of information I didn't know about.

List of examples
Blocks
  MBE01 - a simple cube
  MBE02 - a block with a more complicated shape
  MBE03 - a block (coloured signpost) with multiple variants- four colours, can be placed facing in four directions
  MBE04 - a camouflage ("secret door") block which copies the appearance of adjacent blocks - uses ISmartBlockModel
  MBE05 - a 3D web which joins to neighbours in all six directions - uses ISmartBlockModel and ICustomModelLoader
  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
  MBE13 - customise Mining behaviour of Blocks and Items - several test classes that show how mining works
  MBE14 - an interactive helper tool to adjust the ItemCameraTransforms for your custom item
  MBE15 - a chessboard item with 1 - 64 pieces; uses ISmartItemModel

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

Containers (Inventory blocks)
  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

Recipes (Crafting and Furnaces)
  MBE35 - some typical example crafting recipes and furnace (smelting) recipes

HeadsUpDisplay - overlays
  MBE40 - simple customisations of the heads up display (hotbar, health meter)

EntityFX - particle effects
  MBE50 - shows how to use vanilla EntityFX; also how to generate your own custom EntityFX

Network
  MBE60 - send network messages between client and server

Configuration GUI
  MBE70 - configuration file linked to the "mod options" button GUI on the mods list screen

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

-TGG




5
Hi All

I'm trying to make some changes to SimpleNetworkWrapper in my fork of MinecraftForge, but I'm having trouble getting it to commit & track my changes properly.
For some reason (legacy issue from FML being a submodule?) the FML package is located in two places

C:\Users\TGG\EclipseProjects\MinecraftForge\eclipse\Forge\src\main\java\net\minecraftforge\fml (compiled into the project)
and
C:\Users\TGG\EclipseProjects\MinecraftForge\fml  (synced with the repo)

I can make changes to the project location, but if I want them to be committed and pushed to GitHub, then I need to copy the files over to the "repo" location.  Vica versa for updating from the GitHub repo.

If I keep doing it like this, guaranteed I'm eventually going to copy the wrong way and destroy an evening's work.

Is there a better way?  What am I missing (not really up to speed with Eclipse yet; since IntelliJ seems to break in strange ways with this project)?

-TGG

6
Tutorials / [1.8] Troubleshooting Block and Item Rendering
« on: March 09, 2015, 07:28:03 am »
Hi All

After seeing the number of folks struggling with the dreaded purple-and-black texture for blocks and items in 1.8, I have put together a troubleshooting guide:

http://greyminecraftcoder.blogspot.com.au/2015/03/troubleshooting-block-and-item-rendering.html

-TGG

7
Modder Support / Looking for example Entity code
« on: January 24, 2015, 09:55:16 am »
Howdy folks

have any of you coded up a custom entity I could steal to use for an example code project?
Just the basic stuff like
- registering
- spawning (spawn frequency in biomes)
- simple AI
- simple datawatcher
- base attributes (health, damage, etc)

Never coded an entity myself and although it would be fun to learn it'd be a lot faster if I had a good base to start from....

The example project is for 1.8 but I figure 1.7 entities will probably work just the same.

-TGG

8
Modder Support / Java 6 and Mac?
« on: January 17, 2015, 11:58:00 pm »
Hi all

One of the users of a mod I made can't use it because I wrote it using the SDK for 7 and he only has 6 installed.  He says he has the latest version installed.  Does Minecraft 1.7.10 for Mac only work on Java 6?

-TGG

9
Support & Bug Reports / latest versions of Forge 1.8 beta
« on: January 11, 2015, 01:23:46 pm »
Hi all

How/where do I find the latest version of Forge 1.8 beta for testing?  I have 11.14.0.1252 from quite some time ago and I know there's been progress since then.

Also, which is the current branches on GitHub?  The FML repository appears to be out of date and there is no FML in the Forge repository that I could find.

Upshot is, I have found several bugs and I don't know if they've been fixed.  They aren't in the issues or the commit logs.  I'd rather check first before raising further issues.

-TGG

10
Modder Support / [1.8] MinecraftByExample sample code project
« on: December 25, 2014, 06:45:58 pm »
Hi All

I'd like to ask for some help from you experienced modders out there.

I'm putting together a sample code project to give simple working examples of the important concepts in Minecraft and Forge, to show new modders how the key parts are put together and give them a base to start experimenting from. 

I have made a modest start (https://github.com/TheGreyGhost/MinecraftByExample) and I'd like to make it much more comprehensive, so I am hoping some of you will help out.

What I'm looking for:
- ideas for topics / samples
- pointers to good examples which already exist in other projects
- snippets of self-contained code to illustrate a key concept.
- feedback

The key features of the samples are that
* they must be self-contained, a handful of short classes at most
* must be well documented in the source code itself
* they must be simple and readable; clarity is much more than important than flexibility, extensibility, or "efficiency"

FYI currently I'm planning on adding the following topics over time.  It's a long list and half of it I've got no idea about, so it's going to take forever without help...
Blocks -
   simple block modelling
   more-complicated block modelling
   blocks with properties / metadata
   block with display tick
   block with scheduled update
   animated texture
Items -
   simple item
   item with sub-types
   item with NBT
   how to control rendering in the different views (1st person, 3rd person, inventory, etc)
Recipes
  variety of recipe types
TileEntity
  simple tile entity with NBT, no renderer
  simple TileEntitySpecialRenderer
Containers
  furnace-like
  chest-like
Entities
  basic entity that can be spawned and disappears after a certain time
  missile entity
  entity rendering / techne -based / animation
  entity with basic AI
EntityFX
  simple effect generator
Events
  show some events on different busses
GUI
  customise the standard HUD render elements (crosshairs, etc)
  create a custom GUI
Terrain generation

Generate a new dimension

Miscellaneous
  best practice error logging (I could sure use some help on that one!)

Thoughts, feedback, suggestions very welcome...

-TGG




11
Tutorials / How Minecraft 1.8 works
« on: December 25, 2014, 06:09:49 pm »
Hi all

I have started making a series of posts explaining some of the basic concepts in Minecraft 1.8 and Forge.    It's not intended to be step-by-step tutorials, instead it's a short cut to help folks understand what they're seeing when they start reading tutorials and digging through vanilla code.

The main contents page is here
http://greyminecraftcoder.blogspot.com.au/p/list-of-topics.html

As a kind of a companion to the blog, I am also creating a MinecraftByExample project on GitHub.  The point of the project is to give simple working examples of the important concepts in Minecraft and Forge, to show new modders how the key parts are put together and give them a base to start experimenting from.

https://github.com/TheGreyGhost/MinecraftByExample

Comments and suggestions very welcome, it's a work in progress.

-TGG

12
ForgeGradle / Resources not copying properly
« on: November 23, 2014, 11:54:02 am »
Howdy All

I'm having a problem while debugging a new mod.

I am using the standard structure of
src/main/java
and
src/main/resources

But when I Debug Minecraft Client, all resources are not found (mcmod.info, lang, textures, etc).
If I use the gradle runClient instead, it all works fine.

Debug Minecraft Client copies the resources to
build\resources
and the mod code goes into
build\classes

During mod initialisation, the FMLFolderResourcePack for the mod is added as build\classes\main

Any help on why the resources are being copied to the wrong place?

-TGG




13
Hi

Could anyone point me towards a mod on GitHub or similar which uses Access Transformers? (private ->public for a field)

I've created an access transformer config file and it worked fine for the dev workspace but when I build to a jar and load it in a release environment, the field is still private.

I am about ready to explode trying to get them to work; I am using the FMLAT META-INF method, and FML is loading the rules ok but it just doesn't seem to apply them no matter what combinations I try. 

Based on the logs I know it's loading the three rules out of the access transformer file, and they are parsing correctly.  But it seems they are silently not applying.

Further information:
If I create a new Forge development environment, place my released mod into the eclipse/mods folder, then debug or run, it applies the access transformation no problem.  (It crashes soon after because all the names are obfuscated, but that's not the point...)

Some relevant error logs
Hidden
the field I'm trying to modify in KeyBinding is keybindArray (field_74516_a)
Code: [Select]
@SideOnly(Side.CLIENT)
public class KeyBinding implements Comparable
{
    private static final List keybindArray = new ArrayList();
  ... snip ...

my access_transformer file, trying a few different rules
Code: [Select]
public net.minecraft.client.settings.KeyBinding * # All fields
public net.minecraft.client.settings.KeyBinding field_74516_a # srg name
public net.minecraft.client.settings.KeyBinding keybindArray # deobfs name

the error:
Code: [Select]
cpw.mods.fml.common.LoaderException: java.lang.IllegalAccessError: tried to access field net.minecraft.client.settings.KeyBinding.field_74516_a from class speedytools.clientside.userinput.KeyBindingInterceptor
at cpw.mods.fml.common.LoadController.transition(LoadController.java:162)

from fml-client-latest.log with -Dfml.debugAccessTransformer=true
Code: [Select]
[13:34:14] [main/DEBUG] [FML/]: Examining for coremod candidacy speedytoolsmod-2.0.0.jar
[13:34:14] [main/DEBUG] [FML/]: Loaded 3 rules from AccessTransformer mod jar file C:\Documents and Settings\TGG\My Documents\MineCraft\mods\test\mods\speedytoolsmod-2.0.0.jar

[13:34:14] [main/DEBUG] [FML/]: Not found coremod data in speedytoolsmod-2.0.0.jar
[13:34:14] [main/INFO] [LaunchWrapper/]: Loading tweak class name cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker

... snip...

[13:34:20] [Client thread/DEBUG] [FML/]: Considering all methods and fields on net.minecraft.client.audio.SoundCategory (w)

[13:34:20] [Client thread/DEBUG] [FML/]: Considering all methods and fields on net.minecraft.client.settings.KeyBinding (bal)

[13:34:20] [Client thread/DEBUG] [FML/]: Considering all methods and fields on net.minecraft.client.settings.KeyBinding (bal)

[13:34:20] [Client thread/DEBUG] [FML/]: Considering all methods and fields on net.minecraft.client.settings.KeyBinding (bal)

[13:34:20] [Client thread/DEBUG] [FML/]: Considering all methods and fields on net.minecraft.util.IntHashMap (pz)

from the console output with -Dfml.debugAccessTransformer=true
Code: [Select]
AT RULE: 0000000000000001 *  (type net.minecraft.client.settings.KeyBinding)
AT RULE: 0000000000000001 field_74516_a  (type net.minecraft.client.settings.KeyBinding)
AT RULE: 0000000000000001 keybindArray  (type net.minecraft.client.settings.KeyBinding)

If I create a new Forge development environment, place my released mod into the eclipse/mods folder, then debug or run:
Code: [Select]
[20:03:17] [Client thread/INFO] [STDOUT]: [cpw.mods.fml.common.asm.transformers.AccessTransformer:transform:211]: Field: net.minecraft.client.settings.KeyBinding.keybindArray 0000000000011010 -> 0000000000011001


-TGG


14
ForgeGradle / gradle build for mod with library dependency
« on: October 16, 2014, 12:28:25 pm »
Hi

My mod uses a library that doesn't come with vanilla minecraft or with forge.

What's the best way to include this during gradle build so that it doesn't cause problems when folks install the mod?

-TGG

15
Suggestions / Block.rotateBlock out-of-place
« on: July 16, 2014, 02:17:49 pm »
Hi

I've been trying to use Block.rotateBlock() and I think it could be helpful to provide a method to do out-of-place rotation, i.e. instead of changing the block's metaData, it could accept a "current" metadata value and return the rotated metadata, and let the caller perform the setBlock. 

A number of blocks break if you try to rotate them in place without changing their neighbours too, eg bed, ladder, sign.  It's possible to place multiple blocks at once without them breaking, but only if you know all the rotated metadata in advance.

-TGG

16
Hi guys

Has anyone found a good way to monitor the amount of network traffic to avoid overburdening the network with packets?

I'm writing a mod which needs to send a lot of packets in the background.  If I send too many at once, it overloads the network and slows down everything for other players.  But if I go too conservative it takes an overly long time to send all the packets.

What I'm really looking for is a way to monitor how much network traffic there is and throttle my packet sending accordingly.  I have a couple of ideas from looking through the code (still 1.6.4), but nothing great.

Anyone found a successful method for this before?

-TGG

17
Suggestions / this.mc.mcProfiler.endStartSection hooks
« on: May 06, 2014, 01:31:34 pm »
Howdy

I had an idea the other day while browsing through vanilla looking for a suitable hook.

Perhaps
Profiler.endStartSection()
could be modified to act as an event handler.

For example, if I want to intercept the vanilla code flow so that I change the renderer settings immediately before rendering terrain

Code: [Select]
          this.mc.mcProfiler.endStartSection("prepareterrain");
            this.setupFog(0, partialTick);
            GL11.glEnable(GL11.GL_FOG);
            this.mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture);
            RenderHelper.disableStandardItemLighting();
            this.mc.mcProfiler.endStartSection("terrain");

// want to intercept here
            renderglobal.sortAndRender(entitylivingbase, 0, (double)partialTick);
            GL11.glShadeModel(GL11.GL_FLAT);
            EntityPlayer entityplayer;

I have previously called
Code: [Select]
Profiler.registerListener("terrain", myListenerObject);
so that the call to
Code: [Select]
            this.mc.mcProfiler.endStartSection("terrain");
does something like
Code: [Select]
  IProfilerListener listener = listenerHashMap.get(sectionString);
  if (listener != null) listener.eventOccurred();

I can't imagine no-one has thought of it before, but I couldn't find anything similar in the forums, and I'm not sure why, since it would be almost trivial to implement and I can't see any obvious drawbacks?

-TGG

18
Modder Support / Unit testing & integration testing
« on: March 20, 2014, 01:16:57 pm »
Howdy all

I've got a general question about unit and integration testing in Forge.

I'm trying to write unit tests for some of my new classes and it's proving almost impossible any time my classes refer to any of the vanilla classes such as EntityPlayerMP or similar because writing stubs or mocks for them is just too complicated.  All I really need is to override a couple of the class methods with stubs, but the classes generally don't have a default constructor which makes it a real pain.

Anyone got any tricks you can recommend?  I'm currently resorting to inserting my test harnesses into the mod code and running it like a normal mod, which is pretty clunky.  Surely there's got to be a better way?

-TGG 

19
Modder Support / FMLLog setup for unit testing
« on: March 01, 2014, 06:00:26 am »
Howdy all

I'm trying to set up unit testing for some of my classes (using JUnit) and it's doing my head in trying to set up the FMLLog so it doesn't crash when the class under test writes to it.

eg if my class under test has
Code: [Select]
      if (!backupListing.hasKey(BACKUP_LISTING_VERSION_TAG) || !backupListing.hasKey(BACKUP_LISTING_PATHS_TAG)) {
        FMLLog.warning("Invalid backuplisting file (missing tag): " + backupListingPath.toString());
        return retval;
      }

then when it is called by my test class, it gives me a NullPointerException
caused by this line in FMLRelaunchLog::configureLogging
Code: [Select]
            File logPath = new File(minecraftHome, logFileNamePattern);
because minecraftHome and logFileNamePattern are both not set properly.

I haven't been able to find a way to set them up.

Anyone else figured out a straightforward way to do this?  (Other than replacing all my calls to FMLLog with a wrapper, that is)

-TGG

20
Suggestions / Event registration checks for correct bus
« on: February 17, 2014, 10:49:15 am »
Hi

Perhaps it would be helpful to new modders if the Event handler registration would check that you have registered your event handler to the correct bus.  It is rather easy to get them confused (or be unaware that eg the FML has a different bus) and all you can tell is that your event is not called.

-TGG

21
Support & Bug Reports / Wavefront files won't parse
« on: January 29, 2014, 02:21:06 pm »
Hi.

I think the WaveFront object file parser could be improved.
For example the vertexPattern is given   
private static Pattern vertexPattern = Pattern.compile("(v( (\\-){0,1}\\d+\\.\\d+){3,4} *\\n)|(v( (\\-){0,1}\\d+\\.\\d+){3,4} *$)");
So it expects to find a vertex in the form
v followed by three or four numbers made up of: an optional -, followed by digits, followed by ., followed by more digits.

but some wavefront files don't match this pattern in some cases i.e. they don't have a decimal point
v -1.5 0 1.5

Perhaps there is a better pattern based around eg
v(
     ( (\\-){0,1}\\d+\\.\\d+ )
   | ( (\\-){0,1}\\d+          )
  ) {3,4}
or similar?

-TGG



22
Support & Bug Reports / EntityPlayer mismatched function names
« on: January 29, 2014, 09:06:10 am »
Hi

It looks like a couple of methods in EntityPlayer might have been accidentally swapped

The method that used to be called dropPlayerItem is now called dropPlayerItemWithRandomChoice.
The method that used to be called dropPlayerItemWithRandomChoice is now obfuscated func_146097_a
There is no method called dropPlayerItem.

-TGG

23
Suggestions / Faster updating of MCP / deobfuscation
« on: January 25, 2014, 11:22:06 am »
Hi all

Over the past month I've noticed that the biggest thing holding up progress on the change to 1.7.2 seems to be the deobfuscation of the names.  The folks at MCP are obviously very busy, but it seems to me that they've done the hard work already weeks ago, i.e. decompiling the source and making it compile.  The deobfuscation is the easy part, it's something that the hundreds of us out here could do in a couple of days.

So the idea is basically - can we somehow use the gradle setup to apply deobfuscation that we have supplied ourselves (instead of needing an official MCP release)?  in a text file, or from a minecraft forum web database, or whatever? 
Perhaps this looks something like -
(1) the cached forge and minecraft source all use searge names;
(2) at the start of a session, the deobfuscation "patch" is updated (from wherever) and creates a deobfuscated copy of the cached forge and minecraft sources
(3) ideally, there is some sort of mechanism so that user source code can use either searge or deobfuscated names without conflict - so that when the names are updated, the user source code doesn't break.

Even the ability to create a deobfuscation patch for my own use would be nice, rather than having to use the searge names even though I know what the deobfuscated name is.

I know next to nothing about how the deobfuscation currently works, and not much more about gradle.   But it sounds "so simple", is there a good reason why this wouldn't work?  (Apart from needing a deobfuscation database separate from MCPbot, and some sort of quality control checking)

-TGG

24
ForgeGradle / How to - edit core classes for debugging?
« on: January 15, 2014, 01:12:36 pm »
hi all

The new gradle setup for Forge has put the Forge and Minecraft sources into a library.  Previously I used to edit the vanilla classes to add diagnostics etc when I was trying to figure out how the vanilla worked (or more often - why my own code didn't work).

I'm hoping that I can still do this just by removing the forge jar from the library, extracting all the files into a test workspace, tweaking the build config (should be fun! have no idea about gradle), and editing them directly as in ye happy days of olde. 

Thoughts from people who know more about gradle and IDEA than me?

-TGG


25
Suggestions / WorldInfo.additionalProperties for mods
« on: December 13, 2013, 12:41:52 am »
Hi

The other day I wanted to store some information about the World and I thought WorldInfo would be a good place since it already has
additionalProperties with setAdditionalProperties and getAdditionalProperty.

But from the way it is used it doesn't look like I can access those to add custom properties.

Any chance of adding a similar place to store data in WorldInfo that mods can use?

-TGG




Pages: [1] 2
Close
Please register or Login to join in on the community!