Second update pass (2/3) - 82 -> 0 errors

Second update pass which fixes all compile errors. Some parts may have
aftermath effect, hence why 3rd pass will check those maked with
"aftermath".
Errors: 82 -> 0. Mod can be launched.
This commit is contained in:
elix-x 2016-06-21 11:03:10 +02:00
parent 5498eb6d7c
commit 05aa6972c4
83 changed files with 564 additions and 405 deletions

View File

@ -37,6 +37,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
@ -241,7 +242,7 @@ public interface IPart extends IBoxProvider
*
* @return if your activate method performed something.
*/
boolean onActivate( EntityPlayer player, Vec3d pos );
boolean onActivate( EntityPlayer player, EnumHand hand, Vec3d pos );
/**
* Called when you right click the part, very similar to Block.onActivateBlock
@ -251,7 +252,7 @@ public interface IPart extends IBoxProvider
*
* @return if your activate method performed something, you should use false unless you really need it.
*/
boolean onShiftActivate( EntityPlayer player, Vec3d pos );
boolean onShiftActivate( EntityPlayer player, EnumHand hand, Vec3d pos );
/**
* Add drops to the items being dropped into the world, if your item stores its contents when wrenched use the
@ -283,7 +284,7 @@ public interface IPart extends IBoxProvider
* @param held held item
* @param side placing side
*/
void onPlacement( EntityPlayer player, ItemStack held, AEPartLocation side );
void onPlacement( EntityPlayer player, EnumHand hand, ItemStack held, AEPartLocation side );
/**
* Used to determine which parts can be placed on what cables.

View File

@ -27,6 +27,7 @@ package appeng.api.parts;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
@ -76,7 +77,7 @@ public interface IPartHelper
*
* @return true if placing was successful
*/
boolean placeBus( ItemStack is, BlockPos pos, EnumFacing side, EntityPlayer player, World world );
boolean placeBus( ItemStack is, BlockPos pos, EnumFacing side, EntityPlayer player, EnumHand hand, World world );
/**
* @return the render mode

View File

@ -30,6 +30,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.Vec3d;
import appeng.api.util.AEColor;
@ -71,7 +72,7 @@ public interface IPartHost
* @return null if the item failed to add, the side it was placed on other wise ( may different for cables,
* {@link AEPartLocation}.UNKNOWN )
*/
AEPartLocation addPart( ItemStack is, AEPartLocation side, EntityPlayer owner );
AEPartLocation addPart( ItemStack is, AEPartLocation side, EntityPlayer owner, EnumHand hand );
/**
* Get part by side ( center is {@link AEPartLocation}.UNKNOWN )

View File

@ -3,6 +3,8 @@ package appeng.api.util;
import java.util.EnumSet;
import javax.annotation.Nullable;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.IBakedModel;
@ -49,7 +51,7 @@ public interface ModelGenerator
void setFlipTexture( boolean b );
void setRenderBoundsFromBlock( Block block );
void setRenderBoundsFromBlock( IBlockState state, @Nullable BlockPos pos );
void setRenderBounds( double v, double v1, double v2, double v3, double v4, double v5 );

View File

@ -35,6 +35,7 @@ import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.color.IBlockColor;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.resources.IResource;
import net.minecraft.creativetab.CreativeTabs;
@ -61,6 +62,7 @@ import appeng.api.util.AEPartLocation;
import appeng.api.util.IAESprite;
import appeng.api.util.IOrientable;
import appeng.api.util.IOrientableBlock;
import appeng.block.AEBaseBlock.AEBaseBlockColor;
import appeng.client.render.BaseBlockRender;
import appeng.client.render.BlockRenderInfo;
import appeng.client.texture.BaseIcon;
@ -76,9 +78,9 @@ import appeng.helpers.ICustomCollision;
import appeng.util.LookDirection;
import appeng.util.Platform;
//TODO 1.9.4 - setBlockBounds => ?
public abstract class AEBaseBlock extends Block implements IAEFeature
{
public static final PropertyEnum AXIS_ORIENTATION = PropertyEnum.create( "axis", EnumFacing.Axis.class );
private final String featureFullName;
@ -91,6 +93,8 @@ public abstract class AEBaseBlock extends Block implements IAEFeature
@SideOnly( Side.CLIENT )
private BlockRenderInfo renderInfo;
private String textureName;
protected AxisAlignedBB boundingBox;
@Override
public boolean isVisuallyOpaque()
@ -105,6 +109,11 @@ public abstract class AEBaseBlock extends Block implements IAEFeature
this.setLightLevel( 0 );
this.setHardness( 2.2F );
this.setHarvestLevel( "pickaxe", 0 );
if( Platform.isClient() )
{
Minecraft.getMinecraft().getBlockColors().registerBlockColorHandler( new AEBaseBlockColor(), this );
}
}
protected AEBaseBlock( final Material mat, final Optional<String> subName )
@ -188,13 +197,6 @@ public abstract class AEBaseBlock extends Block implements IAEFeature
}
}
//TODO 1.9.4 - Move to IBlockColor
@Override
public int colorMultiplier( final IBlockAccess worldIn, final BlockPos pos, final int colorTint )
{
return colorTint;
}
@SideOnly( Side.CLIENT )
protected Class<? extends BaseBlockRender> getRenderer()
{
@ -264,6 +266,12 @@ public abstract class AEBaseBlock extends Block implements IAEFeature
return this.getRendererInstance().getTexture( AEPartLocation.fromFacing( side ) );
}
@Override
public AxisAlignedBB getBoundingBox( IBlockState state, IBlockAccess source, BlockPos pos )
{
return boundingBox;
}
@Override
public void addCollisionBoxToList( final IBlockState state, final World w, final BlockPos pos, final AxisAlignedBB bb, final List<AxisAlignedBB> out, final Entity e )
{
@ -308,11 +316,11 @@ public abstract class AEBaseBlock extends Block implements IAEFeature
for( final AxisAlignedBB bb : bbs )
{
this.setBlockBounds( (float) bb.minX, (float) bb.minY, (float) bb.minZ, (float) bb.maxX, (float) bb.maxY, (float) bb.maxZ );
this.boundingBox = bb;
final RayTraceResult r = super.collisionRayTrace( state, w, pos, ld.getA(), ld.getB() );
this.setBlockBounds( 0, 0, 0, 1, 1, 1 );
this.boundingBox = FULL_BLOCK_AABB;
if( r != null )
{
@ -392,11 +400,11 @@ public abstract class AEBaseBlock extends Block implements IAEFeature
for( final AxisAlignedBB bb : bbs )
{
this.setBlockBounds( (float) bb.minX, (float) bb.minY, (float) bb.minZ, (float) bb.maxX, (float) bb.maxY, (float) bb.maxZ );
this.boundingBox = bb;
final RayTraceResult r = super.collisionRayTrace( state, w, pos, a, b );
this.setBlockBounds( 0, 0, 0, 1, 1, 1 );
this.boundingBox = FULL_BLOCK_AABB;
if( r != null )
{
@ -421,7 +429,7 @@ public abstract class AEBaseBlock extends Block implements IAEFeature
return null;
}
this.setBlockBounds( 0, 0, 0, 1, 1, 1 );
this.boundingBox = FULL_BLOCK_AABB;
return super.collisionRayTrace( state, w, pos, a, b );
}
@ -712,4 +720,15 @@ public abstract class AEBaseBlock extends Block implements IAEFeature
this.hasSubtypes = hasSubtypes;
}
@SideOnly( Side.CLIENT )
public class AEBaseBlockColor implements IBlockColor
{
@Override
public int colorMultiplier( IBlockState state, IBlockAccess worldIn, BlockPos pos, int tintIndex )
{
return tintIndex;
}
}
}

View File

@ -225,11 +225,10 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements IAEFeature,
return 0;
}
//TODO 1.9.4 - Move to IBlockState
@Override
public boolean onBlockAdded( final World worldIn, final BlockPos pos, final IBlockState state, final int eventID, final int eventParam )
public boolean eventReceived( final IBlockState state, final World worldIn, final BlockPos pos, final int eventID, final int eventParam )
{
super.onBlockEventReceived( worldIn, pos, state, eventID, eventParam );
super.eventReceived( state, worldIn, pos, eventID, eventParam );
final TileEntity tileentity = worldIn.getTileEntity( pos );
return tileentity != null ? tileentity.receiveClientEvent( eventID, eventParam ) : false;
}

View File

@ -90,8 +90,7 @@ public class BlockCrank extends AEBaseTileBlock
private void dropCrank( final World world, final BlockPos pos )
{
world.destroyBlock( pos, true ); // w.destroyBlock( x, y, z, true );
//TODO 1.9.4 - markBlockForUpdate => ?
world.markBlockForUpdate( pos );
world.notifyBlockUpdate( pos, getDefaultState(), world.getBlockState( pos ), 3 );
}
@Override

View File

@ -158,9 +158,9 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl
private void dropTorch( final World w, final BlockPos pos )
{
final IBlockState prev = w.getBlockState( pos );
w.destroyBlock( pos, true );
//TODO 1.9.4 - markBlockForUpdate => ?
w.markBlockForUpdate( pos );
w.notifyBlockUpdate( pos, prev, w.getBlockState( pos ), 3 );
}
@Override

View File

@ -161,9 +161,9 @@ public class BlockQuartzTorch extends AEBaseBlock implements IOrientableBlock, I
private void dropTorch( final World w, final BlockPos pos )
{
final IBlockState prev = w.getBlockState( pos );
w.destroyBlock( pos, true );
//TODO 1.9.4 - markBlockForUpdate => ?
w.markBlockForUpdate( pos );
w.notifyBlockUpdate( pos, prev, w.getBlockState( pos ), 3 );
}
@Override

View File

@ -87,9 +87,9 @@ public class BlockSkyCompass extends AEBaseTileBlock implements ICustomCollision
private void dropTorch( final World w, final BlockPos pos )
{
final IBlockState prev = w.getBlockState( pos );
w.destroyBlock( pos, true );
//TODO 1.9.4 - markBlockForUpdate => ?
w.markBlockForUpdate( pos );
w.notifyBlockUpdate( pos, prev, w.getBlockState( pos ), 3 );
}
@Override

View File

@ -35,10 +35,12 @@ import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityArrow;
import net.minecraft.init.Items;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.Explosion;
@ -62,8 +64,7 @@ public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision
{
super( Material.TNT );
this.setLightOpacity( 1 );
//TODO 1.9.4 - setBlockBounds => ?
this.setBlockBounds( 0.25f, 0.0f, 0.25f, 0.75f, 0.5f, 0.75f );
this.boundingBox = new AxisAlignedBB( 0.25f, 0.0f, 0.25f, 0.75f, 0.5f, 0.75f );
this.setFullSize( this.setOpaque( false ) );
this.setSoundType( SoundType.GROUND );
this.setHardness( 0F );
@ -107,8 +108,7 @@ public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision
{
final EntityTinyTNTPrimed primedTinyTNTEntity = new EntityTinyTNTPrimed( w, pos.getX() + 0.5F, pos.getY() + 0.5F, pos.getZ() + 0.5F, igniter );
w.spawnEntityInWorld( primedTinyTNTEntity );
//TODO 1.9.4 - playSoundAtEntity => ?
w.playSoundAtEntity( primedTinyTNTEntity, "game.tnt.primed", 1.0F, 1.0F );
w.playSound( null, primedTinyTNTEntity.posX, primedTinyTNTEntity.posY, primedTinyTNTEntity.posZ, SoundEvents.ENTITY_TNT_PRIMED, SoundCategory.BLOCKS, 1, 1 );
}
}

View File

@ -332,7 +332,7 @@ public class BlockCableBus extends AEBaseTileBlock // implements
@Override
public boolean onActivated( final World w, final BlockPos pos, final EntityPlayer player, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ )
{
return this.cb( w, pos ).activate( player, new Vec3d( hitX, hitY, hitZ ) );
return this.cb( w, pos ).activate( player, hand, new Vec3d( hitX, hitY, hitZ ) );
}
@Override

View File

@ -25,6 +25,7 @@ import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
@ -43,8 +44,7 @@ public abstract class BlockQuantumBase extends AEBaseTileBlock implements ICusto
super( mat );
this.setTileEntity( TileQuantumBridge.class );
final float shave = 2.0f / 16.0f;
//TODO 1.9.4 - setBlockBounds => ?
this.setBlockBounds( shave, shave, shave, 1.0f - shave, 1.0f - shave, 1.0f - shave );
this.boundingBox = new AxisAlignedBB( shave, shave, shave, 1.0f - shave, 1.0f - shave, 1.0f - shave );
this.setLightOpacity( 0 );
this.setFullSize( this.setOpaque( false ) );
this.setFeature( EnumSet.of( AEFeature.QuantumNetworkBridge ) );

View File

@ -44,6 +44,7 @@ import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumHand;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.Vec3d;
@ -55,7 +56,6 @@ import net.minecraftforge.client.event.TextureStitchEvent;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.client.registry.ClientRegistry;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.registry.GameRegistry;
import appeng.api.parts.CableRenderMode;
import appeng.api.parts.IPartItem;
@ -495,9 +495,8 @@ public class ClientHelper extends ServerHelper
{
if( reg.item instanceof IPartItem || reg.item instanceof IFacadeItem )
{
//TODO 1.9.4 - UniqueIdentifier => ?
final UniqueIdentifier i = GameRegistry.findUniqueIdentifierFor( (Item) reg.item );
event.getModelRegistry().putObject( new ModelResourceLocation( new ResourceLocation( i.modId, i.name ), "inventory" ), buses );
final ResourceLocation i = Item.REGISTRY.getNameForObject( (Item) reg.item );
event.getModelRegistry().putObject( new ModelResourceLocation( new ResourceLocation( i.getResourceDomain(), i.getResourcePath() ), "inventory" ), buses );
}
if( reg.item instanceof AEBaseBlock )
@ -531,11 +530,23 @@ public class ClientHelper extends ServerHelper
final Minecraft mc = Minecraft.getMinecraft();
final EntityPlayer player = mc.thePlayer;
//TODO 1.9.4 - 2 hands. Just do something!
final ItemStack is = player.getItemStackFromSlot( EntityEquipmentSlot.MAINHAND );
if( is != null && is.getItem() instanceof IMouseWheelItem && player.isSneaking() )
if( player.isSneaking() )
{
final EnumHand hand;
if( player.getHeldItem( EnumHand.MAIN_HAND ) != null && player.getHeldItem( EnumHand.MAIN_HAND ).getItem() instanceof IMouseWheelItem )
{
hand = EnumHand.MAIN_HAND;
}
else if( player.getHeldItem( EnumHand.OFF_HAND ) != null && player.getHeldItem( EnumHand.OFF_HAND ).getItem() instanceof IMouseWheelItem )
{
hand = EnumHand.OFF_HAND;
}
else
{
return;
}
final ItemStack is = player.getHeldItem( hand );
try
{
NetworkHandler.instance.sendToServer( new PacketValueConfig( "Item", me.getDwheel() > 0 ? "WheelUp" : "WheelDown" ) );

View File

@ -78,7 +78,7 @@ public class SmartModel implements IBakedModel
final BlockPos pos = ( (IExtendedBlockState) state ).getValue( AEBaseBlock.AE_BLOCK_POS );
final IBlockAccess world = ( (IExtendedBlockState) state ).getValue( AEBaseBlock.AE_BLOCK_ACCESS );
helper.setTranslation( -pos.getX(), -pos.getY(), -pos.getZ() );
helper.setRenderBoundsFromBlock( blk );
helper.setRenderBoundsFromBlock( state, pos );
helper.setBlockAccess( world );
this.aeRenderer.getRendererInstance().renderInWorld( blk instanceof AEBaseBlock ? (AEBaseBlock) blk : null, world, pos, helper );
helper.finalizeModel( false );
@ -95,7 +95,7 @@ public class SmartModel implements IBakedModel
{
final ModelGenerator helper = new BakingModelGenerator();
final Block blk = Block.getBlockFromItem( stack.getItem() );
helper.setRenderBoundsFromBlock( blk );
helper.setRenderBoundsFromBlock( blk.getDefaultState(), null );
aeRenderer.getRendererInstance().renderInventory( blk instanceof AEBaseBlock ? (AEBaseBlock) blk : null, stack, helper, ItemRenderType.INVENTORY, null );
helper.finalizeModel( true );
return helper.getOutput();

View File

@ -89,7 +89,7 @@ public abstract class AEBaseGui extends GuiContainer
private final List<InternalSlotME> meSlots = new LinkedList<InternalSlotME>();
// drag y
private final Set<Slot> drag_click = new HashSet<Slot>();
private final AppEngRenderItem aeRenderItem = new AppEngRenderItem( Minecraft.getMinecraft().renderEngine, Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getModelManager() );
private final AppEngRenderItem aeRenderItem = new AppEngRenderItem( Minecraft.getMinecraft().renderEngine, Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getModelManager(), Minecraft.getMinecraft().getItemColors() );
private GuiScrollbar myScrollBar = null;
private boolean disableShiftClick = false;
private Stopwatch dbl_clickTimer = Stopwatch.createStarted();
@ -381,7 +381,7 @@ public abstract class AEBaseGui extends GuiContainer
}
}
//TODO 1.9.4 - Whole ClickType thing and 1.8.9 conversion, to be checked
//TODO 1.9.4 aftermath - Whole ClickType thing, to be checked.
@Override
protected void handleMouseClick( final Slot slot, final int slotIdx, final int key, final ClickType clickType )
{

View File

@ -55,7 +55,7 @@ import appeng.util.Platform;
import appeng.util.ReadableNumberConverter;
public class GuICraftingCPU extends AEBaseGui implements ISortSource
public class GuiCraftingCPU extends AEBaseGui implements ISortSource
{
private static final int GUI_HEIGHT = 184;
private static final int GUI_WIDTH = 238;
@ -92,12 +92,12 @@ public class GuICraftingCPU extends AEBaseGui implements ISortSource
private GuiButton cancel;
private int tooltip = -1;
public GuICraftingCPU( final InventoryPlayer inventoryPlayer, final Object te )
public GuiCraftingCPU( final InventoryPlayer inventoryPlayer, final Object te )
{
this( new ContainerCraftingCPU( inventoryPlayer, te ) );
}
protected GuICraftingCPU( final ContainerCraftingCPU container )
protected GuiCraftingCPU( final ContainerCraftingCPU container )
{
super( container );
this.craftingCpu = container;

View File

@ -49,7 +49,7 @@ import appeng.parts.reporting.PartPatternTerminal;
import appeng.parts.reporting.PartTerminal;
public class GuIContainerListenerStatus extends GuICraftingCPU
public class GuiCraftingStatus extends GuiCraftingCPU
{
private final ContainerCraftingStatus status;
@ -59,7 +59,7 @@ public class GuIContainerListenerStatus extends GuICraftingCPU
private GuiBridge originalGui;
private ItemStack myIcon = null;
public GuIContainerListenerStatus( final InventoryPlayer inventoryPlayer, final ITerminalHost te )
public GuiCraftingStatus( final InventoryPlayer inventoryPlayer, final ITerminalHost te )
{
super( new ContainerCraftingStatus( inventoryPlayer, te ) );

View File

@ -36,12 +36,12 @@ import appeng.core.sync.packets.PacketInventoryAction;
import appeng.helpers.InventoryAction;
public class GuIContainerListenerTerm extends GuiMEMonitorable
public class GuiCraftingTerm extends GuiMEMonitorable
{
private GuiImgButton clearBtn;
public GuIContainerListenerTerm( final InventoryPlayer inventoryPlayer, final ITerminalHost te )
public GuiCraftingTerm( final InventoryPlayer inventoryPlayer, final ITerminalHost te )
{
super( inventoryPlayer, te, new ContainerCraftingTerm( inventoryPlayer, te ) );
this.setReservedSpace( 73 );

View File

@ -5,6 +5,8 @@ import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import javax.annotation.Nullable;
import org.lwjgl.util.vector.Vector3f;
import net.minecraft.block.Block;
@ -19,10 +21,14 @@ import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
import net.minecraft.client.renderer.block.model.ItemOverrideList;
import net.minecraft.client.renderer.block.model.ModelRotation;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.client.MinecraftForgeClient;
@ -35,7 +41,6 @@ import appeng.client.texture.MissingIcon;
import appeng.items.AEBaseItem;
import appeng.items.parts.ItemMultiPart;
//TODO 1.9.4 - Just all
public class BakingModelGenerator implements ModelGenerator
{
private static final class CachedModel implements IBakedModel
@ -133,19 +138,28 @@ public class BakingModelGenerator implements ModelGenerator
private EnumFacing currentFace = EnumFacing.UP;
private int color = -1;
public void setRenderBoundsFromBlock( final Block block )
public void setRenderBoundsFromBlock( final IBlockState state, final @Nullable BlockPos pos )
{
if( block == null )
if( state == null )
{
return;
}
this.setRenderMinX( block.getBlockBoundsMinX() );
this.setRenderMinY( block.getBlockBoundsMinY() );
this.setRenderMinZ( block.getBlockBoundsMinZ() );
this.setRenderMaxX( block.getBlockBoundsMaxX() );
this.setRenderMaxY( block.getBlockBoundsMaxY() );
this.setRenderMaxZ( block.getBlockBoundsMaxZ() );
AxisAlignedBB boundingBox;
try
{
boundingBox = state.getBoundingBox( getBlockAccess(), pos );
}
catch( NullPointerException e )
{
boundingBox = Block.FULL_BLOCK_AABB;
}
this.setRenderMinX( boundingBox.minX );
this.setRenderMinY( boundingBox.minY );
this.setRenderMinZ( boundingBox.minZ );
this.setRenderMaxX( boundingBox.maxX );
this.setRenderMaxY( boundingBox.maxY );
this.setRenderMaxZ( boundingBox.maxZ );
}
public void setRenderBounds( final double d, final double e, final double f, final double g, final double h, final double i )
@ -289,6 +303,7 @@ public class BakingModelGenerator implements ModelGenerator
return this.getIcon( state );
}
//TODO 1.9.4 aftermath - Check that this shit still works.
public void addVertexWithUV( final EnumFacing face, final double x, final double y, final double z, final double u, final double v )
{
this.points[this.point++] = new float[] { (float) x + this.tx, (float) y + this.ty, (float) z + this.tz, (float) u, (float) v };
@ -297,40 +312,43 @@ public class BakingModelGenerator implements ModelGenerator
{
this.brightness = -1;
final int[] vertData = {
Float.floatToRawIntBits( this.points[0][0] ),
Float.floatToRawIntBits( this.points[0][1] ),
Float.floatToRawIntBits( this.points[0][2] ),
this.brightness,
Float.floatToRawIntBits( this.points[0][3] ),
Float.floatToRawIntBits( this.points[0][4] ),
0,
Float.floatToRawIntBits( this.points[0][0] ),
Float.floatToRawIntBits( this.points[0][1] ),
Float.floatToRawIntBits( this.points[0][2] ),
// this.brightness,
Float.floatToRawIntBits( this.points[0][3] ),
Float.floatToRawIntBits( this.points[0][4] ),
// 0,
Float.floatToRawIntBits( this.points[1][0] ),
Float.floatToRawIntBits( this.points[1][1] ),
Float.floatToRawIntBits( this.points[1][2] ),
this.brightness,
Float.floatToRawIntBits( this.points[1][3] ),
Float.floatToRawIntBits( this.points[1][4] ),
0,
Float.floatToRawIntBits( this.points[1][0] ),
Float.floatToRawIntBits( this.points[1][1] ),
Float.floatToRawIntBits( this.points[1][2] ),
// this.brightness,
Float.floatToRawIntBits( this.points[1][3] ),
Float.floatToRawIntBits( this.points[1][4] ),
// 0,
Float.floatToRawIntBits( this.points[2][0] ),
Float.floatToRawIntBits( this.points[2][1] ),
Float.floatToRawIntBits( this.points[2][2] ),
this.brightness,
Float.floatToRawIntBits( this.points[2][3] ),
Float.floatToRawIntBits( this.points[2][4] ),
0,
Float.floatToRawIntBits( this.points[2][0] ),
Float.floatToRawIntBits( this.points[2][1] ),
Float.floatToRawIntBits( this.points[2][2] ),
// this.brightness,
Float.floatToRawIntBits( this.points[2][3] ),
Float.floatToRawIntBits( this.points[2][4] ),
// 0,
Float.floatToRawIntBits( this.points[3][0] ),
Float.floatToRawIntBits( this.points[3][1] ),
Float.floatToRawIntBits( this.points[3][2] ),
this.brightness,
Float.floatToRawIntBits( this.points[3][3] ),
Float.floatToRawIntBits( this.points[3][4] ),
0,
};
Float.floatToRawIntBits( this.points[3][0] ),
Float.floatToRawIntBits( this.points[3][1] ),
Float.floatToRawIntBits( this.points[3][2] ),
// this.brightness,
Float.floatToRawIntBits( this.points[3][3] ),
Float.floatToRawIntBits( this.points[3][4] ),
// 0,
};
this.generatedModel.general.add( new IColoredBakedQuad.ColoredBakedQuad( vertData, this.color, face ) );
for( List<BakedQuad> list : this.generatedModel.faces )
{
list.add( new BakedQuad( vertData, this.color, face, Minecraft.getMinecraft().getTextureMapBlocks().getTextureExtry( TextureMap.LOCATION_BLOCKS_TEXTURE.toString() ), true, DefaultVertexFormats.POSITION_TEX ) );
}
this.point = 0;
}
@ -556,15 +574,18 @@ public class BakingModelGenerator implements ModelGenerator
final BlockPartFace bpf = new BlockPartFace( myFace, face.getColor(), "", uv );
BakedQuad bf = this.faceBakery.makeBakedQuad( face.getTo(), face.getFrom(), bpf, face.getSpite(), myFace, mr, null, true, true );
bf = new IColoredBakedQuad.ColoredBakedQuad( bf.getVertexData(), face.getColor(), bf.getFace() );
bf = new BakedQuad( bf.getVertexData(), face.getColor(), bf.getFace(), Minecraft.getMinecraft().getTextureMapBlocks().getTextureExtry( TextureMap.LOCATION_BLOCKS_TEXTURE.toString() ), true, DefaultVertexFormats.POSITION_TEX );
if( face.isEdge() )
{
this.generatedModel.getFaceQuads( myFace ).add( bf );
this.generatedModel.faces[myFace.ordinal()].add( bf );
}
else
{
this.generatedModel.getGeneralQuads().add( bf );
for( List<BakedQuad> list : this.generatedModel.faces )
{
list.add( bf );
}
}
}
}

View File

@ -694,7 +694,7 @@ public class BaseBlockRender<B extends AEBaseBlock, T extends AEBaseTile>
renderer.setTranslation( -pos.getX(), -pos.getY(), -pos.getZ() );
// note that this is a terrible approach...
renderer.setRenderBoundsFromBlock( block );
renderer.setRenderBoundsFromBlock( block.getDefaultState(), pos );
renderer.renderStandardBlock( block, pos );
renderer.setTranslation( 0, 0, 0 );

View File

@ -62,7 +62,7 @@ public final class WorldRender implements ISimpleBlockRenderingHandler
public boolean renderWorldBlock( final IBlockAccess world, final BlockPos pos, final Block block, final int modelId, final ModelGenerator renderer )
{
final AEBaseBlock blk = (AEBaseBlock) block;
renderer.setRenderBoundsFromBlock( block );
renderer.setRenderBoundsFromBlock( world.getBlockState( pos ), pos );
return this.getRender( blk ).renderInWorld( blk, world, pos, renderer );
}
@ -77,7 +77,7 @@ public final class WorldRender implements ISimpleBlockRenderingHandler
if( blk instanceof AEBaseBlock )
{
final AEBaseBlock block = (AEBaseBlock) blk;
this.renderer.setRenderBoundsFromBlock( block );
this.renderer.setRenderBoundsFromBlock( block.getDefaultState(), null );
this.renderer.setUvRotateBottom( this.renderer.setUvRotateEast( this.renderer.setUvRotateNorth( this.renderer.setUvRotateSouth( this.renderer.setUvRotateTop( this.renderer.setUvRotateWest( 0 ) ) ) ) ) );
this.getRender( block ).renderInventory( block, item, this.renderer, type, data );

View File

@ -28,9 +28,10 @@ import appeng.api.storage.data.IAEItemStack;
import appeng.client.EffectType;
import appeng.core.CommonHelper;
import appeng.entity.EntityFloatingItem;
import appeng.entity.ICanDie;
public class AssemblerFX extends Particle
public class AssemblerFX extends Particle implements ICanDie
{
private final EntityFloatingItem fi;
@ -47,8 +48,12 @@ public class AssemblerFX extends Particle
this.fi = new EntityFloatingItem( this, w, x, y, z, is.getItemStack() );
w.spawnEntityInWorld( this.fi );
this.particleMaxAge = (int) Math.ceil( Math.max( 1, 100.0f / speed ) ) + 2;
//TODO 1.9.4 - noClip => ?
this.noClip = true;
}
@Override
public boolean isDead()
{
return isExpired;
}
@Override
@ -61,7 +66,20 @@ public class AssemblerFX extends Particle
@Override
public void onUpdate()
{
super.onUpdate();
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
if (this.particleAge++ >= this.particleMaxAge)
{
this.setExpired();
}
this.motionY -= 0.04D * (double)this.particleGravity;
this.moveEntity(this.motionX, this.motionY, this.motionZ);
this.motionX *= 0.9800000190734863D;
this.motionY *= 0.9800000190734863D;
this.motionZ *= 0.9800000190734863D;
if( this.isExpired )
{

View File

@ -58,9 +58,6 @@ public class CraftingFx extends ParticleBreaking
this.startBlkX = MathHelper.floor_double( this.posX );
this.startBlkY = MathHelper.floor_double( this.posY );
this.startBlkZ = MathHelper.floor_double( this.posZ );
//TODO 1.9.4 - noClip => ?
this.noClip = true;
}
@Override
@ -116,7 +113,20 @@ public class CraftingFx extends ParticleBreaking
@Override
public void onUpdate()
{
super.onUpdate();
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
if (this.particleAge++ >= this.particleMaxAge)
{
this.setExpired();
}
this.motionY -= 0.04D * (double)this.particleGravity;
this.moveEntity(this.motionX, this.motionY, this.motionZ);
this.motionX *= 0.9800000190734863D;
this.motionY *= 0.9800000190734863D;
this.motionZ *= 0.9800000190734863D;
this.particleScale *= 0.51f;
this.particleAlpha *= 0.51f;
}

View File

@ -57,9 +57,6 @@ public class EnergyFx extends ParticleBreaking
this.startBlkX = MathHelper.floor_double( this.posX );
this.startBlkY = MathHelper.floor_double( this.posY );
this.startBlkZ = MathHelper.floor_double( this.posZ );
//TODO 1.9.4 - noClip => ?
this.noClip = true;
}
@Override
@ -106,9 +103,23 @@ public class EnergyFx extends ParticleBreaking
@Override
public void onUpdate()
{
super.onUpdate();
this.particleScale *= 0.89f;
this.particleAlpha *= 0.89f;
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
if (this.particleAge++ >= this.particleMaxAge)
{
this.setExpired();
}
this.motionY -= 0.04D * (double)this.particleGravity;
this.moveEntity(this.motionX, this.motionY, this.motionZ);
this.motionX *= 0.9800000190734863D;
this.motionY *= 0.9800000190734863D;
this.motionZ *= 0.9800000190734863D;
this.particleScale *= 0.89f;
this.particleAlpha *= 0.89f;
}
public void setMotionX( float motionX )

View File

@ -35,8 +35,6 @@ public class LightningArcFX extends LightningFX
public LightningArcFX( final World w, final double x, final double y, final double z, final double ex, final double ey, final double ez, final double r, final double g, final double b )
{
super( w, x, y, z, r, g, b, 6 );
//TODO 1.9.4 - noClip => ?
this.noClip = true;
this.rx = ex - x;
this.ry = ey - y;

View File

@ -55,8 +55,6 @@ public class LightningFX extends Particle
this.motionY = 0;
this.motionZ = 0;
this.particleMaxAge = maxAge;
//TODO 1.9.4 - noClip => ?
this.noClip = true;
}
protected void regen()
@ -83,6 +81,25 @@ public class LightningFX extends Particle
final int j1 = 13;
return j1 << 20 | j1 << 4;
}
@Override
public void onUpdate()
{
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
if (this.particleAge++ >= this.particleMaxAge)
{
this.setExpired();
}
this.motionY -= 0.04D * (double)this.particleGravity;
this.moveEntity(this.motionX, this.motionY, this.motionZ);
this.motionX *= 0.9800000190734863D;
this.motionY *= 0.9800000190734863D;
this.motionZ *= 0.9800000190734863D;
}
@Override
public void renderParticle( final VertexBuffer tess, final Entity p_180434_2_, final float l, final float rX, final float rY, final float rZ, final float rYZ, final float rXY )

View File

@ -48,8 +48,6 @@ public class MatterCannonFX extends ParticleBreaking
this.motionY = 0.0f;
this.motionZ = 0.0f;
this.particleTextureIndex = ExtraBlockTextures.BlockMatterCannonParticle.getIcon().getAtlas();
//TODO 1.9.4 - noClip => ?
this.noClip = true;
}
public void fromItem( final AEPartLocation d )
@ -60,7 +58,21 @@ public class MatterCannonFX extends ParticleBreaking
@Override
public void onUpdate()
{
super.onUpdate();
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
if (this.particleAge++ >= this.particleMaxAge)
{
this.setExpired();
}
this.motionY -= 0.04D * (double)this.particleGravity;
this.moveEntity(this.motionX, this.motionY, this.motionZ);
this.motionX *= 0.9800000190734863D;
this.motionY *= 0.9800000190734863D;
this.motionZ *= 0.9800000190734863D;
this.particleScale *= 1.19f;
this.particleAlpha *= 0.59f;
}

View File

@ -46,8 +46,6 @@ public class VibrantFX extends Particle
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
this.particleMaxAge = (int) ( 20.0D / ( Math.random() * 0.8D + 0.1D ) );
//TODO 1.9.4 - noClip => ?
this.noClip = true;
}
@Override

View File

@ -365,11 +365,10 @@ public class ContainerCraftConfirm extends AEBaseContainer
return new PlayerSource( this.getPlayerInv().player, (IActionHost) this.getTarget() );
}
//TODO 1.9.4 - removeCraftingFromCrafters => ?
@Override
public void removeCraftingFromCrafters( final IContainerListener c )
public void removeListener( final IContainerListener c )
{
super.removeCraftingFromCrafters( c );
super.removeListener( c );
if( this.getJob() != null )
{
this.getJob().cancel( true );

View File

@ -152,11 +152,10 @@ public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorH
this.setEstimatedTime( -1 );
}
//TODO 1.9.4 - removeCraftingFromCrafters => ?
@Override
public void removeCraftingFromCrafters( final IContainerListener c )
public void removeListener( final IContainerListener c )
{
super.removeCraftingFromCrafters( c );
super.removeListener( c );
if( this.listeners.isEmpty() && this.getMonitor() != null )
{

View File

@ -300,11 +300,10 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
super.onUpdate( field, oldValue, newValue );
}
//TODO 1.9.4 - onCraftGuiOpened => ?
@Override
public void onCraftGuiOpened( final IContainerListener c )
public void addListener( final IContainerListener c )
{
super.onCraftGuiOpened( c );
super.addListener( c );
this.queueInventory( c );
}

View File

@ -24,6 +24,7 @@ import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumHand;
import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent;
@ -174,8 +175,7 @@ public class ContainerQuartzKnife extends AEBaseContainer implements IAEAppEngIn
if( item.stackSize == 0 )
{
this.getPlayerInv().mainInventory[this.getPlayerInv().currentItem] = null;
//TODO 1.9.4 - 2 hands. Just do something!
MinecraftForge.EVENT_BUS.post( new PlayerDestroyItemEvent( this.getPlayerInv().player, item ) );
MinecraftForge.EVENT_BUS.post( new PlayerDestroyItemEvent( this.getPlayerInv().player, item, null ) );
}
return true;

View File

@ -70,12 +70,12 @@ public final class AppEng
public static final String ASSETS = "appliedenergistics2:";
public static final String MOD_DEPENDENCIES =
// a few mods, AE should load after, probably.
// required-after:AppliedEnergistics2API|all;
// "after:gregtech_addon;after:Mekanism;after:IC2;after:ThermalExpansion;after:BuildCraft|Core;" +
// a few mods, AE should load after, probably.
// required-after:AppliedEnergistics2API|all;
// "after:gregtech_addon;after:Mekanism;after:IC2;after:ThermalExpansion;after:BuildCraft|Core;" +
// depend on version of forge used for build.
"after:appliedenergistics2-core;" + "required-after:Forge@[" // require forge.
// depend on version of forge used for build.
"after:appliedenergistics2-core;" + "required-after:Forge@[" // require forge.
+ net.minecraftforge.common.ForgeVersion.majorVersion + '.' // majorVersion
+ net.minecraftforge.common.ForgeVersion.minorVersion + '.' // minorVersion
+ net.minecraftforge.common.ForgeVersion.revisionVersion + '.' // revisionVersion

View File

@ -25,8 +25,9 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.fml.common.registry.GameRegistry;
public class FacadeConfig extends Configuration
@ -48,8 +49,7 @@ public class FacadeConfig extends Configuration
return false;
}
//TODO 1.9.4 - UniqueIdentifier => ResourceLocation ???
final UniqueIdentifier blk = GameRegistry.findUniqueIdentifierFor( id );
final ResourceLocation blk = Item.REGISTRY.getNameForObject( Item.getItemFromBlock( id ) );
if( blk == null )
{
for( final Field f : Block.class.getFields() )
@ -69,8 +69,8 @@ public class FacadeConfig extends Configuration
}
else
{
final Matcher mod = this.replacementPattern.matcher( blk.modId );
final Matcher name = this.replacementPattern.matcher( blk.name );
final Matcher mod = this.replacementPattern.matcher( blk.getResourceDomain() );
final Matcher name = this.replacementPattern.matcher( blk.getResourcePath() );
return this.get( mod.replaceAll( "" ), name.replaceAll( "" ) + ( metadata == 0 ? "" : "." + metadata ), automatic ).getBoolean( automatic );
}

View File

@ -20,6 +20,8 @@ package appeng.core;
import java.io.File;
import java.util.HashSet;
import java.util.Set;
import javax.annotation.Nonnull;
@ -46,7 +48,6 @@ import appeng.api.config.Upgrades;
import appeng.api.definitions.IBlocks;
import appeng.api.definitions.IDefinitions;
import appeng.api.definitions.IItems;
import appeng.api.definitions.IMaterials;
import appeng.api.definitions.IParts;
import appeng.api.features.IRecipeHandlerRegistry;
import appeng.api.features.IRegistryContainer;
@ -74,6 +75,7 @@ import appeng.core.localization.PlayerMessages;
import appeng.core.stats.PlayerStatsRegistration;
import appeng.hooks.TickHandler;
import appeng.items.materials.MultiItem;
import appeng.loot.ChestLoot;
import appeng.me.cache.CraftingGridCache;
import appeng.me.cache.EnergyGridCache;
import appeng.me.cache.GridStorageCache;
@ -198,14 +200,19 @@ public final class Registration
if( config.storageProviderID == -1 && force )
{
final Set<Integer> ids = new HashSet<>();
for( DimensionType type : DimensionType.values() )
{
ids.add( type.getId() );
}
config.storageProviderID = -11;
//TODO 1.9.4 - Storage provider ids aren't stored anywhere, so no way to find free one. Do something with this!
while( DimensionManager.isDimensionRegistered( config.storageProviderID ) )
while( ids.contains( config.storageProviderID ) )
{
config.storageProviderID--;
}
storageDimensionType = DimensionType.register( "Storage Cell", "_cell", config.storageProviderID, StorageWorldProvider.class, false );
config.save();
@ -278,9 +285,13 @@ public final class Registration
FMLCommonHandler.instance().bus().register( TickHandler.INSTANCE );
MinecraftForge.EVENT_BUS.register( TickHandler.INSTANCE );
final PartPlacement pp = new PartPlacement();
MinecraftForge.EVENT_BUS.register( pp );
FMLCommonHandler.instance().bus().register( pp );
MinecraftForge.EVENT_BUS.register( new PartPlacement() );
if( AEConfig.instance.isFeatureEnabled( AEFeature.ChestLoot ) )
{
MinecraftForge.EVENT_BUS.register( new ChestLoot() );
}
final IGridCacheRegistry gcr = registries.gridCache();
gcr.registerGridCache( ITickManager.class, TickManagerCache.class );
@ -417,23 +428,6 @@ public final class Registration
registries.wireless().registerWirelessHandler( (IWirelessTermHandler) wirelessTerminalItem );
}
if( AEConfig.instance.isFeatureEnabled( AEFeature.ChestLoot ) )
{
//TODO 1.9.4 - Chest Gen => Loot Tables
final ChestGenHooks d = ChestGenHooks.getInfo( ChestGenHooks.MINESHAFT_CORRIDOR );
final IMaterials materials = definitions.materials();
for( final ItemStack crystal : materials.certusQuartzCrystal().maybeStack( 1 ).asSet() )
{
d.addItem( new WeightedRandomChestContent( crystal, 1, 4, 2 ) );
}
for( final ItemStack dust : materials.certusQuartzDust().maybeStack( 1 ).asSet() )
{
d.addItem( new WeightedRandomChestContent( dust, 1, 4, 2 ) );
}
}
// add villager trading to black smiths for a few basic materials
if( AEConfig.instance.isFeatureEnabled( AEFeature.VillagerTrading ) )
{

View File

@ -44,6 +44,7 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
@ -338,9 +339,9 @@ public class ApiPart implements IPartHelper
}
@Override
public boolean placeBus( final ItemStack is, final BlockPos pos, final EnumFacing side, final EntityPlayer player, final World w )
public boolean placeBus( final ItemStack is, final BlockPos pos, final EnumFacing side, final EntityPlayer player, final EnumHand hand, final World w )
{
return PartPlacement.place( is, pos, side, player, w, PartPlacement.PlaceType.PLACE_ITEM, 0 );
return PartPlacement.place( is, pos, side, player, hand, w, PartPlacement.PlaceType.PLACE_ITEM, 0 );
}
@Override

View File

@ -25,6 +25,7 @@ import io.netty.buffer.Unpooled;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import appeng.api.AEApi;
@ -44,10 +45,11 @@ public class PacketClick extends AppEngPacket
private final int x;
private final int y;
private final int z;
private final int side;
private EnumFacing side;
private final float hitX;
private final float hitY;
private final float hitZ;
private EnumHand hand;
// automatic.
public PacketClick( final ByteBuf stream )
@ -55,14 +57,15 @@ public class PacketClick extends AppEngPacket
this.x = stream.readInt();
this.y = stream.readInt();
this.z = stream.readInt();
this.side = stream.readInt();
this.side = EnumFacing.values()[ stream.readByte() ];
this.hitX = stream.readFloat();
this.hitY = stream.readFloat();
this.hitZ = stream.readFloat();
this.hand = EnumHand.values()[ stream.readByte() ];
}
// api
public PacketClick( final BlockPos pos, final EnumFacing side, final float hitX, final float hitY, final float hitZ )
public PacketClick( final BlockPos pos, final EnumFacing side, final float hitX, final float hitY, final float hitZ, final EnumHand hand )
{
final ByteBuf data = Unpooled.buffer();
@ -71,10 +74,11 @@ public class PacketClick extends AppEngPacket
data.writeInt( this.x = pos.getX() );
data.writeInt( this.y = pos.getY() );
data.writeInt( this.z = pos.getZ() );
data.writeInt( this.side = side.ordinal() );
data.writeByte( side.ordinal() );
data.writeFloat( this.hitX = hitX );
data.writeFloat( this.hitY = hitY );
data.writeFloat( this.hitZ = hitZ );
data.writeByte( hand.ordinal() );
this.configureWrite( data );
}
@ -92,7 +96,7 @@ public class PacketClick extends AppEngPacket
if( is.getItem() instanceof ToolNetworkTool )
{
final ToolNetworkTool tnt = (ToolNetworkTool) is.getItem();
tnt.serverSideToolLogic( is, player, player.worldObj, new BlockPos( this.x, this.y, this.z ), EnumFacing.VALUES[this.side], this.hitX, this.hitY, this.hitZ );
tnt.serverSideToolLogic( is, player, this.hand, player.worldObj, new BlockPos( this.x, this.y, this.z ), this.side, this.hitX, this.hitY, this.hitZ );
}
else if( maybeMemoryCard.isSameAs( is ) )

View File

@ -41,8 +41,8 @@ import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import appeng.api.storage.data.IAEItemStack;
import appeng.client.gui.implementations.GuICraftingCPU;
import appeng.client.gui.implementations.GuiCraftConfirm;
import appeng.client.gui.implementations.GuiCraftingCPU;
import appeng.client.gui.implementations.GuiMEMonitorable;
import appeng.client.gui.implementations.GuiNetworkStatus;
import appeng.core.AELog;
@ -154,9 +154,9 @@ public class PacketMEInventoryUpdate extends AppEngPacket
( (GuiCraftConfirm) gs ).postUpdate( this.list, this.ref );
}
if( gs instanceof GuICraftingCPU )
if( gs instanceof GuiCraftingCPU )
{
( (GuICraftingCPU) gs ).postUpdate( this.list, this.ref );
( (GuiCraftingCPU) gs ).postUpdate( this.list, this.ref );
}
if( gs instanceof GuiMEMonitorable )

View File

@ -25,6 +25,7 @@ import io.netty.buffer.Unpooled;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import appeng.core.CommonHelper;
@ -41,6 +42,7 @@ public class PacketPartPlacement extends AppEngPacket
private int z;
private int face;
private float eyeHeight;
private EnumHand hand;
// automatic.
public PacketPartPlacement( final ByteBuf stream )
@ -50,10 +52,11 @@ public class PacketPartPlacement extends AppEngPacket
this.z = stream.readInt();
this.face = stream.readByte();
this.eyeHeight = stream.readFloat();
this.hand = EnumHand.values()[ stream.readByte() ];
}
// api
public PacketPartPlacement( final BlockPos pos, final EnumFacing face, final float eyeHeight )
public PacketPartPlacement( final BlockPos pos, final EnumFacing face, final float eyeHeight, final EnumHand hand )
{
final ByteBuf data = Unpooled.buffer();
@ -63,6 +66,7 @@ public class PacketPartPlacement extends AppEngPacket
data.writeInt( pos.getZ() );
data.writeByte( face.ordinal() );
data.writeFloat( eyeHeight );
data.writeByte( hand.ordinal() );
this.configureWrite( data );
}
@ -73,8 +77,7 @@ public class PacketPartPlacement extends AppEngPacket
final EntityPlayerMP sender = (EntityPlayerMP) player;
CommonHelper.proxy.updateRenderMode( sender );
PartPlacement.setEyeHeight( this.eyeHeight );
//TODO 1.9.4 - 2 hands! Just do something!
PartPlacement.place( sender.getHeldItem(), new BlockPos( this.x, this.y, this.z ), EnumFacing.VALUES[this.face], sender, sender.worldObj, PartPlacement.PlaceType.INTERACT_FIRST_PASS, 0 );
PartPlacement.place( sender.getHeldItem( hand ), new BlockPos( this.x, this.y, this.z ), EnumFacing.VALUES[this.face], sender, hand, sender.worldObj, PartPlacement.PlaceType.INTERACT_FIRST_PASS, 0 );
CommonHelper.proxy.updateRenderMode( null );
}
}

View File

@ -33,12 +33,13 @@ import net.minecraft.client.gui.GuiScreen;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumHand;
import appeng.api.config.FuzzyMode;
import appeng.api.config.Settings;
import appeng.api.util.IConfigManager;
import appeng.api.util.IConfigurableObject;
import appeng.client.gui.implementations.GuICraftingCPU;
import appeng.client.gui.implementations.GuiCraftingCPU;
import appeng.container.AEBaseContainer;
import appeng.container.implementations.ContainerCellWorkbench;
import appeng.container.implementations.ContainerCraftConfirm;
@ -97,10 +98,23 @@ public class PacketValueConfig extends AppEngPacket
{
final Container c = player.openContainer;
//TODO 1.9.4 - 2 hands! Just do something!
if( this.Name.equals( "Item" ) && player.getHeldItem() != null && player.getHeldItem().getItem() instanceof IMouseWheelItem )
if( this.Name.equals( "Item" ) && ( ( player.getHeldItem( EnumHand.MAIN_HAND ) != null && player.getHeldItem(EnumHand.MAIN_HAND).getItem() instanceof IMouseWheelItem ) || ( player.getHeldItem( EnumHand.OFF_HAND ) != null && player.getHeldItem(EnumHand.OFF_HAND).getItem() instanceof IMouseWheelItem ) ) )
{
final ItemStack is = player.getHeldItem();
final EnumHand hand;
if( player.getHeldItem( EnumHand.MAIN_HAND ) != null && player.getHeldItem( EnumHand.MAIN_HAND ).getItem() instanceof IMouseWheelItem )
{
hand = EnumHand.MAIN_HAND;
}
else if( player.getHeldItem( EnumHand.OFF_HAND ) != null && player.getHeldItem( EnumHand.OFF_HAND ).getItem() instanceof IMouseWheelItem )
{
hand = EnumHand.OFF_HAND;
}
else
{
return;
}
final ItemStack is = player.getHeldItem( hand );
final IMouseWheelItem si = (IMouseWheelItem) is.getItem();
si.onWheel( is, this.Value.equals( "WheelUp" ) );
}
@ -250,9 +264,9 @@ public class PacketValueConfig extends AppEngPacket
else if( this.Name.equals( "CraftingStatus" ) && this.Value.equals( "Clear" ) )
{
final GuiScreen gs = Minecraft.getMinecraft().currentScreen;
if( gs instanceof GuICraftingCPU )
if( gs instanceof GuiCraftingCPU )
{
( (GuICraftingCPU) gs ).clearItems();
( (GuiCraftingCPU) gs ).clearItems();
}
}
else if( c instanceof IConfigurableObject )

View File

@ -139,6 +139,7 @@ public class ToolReplicatorCard extends AEBaseItem
final BlockPos d = new BlockPos( i + rel_x, j + rel_y, k + rel_z );
final IBlockState state = src_w.getBlockState( p );
final Block blk = state.getBlock();
final IBlockState prev = world.getBlockState( d );
world.setBlockState( d, state );
if( blk != null && blk.hasTileEntity( state ) )
@ -150,8 +151,7 @@ public class ToolReplicatorCard extends AEBaseItem
nte.readFromNBT( (NBTTagCompound) data.copy() );
world.setTileEntity( d, nte );
}
//TODO 1.9.4 - markBlockForUpdate => ?
world.markBlockForUpdate( d );
world.notifyBlockUpdate( d, prev, state, 3 );
}
}
}

View File

@ -28,11 +28,11 @@ import net.minecraft.world.World;
public final class EntityFloatingItem extends EntityItem
{
private final Entity parent;
private final ICanDie parent;
private int superDeath = 0;
private float progress = 0;
public EntityFloatingItem( final Entity parent, final World world, final double x, final double y, final double z, final ItemStack stack )
public EntityFloatingItem( final ICanDie parent, final World world, final double x, final double y, final double z, final ItemStack stack )
{
super( world, x, y, z, stack );
this.motionX = this.motionY = this.motionZ = 0.0d;
@ -46,7 +46,7 @@ public final class EntityFloatingItem extends EntityItem
@Override
public void onUpdate()
{
if( !this.isDead && this.parent.isDead )
if( !this.isDead && this.parent.isDead() )
{
this.setDead();
}

View File

@ -0,0 +1,8 @@
package appeng.entity;
public interface ICanDie
{
public boolean isDead();
}

View File

@ -65,7 +65,7 @@ public final class DispenserMatterCannon extends BehaviorDefaultDispenseItem
p.posY += dir.yOffset;
p.posZ += dir.zOffset;
dispensedItem = tm.onItemRightClick( dispensedItem, w, p );
dispensedItem = tm.onItemRightClick( dispensedItem, w, p, null ).getResult();
}
}
return dispensedItem;

View File

@ -22,12 +22,17 @@ package appeng.items.misc;
import java.util.EnumSet;
import java.util.List;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.ItemMeshDefinition;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.client.renderer.color.IBlockColor;
import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@ -36,6 +41,7 @@ import appeng.client.ClientHelper;
import appeng.core.features.AEFeature;
import appeng.core.localization.GuiText;
import appeng.items.AEBaseItem;
import appeng.util.Platform;
public class ItemPaintBall extends AEBaseItem
@ -47,6 +53,11 @@ public class ItemPaintBall extends AEBaseItem
{
this.setFeature( EnumSet.of( AEFeature.PaintBalls ) );
this.setHasSubtypes( true );
if( Platform.isClient() )
{
Minecraft.getMinecraft().getItemColors().registerItemColorHandler( new ItemPaintBallColor(), this );
}
}
@Override
@ -82,29 +93,6 @@ public class ItemPaintBall extends AEBaseItem
return ( is.getItemDamage() >= DAMAGE_THRESHOLD ? GuiText.Lumen.getLocal() + ' ' : "" ) + this.getColor( is );
}
//TODO 1.9.4 - Move to IItemColor
@Override
public int getColorFromItemStack( final ItemStack stack, final int renderPass )
{
final AEColor col = this.getColor( stack );
final int colorValue = stack.getItemDamage() >= 20 ? col.mediumVariant : col.mediumVariant;
final int r = ( colorValue >> 16 ) & 0xff;
final int g = ( colorValue >> 8 ) & 0xff;
final int b = ( colorValue ) & 0xff;
if( stack.getItemDamage() >= 20 )
{
final float fail = 0.7f;
final int full = (int) ( 255 * 0.3 );
return (int) ( full + r * fail ) << 16 | (int) ( full + g * fail ) << 8 | (int) ( full + b * fail ) | 0xff << 24;
}
else
{
return r << 16 | g << 8 | b | 0xff << 24;
}
}
public AEColor getColor( final ItemStack is )
{
int dmg = is.getItemDamage();
@ -146,4 +134,32 @@ public class ItemPaintBall extends AEBaseItem
final int dmg = is.getItemDamage();
return dmg >= DAMAGE_THRESHOLD;
}
@SideOnly( Side.CLIENT )
public class ItemPaintBallColor implements IItemColor
{
@Override
public int getColorFromItemstack( ItemStack stack, int tintIndex )
{
final AEColor col = getColor( stack );
final int colorValue = stack.getItemDamage() >= 20 ? col.mediumVariant : col.mediumVariant;
final int r = ( colorValue >> 16 ) & 0xff;
final int g = ( colorValue >> 8 ) & 0xff;
final int b = ( colorValue ) & 0xff;
if( stack.getItemDamage() >= 20 )
{
final float fail = 0.7f;
final int full = (int) ( 255 * 0.3 );
return (int) ( full + r * fail ) << 16 | (int) ( full + g * fail ) << 8 | (int) ( full + b * fail ) | 0xff << 24;
}
else
{
return r << 16 | g << 8 | b | 0xff << 24;
}
}
}
}

View File

@ -71,7 +71,7 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
@Override
public EnumActionResult onItemUseFirst( final ItemStack is, final EntityPlayer player, final World world, final BlockPos pos, final EnumFacing side, final float hitX, final float hitY, final float hitZ, final EnumHand hand )
{
return AEApi.instance().partHelper().placeBus( is, pos, side, player, world ) ? EnumActionResult.SUCCESS : EnumActionResult.FAIL;
return AEApi.instance().partHelper().placeBus( is, pos, side, player, hand, world ) ? EnumActionResult.SUCCESS : EnumActionResult.FAIL;
}
@Override
@ -169,10 +169,9 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
ds[0] = Item.getIdFromItem( l.getItem() );
ds[1] = metadata;
data.setIntArray( "x", ds );
//TODO 1.9.4 - UniqueIdentifier => ResourceLocation ???
final UniqueIdentifier ui = GameRegistry.findUniqueIdentifierFor( l.getItem() );
data.setString( "modid", ui.modId );
data.setString( "itemname", ui.name );
final ResourceLocation ui = Item.REGISTRY.getNameForObject( l.getItem() );
data.setString( "modid", ui.getResourceDomain() );
data.setString( "itemname", ui.getResourcePath() );
is.setTagCompound( data );
return is;
}

View File

@ -186,7 +186,7 @@ public final class ItemMultiPart extends AEBaseItem implements IPartItem, IItemG
return EnumActionResult.PASS;
}
return AEApi.instance().partHelper().placeBus( is, pos, side, player, w ) ? EnumActionResult.SUCCESS : EnumActionResult.FAIL;
return AEApi.instance().partHelper().placeBus( is, pos, side, player, hand, w ) ? EnumActionResult.SUCCESS : EnumActionResult.FAIL;
}
@Override

View File

@ -124,7 +124,7 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench /
if( Platform.isClient() )
{
NetworkHandler.instance.sendToServer( new PacketClick( pos, side, hitX, hitY, hitZ ) );
NetworkHandler.instance.sendToServer( new PacketClick( pos, side, hitX, hitY, hitZ, hand ) );
}
return EnumActionResult.SUCCESS;
}
@ -135,12 +135,10 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench /
return true;
}
public boolean serverSideToolLogic( final ItemStack is, final EntityPlayer p, final World w, final BlockPos pos, final EnumFacing side, final float hitX, final float hitY, final float hitZ )
public boolean serverSideToolLogic( final ItemStack is, final EntityPlayer p, final EnumHand hand, final World w, final BlockPos pos, final EnumFacing side, final float hitX, final float hitY, final float hitZ )
{
if( side != null )
{
//TODO 1.9.4 - 2 hands! Just do something!
final EnumHand hand = EnumHand.MAIN_HAND;
if( !Platform.hasPermissions( new DimensionalCoord( w, pos ), p ) )
{
return false;

View File

@ -226,8 +226,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
@Override
public ActionResult<ItemStack> onItemRightClick( final ItemStack item, final World w, final EntityPlayer p, final EnumHand hand )
{
//TODO 1.9.4 - getRayTraceResultFromPlayer => ?
final RayTraceResult target = this.getRayTraceResultFromPlayer( w, p, true );
final RayTraceResult target = this.rayTrace( w, p, true );
if( target == null )
{

View File

@ -22,6 +22,8 @@ package appeng.items.tools.powered;
import java.util.EnumSet;
import java.util.List;
import javax.annotation.Nullable;
import com.google.common.base.Optional;
import net.minecraft.block.Block;
@ -117,7 +119,7 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
}
@Override
public ActionResult<ItemStack> onItemRightClick( final ItemStack item, final World w, final EntityPlayer p, final EnumHand hand )
public ActionResult<ItemStack> onItemRightClick( final ItemStack item, final World w, final EntityPlayer p, final @Nullable EnumHand hand )
{
if( this.getAECurrentPower( item ) > 1600 )
{

View File

@ -0,0 +1,36 @@
package appeng.loot;
import com.google.common.collect.FluentIterable;
import com.google.common.collect.Iterables;
import net.minecraft.item.ItemStack;
import net.minecraft.world.storage.loot.LootEntry;
import net.minecraft.world.storage.loot.LootEntryItem;
import net.minecraft.world.storage.loot.LootPool;
import net.minecraft.world.storage.loot.LootTableList;
import net.minecraft.world.storage.loot.RandomValueRange;
import net.minecraft.world.storage.loot.conditions.LootCondition;
import net.minecraft.world.storage.loot.conditions.RandomChance;
import net.minecraft.world.storage.loot.functions.LootFunction;
import net.minecraft.world.storage.loot.functions.SetMetadata;
import net.minecraftforge.event.LootTableLoadEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import appeng.api.AEApi;
import appeng.api.definitions.IMaterials;
public class ChestLoot
{
@SubscribeEvent
public void loadLootTable( LootTableLoadEvent event ){
if( event.getName() == LootTableList.CHESTS_ABANDONED_MINESHAFT )
{
//TODO 1.9.4 aftermath - All these loot quality, pools and stuff. Figure it out and balance it.
final IMaterials materials = AEApi.instance().definitions().materials();
event.getTable().addPool( new LootPool( ( ( FluentIterable<LootEntryItem> ) Iterables.transform( materials.certusQuartzCrystal().maybeStack( 1 ).asSet(), ( ItemStack itemstack ) -> new LootEntryItem( itemstack.getItem(), 2, 3, new LootFunction[]{ new SetMetadata(null, new RandomValueRange( itemstack.getItemDamage() ))}, new LootCondition[]{ new RandomChance( 1 ) }, "AE2 Crystal_" + itemstack.getItemDamage() ) ) ).toArray( LootEntryItem.class ), null, new RandomValueRange( 1, 4 ), new RandomValueRange( 0, 2 ), "AE2 Crystals" ) );
event.getTable().addPool( new LootPool( ( ( FluentIterable<LootEntryItem> ) Iterables.transform( materials.certusQuartzDust().maybeStack( 1 ).asSet(), ( ItemStack itemstack ) -> new LootEntryItem( itemstack.getItem(), 2, 3, new LootFunction[]{ new SetMetadata(null, new RandomValueRange( itemstack.getItemDamage() ))}, new LootCondition[]{ new RandomChance( 1 ) }, "AE2 Dust_" + itemstack.getItemDamage() ) ) ).toArray( LootEntryItem.class ), null, new RandomValueRange( 1, 4 ), new RandomValueRange( 0, 2 ), "AE2 Dusts" ) );
}
}
}

View File

@ -39,6 +39,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
@ -493,39 +494,39 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost,
}
@Override
public final boolean onActivate( final EntityPlayer player, final Vec3d pos )
public final boolean onActivate( final EntityPlayer player, final EnumHand hand, final Vec3d pos )
{
if( this.useMemoryCard( player ) )
{
return true;
}
return this.onPartActivate( player, pos );
return this.onPartActivate( player, hand, pos );
}
@Override
public final boolean onShiftActivate( final EntityPlayer player, final Vec3d pos )
public final boolean onShiftActivate( final EntityPlayer player, final EnumHand hand, final Vec3d pos )
{
if( this.useMemoryCard( player ) )
{
return true;
}
return this.onPartShiftActivate( player, pos );
return this.onPartShiftActivate( player, hand, pos );
}
public boolean onPartActivate( final EntityPlayer player, final Vec3d pos )
public boolean onPartActivate( final EntityPlayer player, final EnumHand hand, final Vec3d pos )
{
return false;
}
public boolean onPartShiftActivate( final EntityPlayer player, final Vec3d pos )
public boolean onPartShiftActivate( final EntityPlayer player, final EnumHand hand, final Vec3d pos )
{
return false;
}
@Override
public void onPlacement( final EntityPlayer player, final ItemStack held, final AEPartLocation side )
public void onPlacement( final EntityPlayer player, final EnumHand hand, final ItemStack held, final AEPartLocation side )
{
this.proxy.setOwner( player );
}

View File

@ -26,6 +26,8 @@ import java.util.List;
import java.util.Random;
import java.util.Set;
import javax.annotation.Nullable;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.Entity;
@ -36,6 +38,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
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.math.Vec3d;
@ -178,7 +181,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
}
@Override
public AEPartLocation addPart( ItemStack is, final AEPartLocation side, final EntityPlayer player )
public AEPartLocation addPart( ItemStack is, final AEPartLocation side, final @Nullable EntityPlayer player, final @Nullable EnumHand hand )
{
if( this.canAddPart( is, side ) )
{
@ -216,7 +219,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
if( player != null )
{
bp.onPlacement( player, is, side );
bp.onPlacement( player, hand, is, side );
}
if( this.inWorld )
@ -271,7 +274,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
if( player != null )
{
bp.onPlacement( player, is, side );
bp.onPlacement( player, hand, is, side );
}
if( this.inWorld )
@ -802,12 +805,12 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
}
@Override
public boolean activate( final EntityPlayer player, final Vec3d pos )
public boolean activate( final EntityPlayer player, final EnumHand hand, final Vec3d pos )
{
final SelectedPart p = this.selectPart( pos );
if( p != null && p.part != null )
{
return p.part.onActivate( player, pos );
return p.part.onActivate( player, hand, pos );
}
return false;
}
@ -972,7 +975,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
else
{
this.removePart( side, false );
side = this.addPart( new ItemStack( myItem, 1, dmgValue ), side, null );
side = this.addPart( new ItemStack( myItem, 1, dmgValue ), side, null, null );
if( side != null )
{
p = this.getPart( side );
@ -1073,7 +1076,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
else
{
this.removePart( side, true );
side = this.addPart( iss, side, null );
side = this.addPart( iss, side, null, null );
if( side != null )
{
p = this.getPart( side );

View File

@ -26,6 +26,7 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
@ -47,7 +48,7 @@ public interface ICableBusContainer
void onEntityCollision( Entity e );
boolean activate( EntityPlayer player, Vec3d vecFromPool );
boolean activate( EntityPlayer player, EnumHand hand, Vec3d vecFromPool );
void onNeighborChanged();

View File

@ -26,6 +26,7 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
@ -62,7 +63,7 @@ public class NullCableBusContainer implements ICableBusContainer
}
@Override
public boolean activate( final EntityPlayer player, final Vec3d vecFromPool )
public boolean activate( final EntityPlayer player, final EnumHand hand, final Vec3d vecFromPool )
{
return false;
}

View File

@ -75,10 +75,8 @@ public class PartPlacement
private final ThreadLocal<Object> placing = new ThreadLocal<Object>();
private boolean wasCanceled = false;
public static boolean place( final ItemStack held, final BlockPos pos, EnumFacing side, final EntityPlayer player, final World world, PlaceType pass, final int depth )
public static boolean place( final ItemStack held, final BlockPos pos, EnumFacing side, final EntityPlayer player, final EnumHand hand, final World world, PlaceType pass, final int depth )
{
//TODO 1.9.4 - 2 hands! Just do something!
final EnumHand hand = EnumHand.MAIN_HAND;
if( depth > 3 )
{
return false;
@ -140,7 +138,7 @@ public class PartPlacement
else
{
player.swingArm( hand );
NetworkHandler.instance.sendToServer( new PacketPartPlacement( pos, side, getEyeOffset( player ) ) );
NetworkHandler.instance.sendToServer( new PacketPartPlacement( pos, side, getEyeOffset( player ), hand ) );
}
return true;
}
@ -191,7 +189,7 @@ public class PartPlacement
else
{
player.swingArm( hand );
NetworkHandler.instance.sendToServer( new PacketPartPlacement( pos, side, getEyeOffset( player ) ) );
NetworkHandler.instance.sendToServer( new PacketPartPlacement( pos, side, getEyeOffset( player ), hand ) );
return true;
}
}
@ -229,11 +227,11 @@ public class PartPlacement
final SelectedPart sPart = selectPart( player, host, mop.hitVec );
if( sPart != null && sPart.part != null )
{
if( sPart.part.onShiftActivate( player, mop.hitVec ) )
if( sPart.part.onShiftActivate( player, hand, mop.hitVec ) )
{
if( world.isRemote )
{
NetworkHandler.instance.sendToServer( new PacketPartPlacement( pos, side, getEyeOffset( player ) ) );
NetworkHandler.instance.sendToServer( new PacketPartPlacement( pos, side, getEyeOffset( player ), hand ) );
}
return true;
}
@ -313,7 +311,7 @@ public class PartPlacement
else
{
player.swingArm( hand );
NetworkHandler.instance.sendToServer( new PacketPartPlacement( pos, side, getEyeOffset( player ) ) );
NetworkHandler.instance.sendToServer( new PacketPartPlacement( pos, side, getEyeOffset( player ), hand ) );
return true;
}
}
@ -346,7 +344,7 @@ public class PartPlacement
// AEPartLocation.INTERNAL
// )
{
return place( held, te_pos, side.getOpposite(), player, world, pass == PlaceType.INTERACT_FIRST_PASS ? PlaceType.INTERACT_SECOND_PASS : PlaceType.PLACE_ITEM, depth + 1 );
return place( held, te_pos, side.getOpposite(), player, hand, world, pass == PlaceType.INTERACT_FIRST_PASS ? PlaceType.INTERACT_SECOND_PASS : PlaceType.PLACE_ITEM, depth + 1 );
}
}
return false;
@ -364,7 +362,7 @@ public class PartPlacement
if( sp.part != null )
{
if( !player.isSneaking() && sp.part.onActivate( player, mop.hitVec ) )
if( !player.isSneaking() && sp.part.onActivate( player, hand, mop.hitVec ) )
{
return false;
}
@ -377,7 +375,7 @@ public class PartPlacement
return false;
}
final AEPartLocation mySide = host.addPart( held, AEPartLocation.fromFacing( side ), player );
final AEPartLocation mySide = host.addPart( held, AEPartLocation.fromFacing( side ), player, hand );
if( mySide != null )
{
for( final Block multiPartBlock : multiPart.maybeBlock().asSet() )
@ -401,7 +399,7 @@ public class PartPlacement
else
{
player.swingArm( hand );
NetworkHandler.instance.sendToServer( new PacketPartPlacement( pos, side, getEyeOffset( player ) ) );
NetworkHandler.instance.sendToServer( new PacketPartPlacement( pos, side, getEyeOffset( player ), hand ) );
}
return true;
}
@ -482,7 +480,7 @@ public class PartPlacement
if( event.getEntityPlayer().isSneaking() && held != null && supportedItem )
{
NetworkHandler.instance.sendToServer( new PacketClick( event.getPos(), event.getFace(), 0, 0, 0 ) );
NetworkHandler.instance.sendToServer( new PacketClick( event.getPos(), event.getFace(), 0, 0, 0, event.getHand() ) );
}
}
}
@ -496,7 +494,7 @@ public class PartPlacement
this.placing.set( event );
final ItemStack held = event.getEntityPlayer().getHeldItem( event.getHand() );
if( place( held, event.getPos(), event.getFace(), event.getEntityPlayer(), event.getEntityPlayer().worldObj, PlaceType.INTERACT_FIRST_PASS, 0 ) )
if( place( held, event.getPos(), event.getFace(), event.getEntityPlayer(), event.getHand(), event.getEntityPlayer().worldObj, PlaceType.INTERACT_FIRST_PASS, 0 ) )
{
event.setCanceled( true );
this.wasCanceled = true;

View File

@ -25,6 +25,7 @@ import com.google.common.collect.ImmutableSet;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraftforge.fml.relauncher.Side;
@ -234,7 +235,7 @@ public class PartExportBus extends PartSharedItemBus implements ICraftingRequest
}
@Override
public boolean onPartActivate( final EntityPlayer player, final Vec3d pos )
public boolean onPartActivate( final EntityPlayer player, final EnumHand hand, final Vec3d pos )
{
if( !player.isSneaking() )
{

View File

@ -349,7 +349,7 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
}
@Override
public boolean onPartActivate( final EntityPlayer player, final Vec3d pos )
public boolean onPartActivate( final EntityPlayer player, final EnumHand hand, final Vec3d pos )
{
if( !player.isSneaking() )
{
@ -410,9 +410,6 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
@Override
public IAEItemStack injectItems( final IAEItemStack input, final Actionable type, final BaseActionSource src )
{
//TODO 1.9.4 - 2 hands! Just do something!
final EnumHand hand = EnumHand.MAIN_HAND;
if( this.blocked || input == null || input.getStackSize() <= 0 )
{
return input;
@ -466,29 +463,29 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
if( side.xOffset == 0 && side.zOffset == 0 )
{
Worked = i.onItemUse( is, player, w, tePos.offset( side.getFacing() ), hand, side.getFacing().getOpposite(), side.xOffset, side.yOffset, side.zOffset ) == EnumActionResult.SUCCESS;
Worked = i.onItemUse( is, player, w, tePos.offset( side.getFacing() ), null, side.getFacing().getOpposite(), side.xOffset, side.yOffset, side.zOffset ) == EnumActionResult.SUCCESS;
}
if( !Worked && side.xOffset == 0 && side.zOffset == 0 )
{
Worked = i.onItemUse( is, player, w, tePos.offset( side.getFacing().getOpposite() ), hand, side.getFacing(), side.xOffset, side.yOffset, side.zOffset ) == EnumActionResult.SUCCESS;
Worked = i.onItemUse( is, player, w, tePos.offset( side.getFacing().getOpposite() ), null, side.getFacing(), side.xOffset, side.yOffset, side.zOffset ) == EnumActionResult.SUCCESS;
}
if( !Worked && side.yOffset == 0 )
{
Worked = i.onItemUse( is, player, w, tePos.offset( EnumFacing.DOWN ), hand, EnumFacing.UP, side.xOffset, side.yOffset, side.zOffset ) == EnumActionResult.SUCCESS;
Worked = i.onItemUse( is, player, w, tePos.offset( EnumFacing.DOWN ), null, EnumFacing.UP, side.xOffset, side.yOffset, side.zOffset ) == EnumActionResult.SUCCESS;
}
if( !Worked )
{
i.onItemUse( is, player, w, tePos, hand, side.getFacing().getOpposite(), side.xOffset, side.yOffset, side.zOffset );
i.onItemUse( is, player, w, tePos, null, side.getFacing().getOpposite(), side.xOffset, side.yOffset, side.zOffset );
}
maxStorage -= is.stackSize;
}
else
{
i.onItemUse( is, player, w, tePos, hand, side.getFacing().getOpposite(), side.xOffset, side.yOffset, side.zOffset );
i.onItemUse( is, player, w, tePos, null, side.getFacing().getOpposite(), side.xOffset, side.yOffset, side.zOffset );
maxStorage -= is.stackSize;
}
}

View File

@ -21,6 +21,7 @@ package appeng.parts.automation;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraftforge.fml.relauncher.Side;
@ -144,7 +145,7 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin
}
@Override
public boolean onPartActivate( final EntityPlayer player, final Vec3d pos )
public boolean onPartActivate( final EntityPlayer player, final EnumHand hand, final Vec3d pos )
{
if( !player.isSneaking() )
{

View File

@ -22,6 +22,7 @@ package appeng.parts.automation;
import java.util.Collection;
import java.util.Random;
import net.minecraft.client.renderer.BlockModelRenderer;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
@ -30,6 +31,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
@ -595,8 +597,7 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
renderer.setRenderAllFaces( true );
//TODO 1.9.4 - getMixedBrightnessForBlock => ?
renderer.setBrightness( rh.getBlock().getMixedBrightnessForBlock( this.getHost().getTile().getWorld(), pos ) );
renderer.setBrightness( rh.getBlock().getPackedLightmapCoords( this.getHost().getTile().getWorld().getBlockState( pos ), this.getHost().getTile().getWorld(), pos ) );
renderer.setColorOpaque_F( 1.0F, 1.0F, 1.0F );
this.renderTorchAtAngle( pos.getX(), pos.getY(), pos.getZ(), renderer );
@ -643,7 +644,7 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
}
@Override
public boolean onPartActivate( final EntityPlayer player, final Vec3d pos )
public boolean onPartActivate( final EntityPlayer player, final EnumHand hand, final Vec3d pos )
{
if( !player.isSneaking() )
{

View File

@ -32,6 +32,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
@ -232,13 +233,13 @@ public class PartCableAnchor implements IPart
}
@Override
public boolean onActivate( final EntityPlayer player, final Vec3d pos )
public boolean onActivate( final EntityPlayer player, final EnumHand hand, final Vec3d pos )
{
return false;
}
@Override
public boolean onShiftActivate( final EntityPlayer player, final Vec3d pos )
public boolean onShiftActivate( final EntityPlayer player, final EnumHand hand, final Vec3d pos )
{
return false;
}
@ -262,7 +263,7 @@ public class PartCableAnchor implements IPart
}
@Override
public void onPlacement( final EntityPlayer player, final ItemStack held, final AEPartLocation side )
public void onPlacement( final EntityPlayer player, final EnumHand hand, final ItemStack held, final AEPartLocation side )
{
}

View File

@ -33,6 +33,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.text.ITextComponent;
@ -200,7 +201,7 @@ public class PartInterface extends PartBasicState implements IGridTickable, ISto
}
@Override
public boolean onPartActivate( final EntityPlayer p, final Vec3d pos )
public boolean onPartActivate( final EntityPlayer p, final EnumHand hand, final Vec3d pos )
{
if( p.isSneaking() )
{

View File

@ -28,6 +28,7 @@ import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraftforge.fml.relauncher.Side;
@ -317,7 +318,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
}
@Override
public boolean onPartActivate( final EntityPlayer player, final Vec3d pos )
public boolean onPartActivate( final EntityPlayer player, final EnumHand hand, final Vec3d pos )
{
if( !player.isSneaking() )
{

View File

@ -30,6 +30,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@ -226,9 +227,9 @@ public class PartToggleBus extends PartBasicState
}
@Override
public void onPlacement( final EntityPlayer player, final ItemStack held, final AEPartLocation side )
public void onPlacement( final EntityPlayer player, final EnumHand hand, final ItemStack held, final AEPartLocation side )
{
super.onPlacement( player, held, side );
super.onPlacement( player, hand, held, side );
this.getOuterProxy().setOwner( player );
}

View File

@ -145,7 +145,7 @@ public class PartCable extends AEBasePart implements IPartCable
}
this.getHost().removePart( AEPartLocation.INTERNAL, true );
this.getHost().addPart( newPart, AEPartLocation.INTERNAL, who );
this.getHost().addPart( newPart, AEPartLocation.INTERNAL, who, null );
return true;
}
}

View File

@ -28,6 +28,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@ -146,9 +147,9 @@ public class PartQuartzFiber extends AEBasePart implements IEnergyGridProvider
}
@Override
public void onPlacement( final EntityPlayer player, final ItemStack held, final AEPartLocation side )
public void onPlacement( final EntityPlayer player, final EnumHand hand, final ItemStack held, final AEPartLocation side )
{
super.onPlacement( player, held, side );
super.onPlacement( player, hand, held, side );
this.outerProxy.setOwner( player );
}

View File

@ -30,6 +30,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraftforge.fml.relauncher.Side;
@ -227,7 +228,7 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
}
@Override
public boolean onPartActivate( final EntityPlayer player, final Vec3d pos )
public boolean onPartActivate( final EntityPlayer player, final EnumHand hand, final Vec3d pos )
{
final ItemStack is = player.inventory.getCurrentItem();
@ -251,7 +252,7 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
if( testPart instanceof PartP2PTunnel )
{
this.getHost().removePart( this.getSide(), true );
final AEPartLocation dir = this.getHost().addPart( newType, this.getSide(), player );
final AEPartLocation dir = this.getHost().addPart( newType, this.getSide(), player, hand );
final IPart newBus = this.getHost().getPart( dir );
if( newBus instanceof PartP2PTunnel )
@ -365,7 +366,7 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
final long myFreq = this.getFrequency();
this.getHost().removePart( this.getSide(), false );
final AEPartLocation dir = this.getHost().addPart( newType, this.getSide(), player );
final AEPartLocation dir = this.getHost().addPart( newType, this.getSide(), player, hand );
final IPart newBus = this.getHost().getPart( dir );
if( newBus instanceof PartP2PTunnel )
@ -394,7 +395,7 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
}
@Override
public boolean onPartShiftActivate( final EntityPlayer player, final Vec3d pos )
public boolean onPartShiftActivate( final EntityPlayer player, final EnumHand hand, final Vec3d pos )
{
final ItemStack is = player.inventory.getCurrentItem();
if( is != null && is.getItem() instanceof IMemoryCard )

View File

@ -27,6 +27,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumHand;
import appeng.api.AEApi;
import appeng.api.exceptions.FailedConnection;
@ -125,9 +126,9 @@ public class PartP2PTunnelME extends PartP2PTunnel<PartP2PTunnelME> implements I
}
@Override
public void onPlacement( final EntityPlayer player, final ItemStack held, final AEPartLocation side )
public void onPlacement( final EntityPlayer player, final EnumHand hand, final ItemStack held, final AEPartLocation side )
{
super.onPlacement( player, held, side );
super.onPlacement( player, hand, held, side );
this.outerProxy.setOwner( player );
}

View File

@ -160,11 +160,8 @@ public abstract class AbstractPartMonitor extends AbstractPartDisplay implements
}
@Override
public boolean onPartActivate( final EntityPlayer player, final Vec3d pos )
{
//TODO 1.9.4 - 2 hands! Just do something!
final EnumHand hand = EnumHand.MAIN_HAND;
public boolean onPartActivate( final EntityPlayer player, final EnumHand hand, final Vec3d pos )
{
if( Platform.isClient() )
{
return true;

View File

@ -27,6 +27,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
@ -189,7 +190,7 @@ public abstract class AbstractPartReporting extends AEBasePart implements IPartM
}
@Override
public boolean onPartActivate( final EntityPlayer player, final Vec3d pos )
public boolean onPartActivate( final EntityPlayer player, final EnumHand hand, final Vec3d pos )
{
final TileEntity te = this.getTile();
@ -225,14 +226,14 @@ public abstract class AbstractPartReporting extends AEBasePart implements IPartM
}
else
{
return super.onPartActivate( player, pos );
return super.onPartActivate( player, hand, pos );
}
}
@Override
public final void onPlacement( final EntityPlayer player, final ItemStack held, final AEPartLocation side )
public final void onPlacement( final EntityPlayer player, final EnumHand hand, final ItemStack held, final AEPartLocation side )
{
super.onPlacement( player, held, side );
super.onPlacement( player, hand, held, side );
final byte rotation = (byte) ( MathHelper.floor_double( ( player.rotationYaw * 4F ) / 360F + 2.5D ) & 3 );
if( side == AEPartLocation.UP )

View File

@ -25,6 +25,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.Vec3d;
import appeng.api.config.Settings;
@ -110,9 +111,9 @@ public abstract class AbstractPartTerminal extends AbstractPartDisplay implement
}
@Override
public boolean onPartActivate( final EntityPlayer player, final Vec3d pos )
public boolean onPartActivate( final EntityPlayer player, final EnumHand hand, final Vec3d pos )
{
if( !super.onPartActivate( player, pos ) )
if( !super.onPartActivate( player, hand, pos ) )
{
if( !player.isSneaking() )
{

View File

@ -55,11 +55,8 @@ public class PartConversionMonitor extends AbstractPartMonitor
}
@Override
public boolean onPartShiftActivate( final EntityPlayer player, final Vec3d pos )
public boolean onPartShiftActivate( final EntityPlayer player, final EnumHand hand, final Vec3d pos )
{
//TODO 1.9.4 - 2 hands! Just do something!
final EnumHand hand = EnumHand.MAIN_HAND;
if( Platform.isClient() )
{
return true;

View File

@ -21,6 +21,7 @@ package appeng.parts.reporting;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.Vec3d;
import appeng.client.texture.CableBusTextures;
@ -40,9 +41,9 @@ public class PartInterfaceTerminal extends AbstractPartDisplay
}
@Override
public boolean onPartActivate( final EntityPlayer player, final Vec3d pos )
public boolean onPartActivate( final EntityPlayer player, final EnumHand hand, final Vec3d pos )
{
if( !super.onPartActivate( player, pos ) )
if( !super.onPartActivate( player, hand, pos ) )
{
if( !player.isSneaking() )
{

View File

@ -40,8 +40,8 @@ import com.google.common.collect.HashMultimap;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.LoaderState;
import net.minecraftforge.fml.common.registry.GameRegistry;
import appeng.api.AEApi;
import appeng.api.definitions.IBlocks;
@ -118,11 +118,10 @@ public class RecipeHandler implements IRecipeHandler
{
Preconditions.checkNotNull( is );
//TODO 1.9.4 - UniqueIdentifier => ResourceLocation
final UniqueIdentifier id = GameRegistry.findUniqueIdentifierFor( is.getItem() );
String realName = id.modId + ':' + id.name;
final ResourceLocation id = Item.REGISTRY.getNameForObject( is.getItem() );
String realName = id.toString();
if( !id.modId.equals( AppEng.MOD_ID ) && !id.modId.equals( "minecraft" ) )
if( !id.getResourceDomain().equals( AppEng.MOD_ID ) && !id.getResourceDomain().equals( "minecraft" ) )
{
throw new RecipeError( "Not applicable for website" );
}

View File

@ -312,8 +312,7 @@ public class CachedPlane
if( c.c.isLoaded() )
{
this.world.addTileEntity( te );
//TODO 1.9.4 - markBlockForUpdate => ?
this.world.markBlockForUpdate( pos );
this.world.notifyBlockUpdate( pos, this.world.getBlockState( pos ), this.world.getBlockState( pos ), z );
}
}

View File

@ -55,8 +55,7 @@ public class DefaultSpatialHandler implements IMovableHandler
if( c.isLoaded() )
{
w.addTileEntity( te );
//TODO 1.9.4 - markBlockForUpdate => ?
w.markBlockForUpdate( newPosition );
w.notifyBlockUpdate( newPosition, w.getBlockState( newPosition ), w.getBlockState( newPosition ), 0 );
}
}
}

View File

@ -19,6 +19,7 @@
package appeng.spatial;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.block.Block;
@ -54,6 +55,7 @@ public class StorageHelper
return instance;
}
//TODO 1.9.4 aftermath - Check that this still works.
/**
* Mostly from dimensional doors.. which mostly got it form X-Comp.
*
@ -87,28 +89,30 @@ public class StorageHelper
{
return entity;
}
//TODO 1.9.4 - Multiple passangers & cell transfers. Take a look at portals.
// Is something riding? Handle it first.
if( entity.isBeingRidden() )
// Are we riding something? Teleport it instead.
if( entity.isRiding() )
{
return this.teleportEntity( entity.riddenByEntity, link );
return this.teleportEntity( entity.getRidingEntity(), link );
}
// Are we riding something? Dismount and tell the mount to go first.
Entity cart = entity.getRidingEntity();
if( cart != null )
// Is something riding us? Handle it first.
final List<Entity> passangers = entity.getPassengers();
final List<Entity> passangersOnOtherSide = new ArrayList<>();
if( !passangers.isEmpty() )
{
entity.dismountRidingEntity();
cart = this.teleportEntity( cart, link );
// We keep track of both so we can remount them on the other side.
for( Entity passanger : passangers )
{
passanger.dismountRidingEntity();
passangersOnOtherSide.add( teleportEntity( passanger, link ) );
}
// We keep track of all so we can remount them on the other side.
}
// load the chunk!
WorldServer.class.cast( newWorld ).getChunkProvider().provideChunk( MathHelper.floor_double( link.x ) >> 4, MathHelper.floor_double( link.z ) >> 4 );
newWorld.getChunkProvider().provideChunk( MathHelper.floor_double( link.x ) >> 4, MathHelper.floor_double( link.z ) >> 4 );
final boolean diffDestination = newWorld != oldWorld;
if( diffDestination )
if( newWorld != oldWorld )
{
if( player != null )
{
@ -121,58 +125,21 @@ public class StorageHelper
}
else
{
//TODO 1.9.4 - Whole entity transfer part, we now have changeDimension method. Evaluate it and remove this s...
final int entX = entity.chunkCoordX;
final int entZ = entity.chunkCoordZ;
if( ( entity.addedToChunk ) && ( oldWorld.getChunkProvider().chunkExists( entX, entZ ) ) )
{
oldWorld.getChunkFromChunkCoords( entX, entZ ).removeEntity( entity );
oldWorld.getChunkFromChunkCoords( entX, entZ ).setModified( true );
}
final Entity newEntity = EntityList.createEntityByName( EntityList.getEntityString( entity ), newWorld );
if( newEntity != null )
{
entity.lastTickPosX = entity.prevPosX = entity.posX = link.x;
entity.lastTickPosY = entity.prevPosY = entity.posY = link.y;
entity.lastTickPosZ = entity.prevPosZ = entity.posZ = link.z;
if( entity instanceof EntityHanging )
{
final EntityHanging h = (EntityHanging) entity;
h.setPosition( link.x, link.y, link.z ); // TODO: VERIFIY THIS WORKS
}
newEntity.copyDataFromOld( entity );
newEntity.dimension = newWorld.provider.getDimension();
newEntity.forceSpawn = true;
entity.isDead = true;
entity = newEntity;
}
else
{
return null;
}
// myChunk.addEntity( entity );
// newWorld.loadedEntityList.add( entity );
// newWorld.onEntityAdded( entity );
newWorld.spawnEntityInWorld( entity );
entity.changeDimension( newWorld.provider.getDimension() );
}
}
entity.worldObj.updateEntityWithOptionalForce( entity, false );
if( cart != null )
if( !passangersOnOtherSide.isEmpty() )
{
if( player != null )
{
entity.worldObj.updateEntityWithOptionalForce( entity, true );
}
entity.startRiding( cart, false );
for( Entity passanger : passangersOnOtherSide )
{
passanger.startRiding( entity, true );
}
}
return entity;

View File

@ -74,6 +74,8 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
private EnumFacing forward = null;
private EnumFacing up = null;
private IBlockState state;
@Override
public boolean shouldRefresh( final World world, final BlockPos pos, final IBlockState oldState, final IBlockState newSate )
{
@ -113,6 +115,15 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
return src.stack( 1 );
}
@Nonnull
public IBlockState getBlockState(){
if( state == null )
{
state = worldObj.getBlockState( getPos() );
}
return state;
}
/**
* for dormant chunk cache.
*/
@ -299,8 +310,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
if( this.worldObj != null )
{
AELog.blockUpdate( this.pos, this );
//TODO 1.9.4 - markBlockForUpdate => ?
this.worldObj.markBlockForUpdate( this.pos );
this.worldObj.notifyBlockUpdate( this.pos, getBlockState(), getBlockState(), 3 );
}
}
}

