From b8957cab5c3c3829f4931dd21faf39323e45fa87 Mon Sep 17 00:00:00 2001 From: SquidDev Date: Tue, 24 Jul 2018 09:27:05 +0100 Subject: [PATCH] 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. --- build.gradle | 2 +- .../render/TileEntityCableRenderer.java | 2 +- .../computer/blocks/BlockCommandComputer.java | 4 +- .../shared/computer/blocks/BlockComputer.java | 4 +- .../computer/items/ItemCommandComputer.java | 2 +- .../shared/computer/items/ItemComputer.java | 4 +- .../shared/media/items/ItemDiskLegacy.java | 2 +- .../shared/media/items/ItemPrintout.java | 4 +- .../shared/media/items/ItemTreasureDisk.java | 2 +- .../shared/peripheral/common/BlockCable.java | 8 ++-- .../peripheral/common/BlockPeripheral.java | 10 ++--- .../common/BlockWiredModemFull.java | 2 +- .../peripheral/common/ItemAdvancedModem.java | 2 +- .../shared/peripheral/common/ItemCable.java | 2 +- .../peripheral/common/ItemPeripheral.java | 2 +- .../peripheral/common/ItemPeripheralBase.java | 2 +- .../peripheral/common/TilePeripheralBase.java | 4 +- .../peripheral/diskdrive/TileDiskDrive.java | 4 +- .../peripheral/modem/BlockAdvancedModem.java | 4 +- .../peripheral/monitor/TileMonitor.java | 2 +- .../pocket/items/ItemPocketComputer.java | 6 +-- .../shared/proxy/CCTurtleProxyCommon.java | 8 ++-- .../proxy/ComputerCraftProxyCommon.java | 8 ++-- .../shared/turtle/blocks/BlockTurtle.java | 2 +- .../shared/turtle/core/TurtleBrain.java | 42 +++++++++---------- .../turtle/core/TurtleCompareCommand.java | 2 +- .../shared/turtle/core/TurtleMoveCommand.java | 6 +-- .../turtle/core/TurtlePlaceCommand.java | 12 +++--- .../turtle/items/ItemTurtleAdvanced.java | 2 +- .../shared/turtle/items/ItemTurtleBase.java | 4 +- .../shared/turtle/items/ItemTurtleLegacy.java | 2 +- .../shared/turtle/items/ItemTurtleNormal.java | 6 +-- .../shared/turtle/upgrades/TurtleTool.java | 14 +++---- .../shared/util/CreativeTabMain.java | 4 +- .../shared/util/CreativeTabTreasure.java | 4 +- .../shared/util/InventoryUtil.java | 8 ++-- .../computercraft/shared/util/WorldUtil.java | 16 +++---- 37 files changed, 107 insertions(+), 107 deletions(-) diff --git a/build.gradle b/build.gradle index 91ca9bf08..c505234eb 100644 --- a/build.gradle +++ b/build.gradle @@ -37,7 +37,7 @@ minecraft { // 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. } diff --git a/src/main/java/dan200/computercraft/client/render/TileEntityCableRenderer.java b/src/main/java/dan200/computercraft/client/render/TileEntityCableRenderer.java index fb125e929..2de99acaa 100644 --- a/src/main/java/dan200/computercraft/client/render/TileEntityCableRenderer.java +++ b/src/main/java/dan200/computercraft/client/render/TileEntityCableRenderer.java @@ -71,7 +71,7 @@ public class TileEntityCableRenderer extends TileEntitySpecialRenderer= 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 @@ public class BlockPeripheral extends BlockPeripheralBase 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 class BlockPeripheral extends BlockPeripheralBase public boolean causesSuffocation(IBlockState state) { // This normally uses the default state - return blockMaterial.blocksMovement() && state.isOpaqueCube(); + return material.blocksMovement() && state.isOpaqueCube(); } @Override diff --git a/src/main/java/dan200/computercraft/shared/peripheral/common/BlockWiredModemFull.java b/src/main/java/dan200/computercraft/shared/peripheral/common/BlockWiredModemFull.java index 6936b12ca..ae3631083 100644 --- a/src/main/java/dan200/computercraft/shared/peripheral/common/BlockWiredModemFull.java +++ b/src/main/java/dan200/computercraft/shared/peripheral/common/BlockWiredModemFull.java @@ -34,7 +34,7 @@ public class BlockWiredModemFull extends BlockPeripheralBase 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 ) diff --git a/src/main/java/dan200/computercraft/shared/peripheral/common/ItemAdvancedModem.java b/src/main/java/dan200/computercraft/shared/peripheral/common/ItemAdvancedModem.java index 377f6a720..2e99252fb 100644 --- a/src/main/java/dan200/computercraft/shared/peripheral/common/ItemAdvancedModem.java +++ b/src/main/java/dan200/computercraft/shared/peripheral/common/ItemAdvancedModem.java @@ -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 ); } diff --git a/src/main/java/dan200/computercraft/shared/peripheral/common/ItemCable.java b/src/main/java/dan200/computercraft/shared/peripheral/common/ItemCable.java index f056532b7..147c012b3 100644 --- a/src/main/java/dan200/computercraft/shared/peripheral/common/ItemCable.java +++ b/src/main/java/dan200/computercraft/shared/peripheral/common/ItemCable.java @@ -28,7 +28,7 @@ public class ItemCable extends ItemPeripheralBase public ItemCable( Block block ) { super( block ); - setUnlocalizedName( "computercraft:cable" ); + setTranslationKey( "computercraft:cable" ); setCreativeTab( ComputerCraft.mainCreativeTab ); } diff --git a/src/main/java/dan200/computercraft/shared/peripheral/common/ItemPeripheral.java b/src/main/java/dan200/computercraft/shared/peripheral/common/ItemPeripheral.java index ab6f04a3b..61f6aba6a 100644 --- a/src/main/java/dan200/computercraft/shared/peripheral/common/ItemPeripheral.java +++ b/src/main/java/dan200/computercraft/shared/peripheral/common/ItemPeripheral.java @@ -20,7 +20,7 @@ public class ItemPeripheral extends ItemPeripheralBase public ItemPeripheral( Block block ) { super( block ); - setUnlocalizedName( "computercraft:peripheral" ); + setTranslationKey( "computercraft:peripheral" ); setCreativeTab( ComputerCraft.mainCreativeTab ); } diff --git a/src/main/java/dan200/computercraft/shared/peripheral/common/ItemPeripheralBase.java b/src/main/java/dan200/computercraft/shared/peripheral/common/ItemPeripheralBase.java index a08bbd5b0..09fc7ac49 100644 --- a/src/main/java/dan200/computercraft/shared/peripheral/common/ItemPeripheralBase.java +++ b/src/main/java/dan200/computercraft/shared/peripheral/common/ItemPeripheralBase.java @@ -59,7 +59,7 @@ public abstract class ItemPeripheralBase extends ItemBlock implements IPeriphera @Nonnull @Override - public String getUnlocalizedName( @Nonnull ItemStack stack ) + public String getTranslationKey( @Nonnull ItemStack stack ) { PeripheralType type = getPeripheralType( stack ); switch( type ) diff --git a/src/main/java/dan200/computercraft/shared/peripheral/common/TilePeripheralBase.java b/src/main/java/dan200/computercraft/shared/peripheral/common/TilePeripheralBase.java index 5ae306a37..f953e4892 100644 --- a/src/main/java/dan200/computercraft/shared/peripheral/common/TilePeripheralBase.java +++ b/src/main/java/dan200/computercraft/shared/peripheral/common/TilePeripheralBase.java @@ -143,7 +143,7 @@ public abstract class TilePeripheralBase extends TileGeneric 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 abstract class TilePeripheralBase extends TileGeneric 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" ) ) { diff --git a/src/main/java/dan200/computercraft/shared/peripheral/diskdrive/TileDiskDrive.java b/src/main/java/dan200/computercraft/shared/peripheral/diskdrive/TileDiskDrive.java index 7f5926c4c..e1dea6b8c 100644 --- a/src/main/java/dan200/computercraft/shared/peripheral/diskdrive/TileDiskDrive.java +++ b/src/main/java/dan200/computercraft/shared/peripheral/diskdrive/TileDiskDrive.java @@ -605,8 +605,8 @@ public class TileDiskDrive extends TilePeripheralBase if( !destroyed ) { EnumFacing dir = getDirection(); - xOff = dir.getFrontOffsetX(); - zOff = dir.getFrontOffsetZ(); + xOff = dir.getXOffset(); + zOff = dir.getZOffset(); } BlockPos pos = getPos(); diff --git a/src/main/java/dan200/computercraft/shared/peripheral/modem/BlockAdvancedModem.java b/src/main/java/dan200/computercraft/shared/peripheral/modem/BlockAdvancedModem.java index af8d1a3ef..87ef06481 100644 --- a/src/main/java/dan200/computercraft/shared/peripheral/modem/BlockAdvancedModem.java +++ b/src/main/java/dan200/computercraft/shared/peripheral/modem/BlockAdvancedModem.java @@ -33,7 +33,7 @@ public class BlockAdvancedModem extends BlockPeripheralBase 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 @@ public class BlockAdvancedModem extends BlockPeripheralBase 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; } diff --git a/src/main/java/dan200/computercraft/shared/peripheral/monitor/TileMonitor.java b/src/main/java/dan200/computercraft/shared/peripheral/monitor/TileMonitor.java index 866675226..e237a33bd 100644 --- a/src/main/java/dan200/computercraft/shared/peripheral/monitor/TileMonitor.java +++ b/src/main/java/dan200/computercraft/shared/peripheral/monitor/TileMonitor.java @@ -344,7 +344,7 @@ public class TileMonitor extends TilePeripheralBase 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() diff --git a/src/main/java/dan200/computercraft/shared/pocket/items/ItemPocketComputer.java b/src/main/java/dan200/computercraft/shared/pocket/items/ItemPocketComputer.java index f469d9265..2dd61d326 100644 --- a/src/main/java/dan200/computercraft/shared/pocket/items/ItemPocketComputer.java +++ b/src/main/java/dan200/computercraft/shared/pocket/items/ItemPocketComputer.java @@ -43,7 +43,7 @@ public class ItemPocketComputer extends Item implements IComputerItem, IMedia, I { setMaxStackSize( 1 ); setHasSubtypes( true ); - setUnlocalizedName( "computercraft:pocket_computer" ); + setTranslationKey( "computercraft:pocket_computer" ); setCreativeTab( ComputerCraft.mainCreativeTab ); } @@ -189,7 +189,7 @@ public class ItemPocketComputer extends Item implements IComputerItem, IMedia, I @Nonnull @Override - public String getUnlocalizedName( @Nonnull ItemStack stack ) + public String getTranslationKey( @Nonnull ItemStack stack ) { switch( getFamily( stack ) ) { @@ -209,7 +209,7 @@ public class ItemPocketComputer extends Item implements IComputerItem, IMedia, I @Override public String getItemStackDisplayName( @Nonnull ItemStack stack ) { - String baseString = getUnlocalizedName( stack ); + String baseString = getTranslationKey( stack ); IPocketUpgrade upgrade = getUpgrade( stack ); if( upgrade != null ) { diff --git a/src/main/java/dan200/computercraft/shared/proxy/CCTurtleProxyCommon.java b/src/main/java/dan200/computercraft/shared/proxy/CCTurtleProxyCommon.java index 037c98401..46d91df90 100644 --- a/src/main/java/dan200/computercraft/shared/proxy/CCTurtleProxyCommon.java +++ b/src/main/java/dan200/computercraft/shared/proxy/CCTurtleProxyCommon.java @@ -413,10 +413,10 @@ public abstract class CCTurtleProxyCommon implements ICCTurtleProxy // We have to use mappings.getAllMappings() as the mod ID is upper case but the domain lower. for( RegistryEvent.MissingMappings.Mapping 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 abstract class CCTurtleProxyCommon implements ICCTurtleProxy // We have to use mappings.getAllMappings() as the mod ID is upper case but the domain lower. for( RegistryEvent.MissingMappings.Mapping 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 ); diff --git a/src/main/java/dan200/computercraft/shared/proxy/ComputerCraftProxyCommon.java b/src/main/java/dan200/computercraft/shared/proxy/ComputerCraftProxyCommon.java index ab4d404fa..dec8466e0 100644 --- a/src/main/java/dan200/computercraft/shared/proxy/ComputerCraftProxyCommon.java +++ b/src/main/java/dan200/computercraft/shared/proxy/ComputerCraftProxyCommon.java @@ -414,10 +414,10 @@ public abstract class ComputerCraftProxyCommon implements IComputerCraftProxy // We have to use mappings.getAllMappings() as the mod ID is upper case but the domain lower. for( RegistryEvent.MissingMappings.Mapping 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 abstract class ComputerCraftProxyCommon implements IComputerCraftProxy // We have to use mappings.getAllMappings() as the mod ID is upper case but the domain lower. for( RegistryEvent.MissingMappings.Mapping 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 ); diff --git a/src/main/java/dan200/computercraft/shared/turtle/blocks/BlockTurtle.java b/src/main/java/dan200/computercraft/shared/turtle/blocks/BlockTurtle.java index 10931e63c..505a69fca 100644 --- a/src/main/java/dan200/computercraft/shared/turtle/blocks/BlockTurtle.java +++ b/src/main/java/dan200/computercraft/shared/turtle/blocks/BlockTurtle.java @@ -48,7 +48,7 @@ public class BlockTurtle extends BlockComputerBase { super( Material.IRON ); setHardness( 2.5f ); - setUnlocalizedName( "computercraft:turtle" ); + setTranslationKey( "computercraft:turtle" ); setCreativeTab( ComputerCraft.mainCreativeTab ); setDefaultState( this.blockState.getBaseState() .withProperty( Properties.FACING, EnumFacing.NORTH ) diff --git a/src/main/java/dan200/computercraft/shared/turtle/core/TurtleBrain.java b/src/main/java/dan200/computercraft/shared/turtle/core/TurtleBrain.java index f04dfcc37..93fab0885 100644 --- a/src/main/java/dan200/computercraft/shared/turtle/core/TurtleBrain.java +++ b/src/main/java/dan200/computercraft/shared/turtle/core/TurtleBrain.java @@ -226,7 +226,7 @@ public class TurtleBrain implements ITurtleAccess 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 class TurtleBrain implements ITurtleAccess // 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 class TurtleBrain implements ITurtleAccess // 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 class TurtleBrain implements ITurtleAccess 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 class TurtleBrain implements ITurtleAccess 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 @@ public class TurtleBrain implements ITurtleAccess 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 @@ public class TurtleBrain implements ITurtleAccess 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 ); diff --git a/src/main/java/dan200/computercraft/shared/turtle/core/TurtleCompareCommand.java b/src/main/java/dan200/computercraft/shared/turtle/core/TurtleCompareCommand.java index 102a91172..42474538d 100644 --- a/src/main/java/dan200/computercraft/shared/turtle/core/TurtleCompareCommand.java +++ b/src/main/java/dan200/computercraft/shared/turtle/core/TurtleCompareCommand.java @@ -126,7 +126,7 @@ public class TurtleCompareCommand implements ITurtleCommand { return TurtleCommandResult.success(); } - else if( selectedStack.getUnlocalizedName().equals( lookAtStack.getUnlocalizedName() ) ) + else if( selectedStack.getTranslationKey().equals( lookAtStack.getTranslationKey() ) ) { return TurtleCommandResult.success(); } diff --git a/src/main/java/dan200/computercraft/shared/turtle/core/TurtleMoveCommand.java b/src/main/java/dan200/computercraft/shared/turtle/core/TurtleMoveCommand.java index fd9cecb74..b55b5ad6f 100644 --- a/src/main/java/dan200/computercraft/shared/turtle/core/TurtleMoveCommand.java +++ b/src/main/java/dan200/computercraft/shared/turtle/core/TurtleMoveCommand.java @@ -87,9 +87,9 @@ public class TurtleMoveCommand implements ITurtleCommand 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() ) { diff --git a/src/main/java/dan200/computercraft/shared/turtle/core/TurtlePlaceCommand.java b/src/main/java/dan200/computercraft/shared/turtle/core/TurtlePlaceCommand.java index b5aeaa17d..eb76e5111 100644 --- a/src/main/java/dan200/computercraft/shared/turtle/core/TurtlePlaceCommand.java +++ b/src/main/java/dan200/computercraft/shared/turtle/core/TurtlePlaceCommand.java @@ -194,9 +194,9 @@ public class TurtlePlaceCommand implements ITurtleCommand // 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 @@ public class TurtlePlaceCommand implements ITurtleCommand 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; diff --git a/src/main/java/dan200/computercraft/shared/turtle/items/ItemTurtleAdvanced.java b/src/main/java/dan200/computercraft/shared/turtle/items/ItemTurtleAdvanced.java index 4b4c18bd0..39d73bb32 100644 --- a/src/main/java/dan200/computercraft/shared/turtle/items/ItemTurtleAdvanced.java +++ b/src/main/java/dan200/computercraft/shared/turtle/items/ItemTurtleAdvanced.java @@ -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 ); } diff --git a/src/main/java/dan200/computercraft/shared/turtle/items/ItemTurtleBase.java b/src/main/java/dan200/computercraft/shared/turtle/items/ItemTurtleBase.java index 6245721f7..b9a2de93f 100644 --- a/src/main/java/dan200/computercraft/shared/turtle/items/ItemTurtleBase.java +++ b/src/main/java/dan200/computercraft/shared/turtle/items/ItemTurtleBase.java @@ -114,7 +114,7 @@ public abstract class ItemTurtleBase extends ItemComputerBase implements ITurtle @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 abstract class ItemTurtleBase extends ItemComputerBase implements ITurtle @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 ) diff --git a/src/main/java/dan200/computercraft/shared/turtle/items/ItemTurtleLegacy.java b/src/main/java/dan200/computercraft/shared/turtle/items/ItemTurtleLegacy.java index 709036447..32218c995 100644 --- a/src/main/java/dan200/computercraft/shared/turtle/items/ItemTurtleLegacy.java +++ b/src/main/java/dan200/computercraft/shared/turtle/items/ItemTurtleLegacy.java @@ -23,7 +23,7 @@ public class ItemTurtleLegacy extends ItemTurtleBase public ItemTurtleLegacy( Block block ) { super( block ); - setUnlocalizedName( "computercraft:turtle" ); + setTranslationKey( "computercraft:turtle" ); setCreativeTab( ComputerCraft.mainCreativeTab ); } diff --git a/src/main/java/dan200/computercraft/shared/turtle/items/ItemTurtleNormal.java b/src/main/java/dan200/computercraft/shared/turtle/items/ItemTurtleNormal.java index 3b8802aa5..d3c898f4d 100644 --- a/src/main/java/dan200/computercraft/shared/turtle/items/ItemTurtleNormal.java +++ b/src/main/java/dan200/computercraft/shared/turtle/items/ItemTurtleNormal.java @@ -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 class ItemTurtleNormal extends ItemTurtleBase } 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 ); diff --git a/src/main/java/dan200/computercraft/shared/turtle/upgrades/TurtleTool.java b/src/main/java/dan200/computercraft/shared/turtle/upgrades/TurtleTool.java index cb544a66a..f71f009cc 100644 --- a/src/main/java/dan200/computercraft/shared/turtle/upgrades/TurtleTool.java +++ b/src/main/java/dan200/computercraft/shared/turtle/upgrades/TurtleTool.java @@ -103,7 +103,7 @@ public class TurtleTool implements ITurtleUpgrade @Nonnull @Override - @SideOnly(Side.CLIENT) + @SideOnly( Side.CLIENT ) public Pair getModel( ITurtleAccess turtle, @Nonnull TurtleSide side ) { float xOffset = (side == TurtleSide.Left) ? -0.40625f : 0.40625f; @@ -154,7 +154,7 @@ public class TurtleTool implements ITurtleUpgrade { 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 @@ public class TurtleTool implements ITurtleUpgrade { return TurtleCommandResult.failure( attackEvent.getFailureMessage() ); } - + // Start claiming entity drops - List extra = new ArrayList<>( ); + List extra = new ArrayList<>(); ComputerCraft.setDropConsumer( hitEntity, turtleDropConsumer( turtle, extra ) ); // Attack the entity @@ -232,7 +232,7 @@ public class TurtleTool implements ITurtleUpgrade return TurtleCommandResult.failure( "Nothing to attack here" ); } - + private TurtleCommandResult dig( ITurtleAccess turtle, EnumFacing direction, TurtleSide side ) { // Get ready to dig @@ -277,7 +277,7 @@ public class TurtleTool implements ITurtleUpgrade } // Consume the items the block drops - List extra = new ArrayList<>( ); + List extra = new ArrayList<>(); ComputerCraft.setDropConsumer( world, blockPosition, turtleDropConsumer( turtle, extra ) ); TileEntity tile = world.getTileEntity( blockPosition ); @@ -291,7 +291,7 @@ public class TurtleTool implements ITurtleUpgrade // 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() ); diff --git a/src/main/java/dan200/computercraft/shared/util/CreativeTabMain.java b/src/main/java/dan200/computercraft/shared/util/CreativeTabMain.java index aae0741e5..cddab4218 100644 --- a/src/main/java/dan200/computercraft/shared/util/CreativeTabMain.java +++ b/src/main/java/dan200/computercraft/shared/util/CreativeTabMain.java @@ -24,7 +24,7 @@ public class CreativeTabMain extends CreativeTabs @Nonnull @Override @SideOnly(Side.CLIENT) - public ItemStack getTabIconItem() + public ItemStack createIcon() { return new ItemStack( ComputerCraft.Blocks.computer ); } @@ -32,7 +32,7 @@ public class CreativeTabMain extends CreativeTabs @Nonnull @Override @SideOnly(Side.CLIENT) - public String getTranslatedTabLabel() + public String getTranslationKey() { return getTabLabel(); } diff --git a/src/main/java/dan200/computercraft/shared/util/CreativeTabTreasure.java b/src/main/java/dan200/computercraft/shared/util/CreativeTabTreasure.java index d8a177dac..cb7261342 100644 --- a/src/main/java/dan200/computercraft/shared/util/CreativeTabTreasure.java +++ b/src/main/java/dan200/computercraft/shared/util/CreativeTabTreasure.java @@ -21,14 +21,14 @@ public class CreativeTabTreasure extends CreativeTabs @Nonnull @Override - public ItemStack getTabIconItem() + public ItemStack createIcon() { return new ItemStack( ComputerCraft.Items.treasureDisk ); } @Nonnull @Override - public String getTranslatedTabLabel() + public String getTranslationKey() { return getTabLabel(); } diff --git a/src/main/java/dan200/computercraft/shared/util/InventoryUtil.java b/src/main/java/dan200/computercraft/shared/util/InventoryUtil.java index f7e808a44..422639a5d 100644 --- a/src/main/java/dan200/computercraft/shared/util/InventoryUtil.java +++ b/src/main/java/dan200/computercraft/shared/util/InventoryUtil.java @@ -73,13 +73,13 @@ public class InventoryUtil // 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 hit = WorldUtil.rayTraceEntities( world, vecStart, vecDir, 1.1 ); if( hit != null ) diff --git a/src/main/java/dan200/computercraft/shared/util/WorldUtil.java b/src/main/java/dan200/computercraft/shared/util/WorldUtil.java index 5d00d954c..50d2dd89f 100644 --- a/src/main/java/dan200/computercraft/shared/util/WorldUtil.java +++ b/src/main/java/dan200/computercraft/shared/util/WorldUtil.java @@ -43,14 +43,14 @@ public class WorldUtil public static Pair 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 @@ public class WorldUtil } 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 class WorldUtil 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 class WorldUtil double zDir; if( direction != null ) { - xDir = direction.getFrontOffsetX(); - yDir = direction.getFrontOffsetY(); - zDir = direction.getFrontOffsetZ(); + xDir = direction.getXOffset(); + yDir = direction.getYOffset(); + zDir = direction.getZOffset(); } else {