mirror of
https://github.com/GTNewHorizons/waila.git
synced 2026-11-21 20:52:40 +00:00
Restored getBlockID to the accessors
Added getBlockQualifiedName to return a block domain:name str Restored the id display (along with the new qualified name)
This commit is contained in:
1 parent
fdd401469e
commit
156e672dbc
5 files changed
+16
-5
No files matched your search
@@ -23,6 +23,7 @@ public interface IWailaCommonAccessor {
|
||||
EntityPlayer getPlayer();
|
||||
Block getBlock();
|
||||
int getBlockID();
|
||||
String getBlockQualifiedName();
|
||||
int getMetadata();
|
||||
TileEntity getTileEntity();
|
||||
Entity getEntity();
|
||||
|
||||
@@ -24,6 +24,7 @@ public interface IWailaDataAccessor{
|
||||
EntityPlayer getPlayer();
|
||||
Block getBlock();
|
||||
int getBlockID();
|
||||
String getBlockQualifiedName();
|
||||
int getMetadata();
|
||||
TileEntity getTileEntity();
|
||||
MovingObjectPosition getPosition();
|
||||
|
||||
@@ -16,7 +16,6 @@ public interface IWailaTooltipRenderer {
|
||||
/**
|
||||
* Draw method for the renderer. The GL matrice is automatically moved to the top left of the reserved zone.<br>
|
||||
* All calls should be relative to (0,0)
|
||||
*
|
||||
*
|
||||
* @param params Array of string parameters as passed to the RENDER arg in the tooltip ({rendername,param1,param2,...})
|
||||
* @param accessor A global accessor for TileEntities and Entities
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package mcp.mobius.waila.api.impl;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameData;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
@@ -25,6 +26,7 @@ public class DataAccessorCommon implements IWailaCommonAccessor, IWailaDataAcces
|
||||
public Vec3 renderingvec = null;
|
||||
public Block block;
|
||||
public int blockID;
|
||||
public String blockResource;
|
||||
public int metadata;
|
||||
public TileEntity tileEntity;
|
||||
public Entity entity;
|
||||
@@ -49,6 +51,8 @@ public class DataAccessorCommon implements IWailaCommonAccessor, IWailaDataAcces
|
||||
this.metadata = world.getBlockMetadata(_mop.blockX, _mop.blockY, _mop.blockZ);
|
||||
this.tileEntity = world.getTileEntity(_mop.blockX, _mop.blockY, _mop.blockZ);
|
||||
this.entity = null;
|
||||
this.blockID = Block.getIdFromBlock(this.block);
|
||||
this.blockResource = GameData.getBlockRegistry().getNameForObject(this.block);
|
||||
try{ this.stack = new ItemStack(this.block, 1, this.metadata); } catch (Exception e) {}
|
||||
|
||||
} else if (this.mop.typeOfHit == MovingObjectType.ENTITY){
|
||||
@@ -184,6 +188,11 @@ public class DataAccessorCommon implements IWailaCommonAccessor, IWailaDataAcces
|
||||
|
||||
public void resetTimer(){
|
||||
this.timeLastUpdate = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockQualifiedName() {
|
||||
return this.blockResource;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,7 +2,7 @@ package mcp.mobius.waila.handlers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
import cpw.mods.fml.common.registry.GameData;
|
||||
import static mcp.mobius.waila.api.SpecialChars.*;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
@@ -11,11 +11,14 @@ import mcp.mobius.waila.api.impl.ConfigHandler;
|
||||
import mcp.mobius.waila.overlay.DisplayUtil;
|
||||
import mcp.mobius.waila.utils.Constants;
|
||||
import mcp.mobius.waila.utils.ModIdentification;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
|
||||
@@ -56,9 +59,7 @@ public class HUDHandlerBlocks implements IWailaDataProvider {
|
||||
currenttip.add("< Unnamed >");
|
||||
else{
|
||||
if (ConfigHandler.instance().getConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_METADATA, true)){
|
||||
name = currenttip.get(0);
|
||||
//currenttip.set(0, name + String.format(" %s:%s", accessor.getBlockID(), accessor.getMetadata()));
|
||||
//currenttip.set(0, name + String.format(" %s:%s", itemStack.itemID, itemStack.getItemDamage()));
|
||||
currenttip.add(String.format(ITALIC + "[%d:%d] | %s", accessor.getBlockID(), accessor.getMetadata(), accessor.getBlockQualifiedName()));
|
||||
}
|
||||
}
|
||||
return currenttip;
|
||||
|
||||
Reference in new issue
Block a user