Most of the 1.8 Port.
This commit is contained in:
@@ -21,15 +21,15 @@ package appeng.core.features;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
import net.minecraftforge.fml.common.registry.GameData;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import appeng.api.definitions.IBlockDefinition;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.core.CommonHelper;
|
||||
import appeng.core.CreativeTab;
|
||||
import appeng.util.Platform;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
|
||||
public final class AEBlockFeatureHandler implements IFeatureHandler
|
||||
@@ -62,20 +62,27 @@ public final class AEBlockFeatureHandler implements IFeatureHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public void register()
|
||||
public void register(Side side)
|
||||
{
|
||||
if( this.enabled )
|
||||
{
|
||||
String name = this.extractor.get();
|
||||
this.featured.setCreativeTab( CreativeTab.instance );
|
||||
this.featured.setBlockName( /* "tile." */"appliedenergistics2." + name );
|
||||
this.featured.setBlockTextureName( "appliedenergistics2:" + name );
|
||||
this.featured.setUnlocalizedName( /* "tile." */"appliedenergistics2." + name );
|
||||
this.featured.setBlockTextureName( name );
|
||||
|
||||
final String registryName = "tile." + name;
|
||||
|
||||
// Bypass the forge magic with null to register our own itemblock later.
|
||||
GameRegistry.registerBlock( this.featured, null, registryName );
|
||||
GameRegistry.registerItem( this.definition.maybeItem().get(), registryName );
|
||||
|
||||
// register the block/item conversion...
|
||||
if ( this.featured != null && this.definition.maybeItem().isPresent() )
|
||||
GameData.getBlockItemMap().put( this.featured, this.definition.maybeItem().get() );
|
||||
|
||||
if ( side == Side.CLIENT)
|
||||
CommonHelper.proxy.configureIcon( this.featured, name );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,12 +21,10 @@ package appeng.core.features;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
import net.minecraftforge.fml.common.registry.GameData;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import appeng.api.definitions.ITileDefinition;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.block.networking.BlockCableBus;
|
||||
@@ -34,6 +32,8 @@ import appeng.core.CommonHelper;
|
||||
import appeng.core.CreativeTab;
|
||||
import appeng.util.Platform;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
|
||||
public final class AECableBusFeatureHandler implements IFeatureHandler
|
||||
{
|
||||
@@ -68,14 +68,14 @@ public final class AECableBusFeatureHandler implements IFeatureHandler
|
||||
* Registration of the {@link TileEntity} will actually be handled by {@link BlockCableBus#setupTile()}.
|
||||
*/
|
||||
@Override
|
||||
public void register()
|
||||
public void register(Side side)
|
||||
{
|
||||
if( this.enabled )
|
||||
{
|
||||
String name = this.extractor.get();
|
||||
this.featured.setCreativeTab( CreativeTab.instance );
|
||||
this.featured.setBlockName( /* "tile." */"appliedenergistics2." + name );
|
||||
this.featured.setBlockTextureName( "appliedenergistics2:" + name );
|
||||
this.featured.setUnlocalizedName( /* "tile." */"appliedenergistics2." + name );
|
||||
this.featured.setBlockTextureName( name );
|
||||
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
@@ -87,6 +87,13 @@ public final class AECableBusFeatureHandler implements IFeatureHandler
|
||||
// Bypass the forge magic with null to register our own itemblock later.
|
||||
GameRegistry.registerBlock( this.featured, null, registryName );
|
||||
GameRegistry.registerItem( this.definition.maybeItem().get(), registryName );
|
||||
|
||||
// register the block/item conversion...
|
||||
if ( this.featured != null && this.definition.maybeItem().isPresent() )
|
||||
GameData.getBlockItemMap().put( this.featured, this.definition.maybeItem().get() );
|
||||
|
||||
if ( side == Side.CLIENT)
|
||||
CommonHelper.proxy.configureIcon( this.featured, name );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,16 +21,17 @@ package appeng.core.features;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
import net.minecraftforge.fml.common.registry.GameData;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import appeng.api.definitions.ITileDefinition;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.core.CommonHelper;
|
||||
import appeng.core.CreativeTab;
|
||||
import appeng.util.Platform;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
|
||||
public final class AETileBlockFeatureHandler implements IFeatureHandler
|
||||
{
|
||||
@@ -62,14 +63,14 @@ public final class AETileBlockFeatureHandler implements IFeatureHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public void register()
|
||||
public void register(Side side)
|
||||
{
|
||||
if( this.enabled )
|
||||
{
|
||||
String name = this.extractor.get();
|
||||
this.featured.setCreativeTab( CreativeTab.instance );
|
||||
this.featured.setBlockName( /* "tile." */"appliedenergistics2." + name );
|
||||
this.featured.setBlockTextureName( "appliedenergistics2:" + name );
|
||||
this.featured.setUnlocalizedName( /* "tile." */"appliedenergistics2." + name );
|
||||
this.featured.setBlockTextureName( name );
|
||||
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
@@ -81,7 +82,15 @@ public final class AETileBlockFeatureHandler implements IFeatureHandler
|
||||
// Bypass the forge magic with null to register our own itemblock later.
|
||||
GameRegistry.registerBlock( this.featured, null, registryName );
|
||||
GameRegistry.registerItem( this.definition.maybeItem().get(), registryName );
|
||||
|
||||
// register the block/item conversion...
|
||||
if ( this.featured != null && this.definition.maybeItem().isPresent() )
|
||||
GameData.getBlockItemMap().put( this.featured, this.definition.maybeItem().get() );
|
||||
|
||||
GameRegistry.registerTileEntity( this.featured.getTileEntityClass(), this.featured.toString() );
|
||||
|
||||
if ( side == Side.CLIENT)
|
||||
CommonHelper.proxy.configureIcon( this.featured, name );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,19 +21,19 @@ package appeng.core.features;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.ObjectArrays;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import appeng.api.definitions.IBlockDefinition;
|
||||
import appeng.block.AEBaseBlock;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.ObjectArrays;
|
||||
|
||||
|
||||
public class BlockDefinition extends ItemDefinition implements IBlockDefinition
|
||||
{
|
||||
@@ -151,8 +151,8 @@ public class BlockDefinition extends ItemDefinition implements IBlockDefinition
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean isSameAs( IBlockAccess world, int x, int y, int z )
|
||||
public final boolean isSameAs( IBlockAccess world, BlockPos pos )
|
||||
{
|
||||
return this.enabled && world.getBlock( x, y, z ) == this.block;
|
||||
return this.enabled && world.getBlockState( pos ).getBlock() == this.block;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@ import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.api.util.AEColoredItemDefinition;
|
||||
|
||||
|
||||
@@ -21,15 +21,15 @@ package appeng.core.features;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import appeng.api.definitions.IItemDefinition;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
|
||||
public final class DamagedItemDefinition implements IItemDefinition
|
||||
{
|
||||
@@ -68,7 +68,7 @@ public final class DamagedItemDefinition implements IItemDefinition
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSameAs( IBlockAccess world, int x, int y, int z )
|
||||
public boolean isSameAs( IBlockAccess world, BlockPos pos )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -7,8 +7,8 @@ import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import appeng.api.definitions.IBlockDefinition;
|
||||
import appeng.api.definitions.IComparableDefinition;
|
||||
import appeng.api.definitions.IItemDefinition;
|
||||
@@ -86,7 +86,7 @@ public final class DefinitionConverter
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean sameAsBlock( IBlockAccess world, int x, int y, int z )
|
||||
public boolean sameAsBlock( IBlockAccess world, BlockPos pos )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -139,9 +139,9 @@ public final class DefinitionConverter
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean sameAsBlock( IBlockAccess world, int x, int y, int z )
|
||||
public boolean sameAsBlock( IBlockAccess world, BlockPos pos )
|
||||
{
|
||||
return this.definition.isSameAs( world, x, y, z );
|
||||
return this.definition.isSameAs( world, pos );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
package appeng.core.features;
|
||||
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import appeng.api.definitions.IItemDefinition;
|
||||
|
||||
|
||||
@@ -28,5 +29,5 @@ public interface IFeatureHandler
|
||||
|
||||
IItemDefinition getDefinition();
|
||||
|
||||
void register();
|
||||
void register(Side side );
|
||||
}
|
||||
|
||||
@@ -19,16 +19,16 @@
|
||||
package appeng.core.features;
|
||||
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import appeng.api.definitions.IItemDefinition;
|
||||
import appeng.util.Platform;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
|
||||
public class ItemDefinition implements IItemDefinition
|
||||
{
|
||||
@@ -70,7 +70,7 @@ public class ItemDefinition implements IItemDefinition
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSameAs( IBlockAccess world, int x, int y, int z )
|
||||
public boolean isSameAs( IBlockAccess world, BlockPos pos )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -21,17 +21,17 @@ package appeng.core.features;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import appeng.api.definitions.IItemDefinition;
|
||||
import appeng.core.CommonHelper;
|
||||
import appeng.core.CreativeTab;
|
||||
import appeng.core.CreativeTabFacade;
|
||||
import appeng.items.parts.ItemFacade;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
|
||||
public final class ItemFeatureHandler implements IFeatureHandler
|
||||
{
|
||||
@@ -63,12 +63,14 @@ public final class ItemFeatureHandler implements IFeatureHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public void register()
|
||||
public void register(Side side)
|
||||
{
|
||||
if( this.enabled )
|
||||
{
|
||||
String name = this.extractor.get();
|
||||
this.item.setTextureName( "appliedenergistics2:" + name );
|
||||
String itemPhysicalName = name;
|
||||
|
||||
//this.item.setTextureName( "appliedenergistics2:" + name );
|
||||
this.item.setUnlocalizedName( /* "item." */"appliedenergistics2." + name );
|
||||
|
||||
if( this.item instanceof ItemFacade )
|
||||
@@ -90,6 +92,20 @@ public final class ItemFeatureHandler implements IFeatureHandler
|
||||
}
|
||||
|
||||
GameRegistry.registerItem( this.item, "item." + name );
|
||||
|
||||
if ( side == Side.CLIENT )
|
||||
{
|
||||
CommonHelper.proxy.configureIcon( item, itemPhysicalName );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void configureIcon(
|
||||
Item item,
|
||||
int meta,
|
||||
String name )
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@ package appeng.core.features;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.items.materials.MaterialType;
|
||||
|
||||
|
||||
|
||||
@@ -1,74 +0,0 @@
|
||||
/*
|
||||
* 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.core.features;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockSlab;
|
||||
import appeng.api.definitions.IBlockDefinition;
|
||||
import appeng.block.AEBaseItemBlockSlab;
|
||||
import appeng.block.AEBaseSlabBlock;
|
||||
import appeng.core.CreativeTab;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
|
||||
public class SlabBlockFeatureHandler implements IFeatureHandler
|
||||
{
|
||||
private final AEBaseSlabBlock slabs;
|
||||
private final FeatureNameExtractor extractor;
|
||||
private final boolean enabled;
|
||||
private final BlockDefinition definition;
|
||||
|
||||
public SlabBlockFeatureHandler( EnumSet<AEFeature> features, AEBaseSlabBlock slabs )
|
||||
{
|
||||
final ActivityState state = new FeaturedActiveChecker( features ).getActivityState();
|
||||
this.slabs = slabs;
|
||||
this.extractor = new FeatureNameExtractor( slabs.getClass(), Optional.<String>absent());
|
||||
this.enabled = state == ActivityState.Enabled;
|
||||
this.definition = new BlockDefinition( slabs, state );
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean isFeatureAvailable()
|
||||
{
|
||||
return this.enabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final IBlockDefinition getDefinition()
|
||||
{
|
||||
return this.definition;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void register()
|
||||
{
|
||||
if( this.enabled )
|
||||
{
|
||||
this.slabs.setCreativeTab( CreativeTab.instance );
|
||||
GameRegistry.registerBlock( slabs, AEBaseItemBlockSlab.class, "tile." + slabs.name(), slabs, slabs.doubleSlabs(), false);
|
||||
GameRegistry.registerBlock( slabs.doubleSlabs(), AEBaseItemBlockSlab.class, "tile." + slabs.name() + ".double", slabs, slabs.doubleSlabs(), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,15 +21,14 @@ package appeng.core.features;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import net.minecraft.block.BlockStairs;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import appeng.api.definitions.IBlockDefinition;
|
||||
import appeng.core.CreativeTab;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
|
||||
public class StairBlockFeatureHandler implements IFeatureHandler
|
||||
{
|
||||
@@ -61,14 +60,14 @@ public class StairBlockFeatureHandler implements IFeatureHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void register()
|
||||
public final void register(Side side)
|
||||
{
|
||||
if( this.enabled )
|
||||
{
|
||||
String name = this.extractor.get();
|
||||
this.stairs.setCreativeTab( CreativeTab.instance );
|
||||
this.stairs.setBlockName( "appliedenergistics2." + name );
|
||||
this.stairs.setBlockTextureName( "appliedenergistics2:" + name );
|
||||
this.stairs.setUnlocalizedName( "appliedenergistics2." + name );
|
||||
//this.stairs.setBlockTextureName( "appliedenergistics2:" + name );
|
||||
|
||||
GameRegistry.registerBlock( this.stairs, "tile." + name );
|
||||
}
|
||||
|
||||
@@ -19,14 +19,13 @@
|
||||
package appeng.core.features;
|
||||
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import appeng.api.definitions.ITileDefinition;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
|
||||
public final class TileDefinition extends BlockDefinition implements ITileDefinition
|
||||
{
|
||||
|
||||
@@ -1,122 +0,0 @@
|
||||
/*
|
||||
* 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.core.features;
|
||||
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import appeng.api.definitions.ITileDefinition;
|
||||
|
||||
|
||||
public final class WrappedDamageItemDefinition implements ITileDefinition
|
||||
{
|
||||
private final ITileDefinition definition;
|
||||
private final int damage;
|
||||
|
||||
public WrappedDamageItemDefinition( ITileDefinition definition, int damage )
|
||||
{
|
||||
Preconditions.checkNotNull( definition );
|
||||
Preconditions.checkArgument( damage >= 0 );
|
||||
|
||||
this.definition = definition;
|
||||
this.damage = damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<? extends Class<? extends TileEntity>> maybeEntity()
|
||||
{
|
||||
return this.definition.maybeEntity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Block> maybeBlock()
|
||||
{
|
||||
return this.definition.maybeBlock();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<ItemBlock> maybeItemBlock()
|
||||
{
|
||||
return this.definition.maybeItemBlock();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Item> maybeItem()
|
||||
{
|
||||
return this.definition.maybeItem();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<ItemStack> maybeStack( final int stackSize )
|
||||
{
|
||||
return this.definition.maybeBlock().transform( new BlockTransformFunction( stackSize, this.damage ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSameAs( ItemStack comparableStack )
|
||||
{
|
||||
if( comparableStack == null )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final boolean sameItem = this.definition.isSameAs( new ItemStack( comparableStack.getItem() ) );
|
||||
final boolean sameDamage = comparableStack.getItemDamage() == this.damage;
|
||||
|
||||
return sameItem && sameDamage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSameAs( IBlockAccess world, int x, int y, int z )
|
||||
{
|
||||
return this.definition.isSameAs( world, x, y, z ) && world.getBlockMetadata( x, y, z ) == this.damage;
|
||||
}
|
||||
|
||||
private static final class BlockTransformFunction implements Function<Block, ItemStack>
|
||||
{
|
||||
private final int stackSize;
|
||||
private final int damage;
|
||||
|
||||
public BlockTransformFunction( int stackSize, int damage )
|
||||
{
|
||||
Preconditions.checkArgument( stackSize > 0 );
|
||||
Preconditions.checkArgument( damage >= 0 );
|
||||
|
||||
this.stackSize = stackSize;
|
||||
this.damage = damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack apply( Block input )
|
||||
{
|
||||
Preconditions.checkNotNull( input );
|
||||
|
||||
return new ItemStack( input, this.stackSize, this.damage );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,6 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.api.storage.ICellHandler;
|
||||
import appeng.api.storage.ICellRegistry;
|
||||
import appeng.api.storage.IMEInventoryHandler;
|
||||
|
||||
@@ -23,8 +23,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.storage.IExternalStorageHandler;
|
||||
import appeng.api.storage.IExternalStorageRegistry;
|
||||
@@ -50,7 +49,7 @@ public class ExternalStorageRegistry implements IExternalStorageRegistry
|
||||
}
|
||||
|
||||
@Override
|
||||
public IExternalStorageHandler getHandler( TileEntity te, ForgeDirection d, StorageChannel chan, BaseActionSource mySrc )
|
||||
public IExternalStorageHandler getHandler( TileEntity te, EnumFacing d, StorageChannel chan, BaseActionSource mySrc )
|
||||
{
|
||||
for( IExternalStorageHandler x : this.Handlers )
|
||||
{
|
||||
|
||||
@@ -28,7 +28,6 @@ import java.util.Map.Entry;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.api.features.IGrinderEntry;
|
||||
import appeng.api.features.IGrinderRegistry;
|
||||
import appeng.core.AEConfig;
|
||||
|
||||
@@ -11,7 +11,6 @@ import java.util.Set;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.api.features.IInscriberRecipe;
|
||||
import appeng.api.features.IInscriberRecipeBuilder;
|
||||
import appeng.api.features.IInscriberRegistry;
|
||||
|
||||
@@ -23,9 +23,7 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import appeng.api.events.LocatableEventAnnounce;
|
||||
import appeng.api.events.LocatableEventAnnounce.LocatableEvent;
|
||||
import appeng.api.features.ILocatable;
|
||||
|
||||
@@ -23,7 +23,6 @@ import java.util.HashMap;
|
||||
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.api.features.IMatterCannonAmmoRegistry;
|
||||
import appeng.recipes.ores.IOreListener;
|
||||
import appeng.recipes.ores.OreDictionaryHandler;
|
||||
|
||||
@@ -25,7 +25,6 @@ import java.util.LinkedList;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import appeng.api.exceptions.AppEngException;
|
||||
import appeng.api.movable.IMovableHandler;
|
||||
import appeng.api.movable.IMovableRegistry;
|
||||
|
||||
@@ -21,16 +21,16 @@ package appeng.core.features.registries;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.TunnelType;
|
||||
import appeng.api.definitions.IBlocks;
|
||||
@@ -158,14 +158,14 @@ public final class P2PTunnelRegistry implements IP2PTunnelRegistry
|
||||
@Nullable
|
||||
private ItemStack getModItem( String modID, String name, int meta )
|
||||
{
|
||||
ItemStack myItemStack = GameRegistry.findItemStack( modID, name, 1 );
|
||||
Item item = GameRegistry.findItem( modID, name );
|
||||
|
||||
if( myItemStack == null )
|
||||
if( item == null )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
myItemStack.setItemDamage( meta );
|
||||
|
||||
ItemStack myItemStack = new ItemStack( item, 1, meta );
|
||||
return myItemStack;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,13 +19,12 @@
|
||||
package appeng.core.features.registries;
|
||||
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import appeng.api.features.IPlayerRegistry;
|
||||
import appeng.core.WorldSettings;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
|
||||
public class PlayerRegistry implements IPlayerRegistry
|
||||
{
|
||||
|
||||
@@ -23,7 +23,6 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.api.features.IItemComparison;
|
||||
import appeng.api.features.IItemComparisonProvider;
|
||||
import appeng.api.features.ISpecialComparisonRegistry;
|
||||
|
||||
@@ -25,7 +25,6 @@ import java.util.List;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.features.ILocatable;
|
||||
import appeng.api.features.IWirelessTermHandler;
|
||||
|
||||
@@ -23,7 +23,6 @@ import java.util.HashSet;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldProvider;
|
||||
|
||||
import appeng.api.features.IWorldGen;
|
||||
|
||||
|
||||
@@ -96,8 +95,8 @@ public final class WorldGenRegistry implements IWorldGen
|
||||
}
|
||||
|
||||
boolean isBadProvider = this.types[type.ordinal()].badProviders.contains( w.provider.getClass() );
|
||||
boolean isBadDimension = this.types[type.ordinal()].badDimensions.contains( w.provider.dimensionId );
|
||||
boolean isGoodDimension = this.types[type.ordinal()].enabledDimensions.contains( w.provider.dimensionId );
|
||||
boolean isBadDimension = this.types[type.ordinal()].badDimensions.contains( w.provider.getDimensionId() );
|
||||
boolean isGoodDimension = this.types[type.ordinal()].enabledDimensions.contains( w.provider.getDimensionId() );
|
||||
|
||||
if( isBadProvider || isBadDimension )
|
||||
{
|
||||
|
||||
@@ -20,7 +20,6 @@ package appeng.core.features.registries.entries;
|
||||
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.api.features.IGrinderEntry;
|
||||
|
||||
|
||||
|
||||
@@ -22,8 +22,6 @@ package appeng.core.features.registries.entries;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import appeng.api.implementations.tiles.IChestOrDrive;
|
||||
import appeng.api.storage.ICellHandler;
|
||||
import appeng.api.storage.ICellInventory;
|
||||
@@ -32,7 +30,9 @@ import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.IMEInventoryHandler;
|
||||
import appeng.api.storage.ISaveProvider;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.client.texture.ExtraBlockTextures;
|
||||
import appeng.client.texture.IAESprite;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.me.storage.CellInventory;
|
||||
import appeng.me.storage.CellInventoryHandler;
|
||||
@@ -59,19 +59,19 @@ public class BasicCellHandler implements ICellHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getTopTexture_Light()
|
||||
public IAESprite getTopTexture_Light()
|
||||
{
|
||||
return ExtraBlockTextures.BlockMEChestItems_Light.getIcon();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getTopTexture_Medium()
|
||||
public IAESprite getTopTexture_Medium()
|
||||
{
|
||||
return ExtraBlockTextures.BlockMEChestItems_Medium.getIcon();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getTopTexture_Dark()
|
||||
public IAESprite getTopTexture_Dark()
|
||||
{
|
||||
return ExtraBlockTextures.BlockMEChestItems_Dark.getIcon();
|
||||
}
|
||||
@@ -79,7 +79,7 @@ public class BasicCellHandler implements ICellHandler
|
||||
@Override
|
||||
public void openChestGui( EntityPlayer player, IChestOrDrive chest, ICellHandler cellHandler, IMEInventoryHandler inv, ItemStack is, StorageChannel chan )
|
||||
{
|
||||
Platform.openGUI( player, (TileEntity) chest, chest.getUp(), GuiBridge.GUI_ME );
|
||||
Platform.openGUI( player, (TileEntity) chest, AEPartLocation.fromFacing( chest.getUp() ), GuiBridge.GUI_ME );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -22,15 +22,15 @@ package appeng.core.features.registries.entries;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import appeng.api.implementations.tiles.IChestOrDrive;
|
||||
import appeng.api.storage.ICellHandler;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.IMEInventoryHandler;
|
||||
import appeng.api.storage.ISaveProvider;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.client.texture.ExtraBlockTextures;
|
||||
import appeng.client.texture.IAESprite;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.items.storage.ItemCreativeStorageCell;
|
||||
import appeng.me.storage.CreativeCellInventory;
|
||||
@@ -57,19 +57,19 @@ public class CreativeCellHandler implements ICellHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getTopTexture_Light()
|
||||
public IAESprite getTopTexture_Light()
|
||||
{
|
||||
return ExtraBlockTextures.BlockMEChestItems_Light.getIcon();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getTopTexture_Medium()
|
||||
public IAESprite getTopTexture_Medium()
|
||||
{
|
||||
return ExtraBlockTextures.BlockMEChestItems_Medium.getIcon();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getTopTexture_Dark()
|
||||
public IAESprite getTopTexture_Dark()
|
||||
{
|
||||
return ExtraBlockTextures.BlockMEChestItems_Dark.getIcon();
|
||||
}
|
||||
@@ -77,7 +77,7 @@ public class CreativeCellHandler implements ICellHandler
|
||||
@Override
|
||||
public void openChestGui( EntityPlayer player, IChestOrDrive chest, ICellHandler cellHandler, IMEInventoryHandler inv, ItemStack is, StorageChannel chan )
|
||||
{
|
||||
Platform.openGUI( player, (TileEntity) chest, chest.getUp(), GuiBridge.GUI_ME );
|
||||
Platform.openGUI( player, (TileEntity) chest, AEPartLocation.fromFacing( chest.getUp() ), GuiBridge.GUI_ME );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -21,8 +21,7 @@ package appeng.core.features.registries.entries;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.storage.IExternalStorageHandler;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
@@ -35,13 +34,13 @@ public class ExternalIInv implements IExternalStorageHandler
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean canHandle( TileEntity te, ForgeDirection d, StorageChannel channel, BaseActionSource mySrc )
|
||||
public boolean canHandle( TileEntity te, EnumFacing d, StorageChannel channel, BaseActionSource mySrc )
|
||||
{
|
||||
return channel == StorageChannel.ITEMS && te instanceof IInventory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEInventory getInventory( TileEntity te, ForgeDirection d, StorageChannel channel, BaseActionSource src )
|
||||
public IMEInventory getInventory( TileEntity te, EnumFacing d, StorageChannel channel, BaseActionSource src )
|
||||
{
|
||||
InventoryAdaptor ad = InventoryAdaptor.getAdaptor( te, d );
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.api.features.InscriberProcessType;
|
||||
|
||||
|
||||
|
||||
@@ -8,13 +8,12 @@ import java.util.List;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.api.features.IInscriberRecipe;
|
||||
import appeng.api.features.InscriberProcessType;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
|
||||
/**
|
||||
* Basic inscriber recipe
|
||||
|
||||
Reference in New Issue
Block a user