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:
shartte
2016-08-22 14:25:10 +02:00
committed by Sebastian Hartte
parent 66df324ef0
commit 6f2bbfab4c
172 changed files with 2289 additions and 2863 deletions
+3 -61
View File
@@ -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;
}
}