Fix advanced computer's item model

This commit is contained in:
SquidDev 2017-05-01 15:30:55 +01:00
parent 77d225d1fe
commit d050ca9849
5 changed files with 13 additions and 14 deletions

View File

@ -13,6 +13,7 @@
import net.minecraft.item.ItemStack;
import net.minecraft.util.SoundEvent;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
// An implementation of IMedia for ItemRecord's
public class RecordMedia implements IMedia
@ -43,7 +44,7 @@ public String getAudioTitle( ItemStack stack )
public SoundEvent getAudio( ItemStack stack )
{
ItemRecord itemRecord = (ItemRecord)stack.getItem();
return itemRecord.getSound();
return ObfuscationReflectionHelper.getPrivateValue(ItemRecord.class, itemRecord, "field_185076_b");
}
@Override

View File

@ -89,7 +89,7 @@ public EnumActionResult onItemUse( ItemStack stack, EntityPlayer player, World w
if( stack.stackSize > 0 )
{
world.setBlockState( pos, existingState.withProperty( BlockCable.Properties.CABLE, true ), 3 );
world.playSound( null, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, ComputerCraft.Blocks.cable.getSoundType().getBreakSound(), SoundCategory.BLOCKS, (ComputerCraft.Blocks.cable.getSoundType().getVolume() + 1.0F ) / 2.0F, ComputerCraft.Blocks.cable.getSoundType().getPitch() * 0.8F);
world.playSound( null, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, ComputerCraft.Blocks.cable.getSoundType().getPlaceSound(), SoundCategory.BLOCKS, (ComputerCraft.Blocks.cable.getSoundType().getVolume() + 1.0F ) / 2.0F, ComputerCraft.Blocks.cable.getSoundType().getPitch() * 0.8F);
stack.stackSize--;
TileEntity tile = world.getTileEntity( pos );
@ -119,7 +119,7 @@ public EnumActionResult onItemUse( ItemStack stack, EntityPlayer player, World w
if( stack.stackSize > 0 )
{
world.setBlockState( offset, offsetExistingState.withProperty( BlockCable.Properties.MODEM, BlockCableModemVariant.fromFacing( side.getOpposite() ) ), 3 );
world.playSound( null, offset.getX() + 0.5, offset.getY() + 0.5, offset.getZ() + 0.5, ComputerCraft.Blocks.cable.getSoundType().getBreakSound(), SoundCategory.BLOCKS, (ComputerCraft.Blocks.cable.getSoundType().getVolume() + 1.0F ) / 2.0F, ComputerCraft.Blocks.cable.getSoundType().getPitch() * 0.8F);
world.playSound( null, offset.getX() + 0.5, offset.getY() + 0.5, offset.getZ() + 0.5, ComputerCraft.Blocks.cable.getSoundType().getPlaceSound(), SoundCategory.BLOCKS, (ComputerCraft.Blocks.cable.getSoundType().getVolume() + 1.0F ) / 2.0F, ComputerCraft.Blocks.cable.getSoundType().getPitch() * 0.8F);
stack.stackSize--;
TileEntity tile = world.getTileEntity( offset );
@ -139,7 +139,7 @@ public EnumActionResult onItemUse( ItemStack stack, EntityPlayer player, World w
if( stack.stackSize > 0 )
{
world.setBlockState( offset, offsetExistingState.withProperty( BlockCable.Properties.CABLE, true ), 3 );
world.playSound( null, offset.getX() + 0.5, offset.getY() + 0.5, offset.getZ() + 0.5, ComputerCraft.Blocks.cable.getSoundType().getBreakSound(), SoundCategory.BLOCKS, (ComputerCraft.Blocks.cable.getSoundType().getVolume() + 1.0F ) / 2.0F, ComputerCraft.Blocks.cable.getSoundType().getPitch() * 0.8F);
world.playSound( null, offset.getX() + 0.5, offset.getY() + 0.5, offset.getZ() + 0.5, ComputerCraft.Blocks.cable.getSoundType().getPlaceSound(), SoundCategory.BLOCKS, (ComputerCraft.Blocks.cable.getSoundType().getVolume() + 1.0F ) / 2.0F, ComputerCraft.Blocks.cable.getSoundType().getPitch() * 0.8F);
stack.stackSize--;
TileEntity tile = world.getTileEntity( offset );

View File

@ -15,7 +15,6 @@
import dan200.computercraft.shared.computer.blocks.BlockComputer;
import dan200.computercraft.shared.computer.blocks.TileCommandComputer;
import dan200.computercraft.shared.computer.blocks.TileComputer;
import dan200.computercraft.shared.computer.core.ClientComputer;
import dan200.computercraft.shared.computer.core.ComputerFamily;
import dan200.computercraft.shared.computer.core.ServerComputer;
import dan200.computercraft.shared.computer.inventory.ContainerComputer;
@ -63,16 +62,15 @@
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.Packet;
import net.minecraft.server.MinecraftServer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IThreadListener;
import net.minecraft.util.SoundEvent;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.IThreadListener;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.translation.I18n;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.world.WorldEvent;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
import net.minecraftforge.fml.common.network.FMLNetworkEvent;
@ -127,8 +125,9 @@ public String getRecordInfo( ItemStack recordStack )
Item item = recordStack.getItem();
if( item instanceof ItemRecord )
{
ItemRecord record = (ItemRecord)item;
return record.getRecordNameLocal();
ItemRecord record = (ItemRecord) item;
String key = ObfuscationReflectionHelper.getPrivateValue( ItemRecord.class, record, "field_185077_c" );
return I18n.translateToLocal( key );
}
return null;
}

View File

@ -281,8 +281,7 @@ private TurtleCommandResult dig( ITurtleAccess turtle, EnumFacing direction )
// Destroy the block
IBlockState previousState = world.getBlockState( newPosition );
Block previousBlock = previousState.getBlock();
world.playSound( null, newPosition, previousBlock.getSoundType().getBreakSound(), SoundCategory.BLOCKS, (previousBlock.getSoundType().getVolume() + 1.0F) / 2.0F, previousBlock.getSoundType().getPitch() * 0.8F );
world.playEvent(2001, newPosition, Block.getStateId(previousState));
world.setBlockToAir( newPosition );
// Remember the previous block

View File

@ -1,3 +1,3 @@
{
"parent": "computercraft:block/advanced_computer_blinking",
"parent": "computercraft:block/advanced_computer_blinking"
}