Some fixups for FML, and use the FML registry for potions
This commit is contained in:
parent
2847644368
commit
b342bf8481
|
@ -1,6 +1,21 @@
|
||||||
--- ../src-base/minecraft/net/minecraft/potion/Potion.java
|
--- ../src-base/minecraft/net/minecraft/potion/Potion.java
|
||||||
+++ ../src-work/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;
|
return this.statusIconIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,7 +23,7 @@
|
||||||
public boolean isBadEffect()
|
public boolean isBadEffect()
|
||||||
{
|
{
|
||||||
return this.isBadEffect;
|
return this.isBadEffect;
|
||||||
@@ -266,7 +265,37 @@
|
@@ -266,7 +266,37 @@
|
||||||
return modifier.getAmount() * (double)(p_111183_1_ + 1);
|
return modifier.getAmount() * (double)(p_111183_1_ + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -126,7 +126,7 @@ public class EntitySpawnHandler extends SimpleChannelInboundHandler<FMLMessage.E
|
||||||
|
|
||||||
if (spawnMsg.dataWatcherList != null)
|
if (spawnMsg.dataWatcherList != null)
|
||||||
{
|
{
|
||||||
entity.getDataWatcher().updateWatchedObjectsFromList(spawnMsg.dataWatcherList);
|
entity.func_184212_Q().func_187218_a(spawnMsg.dataWatcherList);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (spawnMsg.throwerId > 0)
|
if (spawnMsg.throwerId > 0)
|
||||||
|
|
|
@ -6,11 +6,11 @@ import io.netty.buffer.Unpooled;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.minecraft.network.datasync.EntityDataManager;
|
||||||
import org.apache.logging.log4j.Level;
|
import org.apache.logging.log4j.Level;
|
||||||
|
|
||||||
import com.google.common.base.Throwables;
|
import com.google.common.base.Throwables;
|
||||||
|
|
||||||
import net.minecraft.entity.DataWatcher;
|
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.network.PacketBuffer;
|
import net.minecraft.network.PacketBuffer;
|
||||||
|
@ -157,7 +157,7 @@ public abstract class FMLMessage {
|
||||||
double speedScaledX;
|
double speedScaledX;
|
||||||
double speedScaledY;
|
double speedScaledY;
|
||||||
double speedScaledZ;
|
double speedScaledZ;
|
||||||
List<DataWatcher.WatchableObject> dataWatcherList;
|
List<EntityDataManager.DataEntry<?>> dataWatcherList;
|
||||||
ByteBuf dataStream;
|
ByteBuf dataStream;
|
||||||
|
|
||||||
public EntitySpawnMessage() {}
|
public EntitySpawnMessage() {}
|
||||||
|
@ -193,7 +193,7 @@ public abstract class FMLMessage {
|
||||||
PacketBuffer pb = new PacketBuffer(tmpBuf);
|
PacketBuffer pb = new PacketBuffer(tmpBuf);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
entity.getDataWatcher().writeTo(pb);
|
entity.func_184212_Q().func_187216_a(pb);
|
||||||
} catch (IOException e)
|
} catch (IOException e)
|
||||||
{
|
{
|
||||||
FMLLog.log(Level.FATAL,e,"Encountered fatal exception trying to send entity spawn data watchers");
|
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;
|
scaledHeadYaw = dat.readByte() * 360F / 256F;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
dataWatcherList = DataWatcher.readWatchedListFromPacketBuffer(new PacketBuffer(dat));
|
dataWatcherList = EntityDataManager.func_187215_b(new PacketBuffer(dat));
|
||||||
} catch (IOException e)
|
} catch (IOException e)
|
||||||
{
|
{
|
||||||
FMLLog.log(Level.FATAL, e, "There was a critical error decoding the datawatcher stream for a mod entity.");
|
FMLLog.log(Level.FATAL, e, "There was a critical error decoding the datawatcher stream for a mod entity.");
|
||||||
|
|
|
@ -27,7 +27,7 @@ import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
import net.minecraft.inventory.Container;
|
import net.minecraft.inventory.Container;
|
||||||
import net.minecraft.network.NetworkManager;
|
import net.minecraft.network.NetworkManager;
|
||||||
import net.minecraft.network.Packet;
|
import net.minecraft.network.Packet;
|
||||||
import net.minecraft.server.management.ServerConfigurationManager;
|
import net.minecraft.server.management.PlayerList;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.FakePlayer;
|
import net.minecraftforge.common.util.FakePlayer;
|
||||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
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);
|
public static final int LOGIN_TIMEOUT = Integers.parseInt(System.getProperty("fml.loginTimeout","600"),600);
|
||||||
private static EnumMap<Side, FMLEmbeddedChannel> channelPair;
|
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);
|
NetworkDispatcher dispatcher = NetworkDispatcher.allocAndSet(manager, scm);
|
||||||
dispatcher.serverToClientHandshake(player);
|
dispatcher.serverToClientHandshake(player);
|
||||||
|
|
|
@ -254,9 +254,7 @@ public class GameData
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAdd(Potion potion, int id) {
|
public void onAdd(Potion potion, int id) {
|
||||||
// fix the data in the potion and the potions-array
|
// no op for the minute?
|
||||||
potion.id = id;
|
|
||||||
Potion.potionTypes[id] = potion;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue