Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.7.2] Block.blocksList [Update 1.6.4->1.7.2] Question


Recommended Posts

Ok, I'm trying to update SpringMine's BetterLog mod to 1.7.2.  Here's my code:

 

/*  1:   */ package mods.springmine.BetterLog;
/*  2:   */ 
/*  3:   */ import cpw.mods.fml.client.registry.RenderingRegistry;
/*  4:   */ import cpw.mods.fml.common.Mod;
/*  5:   */ import cpw.mods.fml.common.Mod.EventHandler;
/*  6:   */ import cpw.mods.fml.common.event.FMLInitializationEvent;
/*  7:   */ import cpw.mods.fml.common.event.FMLPreInitializationEvent;
/*  9:   */ import cpw.mods.fml.relauncher.Side;
/* 10:   */ import mods.springmine.utils.BlockModelRender;
/* 11:   */ import net.minecraft.block.Block;
/* 12:   */ import net.minecraft.block.BlockLog;
/* 14:   */ 
/* 15:   */ @Mod(modid="mods.springmine.BetterLog", name="BetterLog", version="1.6.2")
/* 16:   */
/* 17:   */ public class BetterLog
/* 18:   */ {
/* 19:   */   public static int RenderType;
/* 20:   */   
/* 21:   */   @Mod.EventHandler
/* 22:   */   public void preinit(FMLPreInitializationEvent event)
/* 23:   */   {
/* 24:24 */     int tempid = Block.field_71951_J.field_71990_ca;
/* 25:25 */     Block.field_71973_m[tempid] = null;
/* 26:26 */     Block block = new BlockBetterLog(tempid);
/* 27:27 */     net.minecraft.item.Item.field_77698_e[tempid] = new ItemMultiTextureTile(tempid - 256, block, BlockLog.field_72142_a).func_77655_b("log");
/* 28:   */   }
/* 29:   */   
/* 30:   */   @Mod.EventHandler
/* 31:   */   public void init(FMLInitializationEvent event)
/* 32:   */   {
/* 33:35 */     if (event.getSide() == Side.CLIENT)
/* 34:   */     {
/* 35:37 */       RenderType = RenderingRegistry.getNextAvailableRenderId();
/* 36:38 */       RenderingRegistry.registerBlockHandler(RenderType, new BlockModelRender(new ModelBetterLog(), RenderType, true));
/* 37:   */     }
/* 38:   */   }
/* 39:   */ }



/* Location:           C:\Users\*****\Downloads\BetterLog162.zip

* Qualified Name:     mods.springmine.BetterLog.BetterLog

* JD-Core Version:    0.7.0.1

*/

Link to post
Share on other sites

Ok, my code is here(w/o line numbers): http://pastebin.com/4HNwrRD3

 

My problem is a couple errors on this line:

net.minecraft.item.Item.field_77698_e[tempid] = new ItemMultiTextureTile(tempid - 256, block, BlockLog.getBlockById(tempid)).setUnlocalizedName("log");

 

 

Not sure how to change ItemMultiTextureTile and field_77698_e to their 1.7.2 equivalents.

Link to post
Share on other sites

No, this mod was meant to render all the vanilla wood with a new, rounder model.  I have most of the errors fixed, but some still bug me.  Like the ones on this line:

net.minecraft.item.Item.field_77698_e[tempid] = new ItemMultiTexture(tempid - 256, block, BlockLog.getBlockById(tempid)).setUnlocalizedName("log");

.  The errors are: 'field_77698_e cannot be resolved or is not a field', and 'ItemMultiTextureTile cannot be resolved to a type'

Link to post
Share on other sites

It says right there.

 

field_77698_e

does not exist (anymore), and it seems you haven't imported the class

ItemMultiTexture

.

 

What is

field_77698_e

supposed to be? Have a look through Item.java and replace

field_77698_e

with the deobfuscated name, if it exists.

Link to post
Share on other sites

The Item.java will need to be decompiled and deobfuscated to make any sense. This has probably already happened if your development environment is set up correctly, but the location of the java files has changed from 1.6.4, I believe.

 

They now reside in forge/build/tmp/recompSrc.

Link to post
Share on other sites

The Item.java will need to be decompiled and deobfuscated to make any sense. This has probably already happened if your development environment is set up correctly, but the location of the java files has changed from 1.6.4, I believe.

 

They now reside in forge/build/tmp/recompSrc.

 

I looked in forge/build/tmp/ and there was no recompSrc folder.  I followed all the directions for installing the Forge src and it still won't show up.

Link to post
Share on other sites

 

C:\Users\joshl\Desktop\forge-1.7.2-10.12.2.1121-src>gradlew.bat setupDecompWorks
pace
****************************
Powered By MCP:
http://mcp.ocean-labs.de/
Searge, ProfMobius, Fesh0r,
R4wk, ZeuX, IngisKahn
MCP Data version : unknown
****************************
:extractUserDev
:getAssetsIndex
:getAssets
:copyAssets
:extractNatives
:genSrgs SKIPPED
:makeStart SKIPPED
:downloadMcpTools
:downloadClient SKIPPED
:downloadServer SKIPPED
:mergeJars SKIPPED
:deobfuscateJar SKIPPED
:decompile SKIPPED
:processSources SKIPPED
:remapJar SKIPPED
:extractMinecraftSrc SKIPPED
:recompMinecraft SKIPPED
:repackMinecraft SKIPPED
:setupDecompWorkspace

BUILD SUCCESSFUL

Total time: 57.673 secs
C:\Users\joshl\Desktop\forge-1.7.2-10.12.2.1121-src>

 

 

Here it is.  Dunno why these were skipped.

Link to post
Share on other sites

Have you run the eclipse command after running setupDecompWorkspace?

For your actual problem, I misunderstood the first time. You are trying to replace vanilla Blocks. This is no longer (or rather: not yet) possible in Forge for 1.7 because of the switch to a non-id based system.

Link to post
Share on other sites

I use reflection for my own diabolical ends (read: replacing vanilla Blocks). That seems to work well, for the most part, for now. Looking forward to a more recommended way of doing that, though :)

Link to post
Share on other sites

I use reflection for my own diabolical ends (read: replacing vanilla Blocks). That seems to work well, for the most part, for now. Looking forward to a more recommended way of doing that, though :)

Lex and other people highly discourage this (for a reason). It can apparently corrupt worlds.
Link to post
Share on other sites

Hence diabolical!

 

I can see how it could corrupt worlds, but what I am working on using reflection is merely a proof of concept.

 

Once Forge for 1.7 supports replacing vanilla Blocks (if it ever will), I will port the code. For now, though, reflection seems to be the best way for me to test out my ideas as if that system was already in place.

 

Thank you for the heads up, though!

Link to post
Share on other sites

just a bit of hijack(sorry), but i use asm to replace items, blocks and remove some entities,while i do a bunch of sanity checks, can it still corrupt worlds? if so, do i need to hook the world load/save events and make backups of the world? thanks

edit:

its just me or this guy decompiled a mod using JAD? (hence line numbers and obfuscated names)

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.