Update to the latest mappings

This is a preliminary for updating to 1.13, as many of the name changes
apply to both. This will make it harder to remain consistent with
actual CC, though that will be less of a consideration when 1.13 hits.
This commit is contained in:
SquidDev 2018-07-24 09:27:05 +01:00
parent 3ac8dde779
commit b8957cab5c
37 changed files with 107 additions and 107 deletions

View File

@ -37,7 +37,7 @@
// stable_# stables are built at the discretion of the MCP team.
// Use non-default mappings at your own risk. they may not allways work.
// simply re-run your setup task after changing the mappings to update your workspace.
mappings = "snapshot_20180324"
mappings = "snapshot_20180724"
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
}

View File

@ -71,7 +71,7 @@ public void render( @Nonnull TileCable te, double x, double y, double z, float p
buffer.setTranslation( x - pos.getX(), y - pos.getY(), z - pos.getZ() );
buffer.noColor();
ForgeHooksClient.setRenderLayer( block.getBlockLayer() );
ForgeHooksClient.setRenderLayer( block.getRenderLayer() );
// See BlockRendererDispatcher#renderBlockDamage
TextureAtlasSprite breakingTexture = mc.getTextureMapBlocks().getAtlasSprite( "minecraft:blocks/destroy_stage_" + destroyStage );

View File

@ -42,7 +42,7 @@ public BlockCommandComputer()
super( Material.IRON );
setBlockUnbreakable();
setResistance( 6000000.0F );
setUnlocalizedName( "computercraft:command_computer" );
setTranslationKey( "computercraft:command_computer" );
setCreativeTab( ComputerCraft.mainCreativeTab );
setDefaultState( this.blockState.getBaseState()
.withProperty( Properties.FACING, EnumFacing.NORTH )
@ -62,7 +62,7 @@ protected BlockStateContainer createBlockState()
@Deprecated
public IBlockState getStateFromMeta( int meta )
{
EnumFacing dir = EnumFacing.getFront( meta & 0x7 );
EnumFacing dir = EnumFacing.byIndex( meta & 0x7 );
if( dir.getAxis() == EnumFacing.Axis.Y )
{
dir = EnumFacing.NORTH;

View File

@ -44,7 +44,7 @@ public BlockComputer()
{
super( Material.ROCK );
setHardness( 2.0f );
setUnlocalizedName( "computercraft:computer" );
setTranslationKey( "computercraft:computer" );
setCreativeTab( ComputerCraft.mainCreativeTab );
setDefaultState( this.blockState.getBaseState()
.withProperty( Properties.FACING, EnumFacing.NORTH )
@ -65,7 +65,7 @@ protected BlockStateContainer createBlockState()
@Deprecated
public IBlockState getStateFromMeta( int meta )
{
EnumFacing dir = EnumFacing.getFront( meta & 0x7 );
EnumFacing dir = EnumFacing.byIndex( meta & 0x7 );
if( dir.getAxis() == EnumFacing.Axis.Y )
{
dir = EnumFacing.NORTH;

View File

@ -24,7 +24,7 @@ public ItemCommandComputer( Block block )
super( block );
setMaxStackSize( 64 );
setHasSubtypes( true );
setUnlocalizedName( "computercraft:command_computer" );
setTranslationKey( "computercraft:command_computer" );
setCreativeTab( ComputerCraft.mainCreativeTab );
}

View File

@ -33,7 +33,7 @@ public ItemComputer( Block block )
super( block );
setMaxStackSize( 64 );
setHasSubtypes( true );
setUnlocalizedName( "computercraft:computer" );
setTranslationKey( "computercraft:computer" );
setCreativeTab( ComputerCraft.mainCreativeTab );
}
@ -114,7 +114,7 @@ private void setupComputerAfterPlacement( @Nonnull ItemStack stack, IComputerTil
@Nonnull
@Override
public String getUnlocalizedName( @Nonnull ItemStack stack )
public String getTranslationKey( @Nonnull ItemStack stack )
{
switch( getFamily( stack ) )
{

View File

@ -33,7 +33,7 @@ public ItemDiskLegacy()
{
setMaxStackSize( 1 );
setHasSubtypes( true );
setUnlocalizedName( "computercraft:disk" );
setTranslationKey( "computercraft:disk" );
setCreativeTab( ComputerCraft.mainCreativeTab );
}

View File

@ -39,7 +39,7 @@ public ItemPrintout()
{
setMaxStackSize( 1 );
setHasSubtypes( true );
setUnlocalizedName( "computercraft:page" );
setTranslationKey( "computercraft:page" );
setCreativeTab( ComputerCraft.mainCreativeTab );
}
@ -64,7 +64,7 @@ public void addInformation( @Nonnull ItemStack itemstack, World world, List<Stri
@Nonnull
@Override
public String getUnlocalizedName( @Nonnull ItemStack stack )
public String getTranslationKey( @Nonnull ItemStack stack )
{
Type type = getType( stack );
switch( type )

View File

@ -34,7 +34,7 @@ public ItemTreasureDisk()
{
setMaxStackSize( 1 );
setHasSubtypes( true );
setUnlocalizedName( "computercraft:treasure_disk" );
setTranslationKey( "computercraft:treasure_disk" );
}
@Override

View File

@ -55,7 +55,7 @@ public static class Properties
public BlockCable()
{
setHardness( 1.5f );
setUnlocalizedName( "computercraft:cable" );
setTranslationKey( "computercraft:cable" );
setCreativeTab( ComputerCraft.mainCreativeTab );
setDefaultState( this.blockState.getBaseState()
.withProperty( Properties.MODEM, BlockCableModemVariant.None )
@ -94,12 +94,12 @@ public IBlockState getStateFromMeta( int meta )
if( meta < 6 )
{
state = state.withProperty( Properties.CABLE, BlockCableCableVariant.NONE );
state = state.withProperty( Properties.MODEM, BlockCableModemVariant.fromFacing( EnumFacing.getFront( meta ) ) );
state = state.withProperty( Properties.MODEM, BlockCableModemVariant.fromFacing( EnumFacing.byIndex( meta ) ) );
}
else if( meta < 12 )
{
state = state.withProperty( Properties.CABLE, BlockCableCableVariant.ANY );
state = state.withProperty( Properties.MODEM, BlockCableModemVariant.fromFacing( EnumFacing.getFront( meta - 6 ) ) );
state = state.withProperty( Properties.MODEM, BlockCableModemVariant.fromFacing( EnumFacing.byIndex( meta - 6 ) ) );
}
else if( meta == 13 )
{
@ -296,7 +296,7 @@ public RayTraceResult collisionRayTrace( IBlockState blockState, @Nonnull World
}
}
return result == null ? null : new RayTraceResult( result.hitVec.addVector( pos.getX(), pos.getY(), pos.getZ() ), result.sideHit, pos );
return result == null ? null : new RayTraceResult( result.hitVec.add( pos.getX(), pos.getY(), pos.getZ() ), result.sideHit, pos );
}
else
{

View File

@ -44,7 +44,7 @@ public static class Properties
public BlockPeripheral()
{
setHardness( 2.0f );
setUnlocalizedName( "computercraft:peripheral" );
setTranslationKey( "computercraft:peripheral" );
setCreativeTab( ComputerCraft.mainCreativeTab );
setDefaultState( this.blockState.getBaseState()
.withProperty( Properties.FACING, EnumFacing.NORTH )
@ -55,7 +55,7 @@ public BlockPeripheral()
@Override
@Nonnull
@SideOnly( Side.CLIENT)
public BlockRenderLayer getBlockLayer()
public BlockRenderLayer getRenderLayer()
{
return BlockRenderLayer.CUTOUT;
}
@ -76,7 +76,7 @@ public IBlockState getStateFromMeta( int meta )
if( meta >= 2 && meta <= 5 )
{
state = state.withProperty( Properties.VARIANT, BlockPeripheralVariant.DiskDriveEmpty );
state = state.withProperty( Properties.FACING, EnumFacing.getFront( meta ) );
state = state.withProperty( Properties.FACING, EnumFacing.byIndex( meta ) );
}
else if( meta <= 9 )
{
@ -93,7 +93,7 @@ else if( meta == 1 )
else
{
state = state.withProperty( Properties.VARIANT, BlockPeripheralVariant.WirelessModemOff );
state = state.withProperty( Properties.FACING, EnumFacing.getFront( meta - 4 ) );
state = state.withProperty( Properties.FACING, EnumFacing.byIndex( meta - 4 ) );
}
}
else if( meta == 10 )
@ -651,7 +651,7 @@ public BlockFaceShape getBlockFaceShape( IBlockAccess world, IBlockState state,
public boolean causesSuffocation(IBlockState state)
{
// This normally uses the default state
return blockMaterial.blocksMovement() && state.isOpaqueCube();
return material.blocksMovement() && state.isOpaqueCube();
}
@Override

View File

@ -34,7 +34,7 @@ public static class Properties
public BlockWiredModemFull()
{
setHardness( 1.5f );
setUnlocalizedName( "computercraft:wired_modem_full" );
setTranslationKey( "computercraft:wired_modem_full" );
setCreativeTab( ComputerCraft.mainCreativeTab );
setDefaultState( blockState.getBaseState()
.withProperty( Properties.MODEM_ON, false )

View File

@ -21,7 +21,7 @@ public class ItemAdvancedModem extends ItemPeripheralBase
public ItemAdvancedModem( Block block )
{
super( block );
setUnlocalizedName( "computercraft:advanced_modem" );
setTranslationKey( "computercraft:advanced_modem" );
setCreativeTab( ComputerCraft.mainCreativeTab );
}

View File

@ -28,7 +28,7 @@ public class ItemCable extends ItemPeripheralBase
public ItemCable( Block block )
{
super( block );
setUnlocalizedName( "computercraft:cable" );
setTranslationKey( "computercraft:cable" );
setCreativeTab( ComputerCraft.mainCreativeTab );
}

View File

@ -20,7 +20,7 @@ public class ItemPeripheral extends ItemPeripheralBase
public ItemPeripheral( Block block )
{
super( block );
setUnlocalizedName( "computercraft:peripheral" );
setTranslationKey( "computercraft:peripheral" );
setCreativeTab( ComputerCraft.mainCreativeTab );
}

View File

@ -59,7 +59,7 @@ public boolean canPlaceBlockOnSide( World world, @Nonnull BlockPos pos, @Nonnull
@Nonnull
@Override
public String getUnlocalizedName( @Nonnull ItemStack stack )
public String getTranslationKey( @Nonnull ItemStack stack )
{
PeripheralType type = getPeripheralType( stack );
switch( type )

View File

@ -143,7 +143,7 @@ public void readFromNBT( NBTTagCompound nbttagcompound )
super.readFromNBT(nbttagcompound);
if( nbttagcompound.hasKey( "dir" ) )
{
m_dir = EnumFacing.getFront( nbttagcompound.getInteger( "dir" ) );
m_dir = EnumFacing.byIndex( nbttagcompound.getInteger( "dir" ) );
}
if( nbttagcompound.hasKey( "anim" ) )
{
@ -174,7 +174,7 @@ public NBTTagCompound writeToNBT( NBTTagCompound nbttagcompound )
public void readDescription( @Nonnull NBTTagCompound nbttagcompound )
{
super.readDescription( nbttagcompound );
m_dir = EnumFacing.getFront( nbttagcompound.getInteger( "dir" ) );
m_dir = EnumFacing.byIndex( nbttagcompound.getInteger( "dir" ) );
m_anim = nbttagcompound.getInteger( "anim" );
if( nbttagcompound.hasKey( "label" ) )
{

View File

@ -605,8 +605,8 @@ private synchronized void ejectContents( boolean destroyed )
if( !destroyed )
{
EnumFacing dir = getDirection();
xOff = dir.getFrontOffsetX();
zOff = dir.getFrontOffsetZ();
xOff = dir.getXOffset();
zOff = dir.getZOffset();
}
BlockPos pos = getPos();

View File

@ -33,7 +33,7 @@ public static class Properties
public BlockAdvancedModem()
{
setHardness( 2.0f );
setUnlocalizedName( "computercraft:advanced_modem" );
setTranslationKey( "computercraft:advanced_modem" );
setCreativeTab( ComputerCraft.mainCreativeTab );
setDefaultState( this.blockState.getBaseState()
.withProperty( Properties.FACING, EnumFacing.NORTH )
@ -54,7 +54,7 @@ protected BlockStateContainer createBlockState()
public IBlockState getStateFromMeta( int meta )
{
IBlockState state = getDefaultState();
state = state.withProperty( Properties.FACING, EnumFacing.getFront( meta ) );
state = state.withProperty( Properties.FACING, EnumFacing.byIndex( meta ) );
state = state.withProperty( Properties.ON, false );
return state;
}

View File

@ -344,7 +344,7 @@ public void setDir( int dir )
public EnumFacing getFront()
{
return m_dir <= 5 ? EnumFacing.getFront( m_dir ) : (m_dir <= 11 ? EnumFacing.DOWN : EnumFacing.UP);
return m_dir <= 5 ? EnumFacing.byIndex( m_dir ) : (m_dir <= 11 ? EnumFacing.DOWN : EnumFacing.UP);
}
public EnumFacing getRight()

View File

@ -43,7 +43,7 @@ public ItemPocketComputer()
{
setMaxStackSize( 1 );
setHasSubtypes( true );
setUnlocalizedName( "computercraft:pocket_computer" );
setTranslationKey( "computercraft:pocket_computer" );
setCreativeTab( ComputerCraft.mainCreativeTab );
}
@ -189,7 +189,7 @@ public ActionResult<ItemStack> onItemRightClick( World world, EntityPlayer playe
@Nonnull
@Override
public String getUnlocalizedName( @Nonnull ItemStack stack )
public String getTranslationKey( @Nonnull ItemStack stack )
{
switch( getFamily( stack ) )
{
@ -209,7 +209,7 @@ public String getUnlocalizedName( @Nonnull ItemStack stack )
@Override
public String getItemStackDisplayName( @Nonnull ItemStack stack )
{
String baseString = getUnlocalizedName( stack );
String baseString = getTranslationKey( stack );
IPocketUpgrade upgrade = getUpgrade( stack );
if( upgrade != null )
{

View File

@ -413,10 +413,10 @@ public void remapItems( RegistryEvent.MissingMappings<Item> mappings )
// We have to use mappings.getAllMappings() as the mod ID is upper case but the domain lower.
for( RegistryEvent.MissingMappings.Mapping<Item> mapping : mappings.getAllMappings() )
{
String domain = mapping.key.getResourceDomain();
String domain = mapping.key.getNamespace();
if( !domain.equalsIgnoreCase( ComputerCraft.MOD_ID ) ) continue;
String key = mapping.key.getResourcePath();
String key = mapping.key.getPath();
if( key.equalsIgnoreCase( "CC-Turtle" ) )
{
mapping.remap( Item.getItemFromBlock( ComputerCraft.Blocks.turtle ) );
@ -438,10 +438,10 @@ public void remapBlocks( RegistryEvent.MissingMappings<Block> mappings )
// We have to use mappings.getAllMappings() as the mod ID is upper case but the domain lower.
for( RegistryEvent.MissingMappings.Mapping<Block> mapping : mappings.getAllMappings() )
{
String domain = mapping.key.getResourceDomain();
String domain = mapping.key.getNamespace();
if( !domain.equalsIgnoreCase( ComputerCraft.MOD_ID ) ) continue;
String key = mapping.key.getResourcePath();
String key = mapping.key.getPath();
if( key.equalsIgnoreCase( "CC-Turtle" ) )
{
mapping.remap( ComputerCraft.Blocks.turtle );

View File

@ -414,10 +414,10 @@ public void remapItems( RegistryEvent.MissingMappings<Item> mappings )
// We have to use mappings.getAllMappings() as the mod ID is upper case but the domain lower.
for( RegistryEvent.MissingMappings.Mapping<Item> mapping : mappings.getAllMappings() )
{
String domain = mapping.key.getResourceDomain();
String domain = mapping.key.getNamespace();
if( !domain.equalsIgnoreCase( ComputerCraft.MOD_ID ) ) continue;
String key = mapping.key.getResourcePath();
String key = mapping.key.getPath();
if( key.equalsIgnoreCase( "CC-Computer" ) )
{
mapping.remap( Item.getItemFromBlock( ComputerCraft.Blocks.computer ) );
@ -451,10 +451,10 @@ public void remapBlocks( RegistryEvent.MissingMappings<Block> mappings )
// We have to use mappings.getAllMappings() as the mod ID is upper case but the domain lower.
for( RegistryEvent.MissingMappings.Mapping<Block> mapping : mappings.getAllMappings() )
{
String domain = mapping.key.getResourceDomain();
String domain = mapping.key.getNamespace();
if( !domain.equalsIgnoreCase( ComputerCraft.MOD_ID ) ) continue;
String key = mapping.key.getResourcePath();
String key = mapping.key.getPath();
if( key.equalsIgnoreCase( "CC-Computer" ) )
{
mapping.remap( ComputerCraft.Blocks.computer );

View File

@ -48,7 +48,7 @@ public BlockTurtle()
{
super( Material.IRON );
setHardness( 2.5f );
setUnlocalizedName( "computercraft:turtle" );
setTranslationKey( "computercraft:turtle" );
setCreativeTab( ComputerCraft.mainCreativeTab );
setDefaultState( this.blockState.getBaseState()
.withProperty( Properties.FACING, EnumFacing.NORTH )

View File

@ -226,7 +226,7 @@ public void update()
public void readFromNBT( NBTTagCompound nbttagcompound )
{
// Read state
m_direction = EnumFacing.getFront( nbttagcompound.getInteger( "dir" ) );
m_direction = EnumFacing.byIndex( nbttagcompound.getInteger( "dir" ) );
m_selectedSlot = nbttagcompound.getInteger( "selectedSlot" );
if( nbttagcompound.hasKey( "fuelLevel" ) )
{
@ -370,8 +370,8 @@ public NBTTagCompound writeToNBT( NBTTagCompound nbttagcompound )
// Write overlay
if( m_overlay != null )
{
nbttagcompound.setString( "overlay_mod", m_overlay.getResourceDomain() );
nbttagcompound.setString( "overlay_path", m_overlay.getResourcePath() );
nbttagcompound.setString( "overlay_mod", m_overlay.getNamespace() );
nbttagcompound.setString( "overlay_path", m_overlay.getPath() );
}
// Write NBT
@ -429,8 +429,8 @@ public void writeDescription( NBTTagCompound nbttagcompound )
// Overlay
if( m_overlay != null )
{
nbttagcompound.setString( "overlay_mod", m_overlay.getResourceDomain() );
nbttagcompound.setString( "overlay_path", m_overlay.getResourcePath() );
nbttagcompound.setString( "overlay_mod", m_overlay.getNamespace() );
nbttagcompound.setString( "overlay_path", m_overlay.getPath() );
}
// Animation
@ -505,7 +505,7 @@ public void readDescription( NBTTagCompound nbttagcompound )
m_lastAnimationProgress = 0;
}
m_direction = EnumFacing.getFront( nbttagcompound.getInteger( "direction" ) );
m_direction = EnumFacing.byIndex( nbttagcompound.getInteger( "direction" ) );
m_fuelLevel = nbttagcompound.getInteger( "fuelLevel" );
}
@ -998,9 +998,9 @@ public Vec3d getRenderOffset( float f )
double distance = -1.0 + getAnimationFraction( f );
return new Vec3d(
distance * dir.getFrontOffsetX(),
distance * dir.getFrontOffsetY(),
distance * dir.getFrontOffsetZ()
distance * dir.getXOffset(),
distance * dir.getYOffset(),
distance * dir.getZOffset()
);
}
default:
@ -1184,31 +1184,31 @@ private void updateAnimation()
float pushFrac = 1.0f - ((float)(m_animationProgress + 1) / (float)ANIM_DURATION);
float push = Math.max( pushFrac + 0.0125f, 0.0f );
if (moveDir.getFrontOffsetX() < 0)
if (moveDir.getXOffset() < 0)
{
minX += moveDir.getFrontOffsetX() * push;
minX += moveDir.getXOffset() * push;
}
else
{
maxX -= moveDir.getFrontOffsetX() * push;
maxX -= moveDir.getXOffset() * push;
}
if (moveDir.getFrontOffsetY() < 0)
if (moveDir.getYOffset() < 0)
{
minY += moveDir.getFrontOffsetY() * push;
minY += moveDir.getYOffset() * push;
}
else
{
maxY -= moveDir.getFrontOffsetY() * push;
maxY -= moveDir.getYOffset() * push;
}
if (moveDir.getFrontOffsetZ() < 0)
if (moveDir.getZOffset() < 0)
{
minZ += moveDir.getFrontOffsetZ() * push;
minZ += moveDir.getZOffset() * push;
}
else
{
maxZ -= moveDir.getFrontOffsetZ() * push;
maxZ -= moveDir.getZOffset() * push;
}
AxisAlignedBB aabb = new AxisAlignedBB( minX, minY, minZ, maxX, maxY, maxZ );
@ -1216,9 +1216,9 @@ private void updateAnimation()
if( !list.isEmpty() )
{
double pushStep = 1.0f / ANIM_DURATION;
double pushStepX = moveDir.getFrontOffsetX() * pushStep;
double pushStepY = moveDir.getFrontOffsetY() * pushStep;
double pushStepZ = moveDir.getFrontOffsetZ() * pushStep;
double pushStepX = moveDir.getXOffset() * pushStep;
double pushStepY = moveDir.getYOffset() * pushStep;
double pushStepZ = moveDir.getZOffset() * pushStep;
for (Entity entity : list)
{
entity.move( MoverType.PISTON, pushStepX, pushStepY, pushStepZ );

View File

@ -126,7 +126,7 @@ else if( selectedStack.getItemDamage() == lookAtStack.getItemDamage() )
{
return TurtleCommandResult.success();
}
else if( selectedStack.getUnlocalizedName().equals( lookAtStack.getUnlocalizedName() ) )
else if( selectedStack.getTranslationKey().equals( lookAtStack.getTranslationKey() ) )
{
return TurtleCommandResult.success();
}

View File

@ -87,9 +87,9 @@ public TurtleCommandResult execute( @Nonnull ITurtleAccess turtle )
if( entityBB != null )
{
AxisAlignedBB pushedBB = entityBB.offset(
direction.getFrontOffsetX(),
direction.getFrontOffsetY(),
direction.getFrontOffsetZ()
direction.getXOffset(),
direction.getYOffset(),
direction.getZOffset()
);
if( !oldWorld.getCollisionBoxes( null, pushedBB ).isEmpty() )
{

View File

@ -194,9 +194,9 @@ private static void orientPlayer( ITurtleAccess turtle, TurtlePlayer turtlePlaye
// Stop intersection with the turtle itself
if( turtle.getPosition().equals( position ) )
{
turtlePlayer.posX += 0.48 * direction.getFrontOffsetX();
turtlePlayer.posY += 0.48 * direction.getFrontOffsetY();
turtlePlayer.posZ += 0.48 * direction.getFrontOffsetZ();
turtlePlayer.posX += 0.48 * direction.getXOffset();
turtlePlayer.posY += 0.48 * direction.getYOffset();
turtlePlayer.posZ += 0.48 * direction.getZOffset();
}
if( direction.getAxis() != EnumFacing.Axis.Y )
@ -367,9 +367,9 @@ private static ItemStack deployOnBlock( @Nonnull ItemStack stack, ITurtleAccess
orientPlayer( turtle, turtlePlayer, playerPosition, playerDir );
// Calculate where the turtle would hit the block
float hitX = 0.5f + side.getFrontOffsetX() * 0.5f;
float hitY = 0.5f + side.getFrontOffsetY() * 0.5f;
float hitZ = 0.5f + side.getFrontOffsetZ() * 0.5f;
float hitX = 0.5f + side.getXOffset() * 0.5f;
float hitY = 0.5f + side.getYOffset() * 0.5f;
float hitZ = 0.5f + side.getZOffset() * 0.5f;
if( Math.abs( hitY - 0.5f ) < 0.01f )
{
hitY = 0.45f;

View File

@ -15,7 +15,7 @@ public class ItemTurtleAdvanced extends ItemTurtleNormal
public ItemTurtleAdvanced( Block block )
{
super( block );
setUnlocalizedName( "computercraft:advanced_turtle" );
setTranslationKey( "computercraft:advanced_turtle" );
setCreativeTab( ComputerCraft.mainCreativeTab );
}

View File

@ -114,7 +114,7 @@ public void setupTurtleAfterPlacement( @Nonnull ItemStack stack, ITurtleTile tur
@Nonnull
@Override
public String getUnlocalizedName( @Nonnull ItemStack stack )
public String getTranslationKey( @Nonnull ItemStack stack )
{
ComputerFamily family = getFamily( stack );
switch( family )
@ -139,7 +139,7 @@ public String getUnlocalizedName( @Nonnull ItemStack stack )
@Override
public String getItemStackDisplayName( @Nonnull ItemStack stack )
{
String baseString = getUnlocalizedName( stack );
String baseString = getTranslationKey( stack );
ITurtleUpgrade left = getUpgrade( stack, TurtleSide.Left );
ITurtleUpgrade right = getUpgrade( stack, TurtleSide.Right );
if( left != null && right != null )

View File

@ -23,7 +23,7 @@ public class ItemTurtleLegacy extends ItemTurtleBase
public ItemTurtleLegacy( Block block )
{
super( block );
setUnlocalizedName( "computercraft:turtle" );
setTranslationKey( "computercraft:turtle" );
setCreativeTab( ComputerCraft.mainCreativeTab );
}

View File

@ -24,7 +24,7 @@ public class ItemTurtleNormal extends ItemTurtleBase
public ItemTurtleNormal( Block block )
{
super( block );
setUnlocalizedName( "computercraft:turtle" );
setTranslationKey( "computercraft:turtle" );
setCreativeTab( ComputerCraft.mainCreativeTab );
}
@ -72,8 +72,8 @@ public ItemStack create( int id, String label, int colour, ITurtleUpgrade leftUp
}
if( overlay != null )
{
nbt.setString( "overlay_mod", overlay.getResourceDomain() );
nbt.setString( "overlay_path", overlay.getResourcePath() );
nbt.setString( "overlay_mod", overlay.getNamespace() );
nbt.setString( "overlay_path", overlay.getPath() );
}
stack.setTagCompound( nbt );

View File

@ -103,7 +103,7 @@ public IPeripheral createPeripheral( @Nonnull ITurtleAccess turtle, @Nonnull Tur
@Nonnull
@Override
@SideOnly(Side.CLIENT)
@SideOnly( Side.CLIENT )
public Pair<IBakedModel, Matrix4f> getModel( ITurtleAccess turtle, @Nonnull TurtleSide side )
{
float xOffset = (side == TurtleSide.Left) ? -0.40625f : 0.40625f;
@ -154,7 +154,7 @@ protected float getDamageMultiplier()
{
return 3.0f;
}
private TurtleCommandResult attack( final ITurtleAccess turtle, EnumFacing direction, TurtleSide side )
{
// Create a fake player, and orient it appropriately
@ -185,9 +185,9 @@ private TurtleCommandResult attack( final ITurtleAccess turtle, EnumFacing direc
{
return TurtleCommandResult.failure( attackEvent.getFailureMessage() );
}
// Start claiming entity drops
List<ItemStack> extra = new ArrayList<>( );
List<ItemStack> extra = new ArrayList<>();
ComputerCraft.setDropConsumer( hitEntity, turtleDropConsumer( turtle, extra ) );
// Attack the entity
@ -232,7 +232,7 @@ private TurtleCommandResult attack( final ITurtleAccess turtle, EnumFacing direc
return TurtleCommandResult.failure( "Nothing to attack here" );
}
private TurtleCommandResult dig( ITurtleAccess turtle, EnumFacing direction, TurtleSide side )
{
// Get ready to dig
@ -277,7 +277,7 @@ private TurtleCommandResult dig( ITurtleAccess turtle, EnumFacing direction, Tur
}
// Consume the items the block drops
List<ItemStack> extra = new ArrayList<>( );
List<ItemStack> extra = new ArrayList<>();
ComputerCraft.setDropConsumer( world, blockPosition, turtleDropConsumer( turtle, extra ) );
TileEntity tile = world.getTileEntity( blockPosition );
@ -291,7 +291,7 @@ private TurtleCommandResult dig( ITurtleAccess turtle, EnumFacing direction, Tur
// Destroy the block
boolean canHarvest = state.getBlock().canHarvestBlock( world, blockPosition, turtlePlayer );
boolean canBreak = state.getBlock().removedByPlayer( state, world, blockPosition, turtlePlayer, canHarvest );
if( canBreak ) state.getBlock().onBlockDestroyedByPlayer( world, blockPosition, state );
if( canBreak ) state.getBlock().onPlayerDestroy( world, blockPosition, state );
if( canHarvest )
{
state.getBlock().harvestBlock( world, turtlePlayer, blockPosition, state, tile, turtlePlayer.getHeldItemMainhand() );

View File

@ -24,7 +24,7 @@ public CreativeTabMain( int i )
@Nonnull
@Override
@SideOnly(Side.CLIENT)
public ItemStack getTabIconItem()
public ItemStack createIcon()
{
return new ItemStack( ComputerCraft.Blocks.computer );
}
@ -32,7 +32,7 @@ public ItemStack getTabIconItem()
@Nonnull
@Override
@SideOnly(Side.CLIENT)
public String getTranslatedTabLabel()
public String getTranslationKey()
{
return getTabLabel();
}

View File

@ -21,14 +21,14 @@ public CreativeTabTreasure( int i )
@Nonnull
@Override
public ItemStack getTabIconItem()
public ItemStack createIcon()
{
return new ItemStack( ComputerCraft.Items.treasureDisk );
}
@Nonnull
@Override
public String getTranslatedTabLabel()
public String getTranslationKey()
{
return getTabLabel();
}

View File

@ -73,13 +73,13 @@ else if( tileEntity instanceof IInventory )
// Look for entity with inventory
Vec3d vecStart = new Vec3d(
pos.getX() + 0.5 + 0.6 * side.getFrontOffsetX(),
pos.getY() + 0.5 + 0.6 * side.getFrontOffsetY(),
pos.getZ() + 0.5 + 0.6 * side.getFrontOffsetZ()
pos.getX() + 0.5 + 0.6 * side.getXOffset(),
pos.getY() + 0.5 + 0.6 * side.getYOffset(),
pos.getZ() + 0.5 + 0.6 * side.getZOffset()
);
EnumFacing dir = side.getOpposite();
Vec3d vecDir = new Vec3d(
dir.getFrontOffsetX(), dir.getFrontOffsetY(), dir.getFrontOffsetZ()
dir.getXOffset(), dir.getYOffset(), dir.getZOffset()
);
Pair<Entity, Vec3d> hit = WorldUtil.rayTraceEntities( world, vecStart, vecDir, 1.1 );
if( hit != null )

View File

@ -43,14 +43,14 @@ public static BlockPos moveCoords( BlockPos pos, EnumFacing dir )
public static Pair<Entity, Vec3d> rayTraceEntities( World world, Vec3d vecStart, Vec3d vecDir, double distance )
{
Vec3d vecEnd = vecStart.addVector( vecDir.x * distance, vecDir.y * distance, vecDir.z * distance );
Vec3d vecEnd = vecStart.add( vecDir.x * distance, vecDir.y * distance, vecDir.z * distance );
// Raycast for blocks
RayTraceResult result = world.rayTraceBlocks( vecStart.addVector(0.0,0.0,0.0), vecEnd.addVector(0.0,0.0,0.0) );
RayTraceResult result = world.rayTraceBlocks( vecStart, vecEnd );
if( result != null && result.typeOfHit == RayTraceResult.Type.BLOCK )
{
distance = vecStart.distanceTo( result.hitVec );
vecEnd = vecStart.addVector( vecDir.x * distance, vecDir.y * distance, vecDir.z * distance );
vecEnd = vecStart.add( vecDir.x * distance, vecDir.y * distance, vecDir.z * distance );
}
// Check for entities
@ -114,7 +114,7 @@ else if( littleBox.intersects( bigBox ) )
}
if( closest != null && closestDist <= distance )
{
Vec3d closestPos = vecStart.addVector( vecDir.x * closestDist, vecDir.y * closestDist, vecDir.z * closestDist );
Vec3d closestPos = vecStart.add( vecDir.x * closestDist, vecDir.y * closestDist, vecDir.z * closestDist );
return Pair.of( closest, closestPos );
}
return null;
@ -128,7 +128,7 @@ public static Vec3d getRayStart( EntityLivingBase entity )
public static Vec3d getRayEnd( EntityPlayer player) {
double reach = player.getEntityAttribute(EntityPlayer.REACH_DISTANCE).getAttributeValue();
Vec3d look = player.getLookVec();
return getRayStart( player ).addVector( look.x * reach, look.y * reach, look.z * reach );
return getRayStart( player ).add( look.x * reach, look.y * reach, look.z * reach );
}
public static boolean isVecInsideInclusive(AxisAlignedBB bb , Vec3d vec) {
@ -147,9 +147,9 @@ public static void dropItemStack( @Nonnull ItemStack stack, World world, BlockPo
double zDir;
if( direction != null )
{
xDir = direction.getFrontOffsetX();
yDir = direction.getFrontOffsetY();
zDir = direction.getFrontOffsetZ();
xDir = direction.getXOffset();
yDir = direction.getYOffset();
zDir = direction.getZOffset();
}
else
{