View File

@ -30,6 +30,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
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.math.Vec3d;
@ -240,9 +241,9 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
}
@Override
public AEPartLocation addPart( final ItemStack is, final AEPartLocation side, final EntityPlayer player )
public AEPartLocation addPart( final ItemStack is, final AEPartLocation side, final EntityPlayer player, final EnumHand hand )
{
return this.getCableBus().addPart( is, side, player );
return this.getCableBus().addPart( is, side, player, hand );
}
@Override

View File

@ -60,6 +60,7 @@ import net.minecraft.nbt.NBTTagString;
import net.minecraft.network.Packet;
import net.minecraft.network.play.server.SPacketChunkData;
import net.minecraft.server.management.PlayerChunkMap;
import net.minecraft.server.management.PlayerChunkMapEntry;
import net.minecraft.stats.Achievement;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityChest;
@ -160,9 +161,7 @@ public class Platform
private static final Random RANDOM_GENERATOR = new Random();
private static final WeakHashMap<World, EntityPlayer> FAKE_PLAYERS = new WeakHashMap<World, EntityPlayer>();
private static Field tagList;
private static Class playerInstance;
private static Method getOrCreateChunkWatcher;
private static Method sendToAllPlayersWatchingChunk;
private static Method getEntry;
public static Random getRandom()
{
@ -2129,7 +2128,6 @@ public class Platform
return is;
}
//TODO 1.9.4 - What do we want to do with this? Seriously, it wont work now, so JUST DO SOMETHING!
public static void sendChunk( final Chunk c, final int verticalBits )
{
try
@ -2137,27 +2135,17 @@ public class Platform
final WorldServer ws = (WorldServer) c.getWorld();
final PlayerChunkMap pm = ws.getPlayerChunkMap();
if( getOrCreateChunkWatcher == null )
if( getEntry == null )
{
getOrCreateChunkWatcher = ReflectionHelper.findMethod( PlayerChunkMap.class, pm, new String[] { "getOrCreateChunkWatcher", "func_72690_a" }, int.class, int.class, boolean.class );
getEntry = ReflectionHelper.findMethod( PlayerChunkMap.class, pm, new String[] { "getEntry", "func_187301_b" }, int.class, int.class );
}
if( getOrCreateChunkWatcher != null )
if( getEntry != null )
{
final Object playerInstance = getOrCreateChunkWatcher.invoke( pm, c.xPosition, c.zPosition, false );
final PlayerChunkMapEntry playerInstance = (PlayerChunkMapEntry) getEntry.invoke( pm, c.xPosition, c.zPosition );
if( playerInstance != null )
{
Platform.playerInstance = playerInstance.getClass();
if( sendToAllPlayersWatchingChunk == null )
{
sendToAllPlayersWatchingChunk = ReflectionHelper.findMethod( Platform.playerInstance, playerInstance, new String[] { "sendToAllPlayersWatchingChunk", "func_151251_a" }, Packet.class );
}
if( sendToAllPlayersWatchingChunk != null )
{
sendToAllPlayersWatchingChunk.invoke( playerInstance, new SPacketChunkData( c, verticalBits ) );
}
playerInstance.sendPacket( new SPacketChunkData( c, verticalBits ) );
}
}
}

