Fix overrides not being read from the server registry snapshot (#4224)

This commit is contained in:
Marvin Rösch 2017-07-27 01:47:55 +02:00 committed by LexManos
parent e59b979e1b
commit 434f95c66e
3 changed files with 17 additions and 3 deletions

View file

@ -130,6 +130,7 @@ enum FMLHandshakeClientState implements IHandshakeState<FMLHandshakeClientState>
ForgeRegistry.Snapshot entry = new ForgeRegistry.Snapshot();
entry.ids.putAll(pkt.getIdMap());
entry.dummied.addAll(pkt.getDummied());
entry.overrides.putAll(pkt.getOverrides());
snap.put(pkt.getName(), entry);
if (pkt.hasMore())

View file

@ -261,6 +261,11 @@ public abstract class FMLHandshakeMessage {
return dummied;
}
public Map<ResourceLocation, String> getOverrides()
{
return overrides;
}
public ResourceLocation getName()
{
return this.name;

View file

@ -21,8 +21,11 @@ package net.minecraftforge.debug;
import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.TextComponentString;
@ -46,6 +49,7 @@ public class RegistryOverrideTest
private static class BlockReplacement extends Block
{
AxisAlignedBB BB = FULL_BLOCK_AABB.contract(0.1, 0, 0.1);
private BlockReplacement()
{
super(Material.ROCK);
@ -62,9 +66,13 @@ public class RegistryOverrideTest
}
@Override
public void onBlockClicked(World worldIn, BlockPos pos, EntityPlayer playerIn)
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
{
playerIn.sendMessage(new TextComponentString("Debug Override Click!"));
if (hand == EnumHand.MAIN_HAND)
{
playerIn.sendMessage(new TextComponentString(worldIn.isRemote ? "Client" : "Server"));
}
return false;
}
}
}