Follow forges registration guidelines for entities and oredict. Remove ore camouflage (#3605)

This commit is contained in:
fscan
2018-07-14 16:37:50 +02:00
committed by GitHub
parent 8f6f35b9cf
commit 3363acb7db
12 changed files with 104 additions and 131 deletions
@@ -202,54 +202,17 @@ public final class ItemMaterial extends AEBaseItem implements IStorageComponent,
return mat.getStackSrc();
}
public void makeUnique()
public void registerOredicts()
{
for( final MaterialType mt : ImmutableSet.copyOf( this.dmgToMaterial.values() ) )
{
if( mt.getOreName() != null )
{
ItemStack replacement = ItemStack.EMPTY;
final String[] names = mt.getOreName().split( "," );
for( final String name : names )
{
if( !replacement.isEmpty() )
{
break;
}
final List<ItemStack> options = OreDictionary.getOres( name );
if( options != OreDictionary.EMPTY_LIST && options.size() > 0 )
{
for( final ItemStack is : options )
{
if( !is.isEmpty() )
{
replacement = is.copy();
break;
}
}
}
}
if( replacement.isEmpty() || AEConfig.instance().useAEVersion( mt ) )
{
// continue using the AE2 item.
for( final String name : names )
{
OreDictionary.registerOre( name, mt.stack( 1 ) );
}
}
else
{
if( mt.getItemInstance() == this )
{
this.dmgToMaterial.remove( mt.getDamageValue() );
}
mt.setItemInstance( replacement.getItem() );
mt.setDamageValue( replacement.getItemDamage() );
OreDictionary.registerOre( name, mt.stack( 1 ) );
}
}
}
@@ -341,8 +304,9 @@ public final class ItemMaterial extends AEBaseItem implements IStorageComponent,
try
{
eqi = droppedEntity.getConstructor( World.class, double.class, double.class, double.class, ItemStack.class ).newInstance( w, location.posX,
location.posY, location.posZ, itemstack );
eqi = droppedEntity.getConstructor( World.class, double.class, double.class, double.class, ItemStack.class )
.newInstance( w, location.posX,
location.posY, location.posZ, itemstack );
}
catch( final Throwable t )
{
@@ -27,13 +27,11 @@ 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;
import appeng.core.features.AEFeature;
import appeng.core.features.MaterialStackSrc;
import appeng.entity.EntityChargedQuartz;
import appeng.entity.EntityIds;
import appeng.entity.EntitySingularity;
@@ -148,11 +146,6 @@ public enum MaterialType
{
this( metaValue, modelName, features );
this.droppedEntity = c;
EntityRegistry.registerModEntity( new ResourceLocation( "appliedenergistics2", this.droppedEntity.getName() ), this.droppedEntity,
this.droppedEntity.getSimpleName(),
EntityIds.get( this.droppedEntity ), AppEng.instance(), 16, 4,
true );
}
MaterialType( final int metaValue, String modelName, final Set<AEFeature> features, final String oreDictionary, final Class<? extends Entity> c )
@@ -160,10 +153,6 @@ public enum MaterialType
this( metaValue, modelName, features );
this.oreName = oreDictionary;
this.droppedEntity = c;
EntityRegistry.registerModEntity( new ResourceLocation( "appliedenergistics2", this.droppedEntity.getName() ), this.droppedEntity,
this.droppedEntity.getSimpleName(),
EntityIds.get( this.droppedEntity ), AppEng.instance(), 16, 4,
true );
}
MaterialType( final int metaValue, String modelName, final Set<AEFeature> features, final String oreDictionary )
@@ -32,9 +32,7 @@ import net.minecraft.entity.Entity;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.NonNullList;
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;
@@ -42,10 +40,8 @@ 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.localization.ButtonToolTips;
import appeng.entity.EntityGrowingCrystal;
import appeng.entity.EntityIds;
import appeng.items.AEBaseItem;
import appeng.util.Platform;
@@ -64,9 +60,6 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
public ItemCrystalSeed()
{
this.setHasSubtypes( true );
EntityRegistry.registerModEntity( new ResourceLocation( "appliedenergistics2", EntityGrowingCrystal.class.getName() ), EntityGrowingCrystal.class,
EntityGrowingCrystal.class.getSimpleName(), EntityIds.get( EntityGrowingCrystal.class ), AppEng.instance(), 16, 4, true );
}
@Nullable