Some fixups for FML, and use the FML registry for potions

This commit is contained in:
cpw 2016-03-06 23:07:25 -05:00
parent 2847644368
commit b342bf8481
5 changed files with 25 additions and 12 deletions

View File

@ -1,6 +1,21 @@
--- ../src-base/minecraft/net/minecraft/potion/Potion.java
+++ ../src-work/minecraft/net/minecraft/potion/Potion.java
@@ -195,7 +195,6 @@
@@ -18,12 +18,13 @@
import net.minecraft.util.StringUtils;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.registry.RegistryNamespaced;
+import net.minecraftforge.fml.common.registry.GameData;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class Potion
{
- public static final RegistryNamespaced<ResourceLocation, Potion> field_188414_b = new RegistryNamespaced();
+ public static final RegistryNamespaced<ResourceLocation, Potion> field_188414_b = GameData.getPotionRegistry();
private final Map<IAttribute, AttributeModifier> attributeModifierMap = Maps.<IAttribute, AttributeModifier>newHashMap();
private final boolean isBadEffect;
private final int liquidColor;
@@ -195,7 +196,6 @@
return this.statusIconIndex;
}
@ -8,7 +23,7 @@
public boolean isBadEffect()
{
return this.isBadEffect;
@@ -266,7 +265,37 @@
@@ -266,7 +266,37 @@
return modifier.getAmount() * (double)(p_111183_1_ + 1);
}

View File

@ -126,7 +126,7 @@ public class EntitySpawnHandler extends SimpleChannelInboundHandler<FMLMessage.E
if (spawnMsg.dataWatcherList != null)
{
entity.getDataWatcher().updateWatchedObjectsFromList(spawnMsg.dataWatcherList);
entity.func_184212_Q().func_187218_a(spawnMsg.dataWatcherList);
}
if (spawnMsg.throwerId > 0)

View File

@ -6,11 +6,11 @@ import io.netty.buffer.Unpooled;
import java.io.IOException;
import java.util.List;
import net.minecraft.network.datasync.EntityDataManager;
import org.apache.logging.log4j.Level;
import com.google.common.base.Throwables;
import net.minecraft.entity.DataWatcher;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.network.PacketBuffer;
@ -157,7 +157,7 @@ public abstract class FMLMessage {
double speedScaledX;
double speedScaledY;
double speedScaledZ;
List<DataWatcher.WatchableObject> dataWatcherList;
List<EntityDataManager.DataEntry<?>> dataWatcherList;
ByteBuf dataStream;
public EntitySpawnMessage() {}
@ -193,7 +193,7 @@ public abstract class FMLMessage {
PacketBuffer pb = new PacketBuffer(tmpBuf);
try
{
entity.getDataWatcher().writeTo(pb);
entity.func_184212_Q().func_187216_a(pb);
} catch (IOException e)
{
FMLLog.log(Level.FATAL,e,"Encountered fatal exception trying to send entity spawn data watchers");
@ -247,7 +247,7 @@ public abstract class FMLMessage {
scaledHeadYaw = dat.readByte() * 360F / 256F;
try
{
dataWatcherList = DataWatcher.readWatchedListFromPacketBuffer(new PacketBuffer(dat));
dataWatcherList = EntityDataManager.func_187215_b(new PacketBuffer(dat));
} catch (IOException e)
{
FMLLog.log(Level.FATAL, e, "There was a critical error decoding the datawatcher stream for a mod entity.");

View File

@ -27,7 +27,7 @@ import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.inventory.Container;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.Packet;
import net.minecraft.server.management.ServerConfigurationManager;
import net.minecraft.server.management.PlayerList;
import net.minecraft.world.World;
import net.minecraftforge.common.util.FakePlayer;
import net.minecraftforge.fml.common.FMLCommonHandler;
@ -59,7 +59,7 @@ public class FMLNetworkHandler
public static final int LOGIN_TIMEOUT = Integers.parseInt(System.getProperty("fml.loginTimeout","600"),600);
private static EnumMap<Side, FMLEmbeddedChannel> channelPair;
public static void fmlServerHandshake(ServerConfigurationManager scm, NetworkManager manager, EntityPlayerMP player)
public static void fmlServerHandshake(PlayerList scm, NetworkManager manager, EntityPlayerMP player)
{
NetworkDispatcher dispatcher = NetworkDispatcher.allocAndSet(manager, scm);
dispatcher.serverToClientHandshake(player);

View File

@ -254,9 +254,7 @@ public class GameData
@Override
public void onAdd(Potion potion, int id) {
// fix the data in the potion and the potions-array
potion.id = id;
Potion.potionTypes[id] = potion;
// no op for the minute?
}
}
}