Jump to content

Awesome_Spider

Forge Modder
  • Posts

    892
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Awesome_Spider

  1. I'm still not having any luck. Any other ideas? There is a null pointer on the same method as last time.
  2. I am trying to make my mod create configurations for every dimension that is registered. However, I'm getting a null pointer exception and have tried many times in vain to fix it. Here is the code: public static void loadAll() { //Dimensions Integer[] ids = DimensionManager.getStaticDimensionIDs(); for (int id : ids) { WorldProvider dimension = DimensionManager.getProvider(id); //NullPointer String modId = ModIdentification.idFromObject(dimension); File file = new File(EnviroMineRevived.configDir, modId.toLowerCase() + "\\dimension.json"); DimensionProperties.base.load(file); } ... } I then call this method in my post-init method. It however throws a null pointer which leads me to believe that none of the dimensions are registered by then. Where should I be calling this? If you need more code just ask. Following is the error:
  3. Maybe I could look though all the tile entity instances in the world and see if they have the capability? I'm not sure.
  4. I am creating a temperature system where some blocks give off heat. I have an api that contains a capability that mod developers can attach to their tile entities. This allows the tile entities to dynamically change their temperature. The amount of heat that reaches the player depends on how far the player is away from the tile entity. Yesterday, I asked how I should get blocks within a cube around the player, and now I need to know how far I should look for tile entities. To do this, I put a maximum temperature value in the capability that is set in the constructor of the capability. Now I need to get the tile entity with the highest maximum value, if that makes any sense. Long story short, getting all the tile entity classes was a stupid idea. I'm not sure how to go about this at this point. Sorry about the long post.
  5. To address your first answer, if I'm not supposed to use the GameData method, is there an event I could subscribe to that is called when a tile entity is registered? I don't see one, but I'll look some more into it. For answer 2, I have an api that can be used by other mods that containes a capability that can be attached to a tile entity. I would like to get all the tile entities to check if their classes have the capability. However, on second thought, I will have to rethink that. The method I would use to check (hasCapability) isn't static. Meaning it is a per instance deal.
  6. I have two questions that I am stuck on. Question one: How do I get a list of all the tile entities that have been registered? Question two: Would I do this in post init to ensure all of the tiles have been registered, or would I use a different event? Any help on this is appreciated. Edit: I found GameData::getTileEntityRegistry, but it's deprecated.
  7. Well, I guess I should have been more clear. A cube around the player will work. Thanks for your help. I think BlockPos::getAllInBox is exactly what I want.
  8. I am thinking about modding again after a few weeks or so of being swamped with school. What I want to do is get all the blocks within a radius around the player to test each block for different properties. Is there an easy way of doing this?
  9. Another question, what was WorldProvider::getDimensionName replaced with?
  10. I'm updating a mod that uses this code to get the modid that registered a biome, dimension etc. I don't think this a very good way of doing it, so I'm wondering how I might be able to get the modid that registered any given dimension. The reason I need this is because the mod generates configuration for how the mod is supposed to behave in a dimension or biome. These configuration files are generated and divided up into modids. I have the biomes working, but I also need to get the modid for the dimensions.
  11. I have another question. How would I get the modid of the mod (or vanilla minecraft) that registered the biome? The mod I'm updating used this code, but I'm not sure if that's a good approach or not.
  12. I am updating a mod from 1.7.10 to 1.11, and I have a quick question. This line in the mod is tripping me up: BiomeGenBase[] biomeArray = BiomeGenBase.getBiomeGenArray(); Was BiomeGenBase replaced with Biome or something else? That's what I thought, but there isn't a getBiomeGenArray or something similar method in it.What would I use instead? I found that there was a Biomes class that had all the vanilla biomes, and it crossed my mind that I could put all these into an array. But that wouldn't work if there was modded biomes. Any help is appreciated.
  13. Ok. I think I'm doing that now. But it isn't rendering. protected static BlockRendererDispatcher blockRenderer; @Override public void renderTileEntityFast(TileEntityRobot te, double x, double y, double z, float partialTicks, int destroyStage, VertexBuffer renderer) { if(blockRenderer == null) blockRenderer = Minecraft.getMinecraft().getBlockRendererDispatcher(); BlockPos pos = te.getPos(); IBlockAccess world = MinecraftForgeClient.getRegionRenderCache(te.getWorld(), pos); IBlockState state = world.getBlockState(pos); final IBakedModel model = blockRenderer.getBlockModelShapes().getModelForState(state); renderer.setTranslation(x - pos.getX() + 2.0f, y - pos.getY(), z - pos.getZ() + 2.0f); for(int i = 0; i > model.getQuads(state, null, 0L).size(); i++) { BakedQuad quad = model.getQuads(state, null, 0L).get(i); quad = transform(quad, new TRSRTransformation(new Vector3f(0, 0, 0), new Quat4f(-0.49f, 0, 0, -0.87f), new Vector3f(1, 1, 1), new Quat4f(0.49f, 0, 0, 0.87f))); renderer.addVertexData(quad.getVertexData()); } } //This method was borrowed from Vazkii's mod called Botania. It was modified to work for a block instead of an item. public static BakedQuad transform(BakedQuad quad, final TRSRTransformation transform) { UnpackedBakedQuad.Builder builder = new UnpackedBakedQuad.Builder(DefaultVertexFormats.BLOCK); final IVertexConsumer consumer = new VertexTransformer(builder) { @Override public void put(int element, float... data) { VertexFormatElement formatElement = DefaultVertexFormats.BLOCK.getElement(element); switch(formatElement.getUsage()) { case POSITION: { float[] newData = new float[3]; Vector3f vec = new Vector3f(data); transform.getMatrix().transform(vec); vec.get(newData); parent.put(element, newData); break; } default: { parent.put(element, data); break; } } } }; quad.pipe(consumer); return builder.build(); }
  14. And even then there's still home invasions...
  15. I finally updated IntelliJ after putting it off for a while, and now it shows this error under the Run Configurations: I ran both setupDecompWorkspace and genIntelliJruns again. That didn't resolve it. How would I fix this?
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.