Skip to content

Commit

Permalink
Updated for Minecraft 1.8.
Browse files Browse the repository at this point in the history
The bulk of the work was done by @GuntherDW. This commit just bumps the minor
version number and updates user-facing documentation and doc-comments.
  • Loading branch information
totemo committed Jan 19, 2015
1 parent 052a186 commit fa4509a
Show file tree
Hide file tree
Showing 10 changed files with 118 additions and 72 deletions.
3 changes: 2 additions & 1 deletion .classpath
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
<classpathentry combineaccessrules="false" kind="src" path="/LiteLoader"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="/Client/jars/libraries/com/google/code/gson/gson/2.2.4/gson-2.2.4.jar"/>
<classpathentry kind="lib" path="/Client/jars/libraries/com/google/guava/guava/15.0/guava-15.0.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/SnakeYAML 1.10"/>
<classpathentry kind="lib" path="/Client/jars/libraries/com/google/guava/guava/17.0/guava-17.0.jar"/>
<classpathentry kind="lib" path="/Client/jars/libraries/com/mojang/realms/1.5.4/realms-1.5.4.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
5 changes: 5 additions & 0 deletions Changes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
Change History
==============
0.9.0.108-mc1.8.0
* Updated to LiteLoader 1.8.0. Thanks to @GuntherDW for contributing this code.
* Added in-game help for /w config. Thanks to @tompreuss for contributing this code.
* Added visualisation of LogBlock death locations. Thanks to @tompreuss.

0.8.0.104-mc1.7.10
-------------------
* Updated to LiteLoader 1.7.10.
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -400,9 +400,11 @@ Note also that the parsing of lookup results currently ignores the returned worl
/co l r:10


### Configuration File
### Configuration

Watson's main configuration settings are stored in ".minecraft/mods/watson/configuration.yml". They can be changed using the "/w config" command. If a setting can be either "on" or "off", omitting a value for it in "/w config" will reverse the current value.
Watson's main configuration settings are stored in ".minecraft/mods/watson/configuration.yml". They can be changed using the "/w config" command. If a setting can be either "on" or "off", omitting a value for it in "/w config" will reverse the current value. If the setting has a value that can't be toggled in this way, "/w config settingname" will show its current value.

Running "/w config help" will show help for all of the configuration settings.

<table>
<tr>
Expand Down
17 changes: 13 additions & 4 deletions build/build_watson.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

<!-- The version of your mod, can be any string as long as it's valid as part of a file name -->
<!-- and should match the version string returned by your mod. -->
<property name="version" value="0.8.1" />
<property name="version" value="0.9.0" />

<!-- The Minecraft version the mod is for, appended to the output file name for reference -->
<property name="mcversion" value="1.8.0" />
Expand Down Expand Up @@ -54,9 +54,18 @@
<property name="file.prefix" value="mod" />
<property name="file.type" value="litemod" />

<!-- Path to the python executable used by MCP, change if using a non-windows OS -->
<!-- <property name="python" location="${mcp.dir}/runtime/bin/python/python_mcp.exe" /> -->
<property name="python" location="/usr/bin/python" />
<!-- Path to the python executable used by MCP. -->
<taskdef resource="net/sf/antcontrib/antcontrib.properties" classpath="tasks/ant-contrib.jar" />
<if>
<os family="windows"/>
<then>
<property name="python" location="${mcp.dir}/runtime/bin/python/python_mcp.exe"/>
</then>
<!-- Add an <elseif> here for <os family=mac"/> if this <else> doesn't work for Macs. -->
<else>
<property name="python" location="/usr/bin/python"/>
</else>
</if>

<!-- Main target -->
<target name="main" description="Perform all tasks for a build">
Expand Down
4 changes: 2 additions & 2 deletions build/buildnumber.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#Build Number for ANT. Do not edit!
#Thu Aug 14 13:19:00 CST 2014
build.number=105
#Mon Jan 19 19:11:40 CST 2015
build.number=109
6 changes: 3 additions & 3 deletions res/litemod.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
"__comment2__": "Actual comments in this file confuse the JSON parser when deployed. :/",

"name": "watson",
"mcversion": "1.7.10",
"version": "0.8.0.104-mc1.7.10",
"revision": "104",
"mcversion": "1.8.0",
"version": "0.9.0.108-mc1.8.0",
"revision": "108",
"author": "totemo",
"description": "A 3-D log visualisation tool."
}
33 changes: 12 additions & 21 deletions src/watson/LiteModWatson.java
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,13 @@ public void upgradeSettings(String version, File configPath, File oldConfigPath)
* Perform actions triggered on initial join.
*
* @see com.mumfrey.liteloader.JoinGameListener#onJoinGame(net.minecraft.network.INetHandler,
* net.minecraft.network.play.server.S01PacketJoinGame)
* net.minecraft.network.play.server.S01PacketJoinGame,
* net.minecraft.client.multiplayer.ServerData,
* com.mojang.realmsclient.dto.RealmsServer)
*/
@Override
public void onJoinGame(INetHandler netHandler, S01PacketJoinGame joinGamePacket, ServerData serverData, RealmsServer realmsServer)
public void onJoinGame(INetHandler netHandler, S01PacketJoinGame joinGamePacket, ServerData serverData,
RealmsServer realmsServer)
{
if (Configuration.instance.isEnabled())
{
Expand All @@ -179,29 +182,17 @@ public void onJoinGame(INetHandler netHandler, S01PacketJoinGame joinGamePacket,

// --------------------------------------------------------------------------
/**
* @see com.mumfrey.liteloader.ChatFilter#onChat(net.minecraft.network.play.server.S02PacketChat,
* net.minecraft.util.IChatComponent, java.lang.String)
* @see com.mumfrey.liteloader.ChatFilter#onChat(net.minecraft.util.IChatComponent,
* java.lang.String,
* com.mumfrey.liteloader.core.LiteLoaderEventBroker.ReturnValue)
*/
@Override
public boolean onChat(IChatComponent chat, String message, LiteLoaderEventBroker.ReturnValue<IChatComponent> newMessage)
{
boolean allowChat = ChatProcessor.instance.onChat(chat);
if (allowChat)
{
/* try
{
// Since the chat won't go through Chat.localChat(), highlight it here.
// TODO: Obfuscation.
String fieldName = ObfuscationUtilities.getObfuscatedFieldName("field_148919_a", "a", "field_148919_a");
Field field = S02PacketChat.class.getDeclaredField(fieldName);
field.setAccessible(true);
field.set(chatPacket, Chat.getChatHighlighter().highlight(chat));
}
catch (Exception ex)
{
Log.exception(Level.WARNING, "can't modify chat packet", ex);
} */
newMessage.set(Chat.getChatHighlighter().highlight(chat));
newMessage.set(Chat.getChatHighlighter().highlight(chat));
}
return allowChat;
}
Expand Down Expand Up @@ -335,23 +326,23 @@ public void onPostRender(float partialTicks)

private double getPlayerX(float partialTicks)
{
EntityPlayerSP p = Minecraft.getMinecraft().thePlayer;
EntityPlayerSP p = Minecraft.getMinecraft().thePlayer;
return p.prevPosX + (p.posX - p.prevPosX) * partialTicks;
}

// --------------------------------------------------------------------------

private double getPlayerY(float partialTicks)
{
EntityPlayerSP p = Minecraft.getMinecraft().thePlayer;
EntityPlayerSP p = Minecraft.getMinecraft().thePlayer;
return p.prevPosY + (p.posY - p.prevPosY) * partialTicks;
}

// --------------------------------------------------------------------------

private double getPlayerZ(float partialTicks)
{
EntityPlayerSP p = Minecraft.getMinecraft().thePlayer;
EntityPlayerSP p = Minecraft.getMinecraft().thePlayer;
return p.prevPosZ + (p.posZ - p.prevPosZ) * partialTicks;
}

Expand Down
49 changes: 32 additions & 17 deletions src/watson/PrivateFieldsWatson.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,38 @@
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.util.EnumChatFormatting;

// ----------------------------------------------------------------------------
/**
* Created by guntherdw on 12/01/15.
* An object that provides access to private fields in Mojang code that lack
* public access methods.
*/
// public class PrivateFieldsClient<P, T> extends PrivateFields<P, T>
public class PrivateFieldsWatson<P, T> extends PrivateFields<P, T> {
/**
* Creates a new private field entry
*
* @param owner
* @param obf
*/
protected PrivateFieldsWatson(Class<P> owner, Obf obf) {
super(owner, obf);
}
public class PrivateFieldsWatson<P, T> extends PrivateFields<P, T>
{
// --------------------------------------------------------------------------
/**
* Constructor.
*
* @param owner class that owns the field to be accessed.
* @param obf the obfuscation entry describing the name of the field in
* various run-time environments - unobfuscated,
*/
protected PrivateFieldsWatson(Class<P> owner, Obf obf)
{
super(owner, obf);
}

public static final PrivateFieldsWatson<EnumChatFormatting, Character> formattingCode = new PrivateFieldsWatson<EnumChatFormatting, Character>(EnumChatFormatting.class, WatsonObf.EnumChatFormatting_formattingCode);
public static final PrivateFieldsWatson<RenderManager, Double> renderPosX = new PrivateFieldsWatson<RenderManager, Double>(RenderManager.class, WatsonObf.RenderManager_renderPosX);
public static final PrivateFieldsWatson<RenderManager, Double> renderPosY = new PrivateFieldsWatson<RenderManager, Double>(RenderManager.class, WatsonObf.RenderManager_renderPosY);
public static final PrivateFieldsWatson<RenderManager, Double> renderPosZ = new PrivateFieldsWatson<RenderManager, Double>(RenderManager.class, WatsonObf.RenderManager_renderPosZ);
}
// --------------------------------------------------------------------------

public static final PrivateFieldsWatson<EnumChatFormatting, Character> formattingCode = new PrivateFieldsWatson<EnumChatFormatting, Character>(
EnumChatFormatting.class,
WatsonObf.EnumChatFormatting_formattingCode);
public static final PrivateFieldsWatson<RenderManager, Double> renderPosX = new PrivateFieldsWatson<RenderManager, Double>(
RenderManager.class,
WatsonObf.RenderManager_renderPosX);
public static final PrivateFieldsWatson<RenderManager, Double> renderPosY = new PrivateFieldsWatson<RenderManager, Double>(
RenderManager.class,
WatsonObf.RenderManager_renderPosY);
public static final PrivateFieldsWatson<RenderManager, Double> renderPosZ = new PrivateFieldsWatson<RenderManager, Double>(
RenderManager.class,
WatsonObf.RenderManager_renderPosZ);
} // class PrivateFieldsWatson<P, T>
65 changes: 43 additions & 22 deletions src/watson/WatsonObf.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,50 @@

import com.mumfrey.liteloader.core.runtime.Obf;

// ----------------------------------------------------------------------------
/**
* Created by guntherdw on 12/01/15.
* Describes the obfuscation mappings for private fields accessed through
* {@link PrivateFieldsWatson}.
*
* When accessing a private field via reflection, its name will vary depending
* on the runtime environment. In the IDE, the fully-deobfuscated MCP name will
* be available. Running as a deployed mod, the field will have its fully
* obfuscated name, e.g. "a", unless Forge ModLoader is running, in which case
* the field will take its Searge name, e.g. field_12345_a.
*
* For classes, MCP always uses the class name assigned by Searge.
*/
public class WatsonObf extends Obf {
/**
* @param seargeName
* @param obfName
* @param mcpName
*/
protected WatsonObf(String seargeName, String obfName, String mcpName) {
super(seargeName, obfName, mcpName);
}
public class WatsonObf extends Obf
{
// --------------------------------------------------------------------------
/**
* Constructor for fields.
*
* @param seargeName the Searge name of the field.
* @param obfName the fully obfuscated name of the field.
* @param mcpName the MCP-assigned name of the field.
*/
protected WatsonObf(String seargeName, String obfName, String mcpName)
{
super(seargeName, obfName, mcpName);
}

/**
* @param seargeName
* @param obfName
*/
public WatsonObf(String seargeName, String obfName) {
super(seargeName, obfName, seargeName);
}
// --------------------------------------------------------------------------
/**
* Constructor for classes.
*
* @param seargeName
* @param obfName
*/
public WatsonObf(String seargeName, String obfName)
{
super(seargeName, obfName, seargeName);
}

protected static WatsonObf EnumChatFormatting_formattingCode = new WatsonObf("field_96329_z", "z", "formattingCode");
protected static WatsonObf RenderManager_renderPosX = new WatsonObf("field_78725_b", "o", "renderPosX");
protected static WatsonObf RenderManager_renderPosY = new WatsonObf("field_78726_c", "p", "renderPosY");
protected static WatsonObf RenderManager_renderPosZ = new WatsonObf("field_78723_d", "q", "renderPosZ");
}
// --------------------------------------------------------------------------

protected static WatsonObf EnumChatFormatting_formattingCode = new WatsonObf("field_96329_z", "z", "formattingCode");
protected static WatsonObf RenderManager_renderPosX = new WatsonObf("field_78725_b", "o", "renderPosX");
protected static WatsonObf RenderManager_renderPosY = new WatsonObf("field_78726_c", "p", "renderPosY");
protected static WatsonObf RenderManager_renderPosZ = new WatsonObf("field_78723_d", "q", "renderPosZ");
} // class WatsonObf
2 changes: 2 additions & 0 deletions src/watson/chat/ChatProcessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ public void addChatHandler(IChatHandler handler)
* Process the chat
*
* @param chat the chat message.
* @return true if the chat should be echoed in the client chat GUI; false if
* it should be filtered out.
*/
public boolean onChat(IChatComponent chat)
{
Expand Down

0 comments on commit fa4509a

Please sign in to comment.