EmcValues
This commit is contained in:
parent
e4b0f8a99c
commit
0f4746336d
2 changed files with 4 additions and 25 deletions
|
@ -24,14 +24,12 @@ import java.util.List;
|
||||||
|
|
||||||
public class InterModCommsHandler implements ITickHandler, IScheduledTickHandler
|
public class InterModCommsHandler implements ITickHandler, IScheduledTickHandler
|
||||||
{
|
{
|
||||||
|
|
||||||
private static Gson gson = new Gson();
|
private static Gson gson = new Gson();
|
||||||
|
|
||||||
// TODO Logging
|
// TODO Logging
|
||||||
|
|
||||||
public static void processIMCMessages(IMCEvent event)
|
public static void processIMCMessages(IMCEvent event)
|
||||||
{
|
{
|
||||||
|
|
||||||
for (IMCMessage imcMessage : event.getMessages())
|
for (IMCMessage imcMessage : event.getMessages())
|
||||||
{
|
{
|
||||||
processIMCMessage(imcMessage);
|
processIMCMessage(imcMessage);
|
||||||
|
@ -40,7 +38,6 @@ public class InterModCommsHandler implements ITickHandler, IScheduledTickHandler
|
||||||
|
|
||||||
public static void processIMCMessage(IMCMessage imcMessage)
|
public static void processIMCMessage(IMCMessage imcMessage)
|
||||||
{
|
{
|
||||||
|
|
||||||
String requestedOperation = imcMessage.key;
|
String requestedOperation = imcMessage.key;
|
||||||
|
|
||||||
if (requestedOperation.equalsIgnoreCase(InterModCommsOperations.RECIPE_ADD))
|
if (requestedOperation.equalsIgnoreCase(InterModCommsOperations.RECIPE_ADD))
|
||||||
|
@ -67,7 +64,6 @@ public class InterModCommsHandler implements ITickHandler, IScheduledTickHandler
|
||||||
|
|
||||||
private static void processAddRecipeMessage(IMCMessage imcMessage)
|
private static void processAddRecipeMessage(IMCMessage imcMessage)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (imcMessage.getMessageType() == String.class)
|
if (imcMessage.getMessageType() == String.class)
|
||||||
{
|
{
|
||||||
RecipeMapping recipeMapping = RecipeMapping.createFromJson(imcMessage.getStringValue());
|
RecipeMapping recipeMapping = RecipeMapping.createFromJson(imcMessage.getStringValue());
|
||||||
|
@ -93,17 +89,14 @@ public class InterModCommsHandler implements ITickHandler, IScheduledTickHandler
|
||||||
|
|
||||||
private static void processPreAssignEmcValueMessage(IMCMessage imcMessage)
|
private static void processPreAssignEmcValueMessage(IMCMessage imcMessage)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (imcMessage.getMessageType() == String.class)
|
if (imcMessage.getMessageType() == String.class)
|
||||||
{
|
{
|
||||||
|
|
||||||
StackValueMapping stackValueMapping = StackValueMapping.createFromJson(imcMessage.getStringValue());
|
StackValueMapping stackValueMapping = StackValueMapping.createFromJson(imcMessage.getStringValue());
|
||||||
|
|
||||||
if (stackValueMapping != null)
|
if (stackValueMapping != null)
|
||||||
{
|
{
|
||||||
|
|
||||||
WrappedStack wrappedStack = stackValueMapping.wrappedStack;
|
WrappedStack wrappedStack = stackValueMapping.wrappedStack;
|
||||||
EmcValue emcValue = stackValueMapping.emcValue;
|
EmcValue emcValue = new EmcValue(stackValueMapping.emcValue.getValue());
|
||||||
|
|
||||||
EmcValuesIMC.addPreAssignedValued(wrappedStack, emcValue);
|
EmcValuesIMC.addPreAssignedValued(wrappedStack, emcValue);
|
||||||
}
|
}
|
||||||
|
@ -120,17 +113,14 @@ public class InterModCommsHandler implements ITickHandler, IScheduledTickHandler
|
||||||
|
|
||||||
private static void processPostAssignEmcValueMessage(IMCMessage imcMessage)
|
private static void processPostAssignEmcValueMessage(IMCMessage imcMessage)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (imcMessage.getMessageType() == String.class)
|
if (imcMessage.getMessageType() == String.class)
|
||||||
{
|
{
|
||||||
|
|
||||||
StackValueMapping stackValueMapping = StackValueMapping.createFromJson(imcMessage.getStringValue());
|
StackValueMapping stackValueMapping = StackValueMapping.createFromJson(imcMessage.getStringValue());
|
||||||
|
|
||||||
if (stackValueMapping != null)
|
if (stackValueMapping != null)
|
||||||
{
|
{
|
||||||
|
|
||||||
WrappedStack wrappedStack = stackValueMapping.wrappedStack;
|
WrappedStack wrappedStack = stackValueMapping.wrappedStack;
|
||||||
EmcValue emcValue = stackValueMapping.emcValue;
|
EmcValue emcValue = new EmcValue(stackValueMapping.emcValue.getValue());
|
||||||
|
|
||||||
EmcValuesIMC.addPostAssignedValued(wrappedStack, emcValue);
|
EmcValuesIMC.addPostAssignedValued(wrappedStack, emcValue);
|
||||||
}
|
}
|
||||||
|
@ -147,10 +137,8 @@ public class InterModCommsHandler implements ITickHandler, IScheduledTickHandler
|
||||||
|
|
||||||
private static void processHasEmcValueMessage(IMCMessage imcMessage)
|
private static void processHasEmcValueMessage(IMCMessage imcMessage)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (imcMessage.getMessageType() == String.class)
|
if (imcMessage.getMessageType() == String.class)
|
||||||
{
|
{
|
||||||
|
|
||||||
WrappedStack wrappedStack = WrappedStack.createFromJson(imcMessage.getStringValue());
|
WrappedStack wrappedStack = WrappedStack.createFromJson(imcMessage.getStringValue());
|
||||||
|
|
||||||
if (wrappedStack != null)
|
if (wrappedStack != null)
|
||||||
|
@ -168,7 +156,6 @@ public class InterModCommsHandler implements ITickHandler, IScheduledTickHandler
|
||||||
}
|
}
|
||||||
else if (imcMessage.getMessageType() == ItemStack.class)
|
else if (imcMessage.getMessageType() == ItemStack.class)
|
||||||
{
|
{
|
||||||
|
|
||||||
ItemStack itemStack = imcMessage.getItemStackValue();
|
ItemStack itemStack = imcMessage.getItemStackValue();
|
||||||
|
|
||||||
if (itemStack != null)
|
if (itemStack != null)
|
||||||
|
@ -192,10 +179,8 @@ public class InterModCommsHandler implements ITickHandler, IScheduledTickHandler
|
||||||
|
|
||||||
private static void processGetEmcValueMessage(IMCMessage imcMessage)
|
private static void processGetEmcValueMessage(IMCMessage imcMessage)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (imcMessage.getMessageType() == String.class)
|
if (imcMessage.getMessageType() == String.class)
|
||||||
{
|
{
|
||||||
|
|
||||||
WrappedStack wrappedStack = WrappedStack.createFromJson(imcMessage.getStringValue());
|
WrappedStack wrappedStack = WrappedStack.createFromJson(imcMessage.getStringValue());
|
||||||
|
|
||||||
if (wrappedStack != null)
|
if (wrappedStack != null)
|
||||||
|
@ -213,7 +198,6 @@ public class InterModCommsHandler implements ITickHandler, IScheduledTickHandler
|
||||||
}
|
}
|
||||||
else if (imcMessage.getMessageType() == ItemStack.class)
|
else if (imcMessage.getMessageType() == ItemStack.class)
|
||||||
{
|
{
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Reply back to the mod that queried for the existance of an EmcValue for the given ItemStack
|
* Reply back to the mod that queried for the existance of an EmcValue for the given ItemStack
|
||||||
*/
|
*/
|
||||||
|
@ -243,13 +227,10 @@ public class InterModCommsHandler implements ITickHandler, IScheduledTickHandler
|
||||||
@Override
|
@Override
|
||||||
public void tickEnd(EnumSet<TickType> type, Object... tickData)
|
public void tickEnd(EnumSet<TickType> type, Object... tickData)
|
||||||
{
|
{
|
||||||
|
|
||||||
for (TickType tickType : type)
|
for (TickType tickType : type)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (tickType == TickType.SERVER)
|
if (tickType == TickType.SERVER)
|
||||||
{
|
{
|
||||||
|
|
||||||
ImmutableList<IMCMessage> runtimeIMCMessages = FMLInterModComms.fetchRuntimeMessages(EquivalentExchange3.instance);
|
ImmutableList<IMCMessage> runtimeIMCMessages = FMLInterModComms.fetchRuntimeMessages(EquivalentExchange3.instance);
|
||||||
|
|
||||||
for (IMCMessage imcMessage : runtimeIMCMessages)
|
for (IMCMessage imcMessage : runtimeIMCMessages)
|
||||||
|
@ -263,14 +244,12 @@ public class InterModCommsHandler implements ITickHandler, IScheduledTickHandler
|
||||||
@Override
|
@Override
|
||||||
public EnumSet<TickType> ticks()
|
public EnumSet<TickType> ticks()
|
||||||
{
|
{
|
||||||
|
|
||||||
return EnumSet.of(TickType.SERVER);
|
return EnumSet.of(TickType.SERVER);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getLabel()
|
public String getLabel()
|
||||||
{
|
{
|
||||||
|
|
||||||
return Reference.MOD_NAME + ": " + this.getClass().getSimpleName();
|
return Reference.MOD_NAME + ": " + this.getClass().getSimpleName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -278,6 +257,6 @@ public class InterModCommsHandler implements ITickHandler, IScheduledTickHandler
|
||||||
public int nextTickSpacing()
|
public int nextTickSpacing()
|
||||||
{
|
{
|
||||||
|
|
||||||
return 20;
|
return Reference.ONE_SECOND_IN_TICKS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ public class Reference
|
||||||
public static final String CHANNEL_NAME = MOD_ID;
|
public static final String CHANNEL_NAME = MOD_ID;
|
||||||
public static final String DEPENDENCIES = "required-after:Forge@[9.10.1.849,)";
|
public static final String DEPENDENCIES = "required-after:Forge@[9.10.1.849,)";
|
||||||
public static final String FINGERPRINT = "@FINGERPRINT@";
|
public static final String FINGERPRINT = "@FINGERPRINT@";
|
||||||
public static final int SECOND_IN_TICKS = 20;
|
public static final int ONE_SECOND_IN_TICKS = 20;
|
||||||
public static final String SERVER_PROXY_CLASS = "com.pahimar.ee3.proxy.ServerProxy";
|
public static final String SERVER_PROXY_CLASS = "com.pahimar.ee3.proxy.ServerProxy";
|
||||||
public static final String CLIENT_PROXY_CLASS = "com.pahimar.ee3.proxy.ClientProxy";
|
public static final String CLIENT_PROXY_CLASS = "com.pahimar.ee3.proxy.ClientProxy";
|
||||||
public static final int VERSION_CHECK_ATTEMPTS = 3;
|
public static final int VERSION_CHECK_ATTEMPTS = 3;
|
||||||
|
|
Loading…
Reference in a new issue