View File

@ -24,6 +24,7 @@ import java.util.List;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@ -48,9 +49,8 @@ public class AEItemDef
private String displayName;
@SideOnly( Side.CLIENT )
private List tooltip;
//TODO 1.9.4 - UniqueIdentifier => ?
@SideOnly( Side.CLIENT )
private UniqueIdentifier uniqueID;
private ResourceLocation uniqueID;
private OreReference isOre;
public AEItemDef( final Item it )
@ -176,12 +176,12 @@ public class AEItemDef
return tooltip;
}
UniqueIdentifier getUniqueID()
ResourceLocation getUniqueID()
{
return this.uniqueID;
}
UniqueIdentifier setUniqueID( final UniqueIdentifier uniqueID )
ResourceLocation setUniqueID( final ResourceLocation uniqueID )
{
this.uniqueID = uniqueID;
return uniqueID;

View File

@ -35,7 +35,7 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompressedStreamTools;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@ -591,7 +591,6 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
return this.getDefinition().getDisplayName();
}
//TODO 1.9.4 - UniqueIdentifier => ResourceLocation ?
@SideOnly( Side.CLIENT )
public String getModID()
{
@ -600,17 +599,17 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
return this.getModName( this.getDefinition().getUniqueID() );
}
return this.getModName( this.getDefinition().setUniqueID( GameRegistry.findUniqueIdentifierFor( this.getDefinition().getItem() ) ) );
return this.getModName( this.getDefinition().setUniqueID( Item.REGISTRY.getNameForObject( this.getDefinition().getItem() ) ) );
}
private String getModName( final UniqueIdentifier uniqueIdentifier )
private String getModName( final ResourceLocation uniqueIdentifier )
{
if( uniqueIdentifier == null )
{
return "** Null";
}
return uniqueIdentifier.modId == null ? "** Null" : uniqueIdentifier.modId;
return uniqueIdentifier.getResourceDomain() == null ? "** Null" : uniqueIdentifier.getResourceDomain();
}
IAEItemStack getLow( final FuzzyMode fuzzy, final boolean ignoreMeta )