Major Refactoring of Bootstrap Code (#75)
- Refactored boostrap code: * Completely reworked item/block/tile registration. * Fixed server side startup. * Fixed server side startup. * More documentation. * More heavy cleanup * More cleanups. * Major refactoring of state mapping and fixes a lot of other issue related to item rendering. * Fixes sky chest item models (no item TESR). * Only use CachingRotatingBakedModel for tile entities automatically. Fix default rotation of quartz pillar for item model. * Used method reference instead of lambda for ItemMeshDefinition for multiparts. * Removed unnecessary IHasSpecialItemModel * Removed unused IconReg class. * Updated resource pack version.
This commit is contained in:
committed by
Sebastian Hartte
parent
66df324ef0
commit
6f2bbfab4c
@@ -19,67 +19,27 @@
|
||||
package appeng.items;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import net.minecraft.client.renderer.ItemMeshDefinition;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.features.FeatureNameExtractor;
|
||||
import appeng.core.features.IAEFeature;
|
||||
import appeng.core.features.IFeatureHandler;
|
||||
import appeng.core.features.ItemFeatureHandler;
|
||||
|
||||
|
||||
public abstract class AEBaseItem extends Item implements IAEFeature
|
||||
public abstract class AEBaseItem extends Item
|
||||
{
|
||||
private final String fullName;
|
||||
private final Optional<String> subName;
|
||||
private IFeatureHandler feature;
|
||||
|
||||
public AEBaseItem()
|
||||
{
|
||||
this( Optional.<String>absent() );
|
||||
this.setNoRepair();
|
||||
}
|
||||
|
||||
public AEBaseItem( final Optional<String> subName )
|
||||
{
|
||||
this.subName = subName;
|
||||
this.fullName = new FeatureNameExtractor( this.getClass(), subName ).get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return this.fullName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFeatureHandler handler()
|
||||
{
|
||||
return this.feature;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit()
|
||||
{
|
||||
// override!
|
||||
}
|
||||
|
||||
public void setFeature( final EnumSet<AEFeature> f )
|
||||
{
|
||||
this.feature = new ItemFeatureHandler( f, this, this, this.subName );
|
||||
String regName = getRegistryName() != null ? getRegistryName().getResourcePath() : "unregistered";
|
||||
return getClass().getSimpleName() + "[" + regName + "]";
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -112,22 +72,4 @@ public abstract class AEBaseItem extends Item implements IAEFeature
|
||||
super.getSubItems( sameItem, creativeTab, itemStacks );
|
||||
}
|
||||
|
||||
/**
|
||||
* During registration of the item in the registry, this method is used to determine which models need to be registered for the item to be
|
||||
* rendered. If your item subclass requires more than just the default, override this method and add them to the list, or replace it entirely.
|
||||
*/
|
||||
@SideOnly( Side.CLIENT )
|
||||
public List<ResourceLocation> getItemVariants() {
|
||||
return Lists.newArrayList( getRegistryName() );
|
||||
}
|
||||
|
||||
/**
|
||||
* If this item requires special logic to select the model for rendering, this method can be overriden to return that selection logic.
|
||||
* Return null to use the standard logic.
|
||||
*/
|
||||
@SideOnly( Side.CLIENT )
|
||||
public ItemMeshDefinition getItemMeshDefinition() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@ package appeng.items.materials;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
@@ -30,12 +29,10 @@ import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
import net.minecraft.client.renderer.ItemMeshDefinition;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
@@ -48,12 +45,9 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import appeng.api.config.Upgrades;
|
||||
@@ -79,11 +73,10 @@ public final class ItemMultiItem extends AEBaseItem implements IStorageComponent
|
||||
|
||||
private static final int KILO_SCALAR = 1024;
|
||||
|
||||
private final Map<Integer, MaterialType> dmgToMaterial = new HashMap<Integer, MaterialType>();
|
||||
private final Map<Integer, MaterialType> dmgToMaterial = new HashMap<>();
|
||||
|
||||
public ItemMultiItem()
|
||||
{
|
||||
this.setFeature( EnumSet.of( AEFeature.Core ) );
|
||||
this.setHasSubtypes( true );
|
||||
instance = this;
|
||||
}
|
||||
@@ -446,22 +439,4 @@ public final class ItemMultiItem extends AEBaseItem implements IStorageComponent
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
public List<ResourceLocation> getItemVariants()
|
||||
{
|
||||
// Register a resource location for every material type
|
||||
return Arrays.stream( MaterialType.values() )
|
||||
.map( MaterialType::getModel )
|
||||
.collect( Collectors.toList() );
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
public ItemMeshDefinition getItemMeshDefinition()
|
||||
{
|
||||
return is -> getTypeByStack( is ).getModel();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.common.registry.EntityRegistry;
|
||||
|
||||
import appeng.core.AppEng;
|
||||
@@ -37,86 +38,86 @@ import appeng.entity.EntitySingularity;
|
||||
|
||||
public enum MaterialType
|
||||
{
|
||||
InvalidType( -1, AEFeature.Core ),
|
||||
InvalidType( -1, "material_invalid_type", AEFeature.Core ),
|
||||
|
||||
CertusQuartzCrystal( 0, AEFeature.Core, "crystalCertusQuartz" ),
|
||||
CertusQuartzCrystalCharged( 1, AEFeature.Core, EntityChargedQuartz.class ),
|
||||
CertusQuartzCrystal( 0, "material_certus_quartz_crystal", AEFeature.Core, "crystalCertusQuartz" ),
|
||||
CertusQuartzCrystalCharged( 1, "material_certus_quartz_crystal_charged", AEFeature.Core, EntityChargedQuartz.class ),
|
||||
|
||||
CertusQuartzDust( 2, AEFeature.Core, "dustCertusQuartz" ),
|
||||
NetherQuartzDust( 3, AEFeature.Core, "dustNetherQuartz" ),
|
||||
Flour( 4, AEFeature.Flour, "dustWheat" ),
|
||||
GoldDust( 51, AEFeature.Core, "dustGold" ),
|
||||
IronDust( 49, AEFeature.Core, "dustIron" ),
|
||||
IronNugget( 50, AEFeature.Core, "nuggetIron" ),
|
||||
CertusQuartzDust( 2, "material_certus_quartz_dust", AEFeature.Core, "dustCertusQuartz" ),
|
||||
NetherQuartzDust( 3, "material_nether_quartz_dust", AEFeature.Core, "dustNetherQuartz" ),
|
||||
Flour( 4, "material_flour", AEFeature.Flour, "dustWheat" ),
|
||||
GoldDust( 51, "material_gold_dust", AEFeature.Core, "dustGold" ),
|
||||
IronDust( 49, "material_iron_dust", AEFeature.Core, "dustIron" ),
|
||||
IronNugget( 50, "material_iron_nugget", AEFeature.Core, "nuggetIron" ),
|
||||
|
||||
Silicon( 5, AEFeature.Core, "itemSilicon" ),
|
||||
MatterBall( 6 ),
|
||||
Silicon( 5, "material_silicon", AEFeature.Core, "itemSilicon" ),
|
||||
MatterBall( 6, "material_matter_ball" ),
|
||||
|
||||
FluixCrystal( 7, AEFeature.Core, "crystalFluix" ),
|
||||
FluixDust( 8, AEFeature.Core, "dustFluix" ),
|
||||
FluixPearl( 9, AEFeature.Core, "pearlFluix" ),
|
||||
FluixCrystal( 7, "material_fluix_crystal", AEFeature.Core, "crystalFluix" ),
|
||||
FluixDust( 8, "material_fluix_dust", AEFeature.Core, "dustFluix" ),
|
||||
FluixPearl( 9, "material_fluix_pearl", AEFeature.Core, "pearlFluix" ),
|
||||
|
||||
PurifiedCertusQuartzCrystal( 10 ),
|
||||
PurifiedNetherQuartzCrystal( 11 ),
|
||||
PurifiedFluixCrystal( 12 ),
|
||||
PurifiedCertusQuartzCrystal( 10, "material_purified_certus_quartz_crystal" ),
|
||||
PurifiedNetherQuartzCrystal( 11, "material_purified_nether_quartz_crystal" ),
|
||||
PurifiedFluixCrystal( 12, "material_purified_fluix_crystal" ),
|
||||
|
||||
CalcProcessorPress( 13 ),
|
||||
EngProcessorPress( 14 ),
|
||||
LogicProcessorPress( 15 ),
|
||||
CalcProcessorPress( 13, "material_calc_processor_press" ),
|
||||
EngProcessorPress( 14, "material_eng_processor_press" ),
|
||||
LogicProcessorPress( 15, "material_logic_processor_press" ),
|
||||
|
||||
CalcProcessorPrint( 16 ),
|
||||
EngProcessorPrint( 17 ),
|
||||
LogicProcessorPrint( 18 ),
|
||||
CalcProcessorPrint( 16, "material_calc_processor_print" ),
|
||||
EngProcessorPrint( 17, "material_eng_processor_print" ),
|
||||
LogicProcessorPrint( 18, "material_logic_processor_print" ),
|
||||
|
||||
SiliconPress( 19 ),
|
||||
SiliconPrint( 20 ),
|
||||
SiliconPress( 19, "material_silicon_press" ),
|
||||
SiliconPrint( 20, "material_silicon_print" ),
|
||||
|
||||
NamePress( 21 ),
|
||||
NamePress( 21, "material_name_press" ),
|
||||
|
||||
LogicProcessor( 22 ),
|
||||
CalcProcessor( 23 ),
|
||||
EngProcessor( 24 ),
|
||||
LogicProcessor( 22, "material_logic_processor" ),
|
||||
CalcProcessor( 23, "material_calc_processor" ),
|
||||
EngProcessor( 24, "material_eng_processor" ),
|
||||
|
||||
// Basic Cards
|
||||
BasicCard( 25 ),
|
||||
CardRedstone( 26 ),
|
||||
CardCapacity( 27 ),
|
||||
BasicCard( 25, "material_basic_card" ),
|
||||
CardRedstone( 26, "material_card_redstone" ),
|
||||
CardCapacity( 27, "material_card_capacity" ),
|
||||
|
||||
// Adv Cards
|
||||
AdvCard( 28 ),
|
||||
CardFuzzy( 29 ),
|
||||
CardSpeed( 30 ),
|
||||
CardInverter( 31 ),
|
||||
AdvCard( 28, "material_adv_card" ),
|
||||
CardFuzzy( 29, "material_card_fuzzy" ),
|
||||
CardSpeed( 30, "material_card_speed" ),
|
||||
CardInverter( 31, "material_card_inverter" ),
|
||||
|
||||
Cell2SpatialPart( 32, AEFeature.SpatialIO ),
|
||||
Cell16SpatialPart( 33, AEFeature.SpatialIO ),
|
||||
Cell128SpatialPart( 34, AEFeature.SpatialIO ),
|
||||
Cell2SpatialPart( 32, "material_cell2_spatial_part", AEFeature.SpatialIO ),
|
||||
Cell16SpatialPart( 33, "material_cell16_spatial_part", AEFeature.SpatialIO ),
|
||||
Cell128SpatialPart( 34, "material_cell128_spatial_part", AEFeature.SpatialIO ),
|
||||
|
||||
Cell1kPart( 35, AEFeature.StorageCells ),
|
||||
Cell4kPart( 36, AEFeature.StorageCells ),
|
||||
Cell16kPart( 37, AEFeature.StorageCells ),
|
||||
Cell64kPart( 38, AEFeature.StorageCells ),
|
||||
EmptyStorageCell( 39, AEFeature.StorageCells ),
|
||||
Cell1kPart( 35, "material_cell1k_part", AEFeature.StorageCells ),
|
||||
Cell4kPart( 36, "material_cell4k_part", AEFeature.StorageCells ),
|
||||
Cell16kPart( 37, "material_cell16k_part", AEFeature.StorageCells ),
|
||||
Cell64kPart( 38, "material_cell64k_part", AEFeature.StorageCells ),
|
||||
EmptyStorageCell( 39, "material_empty_storage_cell", AEFeature.StorageCells ),
|
||||
|
||||
WoodenGear( 40, AEFeature.GrindStone, "gearWood" ),
|
||||
WoodenGear( 40, "material_wooden_gear", AEFeature.GrindStone, "gearWood" ),
|
||||
|
||||
Wireless( 41, AEFeature.WirelessAccessTerminal ),
|
||||
WirelessBooster( 42, AEFeature.WirelessAccessTerminal ),
|
||||
Wireless( 41, "material_wireless", AEFeature.WirelessAccessTerminal ),
|
||||
WirelessBooster( 42, "material_wireless_booster", AEFeature.WirelessAccessTerminal ),
|
||||
|
||||
FormationCore( 43 ),
|
||||
AnnihilationCore( 44 ),
|
||||
FormationCore( 43, "material_formation_core" ),
|
||||
AnnihilationCore( 44, "material_annihilation_core" ),
|
||||
|
||||
SkyDust( 45, AEFeature.Core ),
|
||||
SkyDust( 45, "material_sky_dust", AEFeature.Core ),
|
||||
|
||||
EnderDust( 46, AEFeature.QuantumNetworkBridge, "dustEnder,dustEnderPearl", EntitySingularity.class ),
|
||||
Singularity( 47, AEFeature.QuantumNetworkBridge, EntitySingularity.class ),
|
||||
QESingularity( 48, AEFeature.QuantumNetworkBridge, EntitySingularity.class ),
|
||||
EnderDust( 46, "material_ender_dust", AEFeature.QuantumNetworkBridge, "dustEnder,dustEnderPearl", EntitySingularity.class ),
|
||||
Singularity( 47, "material_singularity", AEFeature.QuantumNetworkBridge, EntitySingularity.class ),
|
||||
QESingularity( 48, "material_qesingularity", AEFeature.QuantumNetworkBridge, EntitySingularity.class ),
|
||||
|
||||
BlankPattern( 52 ),
|
||||
CardCrafting( 53 );
|
||||
BlankPattern( 52, "material_blank_pattern" ),
|
||||
CardCrafting( 53, "material_card_crafting" );
|
||||
|
||||
private final EnumSet<AEFeature> features;
|
||||
private final ModelResourceLocation model = new ModelResourceLocation( "appliedenergistics2:ItemMaterial." + name() );
|
||||
private final ModelResourceLocation model;
|
||||
private Item itemInstance;
|
||||
private int damageValue;
|
||||
// stack!
|
||||
@@ -125,40 +126,37 @@ public enum MaterialType
|
||||
private Class<? extends Entity> droppedEntity;
|
||||
private boolean isRegistered = false;
|
||||
|
||||
MaterialType( final int metaValue )
|
||||
MaterialType( final int metaValue, String modelName )
|
||||
{
|
||||
this.setDamageValue( metaValue );
|
||||
this.features = EnumSet.of( AEFeature.Core );
|
||||
this( metaValue, modelName, AEFeature.Core );
|
||||
}
|
||||
|
||||
MaterialType( final int metaValue, final AEFeature part )
|
||||
MaterialType( final int metaValue, String modelName, final AEFeature part )
|
||||
{
|
||||
this.setDamageValue( metaValue );
|
||||
this.features = EnumSet.of( part );
|
||||
this.model = new ModelResourceLocation( new ResourceLocation( AppEng.MOD_ID, modelName ), "inventory" );
|
||||
}
|
||||
|
||||
MaterialType( final int metaValue, final AEFeature part, final Class<? extends Entity> c )
|
||||
MaterialType( final int metaValue, String modelName, final AEFeature part, final Class<? extends Entity> c )
|
||||
{
|
||||
this.features = EnumSet.of( part );
|
||||
this.setDamageValue( metaValue );
|
||||
this( metaValue, modelName, part );
|
||||
this.droppedEntity = c;
|
||||
|
||||
EntityRegistry.registerModEntity( this.droppedEntity, this.droppedEntity.getSimpleName(), EntityIds.get( this.droppedEntity ), AppEng.instance(), 16, 4, true );
|
||||
}
|
||||
|
||||
MaterialType( final int metaValue, final AEFeature part, final String oreDictionary, final Class<? extends Entity> c )
|
||||
MaterialType( final int metaValue, String modelName, final AEFeature part, final String oreDictionary, final Class<? extends Entity> c )
|
||||
{
|
||||
this.features = EnumSet.of( part );
|
||||
this.setDamageValue( metaValue );
|
||||
this( metaValue, modelName, part );
|
||||
this.oreName = oreDictionary;
|
||||
this.droppedEntity = c;
|
||||
EntityRegistry.registerModEntity( this.droppedEntity, this.droppedEntity.getSimpleName(), EntityIds.get( this.droppedEntity ), AppEng.instance(), 16, 4, true );
|
||||
}
|
||||
|
||||
MaterialType( final int metaValue, final AEFeature part, final String oreDictionary )
|
||||
MaterialType( final int metaValue, String modelName, final AEFeature part, final String oreDictionary )
|
||||
{
|
||||
this.features = EnumSet.of( part );
|
||||
this.setDamageValue( metaValue );
|
||||
this( metaValue, modelName, part );
|
||||
this.oreName = oreDictionary;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,34 +19,25 @@
|
||||
package appeng.items.misc;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.ItemMeshDefinition;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.registry.EntityRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.definitions.IMaterials;
|
||||
import appeng.api.implementations.items.IGrowableCrystal;
|
||||
import appeng.api.recipes.ResolverResult;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.localization.ButtonToolTips;
|
||||
import appeng.entity.EntityGrowingCrystal;
|
||||
import appeng.entity.EntityIds;
|
||||
@@ -57,8 +48,8 @@ import appeng.util.Platform;
|
||||
public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
|
||||
{
|
||||
|
||||
private static final int LEVEL_OFFSET = 200;
|
||||
private static final int SINGLE_OFFSET = LEVEL_OFFSET * 3;
|
||||
static final int LEVEL_OFFSET = 200;
|
||||
static final int SINGLE_OFFSET = LEVEL_OFFSET * 3;
|
||||
|
||||
public static final int CERTUS = 0;
|
||||
public static final int NETHER = SINGLE_OFFSET;
|
||||
@@ -68,7 +59,6 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
|
||||
public ItemCrystalSeed()
|
||||
{
|
||||
this.setHasSubtypes( true );
|
||||
this.setFeature( EnumSet.of( AEFeature.Core ) );
|
||||
|
||||
EntityRegistry.registerModEntity( EntityGrowingCrystal.class, EntityGrowingCrystal.class.getSimpleName(), EntityIds.get( EntityGrowingCrystal.class ), AppEng.instance(), 16, 4, true );
|
||||
}
|
||||
@@ -94,7 +84,7 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
private static int getProgress( final ItemStack is )
|
||||
static int getProgress( final ItemStack is )
|
||||
{
|
||||
if( is.hasTagCompound() )
|
||||
{
|
||||
@@ -259,72 +249,4 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
|
||||
itemStacks.add( newStyle( new ItemStack( this, 1, LEVEL_OFFSET * 2 + FLUIX ) ) );
|
||||
}
|
||||
|
||||
private static final ModelResourceLocation[] MODELS_CERTUS = {
|
||||
new ModelResourceLocation( "appliedenergistics2:crystal_seed_certus" ),
|
||||
new ModelResourceLocation( "appliedenergistics2:crystal_seed_certus2" ),
|
||||
new ModelResourceLocation( "appliedenergistics2:crystal_seed_certus3" )
|
||||
};
|
||||
private static final ModelResourceLocation[] MODELS_FLUIX = {
|
||||
new ModelResourceLocation( "appliedenergistics2:crystal_seed_fluix" ),
|
||||
new ModelResourceLocation( "appliedenergistics2:crystal_seed_fluix2" ),
|
||||
new ModelResourceLocation( "appliedenergistics2:crystal_seed_fluix3" )
|
||||
};
|
||||
private static final ModelResourceLocation[] MODELS_NETHER = {
|
||||
new ModelResourceLocation( "appliedenergistics2:crystal_seed_nether" ),
|
||||
new ModelResourceLocation( "appliedenergistics2:crystal_seed_nether2" ),
|
||||
new ModelResourceLocation( "appliedenergistics2:crystal_seed_nether3" )
|
||||
};
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
public List<ResourceLocation> getItemVariants()
|
||||
{
|
||||
return ImmutableList.<ResourceLocation>builder().add( MODELS_CERTUS ).add( MODELS_FLUIX ).add( MODELS_NETHER ).build();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
public ItemMeshDefinition getItemMeshDefinition()
|
||||
{
|
||||
return is -> {
|
||||
int damage = getProgress( is );
|
||||
|
||||
// Split the damage value into crystal type and growth level
|
||||
int type = damage / SINGLE_OFFSET;
|
||||
int level = ( damage % SINGLE_OFFSET ) / LEVEL_OFFSET;
|
||||
|
||||
// Determine which list of models to use based on the type of crystal
|
||||
ModelResourceLocation[] models;
|
||||
switch( type )
|
||||
{
|
||||
case 0:
|
||||
models = MODELS_CERTUS;
|
||||
break;
|
||||
case 1:
|
||||
models = MODELS_NETHER;
|
||||
break;
|
||||
case 2:
|
||||
models = MODELS_FLUIX;
|
||||
break;
|
||||
default:
|
||||
// We use this as the fallback for broken items
|
||||
models = MODELS_CERTUS;
|
||||
break;
|
||||
}
|
||||
|
||||
// Return one of the 3 models based on the level
|
||||
if( level < 0 )
|
||||
{
|
||||
level = 0;
|
||||
}
|
||||
else if( level >= models.length )
|
||||
{
|
||||
level = models.length - 1;
|
||||
}
|
||||
|
||||
return models[level];
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
package appeng.items.misc;
|
||||
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import net.minecraft.client.renderer.ItemMeshDefinition;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import appeng.bootstrap.IItemRendering;
|
||||
import appeng.bootstrap.ItemRenderingCustomizer;
|
||||
|
||||
|
||||
public class ItemCrystalSeedRendering extends ItemRenderingCustomizer
|
||||
{
|
||||
|
||||
private static final ModelResourceLocation[] MODELS_CERTUS = {
|
||||
new ModelResourceLocation( "appliedenergistics2:crystal_seed_certus" ),
|
||||
new ModelResourceLocation( "appliedenergistics2:crystal_seed_certus2" ),
|
||||
new ModelResourceLocation( "appliedenergistics2:crystal_seed_certus3" )
|
||||
};
|
||||
private static final ModelResourceLocation[] MODELS_FLUIX = {
|
||||
new ModelResourceLocation( "appliedenergistics2:crystal_seed_fluix" ),
|
||||
new ModelResourceLocation( "appliedenergistics2:crystal_seed_fluix2" ),
|
||||
new ModelResourceLocation( "appliedenergistics2:crystal_seed_fluix3" )
|
||||
};
|
||||
private static final ModelResourceLocation[] MODELS_NETHER = {
|
||||
new ModelResourceLocation( "appliedenergistics2:crystal_seed_nether" ),
|
||||
new ModelResourceLocation( "appliedenergistics2:crystal_seed_nether2" ),
|
||||
new ModelResourceLocation( "appliedenergistics2:crystal_seed_nether3" )
|
||||
};
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
public void customize( IItemRendering rendering )
|
||||
{
|
||||
rendering.variants( ImmutableList.<ResourceLocation>builder().add( MODELS_CERTUS ).add( MODELS_FLUIX ).add( MODELS_NETHER ).build() );
|
||||
rendering.meshDefinition( getItemMeshDefinition() );
|
||||
}
|
||||
|
||||
private ItemMeshDefinition getItemMeshDefinition()
|
||||
{
|
||||
return is ->
|
||||
{
|
||||
int damage = ItemCrystalSeed.getProgress( is );
|
||||
|
||||
// Split the damage value into crystal type and growth level
|
||||
int type = damage / ItemCrystalSeed.SINGLE_OFFSET;
|
||||
int level = ( damage % ItemCrystalSeed.SINGLE_OFFSET ) / ItemCrystalSeed.LEVEL_OFFSET;
|
||||
|
||||
// Determine which list of models to use based on the type of crystal
|
||||
ModelResourceLocation[] models;
|
||||
switch( type )
|
||||
{
|
||||
case 0:
|
||||
models = MODELS_CERTUS;
|
||||
break;
|
||||
case 1:
|
||||
models = MODELS_NETHER;
|
||||
break;
|
||||
case 2:
|
||||
models = MODELS_FLUIX;
|
||||
break;
|
||||
default:
|
||||
// We use this as the fallback for broken items
|
||||
models = MODELS_CERTUS;
|
||||
break;
|
||||
}
|
||||
|
||||
// Return one of the 3 models based on the level
|
||||
if( level < 0 )
|
||||
{
|
||||
level = 0;
|
||||
}
|
||||
else if( level >= models.length )
|
||||
{
|
||||
level = models.length - 1;
|
||||
}
|
||||
|
||||
return models[level];
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -19,14 +19,10 @@
|
||||
package appeng.items.misc;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.WeakHashMap;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.ItemMeshDefinition;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -37,16 +33,12 @@ import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.implementations.ICraftingPatternItem;
|
||||
import appeng.api.networking.crafting.ICraftingPatternDetails;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.client.ClientHelper;
|
||||
import appeng.core.CommonHelper;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.helpers.PatternHelper;
|
||||
import appeng.items.AEBaseItem;
|
||||
@@ -60,7 +52,6 @@ public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternIt
|
||||
|
||||
public ItemEncodedPattern()
|
||||
{
|
||||
this.setFeature( EnumSet.of( AEFeature.Patterns ) );
|
||||
this.setMaxStackSize( 1 );
|
||||
}
|
||||
|
||||
|
||||
@@ -19,22 +19,13 @@
|
||||
package appeng.items.misc;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import net.minecraft.client.renderer.ItemMeshDefinition;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.items.AEBaseItem;
|
||||
|
||||
@@ -46,7 +37,6 @@ public class ItemPaintBall extends AEBaseItem
|
||||
|
||||
public ItemPaintBall()
|
||||
{
|
||||
this.setFeature( EnumSet.of( AEFeature.PaintBalls ) );
|
||||
this.setHasSubtypes( true );
|
||||
}
|
||||
|
||||
@@ -97,49 +87,10 @@ public class ItemPaintBall extends AEBaseItem
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isLumen( final ItemStack is )
|
||||
public static boolean isLumen( final ItemStack is )
|
||||
{
|
||||
final int dmg = is.getItemDamage();
|
||||
return dmg >= DAMAGE_THRESHOLD;
|
||||
}
|
||||
|
||||
public static int getColorFromItemstack( ItemStack stack, int tintIndex )
|
||||
{
|
||||
final AEColor col = ( (ItemPaintBall) stack.getItem() ).getColor( stack );
|
||||
|
||||
final int colorValue = stack.getItemDamage() >= 20 ? col.mediumVariant : col.mediumVariant;
|
||||
final int r = ( colorValue >> 16 ) & 0xff;
|
||||
final int g = ( colorValue >> 8 ) & 0xff;
|
||||
final int b = ( colorValue ) & 0xff;
|
||||
|
||||
if( stack.getItemDamage() >= 20 )
|
||||
{
|
||||
final float fail = 0.7f;
|
||||
final int full = (int) ( 255 * 0.3 );
|
||||
return (int) ( full + r * fail ) << 16 | (int) ( full + g * fail ) << 8 | (int) ( full + b * fail ) | 0xff << 24;
|
||||
}
|
||||
else
|
||||
{
|
||||
return r << 16 | g << 8 | b | 0xff << 24;
|
||||
}
|
||||
}
|
||||
|
||||
private static final ModelResourceLocation MODEL_NORMAL = new ModelResourceLocation( "appliedenergistics2:ItemPaintBall" );
|
||||
private static final ModelResourceLocation MODEL_SHIMMER = new ModelResourceLocation( "appliedenergistics2:ItemPaintBallShimmer" );
|
||||
|
||||
@Override
|
||||
public List<ResourceLocation> getItemVariants()
|
||||
{
|
||||
return ImmutableList.of(
|
||||
MODEL_NORMAL,
|
||||
MODEL_SHIMMER
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
public ItemMeshDefinition getItemMeshDefinition()
|
||||
{
|
||||
return is -> isLumen( is ) ? MODEL_SHIMMER : MODEL_NORMAL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
package appeng.items.misc;
|
||||
|
||||
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.bootstrap.IItemRendering;
|
||||
import appeng.bootstrap.ItemRenderingCustomizer;
|
||||
|
||||
|
||||
public class ItemPaintBallRendering extends ItemRenderingCustomizer
|
||||
{
|
||||
|
||||
private static final ModelResourceLocation MODEL_NORMAL = new ModelResourceLocation( "appliedenergistics2:paint_ball" );
|
||||
private static final ModelResourceLocation MODEL_SHIMMER = new ModelResourceLocation( "appliedenergistics2:paint_ball_shimmer" );
|
||||
|
||||
@Override
|
||||
public void customize( IItemRendering rendering )
|
||||
{
|
||||
rendering.color( ItemPaintBallRendering::getColorFromItemstack );
|
||||
rendering.variants( MODEL_NORMAL, MODEL_SHIMMER );
|
||||
rendering.meshDefinition( is -> ItemPaintBall.isLumen( is ) ? MODEL_SHIMMER : MODEL_NORMAL );
|
||||
}
|
||||
|
||||
private static int getColorFromItemstack( ItemStack stack, int tintIndex )
|
||||
{
|
||||
final AEColor col = ( (ItemPaintBall) stack.getItem() ).getColor( stack );
|
||||
|
||||
final int colorValue = stack.getItemDamage() >= 20 ? col.mediumVariant : col.mediumVariant;
|
||||
final int r = ( colorValue >> 16 ) & 0xff;
|
||||
final int g = ( colorValue >> 8 ) & 0xff;
|
||||
final int b = ( colorValue ) & 0xff;
|
||||
|
||||
if( stack.getItemDamage() >= 20 )
|
||||
{
|
||||
final float fail = 0.7f;
|
||||
final int full = (int) ( 255 * 0.3 );
|
||||
return (int) ( full + r * fail ) << 16 | (int) ( full + g * fail ) << 8 | (int) ( full + b * fail ) | 0xff << 24;
|
||||
}
|
||||
else
|
||||
{
|
||||
return r << 16 | g << 8 | b | 0xff << 24;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,6 @@ package appeng.items.parts;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@@ -47,7 +46,6 @@ import appeng.api.exceptions.MissingDefinition;
|
||||
import appeng.api.parts.IAlphaPassItem;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.core.FacadeConfig;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.facade.FacadePart;
|
||||
import appeng.facade.IFacadeItem;
|
||||
import appeng.items.AEBaseItem;
|
||||
@@ -60,7 +58,6 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
||||
|
||||
public ItemFacade()
|
||||
{
|
||||
this.setFeature( EnumSet.of( AEFeature.Facades ) );
|
||||
this.setHasSubtypes( true );
|
||||
}
|
||||
|
||||
|
||||
@@ -23,20 +23,16 @@ import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import net.minecraft.client.renderer.ItemMeshDefinition;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -75,20 +71,13 @@ public final class ItemMultiPart extends AEBaseItem implements IPartItem, IItemG
|
||||
{
|
||||
Preconditions.checkNotNull( partHelper );
|
||||
|
||||
this.registered = new HashMap<Integer, PartTypeWithVariant>( INITIAL_REGISTERED_CAPACITY );
|
||||
this.registered = new HashMap<>( INITIAL_REGISTERED_CAPACITY );
|
||||
|
||||
this.setFeature( EnumSet.of( AEFeature.Core ) );
|
||||
this.setHasSubtypes( true );
|
||||
|
||||
instance = this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemMeshDefinition getItemMeshDefinition()
|
||||
{
|
||||
return itemstack -> new ModelResourceLocation( getTypeByStack( itemstack ).getModel(), null );
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public final ItemStackSrc createPart( final PartType mat )
|
||||
{
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package appeng.items.parts;
|
||||
|
||||
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.bootstrap.IItemRendering;
|
||||
import appeng.bootstrap.ItemRenderingCustomizer;
|
||||
|
||||
|
||||
public class ItemMultipartRendering extends ItemRenderingCustomizer
|
||||
{
|
||||
|
||||
private final ItemMultiPart item;
|
||||
|
||||
public ItemMultipartRendering( ItemMultiPart item )
|
||||
{
|
||||
this.item = item;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void customize( IItemRendering rendering )
|
||||
{
|
||||
rendering.meshDefinition( this::getItemMeshDefinition );
|
||||
}
|
||||
|
||||
private ModelResourceLocation getItemMeshDefinition( ItemStack is )
|
||||
{
|
||||
// TODO: Avoid object creation here. This happens every frame
|
||||
return new ModelResourceLocation( item.getTypeByStack( is ).getModel(), null );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -19,12 +19,9 @@
|
||||
package appeng.items.storage;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
@@ -69,9 +66,6 @@ public final class ItemBasicStorageCell extends AEBaseItem implements IStorageCe
|
||||
|
||||
public ItemBasicStorageCell( final MaterialType whichCell, final int kilobytes )
|
||||
{
|
||||
super( Optional.of( kilobytes + "k" ) );
|
||||
|
||||
this.setFeature( EnumSet.of( AEFeature.StorageCells ) );
|
||||
this.setMaxStackSize( 1 );
|
||||
this.totalBytes = kilobytes * 1024;
|
||||
this.component = whichCell;
|
||||
|
||||
@@ -19,14 +19,11 @@
|
||||
package appeng.items.storage;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.storage.ICellWorkbenchItem;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.items.AEBaseItem;
|
||||
import appeng.items.contents.CellConfig;
|
||||
|
||||
@@ -36,7 +33,6 @@ public class ItemCreativeStorageCell extends AEBaseItem implements ICellWorkbenc
|
||||
|
||||
public ItemCreativeStorageCell()
|
||||
{
|
||||
this.setFeature( EnumSet.of( AEFeature.StorageCells, AEFeature.Creative ) );
|
||||
this.setMaxStackSize( 1 );
|
||||
}
|
||||
|
||||
|
||||
@@ -19,11 +19,8 @@
|
||||
package appeng.items.storage;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -33,7 +30,6 @@ import net.minecraftforge.common.DimensionManager;
|
||||
import appeng.api.implementations.TransitionResult;
|
||||
import appeng.api.implementations.items.ISpatialStorageCell;
|
||||
import appeng.api.util.WorldCoord;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.core.worlddata.WorldData;
|
||||
import appeng.items.AEBaseItem;
|
||||
@@ -48,8 +44,6 @@ public class ItemSpatialStorageCell extends AEBaseItem implements ISpatialStorag
|
||||
|
||||
public ItemSpatialStorageCell( final int spatialScale )
|
||||
{
|
||||
super( Optional.of( spatialScale + "Cubed" ) );
|
||||
this.setFeature( EnumSet.of( AEFeature.SpatialIO ) );
|
||||
this.setMaxStackSize( 1 );
|
||||
this.maxRegion = spatialScale;
|
||||
}
|
||||
|
||||
@@ -19,8 +19,6 @@
|
||||
package appeng.items.storage;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@@ -31,7 +29,6 @@ import appeng.api.implementations.items.IUpgradeModule;
|
||||
import appeng.api.storage.ICellWorkbenchItem;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.items.AEBaseItem;
|
||||
import appeng.items.contents.CellConfig;
|
||||
import appeng.items.contents.CellUpgrades;
|
||||
@@ -47,7 +44,6 @@ public class ItemViewCell extends AEBaseItem implements ICellWorkbenchItem
|
||||
{
|
||||
public ItemViewCell()
|
||||
{
|
||||
this.setFeature( EnumSet.of( AEFeature.Core ) );
|
||||
this.setMaxStackSize( 1 );
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,6 @@ import appeng.api.config.SecurityPermissions;
|
||||
import appeng.api.features.IPlayerRegistry;
|
||||
import appeng.api.implementations.items.IBiometricCard;
|
||||
import appeng.api.networking.security.ISecurityRegistry;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.items.AEBaseItem;
|
||||
import appeng.util.Platform;
|
||||
@@ -48,7 +47,6 @@ public class ToolBiometricCard extends AEBaseItem implements IBiometricCard
|
||||
{
|
||||
public ToolBiometricCard()
|
||||
{
|
||||
this.setFeature( EnumSet.of( AEFeature.Security ) );
|
||||
this.setMaxStackSize( 1 );
|
||||
|
||||
if( Platform.isClient() )
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
package appeng.items.tools;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -35,7 +34,6 @@ import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.implementations.items.IMemoryCard;
|
||||
import appeng.api.implementations.items.MemoryCardMessages;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.core.localization.PlayerMessages;
|
||||
import appeng.items.AEBaseItem;
|
||||
@@ -46,7 +44,6 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard
|
||||
{
|
||||
public ToolMemoryCard()
|
||||
{
|
||||
this.setFeature( EnumSet.of( AEFeature.Core ) );
|
||||
this.setMaxStackSize( 1 );
|
||||
}
|
||||
|
||||
|
||||
@@ -19,10 +19,6 @@
|
||||
package appeng.items.tools;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -48,7 +44,6 @@ import appeng.api.util.DimensionalCoord;
|
||||
import appeng.api.util.INetworkToolAgent;
|
||||
import appeng.client.ClientHelper;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketClick;
|
||||
@@ -64,9 +59,6 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench /
|
||||
|
||||
public ToolNetworkTool()
|
||||
{
|
||||
super( Optional.<String>absent() );
|
||||
|
||||
this.setFeature( EnumSet.of( AEFeature.NetworkTool ) );
|
||||
this.setMaxStackSize( 1 );
|
||||
this.setHarvestLevel( "wrench", 0 );
|
||||
}
|
||||
|
||||
@@ -19,17 +19,12 @@
|
||||
package appeng.items.tools.powered;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.sync.packets.PacketLightning;
|
||||
import appeng.items.tools.powered.powersink.AEBasePoweredItem;
|
||||
import appeng.server.ServerHelper;
|
||||
@@ -41,8 +36,7 @@ public class ToolChargedStaff extends AEBasePoweredItem
|
||||
|
||||
public ToolChargedStaff()
|
||||
{
|
||||
super( AEConfig.instance.chargedStaffBattery, Optional.<String>absent() );
|
||||
this.setFeature( EnumSet.of( AEFeature.ChargedStaff, AEFeature.PoweredTools ) );
|
||||
super( AEConfig.instance.chargedStaffBattery );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -21,15 +21,12 @@ package appeng.items.tools.powered;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockColored;
|
||||
import net.minecraft.block.BlockDispenser;
|
||||
@@ -67,7 +64,6 @@ import appeng.api.util.DimensionalCoord;
|
||||
import appeng.block.misc.BlockPaint;
|
||||
import appeng.block.networking.BlockCableBus;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.helpers.IMouseWheelItem;
|
||||
import appeng.hooks.DispenserBlockTool;
|
||||
@@ -104,8 +100,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
||||
|
||||
public ToolColorApplicator()
|
||||
{
|
||||
super( AEConfig.instance.colorApplicatorBattery, Optional.<String>absent() );
|
||||
this.setFeature( EnumSet.of( AEFeature.ColorApplicator, AEFeature.PoweredTools ) );
|
||||
super( AEConfig.instance.colorApplicatorBattery );
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
// TODO - color applicator
|
||||
@@ -113,10 +108,9 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit()
|
||||
{
|
||||
super.postInit();
|
||||
// TODO BOOTSTRAP
|
||||
BlockDispenser.DISPENSE_BEHAVIOR_REGISTRY.putObject( this, new DispenserBlockTool() );
|
||||
}
|
||||
|
||||
|
||||
@@ -20,13 +20,10 @@ package appeng.items.tools.powered;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockDispenser;
|
||||
import net.minecraft.block.BlockTNT;
|
||||
@@ -52,7 +49,6 @@ import net.minecraft.world.World;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.block.misc.BlockTinyTNT;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.hooks.DispenserBlockTool;
|
||||
import appeng.hooks.IBlockTool;
|
||||
import appeng.items.tools.powered.powersink.AEBasePoweredItem;
|
||||
@@ -67,9 +63,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
||||
|
||||
public ToolEntropyManipulator()
|
||||
{
|
||||
super( AEConfig.instance.entropyManipulatorBattery, Optional.<String>absent() );
|
||||
|
||||
this.setFeature( EnumSet.of( AEFeature.EntropyManipulator, AEFeature.PoweredTools ) );
|
||||
super( AEConfig.instance.entropyManipulatorBattery );
|
||||
|
||||
this.heatUp = new HashMap<InWorldToolOperationIngredient, InWorldToolOperationResult>();
|
||||
this.coolDown = new HashMap<InWorldToolOperationIngredient, InWorldToolOperationResult>();
|
||||
@@ -91,10 +85,9 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
||||
this.heatUp.put( new InWorldToolOperationIngredient( Blocks.SNOW, true ), new InWorldToolOperationResult( new ItemStack( Blocks.FLOWING_WATER ) ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit()
|
||||
{
|
||||
super.postInit();
|
||||
// TODO BOOTSTRAP
|
||||
BlockDispenser.DISPENSE_BEHAVIOR_REGISTRY.putObject( this, new DispenserBlockTool() );
|
||||
}
|
||||
|
||||
|
||||
@@ -19,13 +19,9 @@
|
||||
package appeng.items.tools.powered;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockDispenser;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
@@ -89,14 +85,12 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
|
||||
|
||||
public ToolMassCannon()
|
||||
{
|
||||
super( AEConfig.instance.matterCannonBattery, Optional.<String>absent() );
|
||||
this.setFeature( EnumSet.of( AEFeature.MatterCannon, AEFeature.PoweredTools ) );
|
||||
super( AEConfig.instance.matterCannonBattery );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit()
|
||||
{
|
||||
super.postInit();
|
||||
// TODO BOOTSTRAP
|
||||
BlockDispenser.DISPENSE_BEHAVIOR_REGISTRY.putObject( this, new DispenserMatterCannon() );
|
||||
}
|
||||
|
||||
|
||||
@@ -19,12 +19,9 @@
|
||||
package appeng.items.tools.powered;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -49,7 +46,6 @@ import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.items.contents.CellConfig;
|
||||
@@ -64,8 +60,7 @@ public class ToolPortableCell extends AEBasePoweredItem implements IStorageCell,
|
||||
{
|
||||
public ToolPortableCell()
|
||||
{
|
||||
super( AEConfig.instance.portableCellBattery, Optional.<String>absent() );
|
||||
this.setFeature( EnumSet.of( AEFeature.PortableCell, AEFeature.StorageCells, AEFeature.PoweredTools ) );
|
||||
super( AEConfig.instance.portableCellBattery );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,11 +19,8 @@
|
||||
package appeng.items.tools.powered;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -43,7 +40,6 @@ import appeng.api.config.ViewItems;
|
||||
import appeng.api.features.IWirelessTermHandler;
|
||||
import appeng.api.util.IConfigManager;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.items.tools.powered.powersink.AEBasePoweredItem;
|
||||
import appeng.util.ConfigManager;
|
||||
@@ -56,8 +52,7 @@ public class ToolWirelessTerminal extends AEBasePoweredItem implements IWireless
|
||||
|
||||
public ToolWirelessTerminal()
|
||||
{
|
||||
super( AEConfig.instance.wirelessTerminalBattery, Optional.<String>absent() );
|
||||
this.setFeature( EnumSet.of( AEFeature.WirelessAccessTerminal, AEFeature.PoweredTools ) );
|
||||
super( AEConfig.instance.wirelessTerminalBattery );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,14 +19,11 @@
|
||||
package appeng.items.tools.powered.powersink;
|
||||
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
|
||||
public abstract class AEBasePoweredItem extends AERootPoweredItem
|
||||
{
|
||||
public AEBasePoweredItem( final double powerCapacity, final Optional<String> subName )
|
||||
public AEBasePoweredItem( final double powerCapacity )
|
||||
{
|
||||
super( powerCapacity, subName );
|
||||
super( powerCapacity );
|
||||
|
||||
this.setMaxStackSize( 1 );
|
||||
}
|
||||
|
||||
@@ -22,8 +22,6 @@ package appeng.items.tools.powered.powersink;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -43,9 +41,8 @@ public abstract class AERootPoweredItem extends AEBaseItem implements IAEItemPow
|
||||
private static final String POWER_NBT_KEY = "internalCurrentPower";
|
||||
private final double powerCapacity;
|
||||
|
||||
public AERootPoweredItem( final double powerCapacity, final Optional<String> subName )
|
||||
public AERootPoweredItem( final double powerCapacity )
|
||||
{
|
||||
super( subName );
|
||||
this.setMaxDamage( 32 );
|
||||
this.hasSubtypes = false;
|
||||
this.setFull3D();
|
||||
|
||||
@@ -19,41 +19,21 @@
|
||||
package appeng.items.tools.quartz;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import net.minecraft.item.ItemAxe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.features.IAEFeature;
|
||||
import appeng.core.features.IFeatureHandler;
|
||||
import appeng.core.features.ItemFeatureHandler;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class ToolQuartzAxe extends ItemAxe implements IAEFeature
|
||||
public class ToolQuartzAxe extends ItemAxe
|
||||
{
|
||||
private final AEFeature type;
|
||||
private final IFeatureHandler feature;
|
||||
|
||||
public ToolQuartzAxe( final AEFeature type )
|
||||
{
|
||||
super( ToolMaterial.IRON );
|
||||
this.feature = new ItemFeatureHandler( EnumSet.of( this.type = type, AEFeature.QuartzAxe ), this, this, Optional.of( type.name() ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFeatureHandler handler()
|
||||
{
|
||||
return this.feature;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit()
|
||||
{
|
||||
// override!
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,10 +19,6 @@
|
||||
package appeng.items.tools.quartz;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ActionResult;
|
||||
@@ -48,10 +44,7 @@ public class ToolQuartzCuttingKnife extends AEBaseItem implements IGuiItem
|
||||
|
||||
public ToolQuartzCuttingKnife( final AEFeature type )
|
||||
{
|
||||
super( Optional.of( type.name() ) );
|
||||
|
||||
this.type = type;
|
||||
this.setFeature( EnumSet.of( type, AEFeature.QuartzKnife ) );
|
||||
this.setMaxDamage( 50 );
|
||||
this.setMaxStackSize( 1 );
|
||||
}
|
||||
|
||||
@@ -19,48 +19,27 @@
|
||||
package appeng.items.tools.quartz;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import net.minecraft.item.ItemHoe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.features.IAEFeature;
|
||||
import appeng.core.features.IFeatureHandler;
|
||||
import appeng.core.features.ItemFeatureHandler;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class ToolQuartzHoe extends ItemHoe implements IAEFeature
|
||||
public class ToolQuartzHoe extends ItemHoe
|
||||
{
|
||||
private final AEFeature feature;
|
||||
private final IFeatureHandler handler;
|
||||
private final AEFeature type;
|
||||
|
||||
public ToolQuartzHoe( final AEFeature feature )
|
||||
public ToolQuartzHoe( final AEFeature type )
|
||||
{
|
||||
super( ToolMaterial.IRON );
|
||||
|
||||
this.feature = feature;
|
||||
this.handler = new ItemFeatureHandler( EnumSet.of( feature, AEFeature.QuartzHoe ), this, this, Optional.of( feature.name() ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFeatureHandler handler()
|
||||
{
|
||||
return this.handler;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit()
|
||||
{
|
||||
// override!
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getIsRepairable( final ItemStack a, final ItemStack b )
|
||||
{
|
||||
return Platform.canRepair( this.feature, a, b );
|
||||
return Platform.canRepair( this.type, a, b );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -19,43 +19,21 @@
|
||||
package appeng.items.tools.quartz;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import net.minecraft.item.ItemPickaxe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.features.IAEFeature;
|
||||
import appeng.core.features.IFeatureHandler;
|
||||
import appeng.core.features.ItemFeatureHandler;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class ToolQuartzPickaxe extends ItemPickaxe implements IAEFeature
|
||||
public class ToolQuartzPickaxe extends ItemPickaxe
|
||||
{
|
||||
private final AEFeature type;
|
||||
private final IFeatureHandler feature;
|
||||
|
||||
public ToolQuartzPickaxe( final AEFeature type )
|
||||
{
|
||||
super( ToolMaterial.IRON );
|
||||
|
||||
this.type = type;
|
||||
this.feature = new ItemFeatureHandler( EnumSet.of( type, AEFeature.QuartzPickaxe ), this, this, Optional.of( type.name() ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFeatureHandler handler()
|
||||
{
|
||||
return this.feature;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit()
|
||||
{
|
||||
// override!
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,42 +19,21 @@
|
||||
package appeng.items.tools.quartz;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import net.minecraft.item.ItemSpade;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.features.IAEFeature;
|
||||
import appeng.core.features.IFeatureHandler;
|
||||
import appeng.core.features.ItemFeatureHandler;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class ToolQuartzSpade extends ItemSpade implements IAEFeature
|
||||
public class ToolQuartzSpade extends ItemSpade
|
||||
{
|
||||
private final AEFeature type;
|
||||
private final IFeatureHandler handler;
|
||||
|
||||
public ToolQuartzSpade( final AEFeature type )
|
||||
{
|
||||
super( ToolMaterial.IRON );
|
||||
|
||||
this.handler = new ItemFeatureHandler( EnumSet.of( this.type = type, AEFeature.QuartzSpade ), this, this, Optional.of( type.name() ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFeatureHandler handler()
|
||||
{
|
||||
return this.handler;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit()
|
||||
{
|
||||
// override!
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,41 +19,21 @@
|
||||
package appeng.items.tools.quartz;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemSword;
|
||||
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.features.IAEFeature;
|
||||
import appeng.core.features.IFeatureHandler;
|
||||
import appeng.core.features.ItemFeatureHandler;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class ToolQuartzSword extends ItemSword implements IAEFeature
|
||||
public class ToolQuartzSword extends ItemSword
|
||||
{
|
||||
private final AEFeature type;
|
||||
private final IFeatureHandler feature;
|
||||
|
||||
public ToolQuartzSword( final AEFeature type )
|
||||
public ToolQuartzSword( AEFeature type )
|
||||
{
|
||||
super( ToolMaterial.IRON );
|
||||
this.feature = new ItemFeatureHandler( EnumSet.of( this.type = type, AEFeature.QuartzSword ), this, this, Optional.of( type.name() ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFeatureHandler handler()
|
||||
{
|
||||
return this.feature;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit()
|
||||
{
|
||||
// override!
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,10 +19,6 @@
|
||||
package appeng.items.tools.quartz;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -35,7 +31,6 @@ import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.implementations.items.IAEWrench;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.items.AEBaseItem;
|
||||
import appeng.util.Platform;
|
||||
|
||||
@@ -45,11 +40,8 @@ import appeng.util.Platform;
|
||||
public class ToolQuartzWrench extends AEBaseItem implements IAEWrench /* , IToolWrench */
|
||||
{
|
||||
|
||||
public ToolQuartzWrench( final AEFeature type )
|
||||
public ToolQuartzWrench()
|
||||
{
|
||||
super( Optional.of( type.name() ) );
|
||||
|
||||
this.setFeature( EnumSet.of( type, AEFeature.QuartzWrench ) );
|
||||
this.setMaxStackSize( 1 );
|
||||
this.setHarvestLevel( "wrench", 0 );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user