Merge pull request #1 from xsun2001/rv3-1.7.10

merge
This commit is contained in:
Timo Ley 2020-08-21 23:53:45 +02:00 committed by GitHub
commit 5a2089941d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
40 changed files with 555 additions and 273 deletions

View File

@ -1,21 +1,24 @@
language: java
dist: trusty
branches:
only:
- rv3-1.7.10
jdk:
- oraclejdk8
- oraclejdk7
- openjdk7
- oraclejdk8
before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
cache:
directories:
- "$HOME/.gradle/caches/"
- "$HOME/.gradle/wrapper/"
- "$HOME/.gradle/caches/"
- "$HOME/.gradle/wrapper/"
install: "./gradlew setupCIWorkspace"
script: "./gradlew build test"
deploy:
provider: releases
api_key:
secure: hoIOb6WkNbwuv1T67zh4Gj1YPG2IhYzstd5m5JtbzQdAxGd/9w55tRtk6TxmHGlFnj2UR3hsvNH6LT6pUTqHUCR29LnMQwLBZUyUDYm+sg0sF26sv1FkORZrzuV0n+v3EBkDuQxuUjfzEXtPfZen4mca3EpTz2lKRm9f7Xt38yGWW3CLdgplD06N6SU2m+3f1tIneSZ5oNrKuZd6407yrS1l6UN14Z5vqmPiXga6LW+ryKhAmREULOZJSJOX7wrvGGMddMjVbySlJBz3LYPEf8ow15f5UQJ4MMu46wswSnKpDkwBelwZa/vweuGsbCmX2i0G4pO7675tHGySez1VAVK6itc4awqVRd4DHGt5X0++7nyeRLMbh/35Llsjm4QyFzepBOf2UoTVdEb6ATGVcZ4PExm3zVX3IdEw/2OweB5IkXZkYWnDnTCczfKT3AtvEyZH+6CKVFdW5KNbgWtur98uGAIuVI9T8/B4vKyfa0JfWzrtlLBdPWev4LvUsX5laOTkbmH+2K/cURVPaqX2VtMzQiM3dJvp/kwEtaRHVpift/yEyaqpHcnUmJ1rGWqkWlHfxabAQaRyWyCGsfVfmGwPJUkuHAXvKHP77MfsEsbEHlECHP8DXZfM4sm3eZiCT62Cni0JV3iIZDqolk0QLWQ84RtbbUBm1f64M/ErBSE=
file_glob: true
file: build/libs/*
skip_cleanup: true
on:

View File

@ -45,8 +45,8 @@ buildscript {
}
}
sourceCompatibility = JavaVersion.VERSION_1_6
targetCompatibility = JavaVersion.VERSION_1_6
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
version = aeversion + "-" + aechannel + "-" + aebuild
group = aegroup

View File

@ -1,6 +1,6 @@
aeversion=rv3
aechannel=beta
aebuild=16
aebuild=18
aegroup=appeng
aebasename=appliedenergistics2
@ -29,10 +29,10 @@ invtweaks_version=1.58
#########################################################
# Provided APIs #
#########################################################
fmp_version=1.2.0.345
code_chicken_lib_version=1.1.3.138
fmp_version=1.2.0.347
code_chicken_lib_version=1.1.3.140
code_chicken_core_version=1.0.7.47
nei_version=1.0.5.111
nei_version=1.0.5.120
bc_version=7.0.9
opencomputers_version=1.5.12.26
pneumaticcraft_version=1.9.15-105

View File

@ -21,10 +21,11 @@
repositories {
mavenLocal()
maven {
name "ChickenBones"
url "http://chickenbones.net/maven/"
}
// ChickenBones' maven repo is unavailable now...
// maven {
// name "ChickenBones"
// url "http://chickenbones.net/maven/"
// }
maven {
name "Mobius"
@ -109,11 +110,14 @@ dependencies {
// mods name: 'ThermalExpansion', version: "[${minecraft_version}]${texpansion_version}-dev", ext: 'jar'
// mods name: 'ThermalFoundation', version: "[${minecraft_version}]${tfoundation_version}-dev", ext: 'jar'
// I will not run minecraft with those mods. I don't know why......
compileOnly "codechicken:ForgeMultipart:${minecraft_version}-${fmp_version}:dev"
compileOnly "codechicken:CodeChickenLib:${minecraft_version}-${code_chicken_lib_version}:dev"
compileOnly "codechicken:CodeChickenCore:${minecraft_version}-${code_chicken_core_version}:dev"
compileOnly "codechicken:NotEnoughItems:${minecraft_version}-${nei_version}:dev"
// compileOnly "codechicken:ForgeMultipart:${minecraft_version}-${fmp_version}:dev"
// compileOnly "codechicken:CodeChickenLib:${minecraft_version}-${code_chicken_lib_version}:dev"
// compileOnly "codechicken:CodeChickenCore:${minecraft_version}-${code_chicken_core_version}:dev"
// compileOnly "codechicken:NotEnoughItems:${minecraft_version}-${nei_version}:dev"
compileOnly files("lib/ForgeMultipart-${minecraft_version}-${fmp_version}-dev.jar")
compileOnly files("lib/CodeChickenLib-${minecraft_version}-${code_chicken_lib_version}-dev.jar")
compileOnly files("lib/CodeChickenCore-${minecraft_version}-${code_chicken_core_version}-dev.jar")
compileOnly files("lib/NotEnoughItems-${minecraft_version}-${nei_version}-dev.jar")
compile files("lib/buildcraft-${bc_version}-dev.jar")
compile files("lib/PneumaticCraft-${minecraft_version}-${pneumaticcraft_version}-api.jar")

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -49,7 +49,9 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.event.world.BlockEvent;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@ -236,87 +238,101 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements IAEFeature,
@Override
public boolean onBlockActivated( final World w, final int x, final int y, final int z, final EntityPlayer player, final int side, final float hitX, final float hitY, final float hitZ )
{
if( player != null )
if( player != null && player.inventory.getCurrentItem() != null)
{
final ItemStack is = player.inventory.getCurrentItem();
if( is != null )
final ItemStack heldItem = player.inventory.getCurrentItem();
if( Platform.isWrench( player, heldItem, x, y, z ) && player.isSneaking() )
{
if( Platform.isWrench( player, is, x, y, z ) && player.isSneaking() )
final Block block = w.getBlock( x, y, z );
if( block == null )
{
final Block id = w.getBlock( x, y, z );
if( id != null )
{
final AEBaseTile tile = this.getTileEntity( w, x, y, z );
final ItemStack[] drops = Platform.getBlockDrops( w, x, y, z );
if( tile == null )
{
return false;
}
if( tile instanceof TileCableBus || tile instanceof TileSkyChest )
{
return false;
}
final ItemStack op = new ItemStack( this );
for( final ItemStack ol : drops )
{
if( Platform.isSameItemType( ol, op ) )
{
final NBTTagCompound tag = tile.downloadSettings( SettingsFrom.DISMANTLE_ITEM );
if( tag != null )
{
ol.setTagCompound( tag );
}
}
}
if( id.removedByPlayer( w, player, x, y, z, false ) )
{
final List<ItemStack> l = Lists.newArrayList( drops );
Platform.spawnDrops( w, x, y, z, l );
w.setBlockToAir( x, y, z );
}
}
return false;
}
if( is.getItem() instanceof IMemoryCard && !( this instanceof BlockCableBus ) )
final AEBaseTile tile = this.getTileEntity( w, x, y, z );
if( tile == null )
{
final IMemoryCard memoryCard = (IMemoryCard) is.getItem();
if( player.isSneaking() )
return false;
}
if( tile instanceof TileCableBus || tile instanceof TileSkyChest )
{
return false;
}
BlockEvent.BreakEvent event = new BlockEvent.BreakEvent( x, y, z, w, this, 0, player );
MinecraftForge.EVENT_BUS.post( event );
if( event.isCanceled() )
{
return false;
}
final ItemStack[] itemDropCandidates = Platform.getBlockDrops( w, x, y, z );
final ItemStack op = new ItemStack( this );
for( final ItemStack ol : itemDropCandidates )
{
if( Platform.isSameItemType( ol, op ) )
{
final AEBaseTile t = this.getTileEntity( w, x, y, z );
if( t != null )
final NBTTagCompound tag = tile.downloadSettings( SettingsFrom.DISMANTLE_ITEM );
if( tag != null )
{
final String name = this.getUnlocalizedName();
final NBTTagCompound data = t.downloadSettings( SettingsFrom.MEMORY_CARD );
if( data != null )
{
memoryCard.setMemoryCardContents( is, name, data );
memoryCard.notifyUser( player, MemoryCardMessages.SETTINGS_SAVED );
return true;
}
ol.setTagCompound( tag );
}
}
}
if( block.removedByPlayer( w, player, x, y, z, false) )
{
final List<ItemStack> itemsToDrop = Lists.newArrayList( itemDropCandidates );
Platform.spawnDrops( w, x, y, z, itemsToDrop );
w.setBlockToAir( x, y, z );
}
return false;
}
if( heldItem.getItem() instanceof IMemoryCard && !( this instanceof BlockCableBus ) )
{
final IMemoryCard memoryCard = (IMemoryCard) heldItem.getItem();
final AEBaseTile tileEntity = this.getTileEntity( w, x, y, z );
if( tileEntity == null )
{
return false;
}
final String name = this.getUnlocalizedName();
if( player.isSneaking() )
{
final NBTTagCompound data = tileEntity.downloadSettings( SettingsFrom.MEMORY_CARD );
if( data != null )
{
memoryCard.setMemoryCardContents( heldItem, name, data );
memoryCard.notifyUser( player, MemoryCardMessages.SETTINGS_SAVED );
}
}
else
{
final String savedName = memoryCard.getSettingsName( heldItem );
final NBTTagCompound data = memoryCard.getData( heldItem );
if( this.getUnlocalizedName().equals( savedName ) )
{
tileEntity.uploadSettings( SettingsFrom.MEMORY_CARD, data );
memoryCard.notifyUser( player, MemoryCardMessages.SETTINGS_LOADED );
}
else
{
final String name = memoryCard.getSettingsName( is );
final NBTTagCompound data = memoryCard.getData( is );
if( this.getUnlocalizedName().equals( name ) )
{
final AEBaseTile t = this.getTileEntity( w, x, y, z );
t.uploadSettings( SettingsFrom.MEMORY_CARD, data );
memoryCard.notifyUser( player, MemoryCardMessages.SETTINGS_LOADED );
}
else
{
memoryCard.notifyUser( player, MemoryCardMessages.INVALID_MACHINE );
}
return false;
memoryCard.notifyUser( player, MemoryCardMessages.INVALID_MACHINE );
}
}
return true;
}
}

View File

@ -61,6 +61,7 @@ public class BlockSkyChest extends AEBaseTileBlock implements ICustomCollision
super( Material.rock );
this.setTileEntity( TileSkyChest.class );
this.isOpaque = this.isFullSize = false;
this.hasSubtypes = true;
this.lightOpacity = 0;
this.setHardness( 50 );
this.blockResistance = 150.0f;

View File

@ -372,7 +372,7 @@ public abstract class AEBaseGui extends GuiContainer
if( slot instanceof SlotFake )
{
final InventoryAction action = mouseButton == 1 ? InventoryAction.SPLIT_OR_PLACE_SINGLE : InventoryAction.PICKUP_OR_SET_DOWN;
final InventoryAction action = ctrlDown == 1 ? InventoryAction.SPLIT_OR_PLACE_SINGLE : InventoryAction.PICKUP_OR_SET_DOWN;
if( this.drag_click.size() > 1 )
{

View File

@ -175,10 +175,17 @@ public final class AppEng
if( this.exportConfig.isExportingItemNamesEnabled() )
{
final ExportProcess process = new ExportProcess( this.recipeDirectory, this.exportConfig );
final Thread exportProcessThread = new Thread( process );
if( FMLCommonHandler.instance().getSide().isClient() )
{
final ExportProcess process = new ExportProcess( this.recipeDirectory, this.exportConfig );
final Thread exportProcessThread = new Thread( process );
this.startService( "AE2 CSV Export", exportProcessThread );
this.startService( "AE2 CSV Export", exportProcessThread );
}
else
{
AELog.info( "Disabling item.csv export for custom recipes, since creative tab information is only available on the client." );
}
}
this.registration.initialize( event, this.recipeDirectory, this.customRecipeConfig );

View File

@ -19,6 +19,7 @@
package appeng.core.localization;
import appeng.api.config.SchedulingMode;
import net.minecraft.util.StatCollector;
@ -61,7 +62,7 @@ public enum ButtonToolTips
BlockPlacement, BlockPlacementYes, BlockPlacementNo,
// Used in the tooltips of the items in the terminal, when moused over
ItemsStored, ItemsRequestable,
ItemsStored, ItemsRequestable, P2PFrequency,
SchedulingMode, SchedulingModeDefault, SchedulingModeRoundRobin, SchedulingModeRandom;

View File

@ -28,6 +28,8 @@ public enum WailaText
DeviceOnline, DeviceOffline, DeviceMissingChannel,
P2PUnlinked, P2PInputOneOutput, P2PInputManyOutputs, P2POutput,
Locked, Unlocked, Showing,
Contains, Channels;

View File

@ -27,6 +27,7 @@ import appeng.api.storage.IMEMonitor;
import appeng.api.storage.StorageChannel;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IItemList;
import appeng.util.inv.ItemListIgnoreCrafting;
public class MECraftingInventory implements IMEInventory<IAEItemStack>
@ -48,7 +49,7 @@ public class MECraftingInventory implements IMEInventory<IAEItemStack>
public MECraftingInventory()
{
this.localCache = AEApi.instance().storage().createItemList();
this.localCache = new ItemListIgnoreCrafting<>( AEApi.instance().storage().createItemList() );
this.extractedCache = null;
this.injectedCache = null;
this.missingCache = null;
@ -93,7 +94,7 @@ public class MECraftingInventory implements IMEInventory<IAEItemStack>
this.injectedCache = null;
}
this.localCache = this.target.getAvailableItems( AEApi.instance().storage().createItemList() );
this.localCache = this.target.getAvailableItems( new ItemListIgnoreCrafting<>( AEApi.instance().storage().createItemList() ) );
this.par = parent;
}
@ -132,7 +133,7 @@ public class MECraftingInventory implements IMEInventory<IAEItemStack>
this.injectedCache = null;
}
this.localCache = AEApi.instance().storage().createItemList();
this.localCache = new ItemListIgnoreCrafting<>( AEApi.instance().storage().createItemList() );
for( final IAEItemStack is : target.getStorageList() )
{
this.localCache.add( target.extractItems( is, Actionable.SIMULATE, src ) );

View File

@ -74,7 +74,7 @@ public final class EntityChargedQuartz extends AEBaseEntityItem
this.delay++;
final int j = MathHelper.floor_double( this.posX );
final int i = MathHelper.floor_double( this.posY );
final int i = MathHelper.floor_double( (this.boundingBox.minY + this.boundingBox.maxY) / 2.0D );
final int k = MathHelper.floor_double( this.posZ );
final Material mat = this.worldObj.getBlock( j, i, k ).getMaterial();

View File

@ -72,7 +72,7 @@ public final class EntityGrowingCrystal extends EntityItem
if( gc instanceof IGrowableCrystal ) // if it changes this just stops being an issue...
{
final int j = MathHelper.floor_double( this.posX );
final int i = MathHelper.floor_double( this.posY );
final int i = MathHelper.floor_double( (this.boundingBox.minY + this.boundingBox.maxY) / 2.0D );
final int k = MathHelper.floor_double( this.posZ );
final Block blk = this.worldObj.getBlock( j, i, k );

View File

@ -19,8 +19,6 @@
package appeng.helpers;
import scala.NotImplementedError;
import java.util.Iterator;
@ -58,6 +56,6 @@ public class NonNullArrayIterator<E> implements Iterator<E>
@Override
public void remove()
{
throw new NotImplementedError();
throw new UnsupportedOperationException();
}
}

View File

@ -19,13 +19,11 @@
package appeng.integration.modules.waila;
import appeng.api.parts.IPart;
import appeng.integration.modules.waila.part.*;
import java.util.List;
import com.google.common.base.Optional;
import com.google.common.collect.Lists;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@ -33,11 +31,23 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import java.util.List;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import appeng.api.parts.IPart;
import appeng.integration.modules.waila.part.ChannelWailaDataProvider;
import appeng.integration.modules.waila.part.IPartWailaDataProvider;
import appeng.integration.modules.waila.part.P2PStateWailaDataProvider;
import appeng.integration.modules.waila.part.PartAccessor;
import appeng.integration.modules.waila.part.PartStackWailaDataProvider;
import appeng.integration.modules.waila.part.PowerStateWailaDataProvider;
import appeng.integration.modules.waila.part.StorageMonitorWailaDataProvider;
import appeng.integration.modules.waila.part.Tracer;
/**
* Delegation provider for parts through {@link appeng.integration.modules.waila.part.IPartWailaDataProvider}
* Delegation provider for parts through {@link IPartWailaDataProvider}
*
* @author thatsIch
* @version rv2
@ -68,9 +78,10 @@ public final class PartWailaDataProvider implements IWailaDataProvider
final IPartWailaDataProvider channel = new ChannelWailaDataProvider();
final IPartWailaDataProvider storageMonitor = new StorageMonitorWailaDataProvider();
final IPartWailaDataProvider powerState = new PowerStateWailaDataProvider();
final IPartWailaDataProvider p2pState = new P2PStateWailaDataProvider();
final IPartWailaDataProvider partStack = new PartStackWailaDataProvider();
this.providers = Lists.newArrayList( channel, storageMonitor, powerState, partStack );
this.providers = Lists.newArrayList( channel, storageMonitor, powerState, partStack, p2pState );
}
@Override

View File

@ -0,0 +1,179 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.integration.modules.waila.part;
import java.text.NumberFormat;
import java.util.List;
import java.util.Locale;
import appeng.core.localization.ButtonToolTips;
import com.google.common.collect.Iterators;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import appeng.api.parts.IPart;
import appeng.core.localization.WailaText;
import appeng.me.GridAccessException;
import appeng.parts.p2p.PartP2PTunnel;
import appeng.util.Platform;
/**
* Provides information about a P2P tunnel to WAILA.
*/
public final class P2PStateWailaDataProvider extends BasePartWailaDataProvider
{
private static final int STATE_UNLINKED = 0;
private static final int STATE_OUTPUT = 1;
private static final int STATE_INPUT = 2;
public static final String TAG_P2P_STATE = "p2p_state";
public static final String TAG_P2P_FREQUENCY = "p2p_frequency";
/**
* Adds state to the tooltip
*
* @param part part with state
* @param currentToolTip to be added to tooltip
* @param accessor wrapper for various information
* @param config config settings
*
* @return modified tooltip
*/
@Override
public List<String> getWailaBody( final IPart part, final List<String> currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config )
{
if( part instanceof PartP2PTunnel )
{
NBTTagCompound nbtData = accessor.getNBTData();
if( nbtData.hasKey( TAG_P2P_STATE ) )
{
int[] stateArr = nbtData.getIntArray( TAG_P2P_STATE );
if( stateArr.length == 2 )
{
int state = stateArr[0];
int outputs = stateArr[1];
switch( state )
{
case STATE_UNLINKED:
currentToolTip.add( WailaText.P2PUnlinked.getLocal() );
break;
case STATE_OUTPUT:
currentToolTip.add( WailaText.P2POutput.getLocal() );
break;
case STATE_INPUT:
currentToolTip.add( getOutputText( outputs ) );
break;
}
}
final long freq = nbtData.getLong( TAG_P2P_FREQUENCY );
final String freqTooltip = String.format("%X", freq ).replaceAll("(.{4})", "$0 ").trim();
final String local = ButtonToolTips.P2PFrequency.getLocal();
currentToolTip.add( String.format( local, freqTooltip ) );
}
}
return currentToolTip;
}
@Override
public NBTTagCompound getNBTData( final EntityPlayerMP player, final IPart part, final TileEntity te, final NBTTagCompound tag, final World world, final int x, final int y, final int z )
{
if( part instanceof PartP2PTunnel )
{
final PartP2PTunnel tunnel = (PartP2PTunnel) part;
if( !tunnel.isPowered() )
{
return tag;
}
// Frquency
final long frequency = tunnel.getFrequency();
tag.setLong( TAG_P2P_FREQUENCY, frequency );
// The default state
int state = STATE_UNLINKED;
int outputCount = 0;
if( !tunnel.isOutput() )
{
outputCount = getOutputCount( tunnel );
if( outputCount > 0 )
{
// Only set it to INPUT if we know there are any outputs
state = STATE_INPUT;
}
}
else
{
PartP2PTunnel input = tunnel.getInput();
if( input != null )
{
state = STATE_OUTPUT;
}
}
tag.setIntArray( TAG_P2P_STATE, new int[] {
state,
outputCount
} );
}
return tag;
}
private static int getOutputCount( PartP2PTunnel tunnel )
{
try
{
return Iterators.size( tunnel.getOutputs().iterator() );
}
catch( GridAccessException e )
{
// Well... unknown size it is!
return 0;
}
}
private static String getOutputText( int outputs )
{
if( outputs <= 1 )
{
return WailaText.P2PInputOneOutput.getLocal();
}
else
{
return String.format( WailaText.P2PInputManyOutputs.getLocal(), outputs );
}
}
}

