1.15 port
This commit is contained in:
@@ -24,7 +24,7 @@ import java.util.Random;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
@@ -47,9 +47,9 @@ public abstract class CommonHelper
|
||||
|
||||
public abstract void bindTileEntitySpecialRenderer( Class<? extends TileEntity> tile, AEBaseBlock blk );
|
||||
|
||||
public abstract List<EntityPlayer> getPlayers();
|
||||
public abstract List<PlayerEntity> getPlayers();
|
||||
|
||||
public abstract void sendToAllNearExcept( EntityPlayer p, double x, double y, double z, double dist, World w, AppEngPacket packet );
|
||||
public abstract void sendToAllNearExcept( PlayerEntity p, double x, double y, double z, double dist, World w, AppEngPacket packet );
|
||||
|
||||
public abstract void spawnEffect( EffectType effect, World world, double posX, double posY, double posZ, Object extra );
|
||||
|
||||
@@ -63,7 +63,7 @@ public abstract class CommonHelper
|
||||
|
||||
public abstract void triggerUpdates();
|
||||
|
||||
public abstract void updateRenderMode( EntityPlayer player );
|
||||
public abstract void updateRenderMode( PlayerEntity player );
|
||||
|
||||
public abstract boolean isKeyPressed( @Nonnull final ActionKey key );
|
||||
|
||||
|
||||
@@ -21,8 +21,7 @@ package appeng.core;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
@@ -33,49 +32,45 @@ import appeng.api.definitions.IItems;
|
||||
import appeng.api.definitions.IMaterials;
|
||||
|
||||
|
||||
public final class CreativeTab extends CreativeTabs
|
||||
public final class CreativeTab
|
||||
{
|
||||
public static CreativeTab instance = null;
|
||||
|
||||
public CreativeTab()
|
||||
{
|
||||
super( "appliedenergistics2" );
|
||||
}
|
||||
public static ItemGroup instance = null;
|
||||
|
||||
static void init()
|
||||
{
|
||||
instance = new CreativeTab();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getTabIconItem()
|
||||
{
|
||||
return this.getIconItemStack();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getIconItemStack()
|
||||
{
|
||||
final IDefinitions definitions = AEApi.instance().definitions();
|
||||
final IBlocks blocks = definitions.blocks();
|
||||
final IItems items = definitions.items();
|
||||
final IMaterials materials = definitions.materials();
|
||||
|
||||
return this.findFirst( blocks.controller(), blocks.chest(), blocks.cellWorkbench(), blocks.fluixBlock(), items.cell1k(), items.networkTool(),
|
||||
materials.fluixCrystal(), materials.certusQuartzCrystal(), materials.skyDust() );
|
||||
}
|
||||
|
||||
private ItemStack findFirst( final IItemDefinition... choices )
|
||||
{
|
||||
for( final IItemDefinition definition : choices )
|
||||
instance = new ItemGroup( 11, "appliedenergistics2" )
|
||||
{
|
||||
Optional<ItemStack> maybeIs = definition.maybeStack( 1 );
|
||||
if( maybeIs.isPresent() )
|
||||
{
|
||||
return maybeIs.get();
|
||||
}
|
||||
}
|
||||
|
||||
return new ItemStack( Blocks.CHEST );
|
||||
@Override
|
||||
public ItemStack createIcon()
|
||||
{
|
||||
return this.getIconItemStack();
|
||||
}
|
||||
|
||||
private ItemStack getIconItemStack()
|
||||
{
|
||||
final IDefinitions definitions = AEApi.instance().definitions();
|
||||
final IBlocks blocks = definitions.blocks();
|
||||
final IItems items = definitions.items();
|
||||
final IMaterials materials = definitions.materials();
|
||||
|
||||
return this.findFirst( blocks.controller(), blocks.chest(), blocks.cellWorkbench(), blocks.fluixBlock(), items.cell1k(), items.networkTool(),
|
||||
materials.fluixCrystal(), materials.certusQuartzCrystal(), materials.skyDust() );
|
||||
}
|
||||
|
||||
private ItemStack findFirst( final IItemDefinition... choices )
|
||||
{
|
||||
for( final IItemDefinition definition : choices )
|
||||
{
|
||||
Optional<ItemStack> maybeIs = definition.maybeStack( 1 );
|
||||
if( maybeIs.isPresent() )
|
||||
{
|
||||
return maybeIs.get();
|
||||
}
|
||||
}
|
||||
|
||||
return new ItemStack( net.minecraft.block.Blocks.CHEST );
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -21,8 +21,8 @@ package appeng.core;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
|
||||
@@ -34,30 +34,25 @@ import net.minecraft.advancements.ICriterionInstance;
|
||||
import net.minecraft.advancements.ICriterionTrigger;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.ItemMeshDefinition;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.client.renderer.block.statemap.IStateMapper;
|
||||
import net.minecraft.client.renderer.model.ModelResourceLocation;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.DimensionType;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.dimension.DimensionType;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.client.event.ModelRegistryEvent;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.AttachCapabilitiesEvent;
|
||||
import net.minecraftforge.event.RegistryEvent;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.registry.EntityEntry;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.relauncher.ReflectionHelper;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.fml.loading.FMLEnvironment;
|
||||
import net.minecraftforge.registries.IForgeRegistry;
|
||||
|
||||
import appeng.api.config.Upgrades;
|
||||
@@ -84,7 +79,6 @@ import appeng.bootstrap.components.IEntityRegistrationComponent;
|
||||
import appeng.bootstrap.components.IInitComponent;
|
||||
import appeng.bootstrap.components.IItemRegistrationComponent;
|
||||
import appeng.bootstrap.components.IModelRegistrationComponent;
|
||||
import appeng.bootstrap.components.IOreDictComponent;
|
||||
import appeng.bootstrap.components.IPostInitComponent;
|
||||
import appeng.bootstrap.components.IPreInitComponent;
|
||||
import appeng.bootstrap.components.IRecipeRegistrationComponent;
|
||||
@@ -102,10 +96,7 @@ import appeng.core.stats.Stats;
|
||||
import appeng.core.worlddata.SpatialDimensionManager;
|
||||
import appeng.fluids.registries.BasicFluidCellGuiHandler;
|
||||
import appeng.hooks.TickHandler;
|
||||
import appeng.items.materials.ItemMaterial;
|
||||
import appeng.items.parts.ItemFacade;
|
||||
import appeng.items.parts.ItemPart;
|
||||
import appeng.loot.ChestLoot;
|
||||
import appeng.me.cache.CraftingGridCache;
|
||||
import appeng.me.cache.EnergyGridCache;
|
||||
import appeng.me.cache.GridStorageCache;
|
||||
@@ -222,11 +213,6 @@ final class Registration
|
||||
|
||||
MinecraftForge.EVENT_BUS.register( new PartPlacement() );
|
||||
|
||||
if( AEConfig.instance().isFeatureEnabled( AEFeature.CHEST_LOOT ) )
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.register( new ChestLoot() );
|
||||
}
|
||||
|
||||
final IGridCacheRegistry gcr = registries.gridCache();
|
||||
gcr.registerGridCache( ITickManager.class, TickManagerCache.class );
|
||||
gcr.registerGridCache( IEnergyGrid.class, EnergyGridCache.class );
|
||||
@@ -262,13 +248,13 @@ final class Registration
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
@SideOnly( Side.CLIENT )
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public void modelRegistryEvent( ModelRegistryEvent event )
|
||||
{
|
||||
final ApiDefinitions definitions = Api.INSTANCE.definitions();
|
||||
final IModelRegistry registry = new ModelLoaderWrapper();
|
||||
final Side side = FMLCommonHandler.instance().getEffectiveSide();
|
||||
definitions.getRegistry().getBootstrapComponents( IModelRegistrationComponent.class ).forEachRemaining( b -> b.modelRegistration( side, registry ) );
|
||||
final Dist dist = FMLEnvironment.dist;
|
||||
definitions.getRegistry().getBootstrapComponents( IModelRegistrationComponent.class ).forEachRemaining( b -> b.modelRegistration( dist, registry ) );
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
@@ -276,8 +262,8 @@ final class Registration
|
||||
{
|
||||
final IForgeRegistry<Block> registry = event.getRegistry();
|
||||
final ApiDefinitions definitions = Api.INSTANCE.definitions();
|
||||
final Side side = FMLCommonHandler.instance().getEffectiveSide();
|
||||
definitions.getRegistry().getBootstrapComponents( IBlockRegistrationComponent.class ).forEachRemaining( b -> b.blockRegistration( side, registry ) );
|
||||
final Dist dist = FMLEnvironment.dist;
|
||||
definitions.getRegistry().getBootstrapComponents( IBlockRegistrationComponent.class ).forEachRemaining( b -> b.blockRegistration( dist, registry ) );
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
@@ -285,12 +271,8 @@ final class Registration
|
||||
{
|
||||
final IForgeRegistry<Item> registry = event.getRegistry();
|
||||
final ApiDefinitions definitions = Api.INSTANCE.definitions();
|
||||
final Side side = FMLCommonHandler.instance().getEffectiveSide();
|
||||
definitions.getRegistry().getBootstrapComponents( IItemRegistrationComponent.class ).forEachRemaining( b -> b.itemRegistration( side, registry ) );
|
||||
// register oredicts
|
||||
definitions.getRegistry().getBootstrapComponents( IOreDictComponent.class ).forEachRemaining( b -> b.oreRegistration( side ) );
|
||||
ItemMaterial.instance.registerOredicts();
|
||||
ItemPart.instance.registerOreDicts();
|
||||
final Dist dist = FMLEnvironment.dist;
|
||||
definitions.getRegistry().getBootstrapComponents( IItemRegistrationComponent.class ).forEachRemaining( b -> b.itemRegistration( dist, registry ) );
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
@@ -300,7 +282,7 @@ final class Registration
|
||||
|
||||
final Api api = Api.INSTANCE;
|
||||
final ApiDefinitions definitions = api.definitions();
|
||||
final Side side = FMLCommonHandler.instance().getEffectiveSide();
|
||||
final Dist dist = FMLCommonHandler.instance().getEffectiveSide();
|
||||
|
||||
if( AEConfig.instance().isFeatureEnabled( AEFeature.ENABLE_DISASSEMBLY_CRAFTING ) )
|
||||
{
|
||||
@@ -474,32 +456,30 @@ final class Registration
|
||||
/*
|
||||
* You can't move bed rock.
|
||||
*/
|
||||
mr.blacklistBlock( net.minecraft.init.Blocks.BEDROCK );
|
||||
mr.blacklistBlock( net.minecraft.block.Blocks.BEDROCK );
|
||||
|
||||
/*
|
||||
* White List Vanilla...
|
||||
*/
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityBanner.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityBeacon.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityBrewingStand.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityChest.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityCommandBlock.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityComparator.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityDaylightDetector.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityDispenser.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityDropper.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityEnchantmentTable.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityEnderChest.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityEndPortal.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityFlowerPot.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityFurnace.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityHopper.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityMobSpawner.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityNote.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityPiston.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityShulkerBox.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntitySign.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntitySkull.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.BannerTileEntity.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.BeaconTileEntity.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.BrewingStandTileEntity.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.ChestTileEntity.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.CommandBlockTileEntity.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.ComparatorTileEntity.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.DaylightDetectorTileEntity.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.DispenserTileEntity.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.DropperTileEntity.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.EnchantingTableTileEntity.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.EnderChestTileEntity.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.EndPortalTileEntity.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.FurnaceTileEntity.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.HopperTileEntity.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.MobSpawnerTileEntity.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.PistonTileEntity.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.ShulkerBoxTileEntity.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.SignTileEntity.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.SkullTileEntity.class );
|
||||
|
||||
/*
|
||||
* Whitelist AE2
|
||||
|
||||
@@ -19,316 +19,25 @@
|
||||
package appeng.core.api;
|
||||
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
import com.google.common.cache.CacheLoader;
|
||||
import com.google.common.cache.LoadingCache;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import org.objectweb.asm.ClassReader;
|
||||
import org.objectweb.asm.ClassWriter;
|
||||
import org.objectweb.asm.commons.Remapper;
|
||||
import org.objectweb.asm.commons.RemappingClassAdapter;
|
||||
import org.objectweb.asm.tree.AbstractInsnNode;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import org.objectweb.asm.tree.MethodInsnNode;
|
||||
import org.objectweb.asm.tree.MethodNode;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.parts.CableRenderMode;
|
||||
import appeng.api.parts.IPartHelper;
|
||||
import appeng.api.parts.LayerBase;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.parts.PartPlacement;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import appeng.tile.networking.TileCableBus;
|
||||
|
||||
|
||||
public class ApiPart implements IPartHelper
|
||||
{
|
||||
|
||||
private final LoadingCache<CacheKey, Class<? extends AEBaseTile>> cache = CacheBuilder.newBuilder()
|
||||
.build( new CacheLoader<CacheKey, Class<? extends AEBaseTile>>()
|
||||
{
|
||||
@Override
|
||||
public Class<? extends AEBaseTile> load( CacheKey key ) throws Exception
|
||||
{
|
||||
return ApiPart.this.generateCombinedClass( key );
|
||||
}
|
||||
} );
|
||||
|
||||
private final Map<Class<?>, String> interfaces2Layer = new HashMap<>();
|
||||
private final List<String> desc = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* Conceptually this method will build a new class hierarchy that is rooted at the given base class, and includes a
|
||||
* chain of all registered layers.
|
||||
* <p/>
|
||||
* To accomplish this, it takes the first registered layer, replaces it's inheritance from LayerBase with an
|
||||
* inheritance from the given baseClass,
|
||||
* and uses the resulting class as the parent class for the next registered layer, for which it repeats this
|
||||
* process. This process is then repeated
|
||||
* until a class hierarchy of all layers is formed. While janking out the inheritance from LayerBase, it'll make
|
||||
* also sure that calls to that
|
||||
* classes method will instead be forwarded to the superclass that was inserted as part of the described process.
|
||||
* <p/>
|
||||
* Example: If layers A and B are registered, and TileCableBus is passed in as the baseClass, a synthetic class
|
||||
* A_B_TileCableBus should be returned,
|
||||
* which has A_B_TileCableBus -extends-> B_TileCableBus -extends-> TileCableBus as it's class hierarchy, where
|
||||
* A_B_TileCableBus has been generated
|
||||
* from A, and B_TileCableBus has been generated from B.
|
||||
*/
|
||||
public Class<? extends AEBaseTile> getCombinedInstance( final Class<? extends AEBaseTile> baseClass )
|
||||
{
|
||||
if( this.desc.isEmpty() )
|
||||
{
|
||||
// No layers registered...
|
||||
return baseClass;
|
||||
}
|
||||
|
||||
return this.cache.getUnchecked( new CacheKey( baseClass, this.desc ) );
|
||||
}
|
||||
|
||||
private Class<? extends AEBaseTile> generateCombinedClass( CacheKey cacheKey )
|
||||
{
|
||||
final Class<? extends AEBaseTile> parentClass;
|
||||
|
||||
// Get the list of interfaces that still need to be implemented beyond the current one
|
||||
List<String> remainingInterfaces = cacheKey.getInterfaces().subList( 1, cacheKey.getInterfaces().size() );
|
||||
|
||||
// We are not at the root of the class hierarchy yet
|
||||
if( !remainingInterfaces.isEmpty() )
|
||||
{
|
||||
CacheKey parentKey = new CacheKey( cacheKey.getBaseClass(), remainingInterfaces );
|
||||
parentClass = this.cache.getUnchecked( parentKey );
|
||||
}
|
||||
else
|
||||
{
|
||||
parentClass = cacheKey.getBaseClass();
|
||||
}
|
||||
|
||||
// Which interface should be implemented in this layer?
|
||||
String interfaceName = cacheKey.getInterfaces().get( 0 );
|
||||
|
||||
try
|
||||
{
|
||||
// This is the particular interface that this layer was registered for. Loading the class may fail if i.e.
|
||||
// an API is broken or not present
|
||||
// and in this case, the layer will be skipped!
|
||||
Class<?> interfaceClass = Class.forName( interfaceName );
|
||||
String layerImpl = this.interfaces2Layer.get( interfaceClass );
|
||||
|
||||
return this.getClassByDesc( parentClass, layerImpl );
|
||||
}
|
||||
catch( final Throwable t )
|
||||
{
|
||||
AELog.warn( "Error loading " + interfaceName );
|
||||
AELog.debug( t );
|
||||
return parentClass;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings( "unchecked" )
|
||||
private Class<? extends AEBaseTile> getClassByDesc( Class<? extends AEBaseTile> baseClass, final String next )
|
||||
{
|
||||
final ClassWriter cw = new ClassWriter( ClassWriter.COMPUTE_MAXS );
|
||||
final ClassNode n = this.getReader( next );
|
||||
final String originalName = n.name;
|
||||
|
||||
try
|
||||
{
|
||||
n.name = n.name + '_' + baseClass.getSimpleName();
|
||||
n.superName = baseClass.getName().replace( '.', '/' );
|
||||
}
|
||||
catch( final Throwable t )
|
||||
{
|
||||
AELog.debug( t );
|
||||
}
|
||||
|
||||
for( final MethodNode mn : n.methods )
|
||||
{
|
||||
final Iterator<AbstractInsnNode> i = mn.instructions.iterator();
|
||||
while( i.hasNext() )
|
||||
{
|
||||
this.processNode( i.next(), n.superName );
|
||||
}
|
||||
}
|
||||
|
||||
final DefaultPackageClassNameRemapper remapper = new DefaultPackageClassNameRemapper();
|
||||
remapper.inputOutput.put( "appeng/api/parts/LayerBase", n.superName );
|
||||
remapper.inputOutput.put( originalName, n.name );
|
||||
n.accept( new RemappingClassAdapter( cw, remapper ) );
|
||||
// n.accept( cw );
|
||||
|
||||
// n.accept( new TraceClassVisitor( new PrintWriter( System.out ) ) );
|
||||
final byte[] byteArray = cw.toByteArray();
|
||||
final int size = byteArray.length;
|
||||
final Class clazz = this.loadClass( n.name.replace( "/", "." ), byteArray );
|
||||
|
||||
try
|
||||
{
|
||||
final Object fish = clazz.newInstance();
|
||||
|
||||
boolean hasError = false;
|
||||
|
||||
if( !baseClass.isInstance( fish ) )
|
||||
{
|
||||
hasError = true;
|
||||
AELog.error( "Error, Expected layer to implement " + baseClass + " did not." );
|
||||
}
|
||||
|
||||
if( fish instanceof LayerBase )
|
||||
{
|
||||
hasError = true;
|
||||
AELog.error( "Error, Expected layer to NOT implement LayerBase but it DID." );
|
||||
}
|
||||
|
||||
if( !( fish instanceof TileCableBus ) )
|
||||
{
|
||||
hasError = true;
|
||||
AELog.error( "Error, Expected layer to implement TileCableBus did not." );
|
||||
}
|
||||
|
||||
if( !( fish instanceof TileEntity ) )
|
||||
{
|
||||
hasError = true;
|
||||
AELog.error( "Error, Expected layer to implement TileEntity did not." );
|
||||
}
|
||||
|
||||
if( !hasError )
|
||||
{
|
||||
AELog.info( "Layer: " + n.name + " loaded successfully - " + size + " bytes" );
|
||||
}
|
||||
}
|
||||
catch( final Throwable t )
|
||||
{
|
||||
AELog.error( "Layer: " + n.name + " Failed." );
|
||||
AELog.debug( t );
|
||||
}
|
||||
|
||||
return clazz;
|
||||
}
|
||||
|
||||
private ClassNode getReader( final String name )
|
||||
{
|
||||
final String path = '/' + name.replace( ".", "/" ) + ".class";
|
||||
final InputStream is = this.getClass().getResourceAsStream( path );
|
||||
try
|
||||
{
|
||||
final ClassReader cr = new ClassReader( is );
|
||||
|
||||
final ClassNode cn = new ClassNode();
|
||||
cr.accept( cn, ClassReader.EXPAND_FRAMES );
|
||||
|
||||
return cn;
|
||||
}
|
||||
catch( final IOException e )
|
||||
{
|
||||
throw new IllegalStateException( "Error loading " + name, e );
|
||||
}
|
||||
}
|
||||
|
||||
private void processNode( final AbstractInsnNode next, final String nePar )
|
||||
{
|
||||
if( next instanceof MethodInsnNode )
|
||||
{
|
||||
final MethodInsnNode min = (MethodInsnNode) next;
|
||||
if( min.owner.equals( "appeng/api/parts/LayerBase" ) )
|
||||
{
|
||||
min.owner = nePar;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Class loadClass( final String name, byte[] b )
|
||||
{
|
||||
// override classDefine (as it is protected) and define the class.
|
||||
Class clazz = null;
|
||||
try
|
||||
{
|
||||
final ClassLoader loader = this.getClass().getClassLoader();// ClassLoader.getSystemClassLoader();
|
||||
final Class<ClassLoader> root = ClassLoader.class;
|
||||
final Class<? extends ClassLoader> cls = loader.getClass();
|
||||
final Method defineClassMethod = root.getDeclaredMethod( "defineClass", String.class, byte[].class, int.class, int.class );
|
||||
final Method runTransformersMethod = cls.getDeclaredMethod( "runTransformers", String.class, String.class, byte[].class );
|
||||
|
||||
runTransformersMethod.setAccessible( true );
|
||||
defineClassMethod.setAccessible( true );
|
||||
try
|
||||
{
|
||||
final Object[] argsA = {
|
||||
name,
|
||||
name,
|
||||
b
|
||||
};
|
||||
b = (byte[]) runTransformersMethod.invoke( loader, argsA );
|
||||
|
||||
final Object[] args = {
|
||||
name,
|
||||
b,
|
||||
0,
|
||||
b.length
|
||||
};
|
||||
clazz = (Class) defineClassMethod.invoke( loader, args );
|
||||
}
|
||||
finally
|
||||
{
|
||||
runTransformersMethod.setAccessible( false );
|
||||
defineClassMethod.setAccessible( false );
|
||||
}
|
||||
}
|
||||
catch( final Exception e )
|
||||
{
|
||||
AELog.debug( e );
|
||||
throw new IllegalStateException( "Unable to manage part API.", e );
|
||||
}
|
||||
return clazz;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean registerNewLayer( final String layer, final String layerInterface )
|
||||
{
|
||||
try
|
||||
{
|
||||
final Class<?> layerInterfaceClass = Class.forName( layerInterface );
|
||||
if( this.interfaces2Layer.get( layerInterfaceClass ) == null )
|
||||
{
|
||||
this.interfaces2Layer.put( layerInterfaceClass, layer );
|
||||
this.desc.add( layerInterface );
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
AELog.info( "Layer " + layer + " not registered, " + layerInterface + " already has a layer." );
|
||||
}
|
||||
}
|
||||
catch( final Throwable ignored )
|
||||
{
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumActionResult placeBus( final ItemStack is, final BlockPos pos, final EnumFacing side, final EntityPlayer player, final EnumHand hand, final World w )
|
||||
public ActionResult placeBus( final ItemStack is, final BlockPos pos, final Direction side, final PlayerEntity player, final Hand hand, final World w )
|
||||
{
|
||||
return PartPlacement.place( is, pos, side, player, hand, w, PartPlacement.PlaceType.PLACE_ITEM, 0 );
|
||||
}
|
||||
@@ -338,69 +47,4 @@ public class ApiPart implements IPartHelper
|
||||
{
|
||||
return AppEng.proxy.getRenderMode();
|
||||
}
|
||||
|
||||
private static class DefaultPackageClassNameRemapper extends Remapper
|
||||
{
|
||||
|
||||
private final HashMap<String, String> inputOutput = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public String map( final String typeName )
|
||||
{
|
||||
final String o = this.inputOutput.get( typeName );
|
||||
if( o == null )
|
||||
{
|
||||
return typeName;
|
||||
}
|
||||
return o;
|
||||
}
|
||||
}
|
||||
|
||||
private static class CacheKey
|
||||
{
|
||||
private final Class<? extends AEBaseTile> baseClass;
|
||||
|
||||
private final List<String> interfaces;
|
||||
|
||||
private CacheKey( Class<? extends AEBaseTile> baseClass, List<String> interfaces )
|
||||
{
|
||||
this.baseClass = baseClass;
|
||||
this.interfaces = ImmutableList.copyOf( interfaces );
|
||||
}
|
||||
|
||||
private Class<? extends AEBaseTile> getBaseClass()
|
||||
{
|
||||
return this.baseClass;
|
||||
}
|
||||
|
||||
private List<String> getInterfaces()
|
||||
{
|
||||
return this.interfaces;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals( Object o )
|
||||
{
|
||||
if( this == o )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if( o == null || this.getClass() != o.getClass() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
CacheKey cacheKey = (CacheKey) o;
|
||||
|
||||
return this.baseClass.equals( cacheKey.baseClass ) && this.interfaces.equals( cacheKey.interfaces );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
int result = this.baseClass.hashCode();
|
||||
result = 31 * result + this.interfaces.hashCode();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,8 @@ import com.google.common.collect.MutableClassToInstanceMap;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidUtil;
|
||||
|
||||
@@ -100,7 +101,7 @@ public class ApiStorage implements IStorageHelper
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICraftingLink loadCraftingLink( final NBTTagCompound data, final ICraftingRequester req )
|
||||
public ICraftingLink loadCraftingLink( final CompoundNBT data, final ICraftingRequester req )
|
||||
{
|
||||
Preconditions.checkNotNull( data );
|
||||
Preconditions.checkNotNull( req );
|
||||
@@ -154,7 +155,7 @@ public class ApiStorage implements IStorageHelper
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack createFromNBT( NBTTagCompound nbt )
|
||||
public IAEItemStack createFromNBT( CompoundNBT nbt )
|
||||
{
|
||||
Preconditions.checkNotNull( nbt );
|
||||
return AEItemStack.fromNBT( nbt );
|
||||
@@ -224,11 +225,10 @@ public class ApiStorage implements IStorageHelper
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEFluidStack createFromNBT( NBTTagCompound nbt )
|
||||
public IAEFluidStack createFromNBT( CompoundNBT nbt )
|
||||
{
|
||||
Preconditions.checkNotNull( nbt );
|
||||
return AEFluidStack.fromNBT( nbt );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,9 +18,7 @@
|
||||
|
||||
package appeng.core.api;
|
||||
|
||||
|
||||
import net.minecraftforge.fml.common.event.FMLInterModComms.IMCMessage;
|
||||
|
||||
import net.minecraftforge.fml.InterModComms.IMCMessage;
|
||||
|
||||
public interface IIMCProcessor
|
||||
{
|
||||
|
||||
@@ -23,22 +23,20 @@ import com.google.common.base.Verify;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockDispenser;
|
||||
import net.minecraft.block.BlockSlab;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.block.SlabBlock;
|
||||
import net.minecraft.client.renderer.model.ModelResourceLocation;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.ItemSlab;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.fml.common.registry.EntityEntryBuilder;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import appeng.api.definitions.IBlockDefinition;
|
||||
import appeng.api.definitions.IBlocks;
|
||||
import appeng.api.definitions.IItemDefinition;
|
||||
import appeng.api.definitions.ITileDefinition;
|
||||
import appeng.block.AEBaseItemBlockChargeable;
|
||||
import appeng.block.AEBaseBlockItemChargeable;
|
||||
import appeng.block.crafting.BlockCraftingMonitor;
|
||||
import appeng.block.crafting.BlockCraftingStorage;
|
||||
import appeng.block.crafting.BlockCraftingUnit;
|
||||
@@ -95,7 +93,6 @@ import appeng.bootstrap.FeatureFactory;
|
||||
import appeng.bootstrap.IBlockRendering;
|
||||
import appeng.bootstrap.IItemRendering;
|
||||
import appeng.bootstrap.components.IEntityRegistrationComponent;
|
||||
import appeng.bootstrap.components.IOreDictComponent;
|
||||
import appeng.bootstrap.components.IPostInitComponent;
|
||||
import appeng.bootstrap.components.IPreInitComponent;
|
||||
import appeng.bootstrap.definitions.TileEntityDefinition;
|
||||
@@ -117,6 +114,7 @@ import appeng.debug.TileEnergyGenerator;
|
||||
import appeng.debug.TileItemGen;
|
||||
import appeng.debug.TilePhantomNode;
|
||||
import appeng.decorative.slab.BlockSlabCommon;
|
||||
import appeng.decorative.slab.CommonSlabBlock;
|
||||
import appeng.decorative.solid.BlockChargedQuartzOre;
|
||||
import appeng.decorative.solid.BlockChiseledQuartz;
|
||||
import appeng.decorative.solid.BlockFluix;
|
||||
@@ -252,16 +250,10 @@ public final class ApiBlocks implements IBlocks
|
||||
// this.quartzOre = new BlockDefinition( "ore.quartz", new OreQuartz() );
|
||||
this.quartzOre = registry.block( "quartz_ore", BlockQuartzOre::new )
|
||||
.features( AEFeature.CERTUS_ORE )
|
||||
.bootstrap( ( block, item ) -> (IOreDictComponent) side -> OreDictionary.registerOre( "oreCertusQuartz", new ItemStack( block ) ) )
|
||||
.build();
|
||||
this.quartzOreCharged = registry.block( "charged_quartz_ore", BlockChargedQuartzOre::new )
|
||||
.features( AEFeature.CERTUS_ORE, AEFeature.CHARGED_CERTUS_ORE )
|
||||
.useCustomItemModel()
|
||||
.bootstrap( ( block, item ) -> (IOreDictComponent) side ->
|
||||
{
|
||||
OreDictionary.registerOre( "oreCertusQuartz", new ItemStack( block ) );
|
||||
OreDictionary.registerOre( "oreChargedCertusQuartz", new ItemStack( block ) );
|
||||
} )
|
||||
.build();
|
||||
this.matrixFrame = registry.block( "matrix_frame", BlockMatrixFrame::new ).features( AEFeature.SPATIAL_IO ).build();
|
||||
|
||||
@@ -276,7 +268,7 @@ public final class ApiBlocks implements IBlocks
|
||||
.rendering( new BlockRenderingCustomizer()
|
||||
{
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public void customize( IBlockRendering rendering, IItemRendering itemRendering )
|
||||
{
|
||||
rendering.builtInModel( "models/block/builtin/quartz_glass", new GlassModel() );
|
||||
@@ -349,7 +341,7 @@ public final class ApiBlocks implements IBlocks
|
||||
.rendering( new BlockRenderingCustomizer()
|
||||
{
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public void customize( IBlockRendering rendering, IItemRendering itemRendering )
|
||||
{
|
||||
rendering.tesr( BlockCharger.createTesr() );
|
||||
@@ -448,13 +440,13 @@ public final class ApiBlocks implements IBlocks
|
||||
.build();
|
||||
this.energyCell = registry.block( "energy_cell", BlockEnergyCell::new )
|
||||
.features( AEFeature.ENERGY_CELLS )
|
||||
.item( AEBaseItemBlockChargeable::new )
|
||||
.item( AEBaseBlockItemChargeable::new )
|
||||
.tileEntity( new TileEntityDefinition( TileEnergyCell.class ) )
|
||||
.rendering( new BlockEnergyCellRendering( new ResourceLocation( AppEng.MOD_ID, "energy_cell" ) ) )
|
||||
.build();
|
||||
this.energyCellDense = registry.block( "dense_energy_cell", BlockDenseEnergyCell::new )
|
||||
.features( AEFeature.ENERGY_CELLS, AEFeature.DENSE_ENERGY_CELLS )
|
||||
.item( AEBaseItemBlockChargeable::new )
|
||||
.item( AEBaseBlockItemChargeable::new )
|
||||
.tileEntity( new TileEntityDefinition( TileDenseEnergyCell.class ) )
|
||||
.rendering( new BlockEnergyCellRendering( new ResourceLocation( AppEng.MOD_ID, "dense_energy_cell" ) ) )
|
||||
.build();
|
||||
@@ -591,17 +583,17 @@ public final class ApiBlocks implements IBlocks
|
||||
return new BlockDefinition( slabId, null, null );
|
||||
}
|
||||
|
||||
BlockSlab slabBlock = (BlockSlab) slabDef.maybeBlock().get();
|
||||
SlabBlock slabBlock = (SlabBlock) slabDef.maybeBlock().get();
|
||||
|
||||
// Reigster the double slab variant as well
|
||||
IBlockDefinition doubleSlabDef = registry.block( doubleSlabId, () -> new BlockSlabCommon.Double( slabBlock, block ) )
|
||||
IBlockDefinition doubleSlabDef = registry.block( doubleSlabId, () -> new CommonSlabBlock.Double( slabBlock, block ) )
|
||||
.features( AEFeature.DECORATIVE_BLOCKS )
|
||||
.disableItem()
|
||||
.build();
|
||||
|
||||
Verify.verify( doubleSlabDef.maybeBlock().isPresent() );
|
||||
|
||||
BlockSlab doubleSlabBlock = (BlockSlab) doubleSlabDef.maybeBlock().get();
|
||||
SlabBlock doubleSlabBlock = (SlabBlock) doubleSlabDef.maybeBlock().get();
|
||||
|
||||
// Make the slab item
|
||||
IItemDefinition itemDef = registry.item( slabId, () -> new ItemSlab( slabBlock, slabBlock, doubleSlabBlock ) )
|
||||
@@ -611,7 +603,7 @@ public final class ApiBlocks implements IBlocks
|
||||
Verify.verify( itemDef.maybeItem().isPresent() );
|
||||
|
||||
// Return a new composite block definition that combines the single slab block with the slab item
|
||||
return new BlockDefinition( slabId, slabBlock, (ItemBlock) itemDef.maybeItem().get() );
|
||||
return new BlockDefinition( slabId, slabBlock, (BlockItem) itemDef.maybeItem().get() );
|
||||
}
|
||||
|
||||
private static IBlockDefinition makeStairs( String registryName, FeatureFactory registry, IBlockDefinition block )
|
||||
@@ -621,7 +613,7 @@ public final class ApiBlocks implements IBlocks
|
||||
.rendering( new BlockRenderingCustomizer()
|
||||
{
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public void customize( IBlockRendering rendering, IItemRendering itemRendering )
|
||||
{
|
||||
ModelResourceLocation model = new ModelResourceLocation( new ResourceLocation( AppEng.MOD_ID, registryName ), "facing=east,half=bottom,shape=straight" );
|
||||
|
||||
@@ -24,8 +24,8 @@ import java.util.stream.Collectors;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.common.registry.EntityEntryBuilder;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import appeng.api.definitions.IItemDefinition;
|
||||
import appeng.api.definitions.IMaterials;
|
||||
@@ -129,7 +129,7 @@ public final class ApiMaterials implements IMaterials
|
||||
.rendering( new ItemRenderingCustomizer()
|
||||
{
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public void customize( IItemRendering rendering )
|
||||
{
|
||||
rendering.meshDefinition( is -> materials.getTypeByStack( is ).getModel() );
|
||||
|
||||
@@ -1,52 +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.api.imc;
|
||||
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.common.event.FMLInterModComms.IMCMessage;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.api.IIMCProcessor;
|
||||
|
||||
|
||||
public class IMCBlackListSpatial implements IIMCProcessor
|
||||
{
|
||||
|
||||
@Override
|
||||
public void process( final IMCMessage m )
|
||||
{
|
||||
|
||||
final ItemStack is = m.getItemStackValue();
|
||||
if( !is.isEmpty() )
|
||||
{
|
||||
final Block blk = Block.getBlockFromItem( is.getItem() );
|
||||
if( blk != Blocks.AIR )
|
||||
{
|
||||
AEApi.instance().registries().movable().blacklistBlock( blk );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
AELog.info( "Bad Block blacklisted by " + m.getSender() );
|
||||
}
|
||||
}
|
||||
@@ -1,124 +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>.
|
||||
*/
|
||||
|
||||
/* Example:
|
||||
|
||||
NBTTagCompound msg = new NBTTagCompound();
|
||||
NBTTagCompound in = new NBTTagCompound();
|
||||
NBTTagCompound out = new NBTTagCompound();
|
||||
|
||||
new ItemStack( Blocks.iron_ore ).writeToNBT( in );
|
||||
new ItemStack( Items.iron_ingot ).writeToNBT( out );
|
||||
msg.setTag( "in", in );
|
||||
msg.setTag( "out", out );
|
||||
msg.setInteger( "turns", 8 );
|
||||
|
||||
FMLInterModComms.sendMessage( "appliedenergistics2", "add-grindable", msg );
|
||||
|
||||
-- or --
|
||||
|
||||
NBTTagCompound msg = new NBTTagCompound();
|
||||
NBTTagCompound in = new NBTTagCompound();
|
||||
NBTTagCompound out = new NBTTagCompound();
|
||||
NBTTagCompound optional = new NBTTagCompound();
|
||||
|
||||
new ItemStack( Blocks.iron_ore ).writeToNBT( in );
|
||||
new ItemStack( Items.iron_ingot ).writeToNBT( out );
|
||||
new ItemStack( Blocks.gravel ).writeToNBT( optional );
|
||||
msg.setTag( "in", in );
|
||||
msg.setTag( "out", out );
|
||||
msg.setTag( "optional", optional );
|
||||
msg.setFloat( "chance", 0.5 );
|
||||
msg.setInteger( "turns", 8 );
|
||||
|
||||
FMLInterModComms.sendMessage( "appliedenergistics2", "add-grindable", msg );
|
||||
|
||||
*/
|
||||
|
||||
package appeng.core.api.imc;
|
||||
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.fml.common.event.FMLInterModComms.IMCMessage;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.features.IGrinderRecipe;
|
||||
import appeng.api.features.IGrinderRecipeBuilder;
|
||||
import appeng.api.features.IGrinderRegistry;
|
||||
import appeng.core.api.IIMCProcessor;
|
||||
|
||||
|
||||
public class IMCGrinder implements IIMCProcessor
|
||||
{
|
||||
@Override
|
||||
public void process( final IMCMessage m )
|
||||
{
|
||||
final NBTTagCompound msg = m.getNBTValue();
|
||||
final NBTTagCompound inTag = (NBTTagCompound) msg.getTag( "in" );
|
||||
final NBTTagCompound outTag = (NBTTagCompound) msg.getTag( "out" );
|
||||
|
||||
final ItemStack in = new ItemStack( inTag );
|
||||
final ItemStack out = new ItemStack( outTag );
|
||||
|
||||
final int turns = msg.getInteger( "turns" );
|
||||
|
||||
if( in.isEmpty() )
|
||||
{
|
||||
throw new IllegalStateException( "invalid input" );
|
||||
}
|
||||
|
||||
if( out.isEmpty() )
|
||||
{
|
||||
throw new IllegalStateException( "invalid output" );
|
||||
}
|
||||
|
||||
if( msg.hasKey( "optional" ) )
|
||||
{
|
||||
final NBTTagCompound optionalTag = (NBTTagCompound) msg.getTag( "optional" );
|
||||
final ItemStack optional = new ItemStack( optionalTag );
|
||||
|
||||
if( optional.isEmpty() )
|
||||
{
|
||||
throw new IllegalStateException( "invalid optional" );
|
||||
}
|
||||
|
||||
final float chance = msg.getFloat( "chance" );
|
||||
final IGrinderRegistry grinderRegistry = AEApi.instance().registries().grinder();
|
||||
final IGrinderRecipeBuilder builder = grinderRegistry.builder();
|
||||
final IGrinderRecipe grinderRecipe = builder.withInput( in )
|
||||
.withOutput( out )
|
||||
.withFirstOptional( optional, chance )
|
||||
.withTurns( turns )
|
||||
.build();
|
||||
|
||||
grinderRegistry.addRecipe( grinderRecipe );
|
||||
}
|
||||
else
|
||||
{
|
||||
final IGrinderRegistry grinderRegistry = AEApi.instance().registries().grinder();
|
||||
final IGrinderRecipeBuilder builder = grinderRegistry.builder();
|
||||
final IGrinderRecipe grinderRecipe = builder.withInput( in )
|
||||
.withOutput( out )
|
||||
.withTurns( turns )
|
||||
.build();
|
||||
|
||||
grinderRegistry.addRecipe( grinderRecipe );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,62 +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>.
|
||||
*/
|
||||
|
||||
/* Example:
|
||||
|
||||
NBTTagCompound msg = new NBTTagCompound();
|
||||
NBTTagCompound item = new NBTTagCompound();
|
||||
|
||||
new ItemStack( Blocks.anvil ).writeToNBT( item );
|
||||
msg.setTag( "item", item );
|
||||
msg.setDouble( "weight", 32.0 );
|
||||
|
||||
FMLInterModComms.sendMessage( "appliedenergistics2", "add-mattercannon-ammo", msg );
|
||||
|
||||
*/
|
||||
|
||||
package appeng.core.api.imc;
|
||||
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.fml.common.event.FMLInterModComms.IMCMessage;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.core.api.IIMCProcessor;
|
||||
|
||||
|
||||
public class IMCMatterCannon implements IIMCProcessor
|
||||
{
|
||||
|
||||
@Override
|
||||
public void process( final IMCMessage m )
|
||||
{
|
||||
final NBTTagCompound msg = m.getNBTValue();
|
||||
final NBTTagCompound item = (NBTTagCompound) msg.getTag( "item" );
|
||||
|
||||
final ItemStack ammo = new ItemStack( item );
|
||||
final double weight = msg.getDouble( "weight" );
|
||||
|
||||
if( ammo.isEmpty() )
|
||||
{
|
||||
throw new IllegalStateException( "invalid item in message " + m );
|
||||
}
|
||||
|
||||
AEApi.instance().registries().matterCannon().registerAmmo( ammo, weight );
|
||||
}
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2015, 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>.
|
||||
*/
|
||||
|
||||
/* Example:
|
||||
|
||||
FMLInterModComms.sendMessage( "appliedenergistics2", "add-p2p-attunement-me", new ItemStack( myBlockOrItem ) );
|
||||
FMLInterModComms.sendMessage( "appliedenergistics2", "add-p2p-attunement-bc-power", new ItemStack( myBlockOrItem ) );
|
||||
FMLInterModComms.sendMessage( "appliedenergistics2", "add-p2p-attunement-ic2-power", new ItemStack( myBlockOrItem ) );
|
||||
FMLInterModComms.sendMessage( "appliedenergistics2", "add-p2p-attunement-redstone", new ItemStack( myBlockOrItem ) );
|
||||
FMLInterModComms.sendMessage( "appliedenergistics2", "add-p2p-attunement-fluid", new ItemStack( myBlockOrItem ) );
|
||||
FMLInterModComms.sendMessage( "appliedenergistics2", "add-p2p-attunement-item", new ItemStack( myBlockOrItem ) );
|
||||
|
||||
*/
|
||||
|
||||
package appeng.core.api.imc;
|
||||
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Locale;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.common.event.FMLInterModComms.IMCMessage;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.TunnelType;
|
||||
import appeng.core.api.IIMCProcessor;
|
||||
|
||||
|
||||
public class IMCP2PAttunement implements IIMCProcessor
|
||||
{
|
||||
|
||||
@Override
|
||||
public void process( final IMCMessage m )
|
||||
{
|
||||
final String key = m.key.substring( "add-p2p-attunement-".length() ).replace( '-', '_' ).toUpperCase( Locale.ENGLISH );
|
||||
|
||||
final TunnelType type = TunnelType.valueOf( key );
|
||||
|
||||
if( type != null )
|
||||
{
|
||||
final ItemStack is = m.getItemStackValue();
|
||||
if( !is.isEmpty() )
|
||||
{
|
||||
AEApi.instance().registries().p2pTunnel().addNewAttunement( is, type );
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new IllegalStateException( "invalid item in message " + m );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new IllegalStateException( "invalid type in message " + m + " is not contained in " + Arrays.toString( TunnelType.values() ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,52 +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>.
|
||||
*/
|
||||
|
||||
/* Example:
|
||||
|
||||
FMLInterModComms.sendMessage( "appliedenergistics2", "whitelist-spatial", "mymod.tileentities.MyTileEntity" );
|
||||
|
||||
*/
|
||||
|
||||
package appeng.core.api.imc;
|
||||
|
||||
|
||||
import net.minecraftforge.fml.common.event.FMLInterModComms.IMCMessage;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.api.IIMCProcessor;
|
||||
|
||||
|
||||
public class IMCSpatial implements IIMCProcessor
|
||||
{
|
||||
|
||||
@Override
|
||||
public void process( final IMCMessage m )
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
final Class classInstance = Class.forName( m.getStringValue() );
|
||||
AEApi.instance().registries().movable().whiteListTileEntity( classInstance );
|
||||
}
|
||||
catch( final ClassNotFoundException e )
|
||||
{
|
||||
AELog.info( "Bad Class Registered: " + m.getStringValue() + " by " + m.getSender() );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -24,10 +24,10 @@ import java.util.Optional;
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
|
||||
import appeng.api.definitions.IBlockDefinition;
|
||||
|
||||
@@ -36,7 +36,7 @@ public class BlockDefinition extends ItemDefinition implements IBlockDefinition
|
||||
{
|
||||
private final Optional<Block> block;
|
||||
|
||||
public BlockDefinition( String registryName, Block block, ItemBlock item )
|
||||
public BlockDefinition( String registryName, Block block, BlockItem item )
|
||||
{
|
||||
super( registryName, item );
|
||||
this.block = Optional.ofNullable( block );
|
||||
@@ -49,9 +49,9 @@ public class BlockDefinition extends ItemDefinition implements IBlockDefinition
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Optional<ItemBlock> maybeItemBlock()
|
||||
public Optional<BlockItem> maybeBlockItem()
|
||||
{
|
||||
return this.block.map( ItemBlock::new );
|
||||
return this.block.map( BlockItem::new );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -63,7 +63,7 @@ public class BlockDefinition extends ItemDefinition implements IBlockDefinition
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean isSameAs( final IBlockAccess world, final BlockPos pos )
|
||||
public final boolean isSameAs( final IBlockReader world, final BlockPos pos )
|
||||
{
|
||||
return this.block.isPresent() && world.getBlockState( pos ).getBlock() == this.block.get();
|
||||
}
|
||||
|
||||
@@ -32,18 +32,15 @@ public class BlockStackSrc implements IStackSrc
|
||||
{
|
||||
|
||||
private final Block block;
|
||||
private final int damage;
|
||||
private final boolean enabled;
|
||||
|
||||
public BlockStackSrc( final Block block, final int damage, final ActivityState state )
|
||||
public BlockStackSrc( final Block block, final ActivityState state )
|
||||
{
|
||||
Preconditions.checkNotNull( block );
|
||||
Preconditions.checkArgument( damage >= 0 );
|
||||
Preconditions.checkNotNull( state );
|
||||
Preconditions.checkArgument( state == ActivityState.Enabled || state == ActivityState.Disabled );
|
||||
|
||||
this.block = block;
|
||||
this.damage = damage;
|
||||
this.enabled = state == ActivityState.Enabled;
|
||||
}
|
||||
|
||||
@@ -51,7 +48,7 @@ public class BlockStackSrc implements IStackSrc
|
||||
@Override
|
||||
public ItemStack stack( final int i )
|
||||
{
|
||||
return new ItemStack( this.block, i, this.damage );
|
||||
return new ItemStack( this.block, i );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -60,12 +57,6 @@ public class BlockStackSrc implements IStackSrc
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDamage()
|
||||
{
|
||||
return this.damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled()
|
||||
{
|
||||
|
||||
@@ -97,6 +97,6 @@ public final class ColoredItemDefinition implements AEColoredItemDefinition
|
||||
return false;
|
||||
}
|
||||
|
||||
return comparableItem.getItem() == is.getItem() && comparableItem.getItemDamage() == is.getDamage();
|
||||
return comparableItem.getItem() == is.getItem();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ public final class DamagedItemDefinition implements IItemDefinition
|
||||
return false;
|
||||
}
|
||||
|
||||
return this.isEnabled() && comparableStack.getItem() == this.source.get().getItem() && comparableStack.getItemDamage() == this.source.get().getDamage();
|
||||
return this.isEnabled() && comparableStack.getItem() == this.source.get().getItem();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -30,7 +30,5 @@ public interface IStackSrc
|
||||
|
||||
Item getItem();
|
||||
|
||||
int getDamage();
|
||||
|
||||
boolean isEnabled();
|
||||
}
|
||||
|
||||
@@ -31,18 +31,15 @@ public class ItemStackSrc implements IStackSrc
|
||||
{
|
||||
|
||||
private final Item item;
|
||||
private final int damage;
|
||||
private final boolean enabled;
|
||||
|
||||
public ItemStackSrc( final Item item, final int damage, final ActivityState state )
|
||||
public ItemStackSrc( final Item item, final ActivityState state )
|
||||
{
|
||||
Preconditions.checkNotNull( item );
|
||||
Preconditions.checkArgument( damage >= 0 );
|
||||
Preconditions.checkNotNull( state );
|
||||
Preconditions.checkArgument( state == ActivityState.Enabled || state == ActivityState.Disabled );
|
||||
|
||||
this.item = item;
|
||||
this.damage = damage;
|
||||
this.enabled = state == ActivityState.Enabled;
|
||||
}
|
||||
|
||||
@@ -50,7 +47,7 @@ public class ItemStackSrc implements IStackSrc
|
||||
@Override
|
||||
public ItemStack stack( final int i )
|
||||
{
|
||||
return new ItemStack( this.item, i, this.damage );
|
||||
return new ItemStack( this.item, i );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -59,12 +56,6 @@ public class ItemStackSrc implements IStackSrc
|
||||
return this.item;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDamage()
|
||||
{
|
||||
return this.damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled()
|
||||
{
|
||||
|
||||
@@ -52,12 +52,6 @@ public class MaterialStackSrc implements IStackSrc
|
||||
return this.src.getItemInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDamage()
|
||||
{
|
||||
return this.src.getDamageValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled()
|
||||
{
|
||||
|
||||
@@ -23,7 +23,7 @@ import java.util.Optional;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import appeng.api.definitions.ITileDefinition;
|
||||
@@ -35,7 +35,7 @@ public final class TileDefinition extends BlockDefinition implements ITileDefini
|
||||
|
||||
private final Optional<AEBaseTileBlock> block;
|
||||
|
||||
public TileDefinition( @Nonnull String registryName, AEBaseTileBlock block, ItemBlock item )
|
||||
public TileDefinition( @Nonnull String registryName, AEBaseTileBlock block, BlockItem item )
|
||||
{
|
||||
super( registryName, block, item );
|
||||
this.block = Optional.ofNullable( block );
|
||||
|
||||
@@ -23,7 +23,7 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
|
||||
import appeng.api.events.LocatableEventAnnounce;
|
||||
import appeng.api.events.LocatableEventAnnounce.LocatableEvent;
|
||||
|
||||
@@ -21,8 +21,8 @@ package appeng.core.features.registries;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
|
||||
import appeng.api.features.IMatterCannonAmmoRegistry;
|
||||
import appeng.recipes.ores.IOreListener;
|
||||
|
||||
@@ -81,7 +81,7 @@ public class MovableTileRegistry implements IMovableRegistry
|
||||
( (IMovableTile) te ).prepareToMove();
|
||||
}
|
||||
|
||||
te.invalidate();
|
||||
te.remove();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,14 +26,13 @@ import java.util.Map.Entry;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.TunnelType;
|
||||
@@ -99,15 +98,11 @@ public final class P2PTunnelRegistry implements IP2PTunnelRegistry
|
||||
this.addNewAttunement( new ItemStack( Items.REDSTONE ), TunnelType.REDSTONE );
|
||||
this.addNewAttunement( new ItemStack( Items.REPEATER ), TunnelType.REDSTONE );
|
||||
this.addNewAttunement( new ItemStack( Blocks.REDSTONE_LAMP ), TunnelType.REDSTONE );
|
||||
this.addNewAttunement( new ItemStack( Blocks.UNPOWERED_COMPARATOR ), TunnelType.REDSTONE );
|
||||
this.addNewAttunement( new ItemStack( Blocks.POWERED_COMPARATOR ), TunnelType.REDSTONE );
|
||||
this.addNewAttunement( new ItemStack( Blocks.POWERED_REPEATER ), TunnelType.REDSTONE );
|
||||
this.addNewAttunement( new ItemStack( Blocks.UNPOWERED_REPEATER ), TunnelType.REDSTONE );
|
||||
this.addNewAttunement( new ItemStack( Blocks.COMPARATOR ), TunnelType.REDSTONE );
|
||||
this.addNewAttunement( new ItemStack( Blocks.DAYLIGHT_DETECTOR ), TunnelType.REDSTONE );
|
||||
this.addNewAttunement( new ItemStack( Blocks.REDSTONE_WIRE ), TunnelType.REDSTONE );
|
||||
this.addNewAttunement( new ItemStack( Blocks.REDSTONE_BLOCK ), TunnelType.REDSTONE );
|
||||
this.addNewAttunement( new ItemStack( Blocks.LEVER ), TunnelType.REDSTONE );
|
||||
this.addNewAttunement( this.getModItem( "enderio", "itemredstoneconduit", OreDictionary.WILDCARD_VALUE ), TunnelType.REDSTONE );
|
||||
|
||||
/**
|
||||
* attune based on lots of random item related stuff
|
||||
@@ -124,7 +119,6 @@ public final class P2PTunnelRegistry implements IP2PTunnelRegistry
|
||||
this.addNewAttunement( new ItemStack( Blocks.TRAPPED_CHEST ), TunnelType.ITEM );
|
||||
this.addNewAttunement( this.getModItem( "extrautilities", "extractor_base", 0 ), TunnelType.ITEM );
|
||||
this.addNewAttunement( this.getModItem( "mekanism", "parttransmitter", 9 ), TunnelType.ITEM );
|
||||
this.addNewAttunement( this.getModItem( "enderio", "itemitemconduit", OreDictionary.WILDCARD_VALUE ), TunnelType.ITEM );
|
||||
this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_32", 0 ), TunnelType.ITEM ); // itemduct
|
||||
this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_32", 1 ), TunnelType.ITEM ); // itemduct
|
||||
// (opaque)
|
||||
@@ -144,8 +138,6 @@ public final class P2PTunnelRegistry implements IP2PTunnelRegistry
|
||||
this.addNewAttunement( this.getModItem( "mekanism", "machineblock2", 11 ), TunnelType.FLUID );
|
||||
this.addNewAttunement( this.getModItem( "mekanism", "parttransmitter", 4 ), TunnelType.FLUID );
|
||||
this.addNewAttunement( this.getModItem( "extrautilities", "extractor_base", 6 ), TunnelType.FLUID );
|
||||
this.addNewAttunement( this.getModItem( "extrautilities", "drum", OreDictionary.WILDCARD_VALUE ), TunnelType.FLUID );
|
||||
this.addNewAttunement( this.getModItem( "enderio", "itemliquidconduit", OreDictionary.WILDCARD_VALUE ), TunnelType.FLUID );
|
||||
this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_16", 0 ), TunnelType.FLUID ); // fluiduct
|
||||
this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_16", 1 ), TunnelType.FLUID ); // fluiduct
|
||||
// (opaque)
|
||||
@@ -228,7 +220,7 @@ public final class P2PTunnelRegistry implements IP2PTunnelRegistry
|
||||
{
|
||||
final ItemStack is = entry.getKey();
|
||||
|
||||
if( is.getItem() == trigger.getItem() && is.getItemDamage() == OreDictionary.WILDCARD_VALUE )
|
||||
if( is.getItem() == trigger.getItem() )
|
||||
{
|
||||
return entry.getValue();
|
||||
}
|
||||
@@ -240,11 +232,11 @@ public final class P2PTunnelRegistry implements IP2PTunnelRegistry
|
||||
}
|
||||
|
||||
// Next, check if the Item you're holding supports any registered capability
|
||||
for( EnumFacing face : EnumFacing.VALUES )
|
||||
for( Direction face : Direction.values() )
|
||||
{
|
||||
for( Entry<Capability<?>, TunnelType> entry : this.capTunnels.entrySet() )
|
||||
{
|
||||
if( trigger.hasCapability( entry.getKey(), face ) )
|
||||
if( trigger.getCapability( entry.getKey(), face ).isPresent() )
|
||||
{
|
||||
return entry.getValue();
|
||||
}
|
||||
@@ -254,7 +246,7 @@ public final class P2PTunnelRegistry implements IP2PTunnelRegistry
|
||||
// Use the mod id as last option.
|
||||
for( final Entry<String, TunnelType> entry : this.modIdTunnels.entrySet() )
|
||||
{
|
||||
if( trigger.getItem().getRegistryName() != null && trigger.getItem().getRegistryName().getResourceDomain().equals( entry.getKey() ) )
|
||||
if( trigger.getItem().getRegistryName() != null && trigger.getItem().getRegistryName().getNamespace().equals( entry.getKey() ) )
|
||||
{
|
||||
return entry.getValue();
|
||||
}
|
||||
@@ -275,7 +267,7 @@ public final class P2PTunnelRegistry implements IP2PTunnelRegistry
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
final ItemStack myItemStack = new ItemStack( item, 1, meta );
|
||||
final ItemStack myItemStack = new ItemStack( item, 1 );
|
||||
return myItemStack;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ import javax.annotation.Nullable;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
|
||||
import appeng.api.features.IPlayerRegistry;
|
||||
import appeng.core.worlddata.WorldData;
|
||||
@@ -44,14 +44,14 @@ public class PlayerRegistry implements IPlayerRegistry
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getID( final EntityPlayer player )
|
||||
public int getID( final PlayerEntity player )
|
||||
{
|
||||
return this.getID( player.getGameProfile() );
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public EntityPlayer findPlayer( final int playerID )
|
||||
public PlayerEntity findPlayer( final int playerID )
|
||||
{
|
||||
return WorldData.instance().playerData().getPlayerFromID( playerID );
|
||||
}
|
||||
|
||||
@@ -22,9 +22,9 @@ package appeng.core.features.registries;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.features.ILocatable;
|
||||
@@ -80,7 +80,7 @@ public final class WirelessRegistry implements IWirelessTermRegistry
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openWirelessTerminalGui( final ItemStack item, final World w, final EntityPlayer player )
|
||||
public void openWirelessTerminalGui( ItemStack item, IBlockReader world, PlayerEntity player )
|
||||
{
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
|
||||
@@ -22,7 +22,7 @@ package appeng.core.features.registries;
|
||||
import java.util.HashSet;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldProvider;
|
||||
import net.minecraft.world.dimension.Dimension;
|
||||
|
||||
import appeng.api.features.IWorldGen;
|
||||
|
||||
@@ -45,7 +45,7 @@ public final class WorldGenRegistry implements IWorldGen
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disableWorldGenForProviderID( final WorldGenType type, final Class<? extends WorldProvider> provider )
|
||||
public void disableWorldGenForProviderID( WorldGenType type, Class<? extends Dimension> provider )
|
||||
{
|
||||
if( type == null )
|
||||
{
|
||||
@@ -95,9 +95,9 @@ public final class WorldGenRegistry implements IWorldGen
|
||||
throw new IllegalArgumentException( "Bad Provider Passed" );
|
||||
}
|
||||
|
||||
final boolean isBadProvider = this.types[type.ordinal()].badProviders.contains( w.provider.getClass() );
|
||||
final boolean isBadDimension = this.types[type.ordinal()].badDimensions.contains( w.provider.getDimension() );
|
||||
final boolean isGoodDimension = this.types[type.ordinal()].enabledDimensions.contains( w.provider.getDimension() );
|
||||
final boolean isBadProvider = this.types[type.ordinal()].badProviders.contains( w.dimension.getClass() );
|
||||
final boolean isBadDimension = this.types[type.ordinal()].badDimensions.contains( w.dimension.getDimension() );
|
||||
final boolean isGoodDimension = this.types[type.ordinal()].enabledDimensions.contains( w.dimension.getDimension() );
|
||||
|
||||
if( isBadProvider || isBadDimension )
|
||||
{
|
||||
@@ -115,7 +115,7 @@ public final class WorldGenRegistry implements IWorldGen
|
||||
private static class TypeSet
|
||||
{
|
||||
|
||||
final HashSet<Class<? extends WorldProvider>> badProviders = new HashSet<>();
|
||||
final HashSet<Class<? extends Dimension>> badProviders = new HashSet<>();
|
||||
final HashSet<Integer> badDimensions = new HashSet<>();
|
||||
final HashSet<Integer> enabledDimensions = new HashSet<>();
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
package appeng.core.features.registries.cell;
|
||||
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
@@ -28,7 +28,7 @@ public class BasicItemCellGuiHandler implements ICellGuiHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openChestGui( final EntityPlayer player, final IChestOrDrive chest, final ICellHandler cellHandler, final IMEInventoryHandler inv, final ItemStack is, final IStorageChannel chan )
|
||||
public void openChestGui( final PlayerEntity player, final IChestOrDrive chest, final ICellHandler cellHandler, final IMEInventoryHandler inv, final ItemStack is, final IStorageChannel chan )
|
||||
{
|
||||
Platform.openGUI( player, (TileEntity) chest, AEPartLocation.fromFacing( chest.getUp() ), GuiBridge.GUI_ME );
|
||||
}
|
||||
|
||||
@@ -29,10 +29,10 @@ import javax.annotation.Nonnull;
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
|
||||
import appeng.api.features.IGrinderRecipe;
|
||||
import appeng.api.features.IGrinderRecipeBuilder;
|
||||
@@ -67,9 +67,9 @@ public final class GrinderRecipeManager implements IGrinderRegistry, IOreListene
|
||||
this.addDustRatio( "Coal", 1 );
|
||||
|
||||
this.addOre( "Coal", new ItemStack( Items.COAL ) );
|
||||
this.addOre( "Charcoal", new ItemStack( Items.COAL, 1, 1 ) );
|
||||
this.addOre( "Charcoal", new ItemStack( Items.COAL, 1 ) );
|
||||
|
||||
this.addOre( "NetherQuartz", new ItemStack( Blocks.QUARTZ_ORE ) );
|
||||
this.addOre( "NetherQuartz", new ItemStack( Blocks.NETHER_QUARTZ_ORE ) );
|
||||
this.addIngot( "NetherQuartz", new ItemStack( Items.QUARTZ ) );
|
||||
|
||||
this.addOre( "Gold", new ItemStack( Blocks.GOLD_ORE ) );
|
||||
@@ -138,7 +138,7 @@ public final class GrinderRecipeManager implements IGrinderRegistry, IOreListene
|
||||
return null;
|
||||
}
|
||||
|
||||
this.log( "Recipe for '%1$s' found '%2$s'", input.getUnlocalizedName(), Platform.getItemDisplayName( recipe.getOutput() ) );
|
||||
this.log( "Recipe for '%1$s' found '%2$s'", input.getTranslationKey(), Platform.getItemDisplayName( recipe.getOutput() ) );
|
||||
return recipe;
|
||||
}
|
||||
|
||||
@@ -344,7 +344,6 @@ public final class GrinderRecipeManager implements IGrinderRegistry, IOreListene
|
||||
private static class CacheKey
|
||||
{
|
||||
private final Item item;
|
||||
private final int damage;
|
||||
|
||||
CacheKey( ItemStack input )
|
||||
{
|
||||
@@ -352,7 +351,6 @@ public final class GrinderRecipeManager implements IGrinderRegistry, IOreListene
|
||||
Preconditions.checkNotNull( input.getItem() );
|
||||
|
||||
this.item = input.getItem();
|
||||
this.damage = input.getItemDamage();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -360,7 +358,6 @@ public final class GrinderRecipeManager implements IGrinderRegistry, IOreListene
|
||||
{
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + this.damage;
|
||||
result = prime * result + ( ( this.item == null ) ? 0 : this.item.hashCode() );
|
||||
return result;
|
||||
}
|
||||
@@ -379,11 +376,6 @@ public final class GrinderRecipeManager implements IGrinderRegistry, IOreListene
|
||||
|
||||
CacheKey other = (CacheKey) obj;
|
||||
|
||||
if( this.damage != other.damage )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if( this.item == null )
|
||||
{
|
||||
if( other.item != null )
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
package appeng.core.localization;
|
||||
|
||||
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
|
||||
|
||||
public enum ButtonToolTips
|
||||
@@ -164,10 +164,10 @@ public enum ButtonToolTips
|
||||
|
||||
public String getLocal()
|
||||
{
|
||||
return I18n.translateToLocal( this.getUnlocalized() );
|
||||
return I18n.format( this.getTranslationKey() );
|
||||
}
|
||||
|
||||
public String getUnlocalized()
|
||||
public String getTranslationKey()
|
||||
{
|
||||
return this.root + '.' + this.toString();
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
package appeng.core.localization;
|
||||
|
||||
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
|
||||
|
||||
public enum GuiText
|
||||
@@ -212,10 +212,10 @@ public enum GuiText
|
||||
|
||||
public String getLocal()
|
||||
{
|
||||
return I18n.translateToLocal( this.getUnlocalized() );
|
||||
return I18n.format( this.getTranslationKey() );
|
||||
}
|
||||
|
||||
public String getUnlocalized()
|
||||
public String getTranslationKey()
|
||||
{
|
||||
return this.root + '.' + this.toString();
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ package appeng.core.localization;
|
||||
|
||||
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TextComponentTranslation;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
|
||||
|
||||
public enum PlayerMessages
|
||||
@@ -45,10 +45,10 @@ public enum PlayerMessages
|
||||
|
||||
public ITextComponent get()
|
||||
{
|
||||
return new TextComponentTranslation( this.getName() );
|
||||
return new TranslationTextComponent( this.getTranslationKey() );
|
||||
}
|
||||
|
||||
String getName()
|
||||
String getTranslationKey()
|
||||
{
|
||||
return "chat.appliedenergistics2." + this.toString();
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
package appeng.core.localization;
|
||||
|
||||
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
|
||||
|
||||
public enum WailaText
|
||||
@@ -56,10 +56,10 @@ public enum WailaText
|
||||
|
||||
public String getLocal()
|
||||
{
|
||||
return I18n.translateToLocal( this.getUnlocalized() );
|
||||
return I18n.format( this.getTranslationKey() );
|
||||
}
|
||||
|
||||
public String getUnlocalized()
|
||||
public String getTranslationKey()
|
||||
{
|
||||
return this.root + '.' + this.toString();
|
||||
}
|
||||
|
||||
@@ -31,8 +31,8 @@ import com.google.gson.JsonObject;
|
||||
|
||||
import net.minecraft.advancements.ICriterionTrigger;
|
||||
import net.minecraft.advancements.PlayerAdvancements;
|
||||
import net.minecraft.advancements.critereon.AbstractCriterionInstance;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.advancements.criterion.CriterionInstance;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import appeng.core.AppEng;
|
||||
@@ -98,7 +98,7 @@ public class AppEngAdvancementTrigger implements ICriterionTrigger<AppEngAdvance
|
||||
}
|
||||
|
||||
@Override
|
||||
public void trigger( EntityPlayerMP parPlayer )
|
||||
public void trigger( PlayerEntity parPlayer )
|
||||
{
|
||||
AppEngAdvancementTrigger.Listeners l = this.listeners.get( parPlayer.getAdvancements() );
|
||||
|
||||
@@ -108,7 +108,7 @@ public class AppEngAdvancementTrigger implements ICriterionTrigger<AppEngAdvance
|
||||
}
|
||||
}
|
||||
|
||||
public static class Instance extends AbstractCriterionInstance
|
||||
public static class Instance extends CriterionInstance
|
||||
{
|
||||
public Instance( ResourceLocation parID )
|
||||
{
|
||||
@@ -146,7 +146,7 @@ public class AppEngAdvancementTrigger implements ICriterionTrigger<AppEngAdvance
|
||||
this.listeners.remove( listener );
|
||||
}
|
||||
|
||||
public void trigger( EntityPlayerMP player )
|
||||
public void trigger( PlayerEntity player )
|
||||
{
|
||||
List<ICriterionTrigger.Listener<AppEngAdvancementTrigger.Instance>> list = null;
|
||||
|
||||
|
||||
@@ -19,11 +19,11 @@
|
||||
package appeng.core.stats;
|
||||
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
|
||||
|
||||
@FunctionalInterface
|
||||
public interface IAdvancementTrigger
|
||||
{
|
||||
void trigger( EntityPlayerMP parPlayer );
|
||||
void trigger( PlayerEntity parPlayer );
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
package appeng.core.stats;
|
||||
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.stats.StatBasic;
|
||||
import net.minecraft.util.text.TextComponentTranslation;
|
||||
|
||||
@@ -42,7 +42,7 @@ public enum Stats
|
||||
{
|
||||
}
|
||||
|
||||
public void addToPlayer( final EntityPlayer player, final int howMany )
|
||||
public void addToPlayer( final PlayerEntity player, final int howMany )
|
||||
{
|
||||
player.addStat( this.stat, howMany );
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ import java.io.IOException;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.network.INetHandler;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
@@ -42,7 +42,7 @@ public abstract class AppEngPacket implements Packet
|
||||
private PacketBuffer p;
|
||||
private PacketCallState caller;
|
||||
|
||||
public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final EntityPlayer player )
|
||||
public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final PlayerEntity player )
|
||||
{
|
||||
throw new UnsupportedOperationException( "This packet ( " + this.getPacketID() + " does not implement a server side handler." );
|
||||
}
|
||||
@@ -52,7 +52,7 @@ public abstract class AppEngPacket implements Packet
|
||||
return AppEngPacketHandlerBase.PacketTypes.getID( this.getClass() ).ordinal();
|
||||
}
|
||||
|
||||
public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final EntityPlayer player )
|
||||
public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final PlayerEntity player )
|
||||
{
|
||||
throw new UnsupportedOperationException( "This packet ( " + this.getPacketID() + " does not implement a client side handler." );
|
||||
}
|
||||
|
||||
@@ -21,8 +21,8 @@ package appeng.core.sync;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
@@ -264,7 +264,7 @@ public enum GuiBridge implements IGuiHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getServerGuiElement( final int ordinal, final EntityPlayer player, final World w, final int x, final int y, final int z )
|
||||
public Object getServerGuiElement( final int ordinal, final PlayerEntity player, final World w, final int x, final int y, final int z )
|
||||
{
|
||||
final AEPartLocation side = AEPartLocation.fromOrdinal( ordinal & 0x07 );
|
||||
final GuiBridge ID = values()[ordinal >> 4];
|
||||
@@ -309,7 +309,7 @@ public enum GuiBridge implements IGuiHandler
|
||||
return new ContainerNull();
|
||||
}
|
||||
|
||||
private Object getGuiObject( final ItemStack it, final EntityPlayer player, final World w, final int x, final int y, final int z )
|
||||
private Object getGuiObject( final ItemStack it, final PlayerEntity player, final World w, final int x, final int y, final int z )
|
||||
{
|
||||
if( !it.isEmpty() )
|
||||
{
|
||||
@@ -354,7 +354,7 @@ public enum GuiBridge implements IGuiHandler
|
||||
return newContainer;
|
||||
}
|
||||
|
||||
public Object ConstructContainer( final InventoryPlayer inventory, final AEPartLocation side, final Object tE )
|
||||
public Object ConstructContainer( final PlayerInventory inventory, final AEPartLocation side, final Object tE )
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -380,7 +380,7 @@ public enum GuiBridge implements IGuiHandler
|
||||
}
|
||||
}
|
||||
|
||||
private Constructor findConstructor( final Constructor[] c, final InventoryPlayer inventory, final Object tE )
|
||||
private Constructor findConstructor( final Constructor[] c, final PlayerInventory inventory, final Object tE )
|
||||
{
|
||||
for( final Constructor con : c )
|
||||
{
|
||||
@@ -407,7 +407,7 @@ public enum GuiBridge implements IGuiHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getClientGuiElement( final int ordinal, final EntityPlayer player, final World w, final int x, final int y, final int z )
|
||||
public Object getClientGuiElement( final int ordinal, final PlayerEntity player, final World w, final int x, final int y, final int z )
|
||||
{
|
||||
final AEPartLocation side = AEPartLocation.fromOrdinal( ordinal & 0x07 );
|
||||
final GuiBridge ID = values()[ordinal >> 4];
|
||||
@@ -452,7 +452,7 @@ public enum GuiBridge implements IGuiHandler
|
||||
return new GuiNull( new ContainerNull() );
|
||||
}
|
||||
|
||||
public Object ConstructGui( final InventoryPlayer inventory, final AEPartLocation side, final Object tE )
|
||||
public Object ConstructGui( final PlayerInventory inventory, final AEPartLocation side, final Object tE )
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -478,7 +478,7 @@ public enum GuiBridge implements IGuiHandler
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasPermissions( final TileEntity te, final int x, final int y, final int z, final AEPartLocation side, final EntityPlayer player )
|
||||
public boolean hasPermissions( final TileEntity te, final int x, final int y, final int z, final AEPartLocation side, final PlayerEntity player )
|
||||
{
|
||||
final World w = player.getEntityWorld();
|
||||
final BlockPos pos = new BlockPos( x, y, z );
|
||||
@@ -522,7 +522,7 @@ public enum GuiBridge implements IGuiHandler
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean securityCheck( final Object te, final EntityPlayer player )
|
||||
private boolean securityCheck( final Object te, final PlayerEntity player )
|
||||
{
|
||||
if( te instanceof IActionHost && this.requiredPermission != null )
|
||||
{
|
||||
|
||||
@@ -24,7 +24,7 @@ import java.lang.reflect.InvocationTargetException;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.network.INetHandler;
|
||||
import net.minecraft.network.PacketThreadUtil;
|
||||
import net.minecraftforge.fml.common.network.internal.FMLProxyPacket;
|
||||
@@ -39,7 +39,7 @@ public class AppEngClientPacketHandler extends AppEngPacketHandlerBase implement
|
||||
{
|
||||
|
||||
@Override
|
||||
public void onPacketData( final INetworkInfo manager, final INetHandler handler, final FMLProxyPacket packet, final EntityPlayer player )
|
||||
public void onPacketData( final INetworkInfo manager, final INetHandler handler, final FMLProxyPacket packet, final PlayerEntity player )
|
||||
{
|
||||
final ByteBuf stream = packet.payload();
|
||||
|
||||
@@ -54,12 +54,12 @@ public class AppEngClientPacketHandler extends AppEngPacketHandlerBase implement
|
||||
@Override
|
||||
public void call( final AppEngPacket appEngPacket )
|
||||
{
|
||||
appEngPacket.clientPacketData( manager, appEngPacket, Minecraft.getMinecraft().player );
|
||||
appEngPacket.clientPacketData( manager, appEngPacket, Minecraft.getInstance().player );
|
||||
}
|
||||
};
|
||||
|
||||
pack.setCallParam( callState );
|
||||
PacketThreadUtil.checkThreadAndEnqueue( pack, handler, Minecraft.getMinecraft() );
|
||||
PacketThreadUtil.checkThreadAndEnqueue( pack, handler, Minecraft.getInstance() );
|
||||
callState.call( pack );
|
||||
}
|
||||
catch( final InstantiationException e )
|
||||
|
||||
@@ -23,8 +23,8 @@ import java.lang.reflect.InvocationTargetException;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.PlayerEntityMP;
|
||||
import net.minecraft.network.INetHandler;
|
||||
import net.minecraft.network.PacketThreadUtil;
|
||||
import net.minecraftforge.fml.common.network.internal.FMLProxyPacket;
|
||||
@@ -39,7 +39,7 @@ public final class AppEngServerPacketHandler extends AppEngPacketHandlerBase imp
|
||||
{
|
||||
|
||||
@Override
|
||||
public void onPacketData( final INetworkInfo manager, final INetHandler handler, final FMLProxyPacket packet, final EntityPlayer player )
|
||||
public void onPacketData( final INetworkInfo manager, final INetHandler handler, final FMLProxyPacket packet, final PlayerEntity player )
|
||||
{
|
||||
final ByteBuf stream = packet.payload();
|
||||
|
||||
@@ -59,7 +59,7 @@ public final class AppEngServerPacketHandler extends AppEngPacketHandlerBase imp
|
||||
};
|
||||
|
||||
pack.setCallParam( callState );
|
||||
PacketThreadUtil.checkThreadAndEnqueue( pack, handler, ( (EntityPlayerMP) player ).getServer() );
|
||||
PacketThreadUtil.checkThreadAndEnqueue( pack, handler, ( (PlayerEntityMP) player ).getServer() );
|
||||
callState.call( pack );
|
||||
}
|
||||
catch( final InstantiationException e )
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
package appeng.core.sync.network;
|
||||
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.network.INetHandler;
|
||||
import net.minecraftforge.fml.common.network.internal.FMLProxyPacket;
|
||||
|
||||
@@ -27,6 +27,6 @@ import net.minecraftforge.fml.common.network.internal.FMLProxyPacket;
|
||||
public interface IPacketHandler
|
||||
{
|
||||
|
||||
void onPacketData( INetworkInfo manager, INetHandler handler, FMLProxyPacket packet, EntityPlayer player );
|
||||
void onPacketData( INetworkInfo manager, INetHandler handler, FMLProxyPacket packet, PlayerEntity player );
|
||||
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
package appeng.core.sync.network;
|
||||
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.player.PlayerEntityMP;
|
||||
import net.minecraft.network.NetHandlerPlayServer;
|
||||
import net.minecraft.network.ThreadQuickExitException;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
@@ -129,7 +129,7 @@ public class NetworkHandler
|
||||
this.ec.sendToAll( message.getProxy() );
|
||||
}
|
||||
|
||||
public void sendTo( final AppEngPacket message, final EntityPlayerMP player )
|
||||
public void sendTo( final AppEngPacket message, final PlayerEntityMP player )
|
||||
{
|
||||
this.ec.sendTo( message.getProxy(), player );
|
||||
}
|
||||
|
||||
@@ -24,10 +24,10 @@ import java.io.IOException;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.client.EffectType;
|
||||
@@ -74,8 +74,8 @@ public class PacketAssemblerAnimation extends AppEngPacket
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final EntityPlayer player )
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final PlayerEntity player )
|
||||
{
|
||||
final double d0 = 0.5d;// + ((double) (Platform.getRandomFloat() - 0.5F) * 0.26D);
|
||||
final double d1 = 0.5d;// + ((double) (Platform.getRandomFloat() - 0.5F) * 0.26D);
|
||||
|
||||
@@ -23,10 +23,10 @@ import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
@@ -48,11 +48,11 @@ public class PacketClick extends AppEngPacket
|
||||
private final int x;
|
||||
private final int y;
|
||||
private final int z;
|
||||
private EnumFacing side;
|
||||
private Direction side;
|
||||
private final float hitX;
|
||||
private final float hitY;
|
||||
private final float hitZ;
|
||||
private EnumHand hand;
|
||||
private Hand hand;
|
||||
private final boolean leftClick;
|
||||
|
||||
// automatic.
|
||||
@@ -64,7 +64,7 @@ public class PacketClick extends AppEngPacket
|
||||
byte side = stream.readByte();
|
||||
if( side != -1 )
|
||||
{
|
||||
this.side = EnumFacing.values()[side];
|
||||
this.side = Direction.values()[side];
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -73,17 +73,17 @@ public class PacketClick extends AppEngPacket
|
||||
this.hitX = stream.readFloat();
|
||||
this.hitY = stream.readFloat();
|
||||
this.hitZ = stream.readFloat();
|
||||
this.hand = EnumHand.values()[stream.readByte()];
|
||||
this.hand = Hand.values()[stream.readByte()];
|
||||
this.leftClick = stream.readBoolean();
|
||||
}
|
||||
|
||||
// api
|
||||
public PacketClick( final BlockPos pos, final EnumFacing side, final float hitX, final float hitY, final float hitZ, final EnumHand hand )
|
||||
public PacketClick( final BlockPos pos, final Direction side, final float hitX, final float hitY, final float hitZ, final Hand hand )
|
||||
{
|
||||
this( pos, side, hitX, hitY, hitZ, hand, false );
|
||||
}
|
||||
|
||||
public PacketClick( final BlockPos pos, final EnumFacing side, final float hitX, final float hitY, final float hitZ, final EnumHand hand, boolean leftClick )
|
||||
public PacketClick( final BlockPos pos, final Direction side, final float hitX, final float hitY, final float hitZ, final Hand hand, boolean leftClick )
|
||||
{
|
||||
|
||||
final ByteBuf data = Unpooled.buffer();
|
||||
@@ -110,7 +110,7 @@ public class PacketClick extends AppEngPacket
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final EntityPlayer player )
|
||||
public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final PlayerEntity player )
|
||||
{
|
||||
final ItemStack is = player.inventory.getCurrentItem();
|
||||
final IItems items = AEApi.instance().definitions().items();
|
||||
|
||||
@@ -22,8 +22,8 @@ package appeng.core.sync.packets;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.PlayerEntityMP;
|
||||
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.core.sync.AppEngPacket;
|
||||
@@ -41,7 +41,7 @@ public class PacketCompassRequest extends AppEngPacket implements ICompassCallba
|
||||
final int cz;
|
||||
final int cdy;
|
||||
|
||||
private EntityPlayer talkBackTo;
|
||||
private PlayerEntity talkBackTo;
|
||||
|
||||
// automatic.
|
||||
public PacketCompassRequest( final ByteBuf stream )
|
||||
@@ -70,11 +70,11 @@ public class PacketCompassRequest extends AppEngPacket implements ICompassCallba
|
||||
@Override
|
||||
public void calculatedDirection( final boolean hasResult, final boolean spin, final double radians, final double dist )
|
||||
{
|
||||
NetworkHandler.instance().sendTo( new PacketCompassResponse( this, hasResult, spin, radians ), (EntityPlayerMP) this.talkBackTo );
|
||||
NetworkHandler.instance().sendTo( new PacketCompassResponse( this, hasResult, spin, radians ), (PlayerEntityMP) this.talkBackTo );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final EntityPlayer player )
|
||||
public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final PlayerEntity player )
|
||||
{
|
||||
this.talkBackTo = player;
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ package appeng.core.sync.packets;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
|
||||
import appeng.core.sync.AppEngPacket;
|
||||
import appeng.core.sync.network.INetworkInfo;
|
||||
@@ -71,7 +71,7 @@ public class PacketCompassResponse extends AppEngPacket
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final EntityPlayer player )
|
||||
public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final PlayerEntity player )
|
||||
{
|
||||
CompassManager.INSTANCE.postResult( this.attunement, this.cx << 4, this.cdy << 5, this.cz << 4, this.cr );
|
||||
}
|
||||
|
||||
@@ -32,11 +32,11 @@ import io.netty.buffer.Unpooled;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.nbt.CompressedStreamTools;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import appeng.client.gui.implementations.GuiInterfaceTerminal;
|
||||
import appeng.core.sync.AppEngPacket;
|
||||
@@ -47,7 +47,7 @@ public class PacketCompressedNBT extends AppEngPacket
|
||||
{
|
||||
|
||||
// input.
|
||||
private final NBTTagCompound in;
|
||||
private final CompoundNBT in;
|
||||
// output...
|
||||
private final ByteBuf data;
|
||||
private final GZIPOutputStream compressFrame;
|
||||
@@ -79,7 +79,7 @@ public class PacketCompressedNBT extends AppEngPacket
|
||||
}
|
||||
|
||||
// api
|
||||
public PacketCompressedNBT( final NBTTagCompound din ) throws IOException
|
||||
public PacketCompressedNBT( final CompoundNBT din ) throws IOException
|
||||
{
|
||||
|
||||
this.data = Unpooled.buffer( 2048 );
|
||||
@@ -104,10 +104,10 @@ public class PacketCompressedNBT extends AppEngPacket
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final EntityPlayer player )
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final PlayerEntity player )
|
||||
{
|
||||
final GuiScreen gs = Minecraft.getMinecraft().currentScreen;
|
||||
final GuiScreen gs = Minecraft.getInstance().currentScreen;
|
||||
|
||||
if( gs instanceof GuiInterfaceTerminal )
|
||||
{
|
||||
|
||||
@@ -22,8 +22,8 @@ package appeng.core.sync.packets;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.PlayerEntityMP;
|
||||
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.util.IConfigManager;
|
||||
@@ -64,9 +64,9 @@ public final class PacketConfigButton extends AppEngPacket
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final EntityPlayer player )
|
||||
public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final PlayerEntity player )
|
||||
{
|
||||
final EntityPlayerMP sender = (EntityPlayerMP) player;
|
||||
final PlayerEntityMP sender = (PlayerEntityMP) player;
|
||||
if( sender.openContainer instanceof AEBaseContainer )
|
||||
{
|
||||
final AEBaseContainer baseContainer = (AEBaseContainer) sender.openContainer;
|
||||
|
||||
@@ -24,7 +24,7 @@ import java.util.concurrent.Future;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import appeng.api.networking.IGrid;
|
||||
@@ -70,7 +70,7 @@ public class PacketCraftRequest extends AppEngPacket
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final EntityPlayer player )
|
||||
public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final PlayerEntity player )
|
||||
{
|
||||
if( player.openContainer instanceof ContainerCraftAmount )
|
||||
{
|
||||
|
||||
@@ -25,9 +25,9 @@ import java.util.Map;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraftforge.fml.common.network.ByteBufUtils;
|
||||
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
@@ -44,7 +44,7 @@ public class PacketFluidSlot extends AppEngPacket
|
||||
public PacketFluidSlot( final ByteBuf stream )
|
||||
{
|
||||
this.list = new HashMap<>();
|
||||
NBTTagCompound tag = ByteBufUtils.readTag( stream );
|
||||
CompoundNBT tag = ByteBufUtils.readTag( stream );
|
||||
|
||||
for( final String key : tag.getKeySet() )
|
||||
{
|
||||
@@ -56,10 +56,10 @@ public class PacketFluidSlot extends AppEngPacket
|
||||
public PacketFluidSlot( final Map<Integer, IAEFluidStack> list )
|
||||
{
|
||||
this.list = list;
|
||||
final NBTTagCompound sendTag = new NBTTagCompound();
|
||||
final CompoundNBT sendTag = new CompoundNBT();
|
||||
for( Map.Entry<Integer, IAEFluidStack> fs : list.entrySet() )
|
||||
{
|
||||
final NBTTagCompound tag = new NBTTagCompound();
|
||||
final CompoundNBT tag = new CompoundNBT();
|
||||
if( fs.getValue() != null )
|
||||
{
|
||||
fs.getValue().writeToNBT( tag );
|
||||
@@ -74,7 +74,7 @@ public class PacketFluidSlot extends AppEngPacket
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clientPacketData( final INetworkInfo manager, final AppEngPacket packet, final EntityPlayer player )
|
||||
public void clientPacketData( final INetworkInfo manager, final AppEngPacket packet, final PlayerEntity player )
|
||||
{
|
||||
final Container c = player.openContainer;
|
||||
if( c instanceof IFluidSyncContainer )
|
||||
@@ -84,7 +84,7 @@ public class PacketFluidSlot extends AppEngPacket
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serverPacketData( INetworkInfo manager, AppEngPacket packet, EntityPlayer player )
|
||||
public void serverPacketData( INetworkInfo manager, AppEngPacket packet, PlayerEntity player )
|
||||
{
|
||||
final Container c = player.openContainer;
|
||||
if( c instanceof IFluidSyncContainer )
|
||||
|
||||
@@ -24,8 +24,8 @@ import java.io.IOException;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.PlayerEntityMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
@@ -121,9 +121,9 @@ public class PacketInventoryAction extends AppEngPacket
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final EntityPlayer player )
|
||||
public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final PlayerEntity player )
|
||||
{
|
||||
final EntityPlayerMP sender = (EntityPlayerMP) player;
|
||||
final PlayerEntityMP sender = (PlayerEntityMP) player;
|
||||
if( sender.openContainer instanceof AEBaseContainer )
|
||||
{
|
||||
final AEBaseContainer baseContainer = (AEBaseContainer) sender.openContainer;
|
||||
@@ -158,7 +158,7 @@ public class PacketInventoryAction extends AppEngPacket
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final EntityPlayer player )
|
||||
public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final PlayerEntity player )
|
||||
{
|
||||
if( this.action == InventoryAction.UPDATE_HAND )
|
||||
{
|
||||
|
||||
@@ -27,12 +27,12 @@ import java.io.IOException;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.PlayerEntityMP;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompressedStreamTools;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
@@ -70,7 +70,7 @@ public class PacketJEIRecipe extends AppEngPacket
|
||||
{
|
||||
final ByteArrayInputStream bytes = this.getPacketByteArray( stream );
|
||||
bytes.skip( stream.readerIndex() );
|
||||
final NBTTagCompound comp = CompressedStreamTools.readCompressed( bytes );
|
||||
final CompoundNBT comp = CompressedStreamTools.readCompressed( bytes );
|
||||
if( comp != null )
|
||||
{
|
||||
this.recipe = new ItemStack[9][];
|
||||
@@ -90,7 +90,7 @@ public class PacketJEIRecipe extends AppEngPacket
|
||||
}
|
||||
|
||||
// api
|
||||
public PacketJEIRecipe( final NBTTagCompound recipe ) throws IOException
|
||||
public PacketJEIRecipe( final CompoundNBT recipe ) throws IOException
|
||||
{
|
||||
final ByteBuf data = Unpooled.buffer();
|
||||
|
||||
@@ -106,9 +106,9 @@ public class PacketJEIRecipe extends AppEngPacket
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final EntityPlayer player )
|
||||
public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final PlayerEntity player )
|
||||
{
|
||||
final EntityPlayerMP pmp = (EntityPlayerMP) player;
|
||||
final PlayerEntityMP pmp = (PlayerEntityMP) player;
|
||||
final Container con = pmp.openContainer;
|
||||
|
||||
if( !( con instanceof IContainerCraftingPacket ) )
|
||||
|
||||
@@ -23,9 +23,9 @@ import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import appeng.client.render.effects.LightningFX;
|
||||
import appeng.core.AEConfig;
|
||||
@@ -68,15 +68,15 @@ public class PacketLightning extends AppEngPacket
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final EntityPlayer player )
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final PlayerEntity player )
|
||||
{
|
||||
try
|
||||
{
|
||||
if( Platform.isClient() && AEConfig.instance().isEnableEffects() )
|
||||
{
|
||||
final LightningFX fx = new LightningFX( AppEng.proxy.getWorld(), this.x, this.y, this.z, 0.0f, 0.0f, 0.0f );
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect( fx );
|
||||
Minecraft.getInstance().effectRenderer.addEffect( fx );
|
||||
}
|
||||
}
|
||||
catch( final Exception ignored )
|
||||
|
||||
@@ -35,10 +35,10 @@ import io.netty.buffer.Unpooled;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraftforge.fml.common.network.internal.FMLProxyPacket;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.core.AELog;
|
||||
@@ -148,10 +148,10 @@ public class PacketMEFluidInventoryUpdate extends AppEngPacket
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final EntityPlayer player )
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final PlayerEntity player )
|
||||
{
|
||||
final GuiScreen gs = Minecraft.getMinecraft().currentScreen;
|
||||
final GuiScreen gs = Minecraft.getInstance().currentScreen;
|
||||
|
||||
if( gs instanceof GuiFluidTerminal )
|
||||
{
|
||||
|
||||
@@ -35,10 +35,10 @@ import io.netty.buffer.Unpooled;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraftforge.fml.common.network.internal.FMLProxyPacket;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.client.gui.implementations.GuiCraftConfirm;
|
||||
@@ -146,10 +146,10 @@ public class PacketMEInventoryUpdate extends AppEngPacket
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final EntityPlayer player )
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final PlayerEntity player )
|
||||
{
|
||||
final GuiScreen gs = Minecraft.getMinecraft().currentScreen;
|
||||
final GuiScreen gs = Minecraft.getInstance().currentScreen;
|
||||
|
||||
if( gs instanceof GuiCraftConfirm )
|
||||
{
|
||||
|
||||
@@ -23,12 +23,12 @@ import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.client.FMLClientHandler;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import appeng.client.render.effects.MatterCannonFX;
|
||||
import appeng.core.sync.AppEngPacket;
|
||||
@@ -87,8 +87,8 @@ public class PacketMatterCannon extends AppEngPacket
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final EntityPlayer player )
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final PlayerEntity player )
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -98,7 +98,7 @@ public class PacketMatterCannon extends AppEngPacket
|
||||
{
|
||||
final MatterCannonFX fx = new MatterCannonFX( world, this.x + this.dx * a, this.y + this.dy * a, this.z + this.dz * a, Items.DIAMOND );
|
||||
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect( fx );
|
||||
Minecraft.getInstance().effectRenderer.addEffect( fx );
|
||||
}
|
||||
}
|
||||
catch( final Exception ignored )
|
||||
|
||||
@@ -22,11 +22,11 @@ package appeng.core.sync.packets;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import appeng.core.AppEng;
|
||||
import appeng.core.sync.AppEngPacket;
|
||||
@@ -66,8 +66,8 @@ public class PacketMockExplosion extends AppEngPacket
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final EntityPlayer player )
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final PlayerEntity player )
|
||||
{
|
||||
final World world = AppEng.proxy.getWorld();
|
||||
world.spawnParticle( EnumParticleTypes.EXPLOSION_LARGE, this.x, this.y, this.z, 1.0D, 0.0D, 0.0D, new int[0] );
|
||||
|
||||
@@ -22,7 +22,7 @@ package appeng.core.sync.packets;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.core.sync.AppEngPacket;
|
||||
@@ -61,7 +61,7 @@ public class PacketPaintedEntity extends AppEngPacket
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final EntityPlayer player )
|
||||
public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final PlayerEntity player )
|
||||
{
|
||||
final PlayerColor pc = new PlayerColor( this.entityId, this.myColor, this.ticks );
|
||||
TickHandler.INSTANCE.getPlayerColors().put( this.entityId, pc );
|
||||
|
||||
@@ -22,10 +22,10 @@ package appeng.core.sync.packets;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
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.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.PlayerEntityMP;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
import appeng.core.AppEng;
|
||||
@@ -42,7 +42,7 @@ public class PacketPartPlacement extends AppEngPacket
|
||||
private int z;
|
||||
private int face;
|
||||
private float eyeHeight;
|
||||
private EnumHand hand;
|
||||
private Hand hand;
|
||||
|
||||
// automatic.
|
||||
public PacketPartPlacement( final ByteBuf stream )
|
||||
@@ -52,11 +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()];
|
||||
this.hand = Hand.values()[stream.readByte()];
|
||||
}
|
||||
|
||||
// api
|
||||
public PacketPartPlacement( final BlockPos pos, final EnumFacing face, final float eyeHeight, final EnumHand hand )
|
||||
public PacketPartPlacement( final BlockPos pos, final Direction face, final float eyeHeight, final Hand hand )
|
||||
{
|
||||
final ByteBuf data = Unpooled.buffer();
|
||||
|
||||
@@ -72,12 +72,12 @@ public class PacketPartPlacement extends AppEngPacket
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final EntityPlayer player )
|
||||
public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final PlayerEntity player )
|
||||
{
|
||||
final EntityPlayerMP sender = (EntityPlayerMP) player;
|
||||
final PlayerEntityMP sender = (PlayerEntityMP) player;
|
||||
AppEng.proxy.updateRenderMode( sender );
|
||||
PartPlacement.setEyeHeight( this.eyeHeight );
|
||||
PartPlacement.place( sender.getHeldItem( this.hand ), new BlockPos( this.x, this.y, this.z ), EnumFacing.VALUES[this.face], sender, this.hand,
|
||||
PartPlacement.place( sender.getHeldItem( this.hand ), new BlockPos( this.x, this.y, this.z ), Direction.VALUES[this.face], sender, this.hand,
|
||||
sender.world,
|
||||
PartPlacement.PlaceType.INTERACT_FIRST_PASS, 0 );
|
||||
AppEng.proxy.updateRenderMode( null );
|
||||
|
||||
@@ -24,8 +24,8 @@ import java.io.IOException;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.PlayerEntityMP;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
@@ -109,9 +109,9 @@ public class PacketPatternSlot extends AppEngPacket
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final EntityPlayer player )
|
||||
public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final PlayerEntity player )
|
||||
{
|
||||
final EntityPlayerMP sender = (EntityPlayerMP) player;
|
||||
final PlayerEntityMP sender = (PlayerEntityMP) player;
|
||||
if( sender.openContainer instanceof ContainerPatternTerm )
|
||||
{
|
||||
final ContainerPatternTerm patternTerminal = (ContainerPatternTerm) sender.openContainer;
|
||||
|
||||
@@ -22,7 +22,7 @@ package appeng.core.sync.packets;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.inventory.Container;
|
||||
|
||||
import appeng.container.AEBaseContainer;
|
||||
@@ -59,7 +59,7 @@ public class PacketProgressBar extends AppEngPacket
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final EntityPlayer player )
|
||||
public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final PlayerEntity player )
|
||||
{
|
||||
final Container c = player.openContainer;
|
||||
if( c instanceof AEBaseContainer )
|
||||
@@ -69,7 +69,7 @@ public class PacketProgressBar extends AppEngPacket
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final EntityPlayer player )
|
||||
public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final PlayerEntity player )
|
||||
{
|
||||
final Container c = player.openContainer;
|
||||
if( c instanceof AEBaseContainer )
|
||||
|
||||
@@ -22,7 +22,7 @@ package appeng.core.sync.packets;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.core.sync.AppEngPacket;
|
||||
@@ -55,7 +55,7 @@ public class PacketSwapSlots extends AppEngPacket
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final EntityPlayer player )
|
||||
public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final PlayerEntity player )
|
||||
{
|
||||
if( player != null && player.openContainer instanceof AEBaseContainer )
|
||||
{
|
||||
|
||||
@@ -22,7 +22,7 @@ package appeng.core.sync.packets;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
@@ -59,7 +59,7 @@ public class PacketSwitchGuis extends AppEngPacket
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final EntityPlayer player )
|
||||
public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final PlayerEntity player )
|
||||
{
|
||||
final Container c = player.openContainer;
|
||||
if( c instanceof AEBaseContainer )
|
||||
|
||||
@@ -22,7 +22,7 @@ package appeng.core.sync.packets;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.sync.AppEngPacket;
|
||||
@@ -84,7 +84,7 @@ public class PacketTargetFluidStack extends AppEngPacket
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final EntityPlayer player )
|
||||
public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final PlayerEntity player )
|
||||
{
|
||||
if( player.openContainer instanceof ContainerFluidTerminal )
|
||||
{
|
||||
|
||||
@@ -22,7 +22,7 @@ package appeng.core.sync.packets;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.core.AELog;
|
||||
@@ -79,7 +79,7 @@ public class PacketTargetItemStack extends AppEngPacket
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final EntityPlayer player )
|
||||
public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final PlayerEntity player )
|
||||
{
|
||||
if( player.openContainer instanceof AEBaseContainer )
|
||||
{
|
||||
|
||||
@@ -25,13 +25,13 @@ import io.netty.buffer.Unpooled;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.audio.PositionedSoundRecord;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.client.render.effects.EnergyFx;
|
||||
@@ -82,8 +82,8 @@ public class PacketTransitionEffect extends AppEngPacket
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final EntityPlayer player )
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final PlayerEntity player )
|
||||
{
|
||||
final World world = AppEng.proxy.getWorld();
|
||||
|
||||
@@ -105,7 +105,7 @@ public class PacketTransitionEffect extends AppEngPacket
|
||||
fx.setMotionY( -0.1f * this.d.yOffset );
|
||||
fx.setMotionZ( -0.1f * this.d.zOffset );
|
||||
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect( fx );
|
||||
Minecraft.getInstance().effectRenderer.addEffect( fx );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ public class PacketTransitionEffect extends AppEngPacket
|
||||
{
|
||||
final Block block = world.getBlockState( new BlockPos( (int) this.x, (int) this.y, (int) this.z ) ).getBlock();
|
||||
|
||||
Minecraft.getMinecraft()
|
||||
Minecraft.getInstance()
|
||||
.getSoundHandler()
|
||||
.playSound( new PositionedSoundRecord( block.getSoundType()
|
||||
.getBreakSound(), SoundCategory.BLOCKS, ( block.getSoundType().getVolume() + 1.0F ) / 2.0F, block.getSoundType()
|
||||
|
||||
@@ -29,10 +29,10 @@ import io.netty.buffer.Unpooled;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.Hand;
|
||||
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.config.Settings;
|
||||
@@ -95,22 +95,22 @@ public class PacketValueConfig extends AppEngPacket
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final EntityPlayer player )
|
||||
public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final PlayerEntity player )
|
||||
{
|
||||
final Container c = player.openContainer;
|
||||
|
||||
if( this.Name.equals( "Item" ) && ( ( !player.getHeldItem( EnumHand.MAIN_HAND ).isEmpty() && player.getHeldItem( EnumHand.MAIN_HAND )
|
||||
.getItem() instanceof IMouseWheelItem ) || ( !player.getHeldItem( EnumHand.OFF_HAND )
|
||||
.isEmpty() && player.getHeldItem( EnumHand.OFF_HAND ).getItem() instanceof IMouseWheelItem ) ) )
|
||||
if( this.Name.equals( "Item" ) && ( ( !player.getHeldItem( Hand.MAIN_HAND ).isEmpty() && player.getHeldItem( Hand.MAIN_HAND )
|
||||
.getItem() instanceof IMouseWheelItem ) || ( !player.getHeldItem( Hand.OFF_HAND )
|
||||
.isEmpty() && player.getHeldItem( Hand.OFF_HAND ).getItem() instanceof IMouseWheelItem ) ) )
|
||||
{
|
||||
final EnumHand hand;
|
||||
if( !player.getHeldItem( EnumHand.MAIN_HAND ).isEmpty() && player.getHeldItem( EnumHand.MAIN_HAND ).getItem() instanceof IMouseWheelItem )
|
||||
final Hand hand;
|
||||
if( !player.getHeldItem( Hand.MAIN_HAND ).isEmpty() && player.getHeldItem( Hand.MAIN_HAND ).getItem() instanceof IMouseWheelItem )
|
||||
{
|
||||
hand = EnumHand.MAIN_HAND;
|
||||
hand = Hand.MAIN_HAND;
|
||||
}
|
||||
else if( !player.getHeldItem( EnumHand.OFF_HAND ).isEmpty() && player.getHeldItem( EnumHand.OFF_HAND ).getItem() instanceof IMouseWheelItem )
|
||||
else if( !player.getHeldItem( Hand.OFF_HAND ).isEmpty() && player.getHeldItem( Hand.OFF_HAND ).getItem() instanceof IMouseWheelItem )
|
||||
{
|
||||
hand = EnumHand.OFF_HAND;
|
||||
hand = Hand.OFF_HAND;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -270,7 +270,7 @@ public class PacketValueConfig extends AppEngPacket
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final EntityPlayer player )
|
||||
public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final PlayerEntity player )
|
||||
{
|
||||
final Container c = player.openContainer;
|
||||
|
||||
@@ -284,7 +284,7 @@ public class PacketValueConfig extends AppEngPacket
|
||||
}
|
||||
else if( this.Name.equals( "CraftingStatus" ) && this.Value.equals( "Clear" ) )
|
||||
{
|
||||
final GuiScreen gs = Minecraft.getMinecraft().currentScreen;
|
||||
final GuiScreen gs = Minecraft.getInstance().currentScreen;
|
||||
if( gs instanceof GuiCraftingCPU )
|
||||
{
|
||||
( (GuiCraftingCPU) gs ).clearItems();
|
||||
|
||||
@@ -23,7 +23,7 @@ import javax.annotation.Nullable;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
|
||||
|
||||
/**
|
||||
@@ -34,7 +34,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
public interface IWorldPlayerData
|
||||
{
|
||||
@Nullable
|
||||
EntityPlayer getPlayerFromID( int playerID );
|
||||
PlayerEntity getPlayerFromID( int playerID );
|
||||
|
||||
int getPlayerID( GameProfile profile );
|
||||
}
|
||||
|
||||
@@ -21,7 +21,8 @@ package appeng.core.worlddata;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.world.dimension.Dimension;
|
||||
|
||||
|
||||
/**
|
||||
@@ -31,11 +32,11 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
*/
|
||||
public interface IWorldSpawnData
|
||||
{
|
||||
void setGenerated( int dim, int chunkX, int chunkZ );
|
||||
void setGenerated( Dimension dim, int chunkX, int chunkZ );
|
||||
|
||||
boolean hasGenerated( int dim, int chunkX, int chunkZ );
|
||||
boolean hasGenerated( Dimension dim, int chunkX, int chunkZ );
|
||||
|
||||
boolean addNearByMeteorites( int dim, int chunkX, int chunkZ, NBTTagCompound newData );
|
||||
boolean addNearByMeteorites( Dimension dim, int chunkX, int chunkZ, CompoundNBT newData );
|
||||
|
||||
Collection<NBTTagCompound> getNearByMeteorites( int dim, int chunkX, int chunkZ );
|
||||
Collection<CompoundNBT> getNearByMeteorites( Dimension dim, int chunkX, int chunkZ );
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ import javax.annotation.Nullable;
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraftforge.common.config.ConfigCategory;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
import net.minecraftforge.common.config.Property;
|
||||
@@ -68,14 +68,14 @@ final class PlayerData implements IWorldPlayerData, IOnWorldStartable, IOnWorldS
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public EntityPlayer getPlayerFromID( final int playerID )
|
||||
public PlayerEntity getPlayerFromID( final int playerID )
|
||||
{
|
||||
final Optional<UUID> maybe = this.playerMapping.get( playerID );
|
||||
|
||||
if( maybe.isPresent() )
|
||||
{
|
||||
final UUID uuid = maybe.get();
|
||||
for( final EntityPlayer player : AppEng.proxy.getPlayers() )
|
||||
for( final PlayerEntity player : AppEng.proxy.getPlayers() )
|
||||
{
|
||||
if( player.getUniqueID().equals( uuid ) )
|
||||
{
|
||||
|
||||
@@ -22,9 +22,9 @@ package appeng.core.worlddata;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
@@ -35,7 +35,7 @@ import appeng.api.storage.ISpatialDimension;
|
||||
import appeng.capabilities.Capabilities;
|
||||
|
||||
|
||||
public class SpatialDimensionManager implements ISpatialDimension, ICapabilitySerializable<NBTTagCompound>
|
||||
public class SpatialDimensionManager implements ISpatialDimension, ICapabilitySerializable<CompoundNBT>
|
||||
{
|
||||
private static final String NBT_SPATIAL_DATA_KEY = "spatial_data";
|
||||
private static final String NBT_SPATIAL_ID_KEY = "id";
|
||||
@@ -119,13 +119,13 @@ public class SpatialDimensionManager implements ISpatialDimension, ICapabilitySe
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCapability( Capability<?> capability, EnumFacing facing )
|
||||
public boolean hasCapability( Capability<?> capability, Direction facing )
|
||||
{
|
||||
return capability == Capabilities.SPATIAL_DIMENSION;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getCapability( Capability<T> capability, EnumFacing facing )
|
||||
public <T> T getCapability( Capability<T> capability, Direction facing )
|
||||
{
|
||||
if( capability == Capabilities.SPATIAL_DIMENSION )
|
||||
{
|
||||
@@ -135,14 +135,14 @@ public class SpatialDimensionManager implements ISpatialDimension, ICapabilitySe
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound serializeNBT()
|
||||
public CompoundNBT serializeNBT()
|
||||
{
|
||||
final NBTTagCompound ret = new NBTTagCompound();
|
||||
final CompoundNBT ret = new CompoundNBT();
|
||||
final NBTTagList list = new NBTTagList();
|
||||
|
||||
for( Map.Entry<Integer, StorageCellData> entry : this.spatialData.entrySet() )
|
||||
{
|
||||
final NBTTagCompound nbt = entry.getValue().serializeNBT();
|
||||
final CompoundNBT nbt = entry.getValue().serializeNBT();
|
||||
nbt.setInteger( NBT_SPATIAL_ID_KEY, entry.getKey() );
|
||||
list.appendTag( nbt );
|
||||
}
|
||||
@@ -151,7 +151,7 @@ public class SpatialDimensionManager implements ISpatialDimension, ICapabilitySe
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserializeNBT( NBTTagCompound nbt )
|
||||
public void deserializeNBT( CompoundNBT nbt )
|
||||
{
|
||||
if( nbt.hasKey( NBT_SPATIAL_DATA_KEY ) )
|
||||
{
|
||||
@@ -160,7 +160,7 @@ public class SpatialDimensionManager implements ISpatialDimension, ICapabilitySe
|
||||
this.spatialData.clear();
|
||||
for( int i = 0; i < list.tagCount(); ++i )
|
||||
{
|
||||
final NBTTagCompound entry = list.getCompoundTagAt( i );
|
||||
final CompoundNBT entry = list.getCompoundTagAt( i );
|
||||
final StorageCellData data = new StorageCellData();
|
||||
final int id = entry.getInteger( NBT_SPATIAL_ID_KEY );
|
||||
data.deserializeNBT( entry );
|
||||
@@ -214,7 +214,7 @@ public class SpatialDimensionManager implements ISpatialDimension, ICapabilitySe
|
||||
// TODO reset chunks?
|
||||
}
|
||||
|
||||
private static class StorageCellData implements INBTSerializable<NBTTagCompound>
|
||||
private static class StorageCellData implements INBTSerializable<CompoundNBT>
|
||||
{
|
||||
private static final String NBT_OWNER_KEY = "owner";
|
||||
private static final String NBT_DIM_X_KEY = "dim_x";
|
||||
@@ -225,9 +225,9 @@ public class SpatialDimensionManager implements ISpatialDimension, ICapabilitySe
|
||||
public int owner;
|
||||
|
||||
@Override
|
||||
public NBTTagCompound serializeNBT()
|
||||
public CompoundNBT serializeNBT()
|
||||
{
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
CompoundNBT nbt = new CompoundNBT();
|
||||
nbt.setInteger( NBT_DIM_X_KEY, this.contentDimension.getX() );
|
||||
nbt.setInteger( NBT_DIM_Y_KEY, this.contentDimension.getY() );
|
||||
nbt.setInteger( NBT_DIM_Z_KEY, this.contentDimension.getZ() );
|
||||
@@ -236,7 +236,7 @@ public class SpatialDimensionManager implements ISpatialDimension, ICapabilitySe
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserializeNBT( NBTTagCompound nbt )
|
||||
public void deserializeNBT( CompoundNBT nbt )
|
||||
{
|
||||
this.contentDimension = new BlockPos( nbt.getInteger( NBT_DIM_X_KEY ), nbt.getInteger( NBT_DIM_Y_KEY ), nbt.getInteger( NBT_DIM_Z_KEY ) );
|
||||
this.owner = nbt.getInteger( NBT_OWNER_KEY );
|
||||
|
||||
@@ -30,8 +30,8 @@ import javax.annotation.Nonnull;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.CompressedStreamTools;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import appeng.core.AELog;
|
||||
|
||||
@@ -57,11 +57,11 @@ final class SpawnData implements IWorldSpawnData
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGenerated( final int dim, final int chunkX, final int chunkZ )
|
||||
public void setGenerated( final Dimension dim, final int chunkX, final int chunkZ )
|
||||
{
|
||||
synchronized( SpawnData.class )
|
||||
{
|
||||
final NBTTagCompound data = this.loadSpawnData( dim, chunkX, chunkZ );
|
||||
final CompoundNBT data = this.loadSpawnData( dim, chunkX, chunkZ );
|
||||
|
||||
// edit.
|
||||
data.setBoolean( chunkX + "," + chunkZ, true );
|
||||
@@ -71,21 +71,21 @@ final class SpawnData implements IWorldSpawnData
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasGenerated( final int dim, final int chunkX, final int chunkZ )
|
||||
public boolean hasGenerated( final Dimension dim, final int chunkX, final int chunkZ )
|
||||
{
|
||||
synchronized( SpawnData.class )
|
||||
{
|
||||
final NBTTagCompound data = this.loadSpawnData( dim, chunkX, chunkZ );
|
||||
final CompoundNBT data = this.loadSpawnData( dim, chunkX, chunkZ );
|
||||
return data.getBoolean( chunkX + "," + chunkZ );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addNearByMeteorites( final int dim, final int chunkX, final int chunkZ, final NBTTagCompound newData )
|
||||
public boolean addNearByMeteorites( final Dimension dim, final int chunkX, final int chunkZ, final CompoundNBT newData )
|
||||
{
|
||||
synchronized( SpawnData.class )
|
||||
{
|
||||
final NBTTagCompound data = this.loadSpawnData( dim, chunkX, chunkZ );
|
||||
final CompoundNBT data = this.loadSpawnData( dim, chunkX, chunkZ );
|
||||
|
||||
// edit.
|
||||
final int size = data.getInteger( "num" );
|
||||
@@ -99,9 +99,9 @@ final class SpawnData implements IWorldSpawnData
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<NBTTagCompound> getNearByMeteorites( final int dim, final int chunkX, final int chunkZ )
|
||||
public Collection<CompoundNBT> getNearByMeteorites( final int Dimension, final int chunkX, final int chunkZ )
|
||||
{
|
||||
final Collection<NBTTagCompound> ll = new ArrayList<>();
|
||||
final Collection<CompoundNBT> ll = new ArrayList<>();
|
||||
|
||||
synchronized( SpawnData.class )
|
||||
{
|
||||
@@ -112,7 +112,7 @@ final class SpawnData implements IWorldSpawnData
|
||||
final int cx = x + ( chunkX >> 4 );
|
||||
final int cz = z + ( chunkZ >> 4 );
|
||||
|
||||
final NBTTagCompound data = this.loadSpawnData( dim, cx << 4, cz << 4 );
|
||||
final CompoundNBT data = this.loadSpawnData( dim, cx << 4, cz << 4 );
|
||||
|
||||
if( data != null )
|
||||
{
|
||||
@@ -130,14 +130,14 @@ final class SpawnData implements IWorldSpawnData
|
||||
return ll;
|
||||
}
|
||||
|
||||
private NBTTagCompound loadSpawnData( final int dim, final int chunkX, final int chunkZ )
|
||||
private CompoundNBT loadSpawnData( final int dim, final int chunkX, final int chunkZ )
|
||||
{
|
||||
if( !Thread.holdsLock( SpawnData.class ) )
|
||||
{
|
||||
throw new IllegalStateException( "Invalid Request" );
|
||||
}
|
||||
|
||||
NBTTagCompound data = null;
|
||||
CompoundNBT data = null;
|
||||
final String fileName = this.encoder.encode( dim, chunkX, chunkZ );
|
||||
final File file = new File( this.spawnDirectory, fileName );
|
||||
|
||||
@@ -152,7 +152,7 @@ final class SpawnData implements IWorldSpawnData
|
||||
}
|
||||
catch( final Throwable e )
|
||||
{
|
||||
data = new NBTTagCompound();
|
||||
data = new CompoundNBT();
|
||||
AELog.debug( e );
|
||||
}
|
||||
finally
|
||||
@@ -172,13 +172,13 @@ final class SpawnData implements IWorldSpawnData
|
||||
}
|
||||
else
|
||||
{
|
||||
data = new NBTTagCompound();
|
||||
data = new CompoundNBT();
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
private void writeSpawnData( final int dim, final int chunkX, final int chunkZ, final NBTTagCompound data )
|
||||
private void writeSpawnData( final int dim, final int chunkX, final int chunkZ, final CompoundNBT data )
|
||||
{
|
||||
if( !Thread.holdsLock( SpawnData.class ) )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user