View File

@ -21,11 +21,14 @@ package appeng.items.tools;
import appeng.api.implementations.items.IMemoryCard;
import appeng.api.implementations.items.MemoryCardMessages;
import appeng.api.util.AEColor;
import appeng.core.features.AEFeature;
import appeng.core.localization.ButtonToolTips;
import appeng.core.localization.GuiText;
import appeng.core.localization.PlayerMessages;
import appeng.items.AEBaseItem;
import appeng.util.Platform;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@ -33,12 +36,15 @@ import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import net.minecraftforge.event.ForgeEventFactory;
import java.text.NumberFormat;
import java.util.EnumSet;
import java.util.List;
import java.util.Locale;
public class ToolMemoryCard extends AEBaseItem implements IMemoryCard
{
public ToolMemoryCard()
{
this.setFeature( EnumSet.of( AEFeature.Core ) );
@ -55,6 +61,16 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard
{
lines.add( StatCollector.translateToLocal( this.getLocalizedName( data.getString( "tooltip" ) + ".name", data.getString( "tooltip" ) ) ) );
}
if( data.hasKey( "freq" ) )
{
final long freq = data.getLong( "freq" );
final String freqTooltip = String.format("%X", freq ).replaceAll("(.{4})", "$0 ").trim();
final String local = ButtonToolTips.P2PFrequency.getLocal();
lines.add( String.format( local, freqTooltip ) );
}
}
/**

View File

@ -156,6 +156,13 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench,
}
final Block b = w.getBlock( x, y, z );
if( b != null )
if( ForgeEventFactory.onPlayerInteract( p,
b.isAir( w, x, y, z ) ? PlayerInteractEvent.Action.RIGHT_CLICK_AIR : PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK,
x, y, z, side, w ).isCanceled() )
return false;
if( b != null && !p.isSneaking() )
{
final TileEntity te = w.getTileEntity( x, y, z );
@ -192,11 +199,7 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench,
}
else
{
if( b != null )
if( !ForgeEventFactory.onPlayerInteract( p,
b.isAir( w, x, y, z ) ? PlayerInteractEvent.Action.RIGHT_CLICK_AIR : PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK,
x, y, z, side, w ).isCanceled() )
b.onBlockActivated( w, x, y, z, p, side, hitX, hitY, hitZ );
b.onBlockActivated( w, x, y, z, p, side, hitX, hitY, hitZ );
}
}
else

View File

@ -69,6 +69,7 @@ import net.minecraftforge.oredict.OreDictionary;
import java.util.*;
import org.apache.commons.lang3.text.WordUtils;
public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCell, IItemGroup, IBlockTool, IMouseWheelItem
{
@ -78,14 +79,13 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
static
{
for( final AEColor col : AEColor.values() )
for( final AEColor color : AEColor.VALID_COLORS )
{
if( col == AEColor.Transparent )
{
continue;
}
final String dyeName = color.unlocalizedName;
final String oreDictName = "dye" + WordUtils.capitalize( dyeName );
final int oreDictId = OreDictionary.getOreID( oreDictName );
ORE_TO_COLOR.put( OreDictionary.getOreID( "dye" + col.name() ), col );
ORE_TO_COLOR.put( oreDictId, color );
}
}

View File

@ -84,6 +84,13 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
this.heatUp.put( new InWorldToolOperationIngredient( Blocks.snow, OreDictionary.WILDCARD_VALUE ), new InWorldToolOperationResult( new ItemStack( Blocks.flowing_water ) ) );
}
private static final boolean breakBlockWithCheck( final World w, final EntityPlayer p, final int x, final int y, final int z )
{
BlockEvent.BreakEvent event = new BlockEvent.BreakEvent( x, y, z, w, w.getBlock( x, y, z ), w.getBlockMetadata( x, y, z ), p );
MinecraftForge.EVENT_BUS.post( event );
return !event.isCanceled() && w.setBlockToAir( x, y, z );
}
@Override
public void postInit()
{
@ -91,44 +98,14 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
BlockDispenser.dispenseBehaviorRegistry.putObject( this, new DispenserBlockTool() );
}
private static class InWorldToolOperationIngredient
private boolean heat( final Block blockID, final EntityPlayer p, final int metadata, final World w, final int x, final int y, final int z )
{
private final Block blockID;
private final int metadata;
if( !breakBlockWithCheck( w, p, x, y, z ) )
return false;
public InWorldToolOperationIngredient( final Block blockID, final int metadata )
{
this.blockID = blockID;
this.metadata = metadata;
}
@Override
public int hashCode()
{
return this.blockID.hashCode() ^ this.metadata;
}
@Override
public boolean equals( final Object obj )
{
if( obj == null )
{
return false;
}
if( this.getClass() != obj.getClass() )
{
return false;
}
final InWorldToolOperationIngredient other = (InWorldToolOperationIngredient) obj;
return this.blockID == other.blockID && this.metadata == other.metadata;
}
}
private boolean heat( final Block blockID,final EntityPlayer p,final int metadata, final World w, final int x, final int y, final int z )
{
InWorldToolOperationResult r = this.heatUp.get( new InWorldToolOperationIngredient( blockID, metadata ) );
if(!breakBlockWithCheck( w,p,x,y,z ))return false;
if( r == null )
{
r = this.heatUp.get( new InWorldToolOperationIngredient( blockID, OreDictionary.WILDCARD_VALUE ) );
@ -139,7 +116,6 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
w.setBlock( x, y, z, Block.getBlockFromItem( r.getBlockItem().getItem() ), r.getBlockItem().getItemDamage(), 3 );
}
if( r.getDrops() != null )
{
Platform.spawnDrops( w, x, y, z, r.getDrops() );
@ -160,8 +136,11 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
return r != null;
}
private boolean cool( final Block blockID,final EntityPlayer p, final int metadata, final World w, final int x, final int y, final int z )
private boolean cool( final Block blockID, final EntityPlayer p, final int metadata, final World w, final int x, final int y, final int z )
{
if( !breakBlockWithCheck( w, p, x, y, z ) )
return false;
InWorldToolOperationResult r = this.coolDown.get( new InWorldToolOperationIngredient( blockID, metadata ) );
if( r == null )
@ -169,7 +148,6 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
r = this.coolDown.get( new InWorldToolOperationIngredient( blockID, OreDictionary.WILDCARD_VALUE ) );
}
if(!breakBlockWithCheck( w,p,x,y,z ))return false;
if( r.getBlockItem() != null )
{
w.setBlock( x, y, z, Block.getBlockFromItem( r.getBlockItem().getItem() ), r.getBlockItem().getItemDamage(), 3 );
@ -252,13 +230,14 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
if( blockID == null || ForgeEventFactory.onPlayerInteract( p,
blockID.isAir( w, x, y, z ) ? PlayerInteractEvent.Action.RIGHT_CLICK_AIR : PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK,
x, y, z, side, w ).isCanceled() ) return false;
x, y, z, side, w ).isCanceled() )
return false;
if( p.isSneaking() )
{
if( this.canCool( blockID, metadata ) )
{
if(this.cool( blockID, p, metadata, w, x, y, z ))
if( this.cool( blockID, p, metadata, w, x, y, z ) )
{
this.extractAEPower( item, 1600 );
return true;
@ -270,21 +249,23 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
{
if( blockID instanceof BlockTNT )
{
if(!breakBlockWithCheck( w,p,x,y,z )) return false;
if( !breakBlockWithCheck( w, p, x, y, z ) )
return false;
( (BlockTNT) blockID ).func_150114_a( w, x, y, z, 1, p );
return true;
}
if( blockID instanceof BlockTinyTNT )
{
if(!breakBlockWithCheck( w,p,x,y,z )) return false;
if( !breakBlockWithCheck( w, p, x, y, z ) )
return false;
( (BlockTinyTNT) blockID ).startFuse( w, x, y, z, p );
return true;
}
if( this.canHeat( blockID, metadata ) )
{
if(this.heat( blockID, p, metadata, w, x, y, z ))
if( this.heat( blockID, p, metadata, w, x, y, z ) )
{
this.extractAEPower( item, 1600 );
return true;
@ -322,11 +303,13 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
if( hasFurnaceable && canFurnaceable )
{
if( !breakBlockWithCheck( w, p, x, y, z ) )
return false;
this.extractAEPower( item, 1600 );
final InWorldToolOperationResult or = InWorldToolOperationResult.getBlockOperationResult( out.toArray( new ItemStack[out.size()] ) );
w.playSoundEffect( x + 0.5D, y + 0.5D, z + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F );
if(!breakBlockWithCheck( w,p,x,y,z )) return false;
if( or.getBlockItem() != null )
{
w.setBlock( x, y, z, Block.getBlockFromItem( or.getBlockItem().getItem() ), or.getBlockItem().getItemDamage(), 3 );
@ -366,11 +349,37 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
return false;
}
private static final boolean breakBlockWithCheck(final World w,final EntityPlayer p,final int x,final int y,final int z)
private static class InWorldToolOperationIngredient
{
BlockEvent.BreakEvent event = new BlockEvent.BreakEvent( x, y, z, w, w.getBlock( x, y, z ), w.getBlockMetadata( x, y, z ), p );
MinecraftForge.EVENT_BUS.post( event );
return !event.isCanceled() && w.setBlockToAir( x, y, z );
private final Block blockID;
private final int metadata;
public InWorldToolOperationIngredient( final Block blockID, final int metadata )
{
this.blockID = blockID;
this.metadata = metadata;
}
@Override
public int hashCode()
{
return this.blockID.hashCode() ^ this.metadata;
}
@Override
public boolean equals( final Object obj )
{
if( obj == null )
{
return false;
}
if( this.getClass() != obj.getClass() )
{
return false;
}
final InWorldToolOperationIngredient other = (InWorldToolOperationIngredient) obj;
return this.blockID == other.blockID && this.metadata == other.metadata;
}
}
}

View File

@ -106,9 +106,9 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost,
@Override
public void securityBreak()
{
if( this.getItemStack().stackSize > 0 )
if( this.getItemStack().stackSize > 0 && this.getGridNode() != null )
{
final List<ItemStack> items = new ArrayList<ItemStack>();
final List<ItemStack> items = new ArrayList<>();
items.add( this.getItemStack().copy() );
this.host.removePart( this.getSide(), false );
Platform.spawnDrops( this.tile.getWorldObj(), this.tile.xCoord, this.tile.yCoord, this.tile.zCoord, items );

View File

@ -50,6 +50,7 @@ import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.BlockSnapshot;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent;
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
@ -104,8 +105,11 @@ public class PartPlacement
final SelectedPart sp = selectPart( player, host, mop.hitVec.addVector( -mop.blockX, -mop.blockY, -mop.blockZ ) );
BlockEvent.BreakEvent event = new BlockEvent.BreakEvent( x, y, z, world, block, world.getBlockMetadata( x, y, z ), player );
MinecraftForge.EVENT_BUS.post(event);
if(event.isCanceled()) return true;
MinecraftForge.EVENT_BUS.post( event );
if( event.isCanceled() )
{
return false;
}
if( sp.part != null )
{
@ -169,6 +173,7 @@ public class PartPlacement
{
if( host.getFacadeContainer().addFacade( fp ) )
{
host.markForSave();
host.markForUpdate();
if( !player.capabilities.isCreativeMode )
{
@ -361,6 +366,12 @@ public class PartPlacement
return false;
}
BlockEvent.PlaceEvent event = new BlockEvent.PlaceEvent( BlockSnapshot.getBlockSnapshot( world, x, y, z ), world.getBlock( x, y, z ), player );
MinecraftForge.EVENT_BUS.post( event );
if( event.isCanceled() )
{
return false;
}
final ForgeDirection mySide = host.addPart( held, side, player );
if( mySide != null )
{

View File

@ -148,6 +148,7 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
}
bch.addBox( 5, 5, 14, 11, 11, 15 );
// The smaller collision hitbox here is needed to allow for the entity collision event
bch.addBox( minX, minY, 15, maxX, maxY, bch.isBBCollision() ? 15 : 16 );
}
@ -240,6 +241,9 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
{
boolean capture = false;
// This is the middle point of the entities BB, which is better suited for comparisons that don't rely on it "touching" the plane
double posYMiddle = (entity.boundingBox.minY + entity.boundingBox.maxY) / 2.0D;
switch( this.getSide() )
{
case DOWN:
@ -259,7 +263,7 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
case NORTH:
if( entity.posX > this.getTile().xCoord && entity.posX < this.getTile().xCoord + 1 )
{
if( entity.posY > this.getTile().yCoord && entity.posY < this.getTile().yCoord + 1 )
if( posYMiddle > this.getTile().yCoord && posYMiddle < this.getTile().yCoord + 1 )
{
if( ( entity.posZ > this.getTile().zCoord + 0.9 && this.getSide() == ForgeDirection.SOUTH ) || ( entity.posZ < this.getTile().zCoord + 0.1 && this.getSide() == ForgeDirection.NORTH ) )
{
@ -272,7 +276,7 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
case WEST:
if( entity.posZ > this.getTile().zCoord && entity.posZ < this.getTile().zCoord + 1 )
{
if( entity.posY > this.getTile().yCoord && entity.posY < this.getTile().yCoord + 1 )
if( posYMiddle > this.getTile().yCoord && posYMiddle < this.getTile().yCoord + 1 )
{
if( ( entity.posX > this.getTile().xCoord + 0.9 && this.getSide() == ForgeDirection.EAST ) || ( entity.posX < this.getTile().xCoord + 0.1 && this.getSide() == ForgeDirection.WEST ) )
{

View File

@ -48,6 +48,7 @@ import appeng.util.prioitylist.FuzzyPriorityList;
import appeng.util.prioitylist.PrecisePriorityList;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
@ -61,10 +62,9 @@ import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import net.minecraft.world.chunk.Chunk;
import net.minecraftforge.common.IPlantable;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.BlockSnapshot;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.event.world.BlockEvent;
import net.minecraftforge.event.ForgeEventFactory;
import java.util.ArrayList;
import java.util.List;
@ -78,6 +78,7 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
private int priority = 0;
private boolean wasActive = false;
private boolean blocked = false;
public PartFormationPlane( final ItemStack is )
{
super( is );
@ -453,35 +454,45 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
{
boolean Worked = false;
if( side.offsetX == 0 && side.offsetZ == 0 )
if( ForgeEventFactory.onItemUseStart( player, is, 1 ) >= 0 )
{
Worked = i.onItemUse( is, player, w, x + side.offsetX, y + side.offsetY, z + side.offsetZ, side.getOpposite().ordinal(), side.offsetX, side.offsetY, side.offsetZ );
}
if( side.offsetX == 0 && side.offsetZ == 0 )
{
Worked = i.onItemUse( is, player, w, x + side.offsetX, y + side.offsetY, z + side.offsetZ, side.getOpposite().ordinal(), side.offsetX, side.offsetY, side.offsetZ );
}
if( !Worked && side.offsetX == 0 && side.offsetZ == 0 )
{
Worked = i.onItemUse( is, player, w, x - side.offsetX, y - side.offsetY, z - side.offsetZ, side.ordinal(), side.offsetX, side.offsetY, side.offsetZ );
}
if( !Worked && side.offsetX == 0 && side.offsetZ == 0 )
{
Worked = i.onItemUse( is, player, w, x - side.offsetX, y - side.offsetY, z - side.offsetZ, side.ordinal(), side.offsetX, side.offsetY, side.offsetZ );
}
if( !Worked && side.offsetY == 0 )
{
Worked = i.onItemUse( is, player, w, x, y - 1, z, ForgeDirection.UP.ordinal(), side.offsetX, side.offsetY, side.offsetZ );
}
if( !Worked && side.offsetY == 0 )
{
Worked = i.onItemUse( is, player, w, x, y - 1, z, ForgeDirection.UP.ordinal(), side.offsetX, side.offsetY, side.offsetZ );
}
if( !Worked )
{
i.onItemUse( is, player, w, x, y, z, side.getOpposite().ordinal(), side.offsetX, side.offsetY, side.offsetZ );
}
if( !Worked )
{
i.onItemUse( is, player, w, x, y, z, side.getOpposite().ordinal(), side.offsetX, side.offsetY, side.offsetZ );
}
maxStorage -= is.stackSize;
maxStorage -= is.stackSize;
}
}
else
{
Block block = null;
player.setCurrentItemOrArmor( 0, is.copy() );
BlockSnapshot blockSnapshot = new BlockSnapshot( w, x, y, z, ( (ItemBlock) i ).field_150939_a, i.getMetadata( is.getItemDamage() ) );
BlockEvent.PlaceEvent event = new BlockEvent.PlaceEvent( blockSnapshot, w.getBlock( x, y, z ), owner == null ? player : owner );
MinecraftForge.EVENT_BUS.post( event );
if( !event.isCanceled() )
if( i instanceof ItemBlock )
block = ( (ItemBlock) i ).field_150939_a;
if( i instanceof IPartItem )
block = AEApi.instance().definitions().blocks().multiPart().maybeBlock().orNull();
if( block == null ||
!ForgeEventFactory.onPlayerBlockPlace(
owner == null ? player : owner,
new BlockSnapshot( w, x, y, z, block, i.getMetadata( is.getItemDamage() ) ),
side.getOpposite()
).isCanceled() )
{
i.onItemUse( is, player, w, x, y, z, side.getOpposite().ordinal(), side.offsetX, side.offsetY, side.offsetZ );
maxStorage -= is.stackSize;

View File

@ -31,7 +31,6 @@ import appeng.client.texture.CableBusTextures;
import appeng.helpers.Reflected;
import appeng.me.helpers.AENetworkProxy;
import appeng.parts.PartBasicState;
import appeng.util.Platform;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.RenderBlocks;
@ -43,9 +42,7 @@ import net.minecraft.util.IIcon;
import net.minecraftforge.common.util.ForgeDirection;
import org.lwjgl.opengl.GL11;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
public class PartToggleBus extends PartBasicState
@ -96,19 +93,6 @@ public class PartToggleBus extends PartBasicState
return AECableType.GLASS;
}
@Override
public void securityBreak()
{
if( this.getItemStack().stackSize > 0 )
{
final List<ItemStack> items = new ArrayList<ItemStack>();
items.add( this.getItemStack().copy() );
this.getHost().removePart( this.getSide(), false );
Platform.spawnDrops( this.getTile().getWorldObj(), this.getTile().xCoord, this.getTile().yCoord, this.getTile().zCoord, items );
this.getItemStack().stackSize = 0;
}
}
@Override
public void getBoxes( final IPartCollisionHelper bch )
{

View File

@ -40,6 +40,7 @@ import appeng.items.parts.ItemMultiPart;
import appeng.me.GridAccessException;
import appeng.parts.AEBasePart;
import appeng.util.Platform;
import net.minecraftforge.common.util.ForgeDirection;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import io.netty.buffer.ByteBuf;
@ -466,52 +467,40 @@ public class PartCable extends AEBasePart implements IPartCable
@Override
public void writeToStream( final ByteBuf data ) throws IOException
{
int cs = 0;
int sideOut = 0;
int flags = 0;
boolean[] writeSide = new boolean[ForgeDirection.VALID_DIRECTIONS.length];
int[] channelsPerSide = new int[ForgeDirection.VALID_DIRECTIONS.length];
final IGridNode n = this.getGridNode();
if( n != null )
for( final ForgeDirection thisSide : ForgeDirection.VALID_DIRECTIONS )
{
for( final ForgeDirection thisSide : ForgeDirection.VALID_DIRECTIONS )
final IPart part = this.getHost().getPart( thisSide );
if( part != null )
{
final IPart part = this.getHost().getPart( thisSide );
if( part != null )
writeSide[thisSide.ordinal()] = true;
int channels = 0;
if( part.getGridNode() != null )
{
if( part.getGridNode() != null )
final IReadOnlyCollection<IGridConnection> set = part.getGridNode().getConnections();
for( final IGridConnection gc : set )
{
final IReadOnlyCollection<IGridConnection> set = part.getGridNode().getConnections();
for( final IGridConnection gc : set )
{
if( this.getProxy().getNode().hasFlag( GridFlags.DENSE_CAPACITY ) && gc.getOtherSide( this.getProxy().getNode() ).hasFlag( GridFlags.DENSE_CAPACITY ) )
{
sideOut |= ( gc.getUsedChannels() / 4 ) << ( 4 * thisSide.ordinal() );
}
else
{
sideOut |= ( gc.getUsedChannels() ) << ( 4 * thisSide.ordinal() );
}
}
channels = Math.max( channels, gc.getUsedChannels() );
}
}
channelsPerSide[thisSide.ordinal()] = channels;
}
}
IGridNode n = this.getGridNode();
if( n != null )
{
for( final IGridConnection gc : n.getConnections() )
{
final ForgeDirection side = gc.getDirection( n );
if( side != ForgeDirection.UNKNOWN )
{
final boolean isTier2a = this.getProxy().getNode().hasFlag( GridFlags.DENSE_CAPACITY );
final boolean isTier2b = gc.getOtherSide( this.getProxy().getNode() ).hasFlag( GridFlags.DENSE_CAPACITY );
if( isTier2a && isTier2b )
{
sideOut |= ( gc.getUsedChannels() / 4 ) << ( 4 * side.ordinal() );
}
else
{
sideOut |= gc.getUsedChannels() << ( 4 * side.ordinal() );
}
cs |= ( 1 << side.ordinal() );
writeSide[side.ordinal()] = true;
channelsPerSide[side.ordinal()] = gc.getUsedChannels();
flags |= ( 1 << side.ordinal() );
}
}
}
@ -520,7 +509,7 @@ public class PartCable extends AEBasePart implements IPartCable
{
if( this.getProxy().getEnergy().isNetworkPowered() )
{
cs |= ( 1 << ForgeDirection.UNKNOWN.ordinal() );
flags |= ( 1 << ForgeDirection.UNKNOWN.ordinal() );
}
}
catch( final GridAccessException e )
@ -528,16 +517,21 @@ public class PartCable extends AEBasePart implements IPartCable
// aww...
}
data.writeByte( (byte) cs );
data.writeInt( sideOut );
data.writeByte( (byte) flags );
// Only write the used channels for sides where we have a part or another cable
for( int i = 0; i < writeSide.length; i++ )
{
if( writeSide[i] )
{
data.writeByte( channelsPerSide[i] );
}
}
}
@Override
public boolean readFromStream( final ByteBuf data ) throws IOException
{
final int cs = data.readByte();
final int sideOut = data.readInt();
int cs = data.readByte();
final EnumSet<ForgeDirection> myC = this.getConnections().clone();
final boolean wasPowered = this.powered;
this.powered = false;
@ -545,16 +539,6 @@ public class PartCable extends AEBasePart implements IPartCable
for( final ForgeDirection d : ForgeDirection.values() )
{
if( d != ForgeDirection.UNKNOWN )
{
final int ch = ( sideOut >> ( d.ordinal() * 4 ) ) & 0xF;
if( ch != this.getChannelsOnSide()[d.ordinal()] )
{
channelsChanged = true;
this.getChannelsOnSide()[d.ordinal()] = ch;
}
}
if( d == ForgeDirection.UNKNOWN )
{
final int id = 1 << d.ordinal();
@ -565,8 +549,8 @@ public class PartCable extends AEBasePart implements IPartCable
}
else
{
final int id = 1 << d.ordinal();
if( id == ( cs & id ) )
boolean conOnSide = ( cs & ( 1 << d.ordinal() ) ) != 0;
if( conOnSide )
{
this.getConnections().add( d );
}
@ -574,6 +558,22 @@ public class PartCable extends AEBasePart implements IPartCable
{
this.getConnections().remove( d );
}
int ch = 0;
// Only read channels if there's a part on this side or a cable connection
// This works only because cables are always read *last* from the packet update for
// a cable bus
if( conOnSide || getHost().getPart( d ) != null )
{
ch = ( (int) data.readByte() ) & 0xFF;
}
if( ch != this.channelsOnSide[d.ordinal()] )
{
channelsChanged = true;
this.channelsOnSide[d.ordinal()] = ch;
}
}
}

View File

@ -150,7 +150,8 @@ public class PartP2PLiquids extends PartP2PTunnel<PartP2PLiquids> implements IFl
i = list.iterator();
int used = 0;
while( i.hasNext() )
while( i.hasNext() && available > 0 )
{
final PartP2PLiquids l = i.next();
@ -172,7 +173,7 @@ public class PartP2PLiquids extends PartP2PTunnel<PartP2PLiquids> implements IFl
}
available -= insert.amount;
used += insert.amount;
used += l.tmpUsed;
}
if( stack.pop() != this )

View File

@ -27,7 +27,12 @@ import appeng.api.config.TunnelType;
import appeng.api.definitions.IParts;
import appeng.api.implementations.items.IMemoryCard;
import appeng.api.implementations.items.MemoryCardMessages;
import appeng.api.parts.*;
import appeng.api.parts.IPart;
import appeng.api.parts.IPartCollisionHelper;
import appeng.api.parts.IPartItem;
import appeng.api.parts.IPartRenderHelper;
import appeng.api.parts.PartItemStack;
import appeng.api.util.AEColor;
import appeng.client.texture.CableBusTextures;
import appeng.core.AEConfig;
import appeng.me.GridAccessException;
@ -75,7 +80,7 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
return null;
}
T getInput()
public T getInput()
{
if( this.getFrequency() == 0 )
{
@ -97,7 +102,7 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
return null;
}
TunnelCollection<T> getOutputs() throws GridAccessException
public TunnelCollection<T> getOutputs() throws GridAccessException
{
if( this.getProxy().isActive() )
{
@ -116,7 +121,7 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
@Override
@SideOnly( Side.CLIENT )
public void renderInventory( final IPartRenderHelper rh, final RenderBlocks renderer )
public void renderInventory(final IPartRenderHelper rh, final RenderBlocks renderer)
{
rh.setTexture( this.getTypeTexture() );

View File

@ -167,6 +167,7 @@ public class AppEngInternalAEInventory implements IInventory, Iterable<ItemStack
if( this.te != null && Platform.isServer() )
{
this.te.onChangeInventory( this, slot, InvOperation.decreaseStackSize, ns, null );
this.te.saveChanges();
}
return ns;
@ -213,6 +214,7 @@ public class AppEngInternalAEInventory implements IInventory, Iterable<ItemStack
}
this.te.onChangeInventory( this, slot, InvOperation.setInventorySlotContents, removed, added );
this.te.saveChanges();
}
}
@ -240,6 +242,7 @@ public class AppEngInternalAEInventory implements IInventory, Iterable<ItemStack
if( this.te != null && Platform.isServer() )
{
this.te.onChangeInventory( this, -1, InvOperation.markDirty, null, null );
this.te.saveChanges();
}
}

View File

@ -180,6 +180,7 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
if( this.getTileEntity() != null && this.eventsEnabled() )
{
this.getTileEntity().onChangeInventory( this, -1, InvOperation.markDirty, null, null );
this.getTileEntity().saveChanges();
}
}
@ -216,6 +217,7 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
if( this.getTileEntity() != null && this.eventsEnabled() )
{
this.getTileEntity().onChangeInventory( this, slotIndex, InvOperation.markDirty, null, null );
this.getTileEntity().saveChanges();
}
}

View File

@ -204,13 +204,15 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
private void recalculateDisplay()
{
final boolean currentActive = this.getProxy().isActive();
int newState = this.state;
if( currentActive )
{
this.state |= 0x80000000;
newState |= 0x80000000;
}
else
{
this.state &= ~0x80000000;
newState &= ~0x80000000;
}
if( this.wasActive != currentActive )
@ -228,12 +230,12 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
for( int x = 0; x < this.getCellCount(); x++ )
{
this.state |= ( this.getCellStatus( x ) << ( 3 * x ) );
newState |= ( this.getCellStatus( x ) << ( 3 * x ) );
}
final int oldState = 0;
if( oldState != this.state )
if( newState != this.state )
{
this.state = newState;
this.markForUpdate();
}
}

View File

@ -0,0 +1,3 @@
# GUI rendering
public net.minecraft.client.gui.inventory.GuiContainer func_146977_a(Lnet/minecraft/inventory/Slot;)V # drawSlot
public net.minecraft.client.gui.GuiTextField func_146188_c(IIII)V # drawSelectionBox

View File

@ -325,6 +325,7 @@ gui.tooltips.appliedenergistics2.SchedulingModeRoundRobin=Export using round rob
gui.tooltips.appliedenergistics2.SchedulingModeRandom=Export items in random mode.
gui.tooltips.appliedenergistics2.ItemsStored=Items Stored: %s
gui.tooltips.appliedenergistics2.ItemsRequestable=Items Requestable: %s
gui.tooltips.appliedenergistics2.P2PFrequency=Frequency: %s
# Units
gui.appliedenergistics2.units.appliedenergstics=AE
@ -362,6 +363,10 @@ waila.appliedenergistics2.Unlocked=Unlocked
waila.appliedenergistics2.Showing=Showing
waila.appliedenergistics2.Contains=Contains
waila.appliedenergistics2.Channels=%1$d of %2$d Channels
waila.appliedenergistics2.P2PUnlinked=Unlinked
waila.appliedenergistics2.P2PInputOneOutput=Linked (Input Side)
waila.appliedenergistics2.P2PInputManyOutputs=Linked (Input Side) - %d Outputs
waila.appliedenergistics2.P2POutput=Linked (Output Side)
# Items
item.appliedenergistics2.ItemBasicStorageCell.1k.name=1k ME Storage Cell

Binary file not shown.

Before

Width:  |  Height:  |  Size: 294 B

After

Width:  |  Height:  |  Size: 295 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -3,7 +3,7 @@
"modid":"appliedenergistics2",
"name":"AppEng 2 tilera Edition",
"description":"A Mod about Matter, Energy and using them to conquer the world..",
"version":"rv3-beta-16",
"version":"rv3-beta-18",
"mcversion":"1.7.10",
"url":"http://ae2.ae-mod.info",
"updateUrl":"",