Added older registries back in

This commit is contained in:
Sebastian Hartte
2020-06-04 23:25:11 +02:00
parent 70444999b9
commit 51e82587c7
38 changed files with 453 additions and 434 deletions
@@ -95,9 +95,9 @@ public class FeatureFactory
return new BlockDefinitionBuilder( this, id, block ).features( this.defaultFeatures );
}
public IItemBuilder item( String id, Supplier<Item> item )
public IItemBuilder item( String id, Function<Item.Properties, Item> itemFactory )
{
return new ItemDefinitionBuilder( this, id, item ).features( this.defaultFeatures );
return new ItemDefinitionBuilder( this, id, itemFactory ).features( this.defaultFeatures );
}
public <T extends AEBaseTile> TileEntityBuilder<T> tileEntity(String id, Class<T> teClass, Function<TileEntityType<T>, T> factory)
@@ -19,6 +19,7 @@
package appeng.bootstrap;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Supplier;
@@ -44,7 +45,9 @@ public interface IItemBuilder
IItemBuilder itemGroup( ItemGroup tab );
//FIXME IItemBuilder rendering( ItemRenderingCustomizer callback );
IItemBuilder props(Consumer<Item.Properties> customizer);
IItemBuilder rendering( ItemRenderingCustomizer callback );
/**
* Registers a custom dispenser behavior for this item.
@@ -23,6 +23,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.EnumSet;
import java.util.List;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Supplier;
@@ -38,6 +39,8 @@ import appeng.core.CreativeTab;
import appeng.api.features.AEFeature;
import appeng.core.features.ItemDefinition;
import appeng.util.Platform;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
class ItemDefinitionBuilder implements IItemBuilder
@@ -47,28 +50,29 @@ class ItemDefinitionBuilder implements IItemBuilder
private final String registryName;
private final Supplier<Item> itemSupplier;
private final Function<Item.Properties, Item> itemFactory;
private final EnumSet<AEFeature> features = EnumSet.noneOf( AEFeature.class );
private final List<Function<Item, IBootstrapComponent>> boostrapComponents = new ArrayList<>();
private final Item.Properties props = new Item.Properties();
private Supplier<IDispenseItemBehavior> dispenserBehaviorSupplier;
// FIXME
// @OnlyIn( Dist.CLIENT )
// private ItemRendering itemRendering;
//
@OnlyIn( Dist.CLIENT )
private ItemRendering itemRendering;
private ItemGroup itemGroup = CreativeTab.instance;
ItemDefinitionBuilder( FeatureFactory factory, String registryName, Supplier<Item> itemSupplier )
ItemDefinitionBuilder( FeatureFactory factory, String registryName, Function<Item.Properties, Item> itemFactory )
{
this.factory = factory;
this.registryName = registryName;
this.itemSupplier = itemSupplier;
this.itemFactory = itemFactory;
if( Platform.hasClientClasses() )
{
// FIXME this.itemRendering = new ItemRendering();
this.itemRendering = new ItemRendering();
}
}
@@ -101,16 +105,23 @@ class ItemDefinitionBuilder implements IItemBuilder
return this;
}
// FIXME @Override
// FIXME public IItemBuilder rendering( ItemRenderingCustomizer callback )
// FIXME {
// FIXME if( Platform.hasClientClasses() )
// FIXME {
// FIXME this.customizeForClient( callback );
// FIXME }
// FIXME
// FIXME return this;
// FIXME }
@Override
public IItemBuilder props( Consumer<Item.Properties> consumer )
{
consumer.accept(props);
return this;
}
@Override
public IItemBuilder rendering( ItemRenderingCustomizer callback )
{
if( Platform.hasClientClasses() )
{
this.customizeForClient( callback );
}
return this;
}
@Override
public IItemBuilder dispenserBehavior( Supplier<IDispenseItemBehavior> behavior )
@@ -119,16 +130,18 @@ class ItemDefinitionBuilder implements IItemBuilder
return this;
}
// FIXME @OnlyIn( Dist.CLIENT )
// FIXME private void customizeForClient( ItemRenderingCustomizer callback )
// FIXME {
// FIXME callback.customize( this.itemRendering );
// FIXME }
@OnlyIn( Dist.CLIENT )
private void customizeForClient( ItemRenderingCustomizer callback )
{
callback.customize( this.itemRendering );
}
@Override
public ItemDefinition build()
{
Item item = this.itemSupplier.get();
props.group(itemGroup);
Item item = this.itemFactory.apply(props);
item.setRegistryName( AppEng.MOD_ID, this.registryName );
ItemDefinition definition = new ItemDefinition( this.registryName, item, features );
@@ -150,7 +163,7 @@ class ItemDefinitionBuilder implements IItemBuilder
if( Platform.hasClientClasses() )
{
// FIXME this.itemRendering.apply( this.factory, item );
this.itemRendering.apply( this.factory, item );
}
return definition;
@@ -2,7 +2,6 @@
package appeng.client.render.crafting;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@@ -21,8 +20,8 @@ public class ItemEncodedPatternRendering extends ItemRenderingCustomizer
@OnlyIn( Dist.CLIENT )
public void customize( IItemRendering rendering )
{
rendering.builtInModel( "models/item/builtin/encoded_pattern", new ItemEncodedPatternModel() );
rendering.model( new ModelResourceLocation( MODEL, "inventory" ) ).variants( MODEL );
// FIXME rendering.builtInModel( "models/item/builtin/encoded_pattern", new ItemEncodedPatternModel() );
// FIXME rendering.model( new ModelResourceLocation( MODEL, "inventory" ) ).variants( MODEL );
}
}
+14 -16
View File
@@ -35,6 +35,7 @@ import net.minecraftforge.fml.config.ModConfig;
import org.apache.commons.lang3.tuple.Pair;
import java.util.*;
import java.util.function.DoubleSupplier;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -68,7 +69,7 @@ public final class AEConfig implements IConfigurableObject, IConfigManagerHost
public static final String PACKET_CHANNEL = "AE";
// Config instance
private static AEConfig instance;
private static final AEConfig instance = new AEConfig();
private final IConfigManager settings = new ConfigManager( this );
@@ -138,9 +139,6 @@ public final class AEConfig implements IConfigurableObject, IConfigManagerHost
@SubscribeEvent
public static void onModConfigEvent(final ModConfig.ModConfigEvent configEvent) {
if (configEvent.getConfig().getSpec() == CLIENT_SPEC) {
if (instance == null) {
instance = new AEConfig();
}
instance.syncConfig(CLIENT);
}
}
@@ -529,34 +527,34 @@ public final class AEConfig implements IConfigurableObject, IConfigManagerHost
return this.oreDoublePercentage;
}
public int getWirelessTerminalBattery()
public DoubleSupplier getWirelessTerminalBattery()
{
return this.wirelessTerminalBattery;
return () -> this.wirelessTerminalBattery;
}
public int getEntropyManipulatorBattery()
public DoubleSupplier getEntropyManipulatorBattery()
{
return this.entropyManipulatorBattery;
return () -> this.entropyManipulatorBattery;
}
public int getMatterCannonBattery()
public DoubleSupplier getMatterCannonBattery()
{
return this.matterCannonBattery;
return () -> this.matterCannonBattery;
}
public int getPortableCellBattery()
public DoubleSupplier getPortableCellBattery()
{
return this.portableCellBattery;
return () -> this.portableCellBattery;
}
public int getColorApplicatorBattery()
public DoubleSupplier getColorApplicatorBattery()
{
return this.colorApplicatorBattery;
return () -> this.colorApplicatorBattery;
}
public int getChargedStaffBattery()
public DoubleSupplier getChargedStaffBattery()
{
return this.chargedStaffBattery;
return () -> this.chargedStaffBattery;
}
public float getSpawnChargedChance()
+49 -71
View File
@@ -22,64 +22,67 @@ package appeng.core;
import appeng.api.IAppEngApi;
import appeng.api.features.IRegistryContainer;
import appeng.api.networking.IGridHelper;
import appeng.api.parts.IPartHelper;
import appeng.api.storage.IStorageHelper;
import appeng.api.util.IClientHelper;
import appeng.core.api.ApiClientHelper;
import appeng.core.api.ApiGrid;
import appeng.core.api.ApiPart;
import appeng.core.api.ApiStorage;
import appeng.core.features.registries.PartModels;
import appeng.core.features.registries.RegistryContainer;
public final class Api implements IAppEngApi
{
public static final Api INSTANCE = new Api();
// FIXME private final ApiPart partHelper;
private final ApiPart partHelper;
// private MovableTileRegistry MovableRegistry = new MovableTileRegistry();
// FIXME private final IRegistryContainer registryContainer;
// FIXME private final IStorageHelper storageHelper;
// FIXME private final IGridHelper networkHelper;
private final IRegistryContainer registryContainer;
private final IStorageHelper storageHelper;
private final IGridHelper networkHelper;
private final ApiDefinitions definitions;
// FIXME private final IClientHelper client;
private final IClientHelper client;
private Api()
{
// FIXME this.storageHelper = new ApiStorage();
// FIXME this.networkHelper = new ApiGrid();
// FIXME this.registryContainer = new RegistryContainer();
// FIXME this.partHelper = new ApiPart();
PartModels partModels = new PartModels();
this.definitions = new ApiDefinitions( partModels /* FIXME (PartModels) this.registryContainer.partModels() */ );
// FIXME this.client = new ApiClientHelper();
this.storageHelper = new ApiStorage();
this.networkHelper = new ApiGrid();
this.registryContainer = new RegistryContainer();
this.partHelper = new ApiPart();
this.definitions = new ApiDefinitions( (PartModels) this.registryContainer.partModels() );
this.client = new ApiClientHelper();
}
// FIXME public PartModels getPartModels()
// FIXME {
// FIXME return (PartModels) this.registryContainer.partModels();
// FIXME }
// FIXME
// FIXME @Override
// FIXME public IRegistryContainer registries()
// FIXME {
// FIXME return this.registryContainer;
// FIXME }
// FIXME
// FIXME @Override
// FIXME public IStorageHelper storage()
// FIXME {
// FIXME return this.storageHelper;
// FIXME }
// FIXME
// FIXME @Override
// FIXME public IGridHelper grid()
// FIXME {
// FIXME return this.networkHelper;
// FIXME }
// FIXME
// FIXME @Override
// FIXME public ApiPart partHelper()
// FIXME {
// FIXME return this.partHelper;
// FIXME }
public PartModels getPartModels()
{
return (PartModels) this.registryContainer.partModels();
}
@Override
public IRegistryContainer registries()
{
return this.registryContainer;
}
@Override
public IStorageHelper storage()
{
return this.storageHelper;
}
@Override
public IGridHelper grid()
{
return this.networkHelper;
}
@Override
public ApiPart partHelper()
{
return this.partHelper;
}
@Override
public ApiDefinitions definitions()
@@ -87,35 +90,10 @@ public final class Api implements IAppEngApi
return this.definitions;
}
// FIXME @Override
// FIXME public IClientHelper client()
// FIXME {
// FIXME return this.client;
// FIXME }
@Override
public IClientHelper client()
{
return this.client;
}
// FIXME
@Override
public IRegistryContainer registries() {
return null;
}
// FIXME
@Override
public IStorageHelper storage() {
return null;
}
// FIXME
@Override
public IGridHelper grid() {
return null;
}
// FIXME
@Override
public IPartHelper partHelper() {
return null;
}
// FIXME
@Override
public IClientHelper client() {
return null;
}
}
@@ -26,6 +26,8 @@ import appeng.api.definitions.IParts;
import appeng.bootstrap.FeatureFactory;
import appeng.core.api.definitions.ApiBlocks;
import appeng.core.api.definitions.ApiItems;
import appeng.core.api.definitions.ApiMaterials;
import appeng.core.api.definitions.ApiParts;
import appeng.core.features.registries.PartModels;
@@ -36,8 +38,8 @@ public final class ApiDefinitions implements IDefinitions
{
private final ApiBlocks blocks;
private final ApiItems items;
//private final ApiMaterials materials;
//private final ApiParts parts;
private final ApiMaterials materials;
private final ApiParts parts;
private final FeatureFactory registry = new FeatureFactory();
@@ -45,8 +47,8 @@ public final class ApiDefinitions implements IDefinitions
{
this.blocks = new ApiBlocks( this.registry, partModels );
this.items = new ApiItems( this.registry );
//this.materials = new ApiMaterials( this.registry );
//this.parts = new ApiParts( this.registry, partModels );
this.materials = new ApiMaterials( this.registry );
this.parts = new ApiParts( this.registry, partModels );
}
public FeatureFactory getRegistry()
@@ -69,12 +71,12 @@ public final class ApiDefinitions implements IDefinitions
@Override
public IMaterials materials()
{
return null /* FIXME */;
return materials;
}
@Override
public IParts parts()
{
return null /* FIXME */;
return parts;
}
}
@@ -11,6 +11,7 @@ import appeng.api.storage.data.IAEStack;
import appeng.api.util.IClientHelper;
import appeng.core.localization.GuiText;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
public class ApiClientHelper implements IClientHelper
@@ -27,10 +28,15 @@ public class ApiClientHelper implements IClientHelper
if( cellInventory != null )
{
lines.add( cellInventory.getUsedBytes() + " " + GuiText.Of.getLocal() + ' ' + cellInventory.getTotalBytes() + ' ' + GuiText.BytesUsed.getLocal() );
lines.add(new StringTextComponent(cellInventory.getUsedBytes() + " ")
.appendSibling(GuiText.Of.textComponent())
.appendText(" " + cellInventory.getTotalBytes() + " ")
.appendSibling(GuiText.BytesUsed.textComponent()));
lines.add( cellInventory.getStoredItemTypes() + " " + GuiText.Of.getLocal() + ' ' + cellInventory.getTotalItemTypes() + ' ' + GuiText.Types
.getLocal() );
lines.add(new StringTextComponent(cellInventory.getStoredItemTypes() + " ")
.appendSibling(GuiText.Of.textComponent())
.appendText(" " + cellInventory.getTotalItemTypes() + " ")
.appendSibling(GuiText.Types.textComponent()));
}
if( handler.isPreformatted() )
@@ -39,11 +45,15 @@ public class ApiClientHelper implements IClientHelper
if( handler.isFuzzy() )
{
lines.add( GuiText.Partitioned.getLocal() + " - " + list + ' ' + GuiText.Fuzzy.getLocal() );
lines.add( GuiText.Partitioned.textComponent()
.appendText(" - " + list + " ")
.appendSibling(GuiText.Fuzzy.textComponent()));
}
else
{
lines.add( GuiText.Partitioned.getLocal() + " - " + list + ' ' + GuiText.Precise.getLocal() );
lines.add( GuiText.Partitioned.textComponent()
.appendText(" - " + list + " ")
.appendSibling(GuiText.Precise.textComponent()));
}
}
@@ -24,7 +24,37 @@ import appeng.api.definitions.IItems;
import appeng.api.util.AEColoredItemDefinition;
import appeng.bootstrap.FeatureFactory;
import appeng.api.features.AEFeature;
import appeng.bootstrap.components.IEntityRegistrationComponent;
import appeng.client.render.crafting.ItemEncodedPatternRendering;
import appeng.core.CreativeTabFacade;
import appeng.debug.ToolDebugCard;
import appeng.debug.ToolEraser;
import appeng.debug.ToolMeteoritePlacer;
import appeng.debug.ToolReplicatorCard;
import appeng.entity.EntityGrowingCrystal;
import appeng.fluids.items.BasicFluidStorageCell;
import appeng.fluids.items.FluidDummyItem;
import appeng.fluids.items.FluidDummyItemRendering;
import appeng.hooks.DispenserBlockTool;
import appeng.hooks.DispenserMatterCannon;
import appeng.items.materials.MaterialType;
import appeng.items.misc.*;
import appeng.items.parts.FacadeRendering;
import appeng.items.parts.ItemFacade;
import appeng.items.storage.BasicItemStorageCell;
import appeng.items.storage.ItemCreativeStorageCell;
import appeng.items.storage.ItemSpatialStorageCell;
import appeng.items.storage.ItemViewCell;
import appeng.items.tools.*;
import appeng.items.tools.powered.*;
import appeng.items.tools.quartz.*;
import net.minecraft.entity.EntityClassification;
import net.minecraft.entity.EntityType;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraftforge.common.ToolType;
import java.util.function.Consumer;
/**
@@ -32,209 +62,250 @@ import appeng.items.tools.quartz.*;
*/
public final class ApiItems implements IItems
{
// FIXME: Make final after porting
private IItemDefinition certusQuartzAxe;
private IItemDefinition certusQuartzHoe;
private IItemDefinition certusQuartzShovel;
private IItemDefinition certusQuartzPick;
private IItemDefinition certusQuartzSword;
private IItemDefinition certusQuartzWrench;
private IItemDefinition certusQuartzKnife;
private final IItemDefinition certusQuartzAxe;
private final IItemDefinition certusQuartzHoe;
private final IItemDefinition certusQuartzShovel;
private final IItemDefinition certusQuartzPick;
private final IItemDefinition certusQuartzSword;
private final IItemDefinition certusQuartzWrench;
private final IItemDefinition certusQuartzKnife;
private IItemDefinition netherQuartzAxe;
private IItemDefinition netherQuartzHoe;
private IItemDefinition netherQuartzShovel;
private IItemDefinition netherQuartzPick;
private IItemDefinition netherQuartzSword;
private IItemDefinition netherQuartzWrench;
private IItemDefinition netherQuartzKnife;
private final IItemDefinition netherQuartzAxe;
private final IItemDefinition netherQuartzHoe;
private final IItemDefinition netherQuartzShovel;
private final IItemDefinition netherQuartzPick;
private final IItemDefinition netherQuartzSword;
private final IItemDefinition netherQuartzWrench;
private final IItemDefinition netherQuartzKnife;
private IItemDefinition entropyManipulator;
private IItemDefinition wirelessTerminal;
private IItemDefinition biometricCard;
private IItemDefinition chargedStaff;
private IItemDefinition massCannon;
private IItemDefinition memoryCard;
private IItemDefinition networkTool;
private IItemDefinition portableCell;
private final IItemDefinition entropyManipulator;
private final IItemDefinition wirelessTerminal;
private final IItemDefinition biometricCard;
private final IItemDefinition chargedStaff;
private final IItemDefinition massCannon;
private final IItemDefinition memoryCard;
private final IItemDefinition networkTool;
private final IItemDefinition portableCell;
private IItemDefinition cellCreative;
private IItemDefinition viewCell;
private final IItemDefinition cellCreative;
private final IItemDefinition viewCell;
private IItemDefinition cell1k;
private IItemDefinition cell4k;
private IItemDefinition cell16k;
private IItemDefinition cell64k;
private final IItemDefinition cell1k;
private final IItemDefinition cell4k;
private final IItemDefinition cell16k;
private final IItemDefinition cell64k;
private IItemDefinition fluidCell1k;
private IItemDefinition fluidCell4k;
private IItemDefinition fluidCell16k;
private IItemDefinition fluidCell64k;
private final IItemDefinition fluidCell1k;
private final IItemDefinition fluidCell4k;
private final IItemDefinition fluidCell16k;
private final IItemDefinition fluidCell64k;
private IItemDefinition spatialCell2;
private IItemDefinition spatialCell16;
private IItemDefinition spatialCell128;
private final IItemDefinition spatialCell2;
private final IItemDefinition spatialCell16;
private final IItemDefinition spatialCell128;
private IItemDefinition facade;
private IItemDefinition crystalSeed;
private final IItemDefinition facade;
private final IItemDefinition crystalSeed;
// rv1
private IItemDefinition encodedPattern;
private IItemDefinition colorApplicator;
private final IItemDefinition encodedPattern;
private final IItemDefinition colorApplicator;
private IItemDefinition paintBall;
private AEColoredItemDefinition coloredPaintBall;
private AEColoredItemDefinition coloredLumenPaintBall;
private final IItemDefinition paintBall;
private final AEColoredItemDefinition coloredPaintBall;
private final AEColoredItemDefinition coloredLumenPaintBall;
// unsupported dev tools
private IItemDefinition toolEraser;
private IItemDefinition toolMeteoritePlacer;
private IItemDefinition toolDebugCard;
private IItemDefinition toolReplicatorCard;
private final IItemDefinition toolEraser;
private final IItemDefinition toolMeteoritePlacer;
private final IItemDefinition toolDebugCard;
private final IItemDefinition toolReplicatorCard;
private IItemDefinition dummyFluidItem;
private final IItemDefinition dummyFluidItem;
public ApiItems( FeatureFactory registry )
{
FeatureFactory certusTools = registry.features( AEFeature.CERTUS_QUARTZ_TOOLS );
this.certusQuartzAxe = certusTools.item( "certus_quartz_axe", () -> new ToolQuartzAxe( AEFeature.CERTUS_QUARTZ_TOOLS ) )
this.certusQuartzAxe = certusTools.item( "certus_quartz_axe", props -> new ToolQuartzAxe( props, AEFeature.CERTUS_QUARTZ_TOOLS ) )
.itemGroup(ItemGroup.TOOLS)
.addFeatures( AEFeature.QUARTZ_AXE )
.build();
this.certusQuartzHoe = certusTools.item( "certus_quartz_hoe", () -> new ToolQuartzHoe( AEFeature.CERTUS_QUARTZ_TOOLS ) )
this.certusQuartzHoe = certusTools.item( "certus_quartz_hoe", props -> new ToolQuartzHoe( props, AEFeature.CERTUS_QUARTZ_TOOLS ) )
.itemGroup(ItemGroup.TOOLS)
.addFeatures( AEFeature.QUARTZ_HOE )
.build();
this.certusQuartzShovel = certusTools.item( "certus_quartz_spade", () -> new ToolQuartzSpade( AEFeature.CERTUS_QUARTZ_TOOLS ) )
this.certusQuartzShovel = certusTools.item( "certus_quartz_spade", props -> new ToolQuartzSpade( props, AEFeature.CERTUS_QUARTZ_TOOLS ) )
.itemGroup(ItemGroup.TOOLS)
.addFeatures( AEFeature.QUARTZ_SPADE )
.build();
this.certusQuartzPick = certusTools.item( "certus_quartz_pickaxe", () -> new ToolQuartzPickaxe( AEFeature.CERTUS_QUARTZ_TOOLS ) )
this.certusQuartzPick = certusTools.item( "certus_quartz_pickaxe", props -> new ToolQuartzPickaxe( props, AEFeature.CERTUS_QUARTZ_TOOLS ) )
.itemGroup(ItemGroup.TOOLS)
.addFeatures( AEFeature.QUARTZ_PICKAXE )
.build();
this.certusQuartzSword = certusTools.item( "certus_quartz_sword", () -> new ToolQuartzSword( AEFeature.CERTUS_QUARTZ_TOOLS ) )
this.certusQuartzSword = certusTools.item( "certus_quartz_sword", props -> new ToolQuartzSword( props, AEFeature.CERTUS_QUARTZ_TOOLS ) )
.itemGroup(ItemGroup.COMBAT)
.addFeatures( AEFeature.QUARTZ_SWORD )
.build();
this.certusQuartzWrench = certusTools.item( "certus_quartz_wrench", ToolQuartzWrench::new )
.itemGroup(ItemGroup.TOOLS)
.props(props -> props.maxStackSize( 1 ) )
.addFeatures( AEFeature.QUARTZ_WRENCH )
// FIXME .bootstrap( item -> (IOreDictComponent) side -> OreDictionary.registerOre( "itemQuartzWrench", new ItemStack( item ) ) )
.build();
this.certusQuartzKnife = certusTools.item( "certus_quartz_cutting_knife", () -> new ToolQuartzCuttingKnife( AEFeature.CERTUS_QUARTZ_TOOLS ) )
this.certusQuartzKnife = certusTools.item( "certus_quartz_cutting_knife", props -> new ToolQuartzCuttingKnife( props, AEFeature.CERTUS_QUARTZ_TOOLS ) )
.itemGroup(ItemGroup.TOOLS)
.props(props -> props.maxStackSize(1).maxDamage(50).setNoRepair())
.addFeatures( AEFeature.QUARTZ_KNIFE )
// FIXME .bootstrap( item -> (IOreDictComponent) side -> OreDictionary.registerOre( "itemQuartzKnife", new ItemStack( item ) ) )
.build();
FeatureFactory netherTools = registry.features( AEFeature.NETHER_QUARTZ_TOOLS );
this.netherQuartzAxe = netherTools.item( "nether_quartz_axe", () -> new ToolQuartzAxe( AEFeature.NETHER_QUARTZ_TOOLS ) )
this.netherQuartzAxe = netherTools.item( "nether_quartz_axe", props -> new ToolQuartzAxe( props, AEFeature.NETHER_QUARTZ_TOOLS ) )
.itemGroup(ItemGroup.TOOLS)
.addFeatures( AEFeature.QUARTZ_AXE )
.build();
this.netherQuartzHoe = netherTools.item( "nether_quartz_hoe", () -> new ToolQuartzHoe( AEFeature.NETHER_QUARTZ_TOOLS ) )
this.netherQuartzHoe = netherTools.item( "nether_quartz_hoe", props -> new ToolQuartzHoe( props, AEFeature.NETHER_QUARTZ_TOOLS ) )
.itemGroup(ItemGroup.TOOLS)
.addFeatures( AEFeature.QUARTZ_HOE )
.build();
this.netherQuartzShovel = netherTools.item( "nether_quartz_spade", () -> new ToolQuartzSpade( AEFeature.NETHER_QUARTZ_TOOLS ) )
this.netherQuartzShovel = netherTools.item( "nether_quartz_spade", props -> new ToolQuartzSpade( props, AEFeature.NETHER_QUARTZ_TOOLS ) )
.itemGroup(ItemGroup.TOOLS)
.addFeatures( AEFeature.QUARTZ_SPADE )
.build();
this.netherQuartzPick = netherTools.item( "nether_quartz_pickaxe", () -> new ToolQuartzPickaxe( AEFeature.NETHER_QUARTZ_TOOLS ) )
this.netherQuartzPick = netherTools.item( "nether_quartz_pickaxe", props -> new ToolQuartzPickaxe( props, AEFeature.NETHER_QUARTZ_TOOLS ) )
.itemGroup(ItemGroup.TOOLS)
.addFeatures( AEFeature.QUARTZ_PICKAXE )
.build();
this.netherQuartzSword = netherTools.item( "nether_quartz_sword", () -> new ToolQuartzSword( AEFeature.NETHER_QUARTZ_TOOLS ) )
this.netherQuartzSword = netherTools.item( "nether_quartz_sword", props -> new ToolQuartzSword( props, AEFeature.NETHER_QUARTZ_TOOLS ) )
.itemGroup(ItemGroup.COMBAT)
.addFeatures( AEFeature.QUARTZ_SWORD )
.build();
this.netherQuartzWrench = netherTools.item( "nether_quartz_wrench", ToolQuartzWrench::new )
.itemGroup(ItemGroup.TOOLS)
.props(props -> props.maxStackSize( 1 ) )
.addFeatures( AEFeature.QUARTZ_WRENCH )
// FIXME .bootstrap( item -> (IOreDictComponent) side -> OreDictionary.registerOre( "itemQuartzWrench", new ItemStack( item ) ) )
.build();
this.netherQuartzKnife = netherTools.item( "nether_quartz_cutting_knife", () -> new ToolQuartzCuttingKnife( AEFeature.NETHER_QUARTZ_TOOLS ) )
this.netherQuartzKnife = netherTools.item( "nether_quartz_cutting_knife", props -> new ToolQuartzCuttingKnife( props, AEFeature.NETHER_QUARTZ_TOOLS ) )
.itemGroup(ItemGroup.TOOLS)
.props(props -> props.maxStackSize(1).maxDamage(50).setNoRepair())
.addFeatures( AEFeature.QUARTZ_KNIFE )
// FIXME .bootstrap( item -> (IOreDictComponent) side -> OreDictionary.registerOre( "itemQuartzKnife", new ItemStack( item ) ) )
.build();
// FeatureFactory powerTools = registry.features( AEFeature.POWERED_TOOLS );
// this.entropyManipulator = powerTools.item( "entropy_manipulator", ToolEntropyManipulator::new )
// .addFeatures( AEFeature.ENTROPY_MANIPULATOR )
// .dispenserBehavior( DispenserBlockTool::new )
// .build();
// this.wirelessTerminal = powerTools.item( "wireless_terminal", ToolWirelessTerminal::new ).addFeatures( AEFeature.WIRELESS_ACCESS_TERMINAL ).build();
// this.chargedStaff = powerTools.item( "charged_staff", ToolChargedStaff::new ).addFeatures( AEFeature.CHARGED_STAFF ).build();
// this.massCannon = powerTools.item( "matter_cannon", ToolMatterCannon::new )
// .addFeatures( AEFeature.MATTER_CANNON )
// .dispenserBehavior( DispenserMatterCannon::new )
// .build();
// this.portableCell = powerTools.item( "portable_cell", ToolPortableCell::new ).addFeatures( AEFeature.PORTABLE_CELL, AEFeature.STORAGE_CELLS ).build();
// this.colorApplicator = powerTools.item( "color_applicator", ToolColorApplicator::new )
// .addFeatures( AEFeature.COLOR_APPLICATOR )
// .dispenserBehavior( DispenserBlockTool::new )
// .rendering( new ToolColorApplicatorRendering() )
// .build();
//
// this.biometricCard = registry.item( "biometric_card", ToolBiometricCard::new )
// .rendering( new ToolBiometricCardRendering() )
// .features( AEFeature.SECURITY )
// .build();
// this.memoryCard = registry.item( "memory_card", ToolMemoryCard::new )
// .rendering( new ToolMemoryCardRendering() )
// .features( AEFeature.MEMORY_CARD )
// .build();
// this.networkTool = registry.item( "network_tool", ToolNetworkTool::new ).features( AEFeature.NETWORK_TOOL ).build();
//
// this.cellCreative = registry.item( "creative_storage_cell", ItemCreativeStorageCell::new )
// .features( AEFeature.STORAGE_CELLS, AEFeature.CREATIVE )
// .build();
// this.viewCell = registry.item( "view_cell", ItemViewCell::new ).features( AEFeature.VIEW_CELL ).build();
//
// FeatureFactory storageCells = registry.features( AEFeature.STORAGE_CELLS );
// this.cell1k = storageCells.item( "storage_cell_1k", () -> new BasicItemStorageCell( MaterialType.CELL1K_PART, 1 ) ).build();
// this.cell4k = storageCells.item( "storage_cell_4k", () -> new BasicItemStorageCell( MaterialType.CELL4K_PART, 4 ) ).build();
// this.cell16k = storageCells.item( "storage_cell_16k", () -> new BasicItemStorageCell( MaterialType.CELL16K_PART, 16 ) ).build();
// this.cell64k = storageCells.item( "storage_cell_64k", () -> new BasicItemStorageCell( MaterialType.CELL64K_PART, 64 ) ).build();
//
// this.fluidCell1k = storageCells.item( "fluid_storage_cell_1k", () -> new BasicFluidStorageCell( MaterialType.FLUID_CELL1K_PART, 1 ) ).build();
// this.fluidCell4k = storageCells.item( "fluid_storage_cell_4k", () -> new BasicFluidStorageCell( MaterialType.FLUID_CELL4K_PART, 4 ) ).build();
// this.fluidCell16k = storageCells.item( "fluid_storage_cell_16k", () -> new BasicFluidStorageCell( MaterialType.FLUID_CELL16K_PART, 16 ) ).build();
// this.fluidCell64k = storageCells.item( "fluid_storage_cell_64k", () -> new BasicFluidStorageCell( MaterialType.FLUID_CELL64K_PART, 64 ) ).build();
//
// FeatureFactory spatialCells = registry.features( AEFeature.SPATIAL_IO );
// this.spatialCell2 = spatialCells.item( "spatial_storage_cell_2_cubed", () -> new ItemSpatialStorageCell( 2 ) ).build();
// this.spatialCell16 = spatialCells.item( "spatial_storage_cell_16_cubed", () -> new ItemSpatialStorageCell( 16 ) ).build();
// this.spatialCell128 = spatialCells.item( "spatial_storage_cell_128_cubed", () -> new ItemSpatialStorageCell( 128 ) ).build();
//
// this.facade = registry.item( "facade", ItemFacade::new )
// .features( AEFeature.FACADES )
// .creativeTab( CreativeTabFacade.instance )
// .rendering( new FacadeRendering() )
// .build();
// this.crystalSeed = registry.item( "crystal_seed", ItemCrystalSeed::new )
// .features( AEFeature.CRYSTAL_SEEDS )
// .rendering( new ItemCrystalSeedRendering() )
// .bootstrap( item -> (IEntityRegistrationComponent) r ->
// {
// r.register( EntityEntryBuilder.create()
// .entity( EntityGrowingCrystal.class )
// .id( new ResourceLocation( "appliedenergistics2", EntityGrowingCrystal.class.getName() ),
// EntityIds.get( EntityGrowingCrystal.class ) )
// .name( EntityGrowingCrystal.class.getSimpleName() )
// .tracker( 16, 4, true )
// .build() );
// } )
// .build();
//
// // rv1
// this.encodedPattern = registry.item( "encoded_pattern", ItemEncodedPattern::new )
// .features( AEFeature.PATTERNS )
// .rendering( new ItemEncodedPatternRendering() )
// .build();
//
// this.paintBall = registry.item( "paint_ball", ItemPaintBall::new )
// .features( AEFeature.PAINT_BALLS )
// .rendering( new ItemPaintBallRendering() )
// .build();
// this.coloredPaintBall = registry.colored( this.paintBall, 0 );
// this.coloredLumenPaintBall = registry.colored( this.paintBall, 20 );
//
// FeatureFactory debugTools = registry.features( AEFeature.UNSUPPORTED_DEVELOPER_TOOLS, AEFeature.CREATIVE );
// this.toolEraser = debugTools.item( "debug_eraser", ToolEraser::new ).build();
// this.toolMeteoritePlacer = debugTools.item( "debug_meteorite_placer", ToolMeteoritePlacer::new ).build();
// this.toolDebugCard = debugTools.item( "debug_card", ToolDebugCard::new ).build();
// this.toolReplicatorCard = debugTools.item( "debug_replicator_card", ToolReplicatorCard::new ).build();
//
// this.dummyFluidItem = registry.item( "dummy_fluid_item", FluidDummyItem::new ).rendering( new FluidDummyItemRendering() ).build();
Consumer<Item.Properties> chargedDefaults = props -> props.maxStackSize( 1 ).maxDamage( 32 ).setNoRepair();
FeatureFactory powerTools = registry.features( AEFeature.POWERED_TOOLS );
this.entropyManipulator = powerTools.item( "entropy_manipulator", ToolEntropyManipulator::new )
.props(chargedDefaults)
.addFeatures( AEFeature.ENTROPY_MANIPULATOR )
.dispenserBehavior( DispenserBlockTool::new )
.build();
this.wirelessTerminal = powerTools.item( "wireless_terminal", ToolWirelessTerminal::new )
.props(chargedDefaults)
.addFeatures( AEFeature.WIRELESS_ACCESS_TERMINAL )
.build();
this.chargedStaff = powerTools.item( "charged_staff", ToolChargedStaff::new )
.props(chargedDefaults)
.addFeatures( AEFeature.CHARGED_STAFF )
.build();
this.massCannon = powerTools.item( "matter_cannon", ToolMatterCannon::new )
.props(chargedDefaults)
.addFeatures( AEFeature.MATTER_CANNON )
.dispenserBehavior( DispenserMatterCannon::new )
.build();
this.portableCell = powerTools.item( "portable_cell", ToolPortableCell::new )
.props(chargedDefaults)
.addFeatures( AEFeature.PORTABLE_CELL, AEFeature.STORAGE_CELLS )
.build();
this.colorApplicator = powerTools.item( "color_applicator", ToolColorApplicator::new )
.props(chargedDefaults)
.addFeatures( AEFeature.COLOR_APPLICATOR )
.dispenserBehavior( DispenserBlockTool::new )
.rendering( new ToolColorApplicatorRendering() )
.build();
this.biometricCard = registry.item( "biometric_card", ToolBiometricCard::new )
.props(props -> props.maxStackSize( 1 ))
.rendering( new ToolBiometricCardRendering() )
.features( AEFeature.SECURITY )
.build();
this.memoryCard = registry.item( "memory_card", ToolMemoryCard::new )
.props(props -> props.maxStackSize( 1 ))
.rendering( new ToolMemoryCardRendering() )
.features( AEFeature.MEMORY_CARD )
.build();
this.networkTool = registry.item( "network_tool", ToolNetworkTool::new )
.props(props -> props.maxStackSize( 1 ).addToolType( ToolType.get("wrench"), 0 ) )
.features( AEFeature.NETWORK_TOOL )
.build();
this.cellCreative = registry.item( "creative_storage_cell", ItemCreativeStorageCell::new )
.props(props -> props.maxStackSize(1))
.features( AEFeature.STORAGE_CELLS, AEFeature.CREATIVE )
.build();
this.viewCell = registry.item( "view_cell", ItemViewCell::new )
.props(props -> props.maxStackSize(1))
.features( AEFeature.VIEW_CELL )
.build();
FeatureFactory storageCells = registry.features( AEFeature.STORAGE_CELLS );
this.cell1k = storageCells.item( "storage_cell_1k", props -> new BasicItemStorageCell(props, MaterialType.CELL1K_PART, 1 ) ).build();
this.cell4k = storageCells.item( "storage_cell_4k", props -> new BasicItemStorageCell(props, MaterialType.CELL4K_PART, 4 ) ).build();
this.cell16k = storageCells.item( "storage_cell_16k", props -> new BasicItemStorageCell(props, MaterialType.CELL16K_PART, 16 ) ).build();
this.cell64k = storageCells.item( "storage_cell_64k", props -> new BasicItemStorageCell(props, MaterialType.CELL64K_PART, 64 ) ).build();
this.fluidCell1k = storageCells.item( "fluid_storage_cell_1k", props -> new BasicFluidStorageCell(props, MaterialType.FLUID_CELL1K_PART, 1 ) ).build();
this.fluidCell4k = storageCells.item( "fluid_storage_cell_4k", props -> new BasicFluidStorageCell(props, MaterialType.FLUID_CELL4K_PART, 4 ) ).build();
this.fluidCell16k = storageCells.item( "fluid_storage_cell_16k", props -> new BasicFluidStorageCell(props, MaterialType.FLUID_CELL16K_PART, 16 ) ).build();
this.fluidCell64k = storageCells.item( "fluid_storage_cell_64k", props -> new BasicFluidStorageCell(props, MaterialType.FLUID_CELL64K_PART, 64 ) ).build();
FeatureFactory spatialCells = registry.features( AEFeature.SPATIAL_IO );
this.spatialCell2 = spatialCells.item( "spatial_storage_cell_2_cubed", props -> new ItemSpatialStorageCell(props, 2 ) ).build();
this.spatialCell16 = spatialCells.item( "spatial_storage_cell_16_cubed", props -> new ItemSpatialStorageCell(props, 16 ) ).build();
this.spatialCell128 = spatialCells.item( "spatial_storage_cell_128_cubed", props -> new ItemSpatialStorageCell(props, 128 ) ).build();
this.facade = registry.item( "facade", ItemFacade::new )
.features( AEFeature.FACADES )
.itemGroup( CreativeTabFacade.instance )
.rendering( new FacadeRendering() )
.build();
this.crystalSeed = registry.item( "crystal_seed", ItemCrystalSeed::new )
.features( AEFeature.CRYSTAL_SEEDS )
.rendering( new ItemCrystalSeedRendering() )
.bootstrap( item -> (IEntityRegistrationComponent) r ->
{
r.register( EntityType.Builder.<EntityGrowingCrystal>create(EntityGrowingCrystal::new, EntityClassification.MISC)
.setTrackingRange(16)
.setUpdateInterval(4)
.setShouldReceiveVelocityUpdates(true)
.build("appliedenergistics2:growing_crystal")
.setRegistryName("appliedenergistics2:growing_crystal")
);
} )
.build();
// rv1
this.encodedPattern = registry.item( "encoded_pattern", ItemEncodedPattern::new )
.props(props -> props.maxStackSize(1))
.features( AEFeature.PATTERNS )
.rendering( new ItemEncodedPatternRendering() )
.build();
this.paintBall = registry.item( "paint_ball", ItemPaintBall::new )
.features( AEFeature.PAINT_BALLS )
.rendering( new ItemPaintBallRendering() )
.build();
this.coloredPaintBall = registry.colored( this.paintBall, 0 );
this.coloredLumenPaintBall = registry.colored( this.paintBall, 20 );
FeatureFactory debugTools = registry.features( AEFeature.UNSUPPORTED_DEVELOPER_TOOLS, AEFeature.CREATIVE );
this.toolEraser = debugTools.item( "debug_eraser", ToolEraser::new ).build();
this.toolMeteoritePlacer = debugTools.item( "debug_meteorite_placer", ToolMeteoritePlacer::new ).build();
this.toolDebugCard = debugTools.item( "debug_card", ToolDebugCard::new ).build();
this.toolReplicatorCard = debugTools.item( "debug_replicator_card", ToolReplicatorCard::new ).build();
this.dummyFluidItem = registry.item( "dummy_fluid_item", FluidDummyItem::new ).rendering( new FluidDummyItemRendering() ).build();
}
@Override
@@ -22,8 +22,8 @@ package appeng.core.api.definitions;
import java.util.Arrays;
import java.util.stream.Collectors;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.registry.EntityEntryBuilder;
import net.minecraft.entity.EntityClassification;
import net.minecraft.entity.EntityType;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@@ -35,7 +35,6 @@ import appeng.bootstrap.ItemRenderingCustomizer;
import appeng.bootstrap.components.IEntityRegistrationComponent;
import appeng.core.features.DamagedItemDefinition;
import appeng.entity.EntityChargedQuartz;
import appeng.entity.EntityIds;
import appeng.entity.EntitySingularity;
import appeng.items.materials.ItemMaterial;
import appeng.items.materials.MaterialType;
@@ -124,15 +123,14 @@ public final class ApiMaterials implements IMaterials
public ApiMaterials( FeatureFactory registry )
{
final ItemMaterial materials = new ItemMaterial();
registry.item( "material", () -> materials )
IItemDefinition materialDef = registry.item( "material", ItemMaterial::new )
.rendering( new ItemRenderingCustomizer()
{
@Override
@OnlyIn( Dist.CLIENT )
public void customize( IItemRendering rendering )
{
rendering.meshDefinition( is -> materials.getTypeByStack( is ).getModel() );
// FIXME rendering.meshDefinition( is -> materials.getTypeByStack( is ).getModel() );
// Register a resource location for every material type
rendering.variants( Arrays.stream( MaterialType.values() )
.map( MaterialType::getModel )
@@ -141,21 +139,23 @@ public final class ApiMaterials implements IMaterials
} )
.bootstrap( item -> (IEntityRegistrationComponent) r ->
{
r.register( EntityEntryBuilder.create()
.entity( EntitySingularity.class )
.id( new ResourceLocation( "appliedenergistics2", EntitySingularity.class.getName() ), EntityIds.get( EntitySingularity.class ) )
.name( EntitySingularity.class.getSimpleName() )
.tracker( 16, 4, true )
.build() );
r.register( EntityEntryBuilder.create()
.entity( EntityChargedQuartz.class )
.id( new ResourceLocation( "appliedenergistics2", EntityChargedQuartz.class.getName() ),
EntityIds.get( EntityChargedQuartz.class ) )
.name( EntityChargedQuartz.class.getSimpleName() )
.tracker( 16, 4, true )
.build() );
r.register( EntityType.Builder.<EntitySingularity>create(EntitySingularity::new, EntityClassification.MISC)
.setTrackingRange(16)
.setUpdateInterval(4)
.setShouldReceiveVelocityUpdates(true)
.build("appliedenergistics2:singularity")
.setRegistryName("appliedenergistics2:singularity")
);
r.register( EntityType.Builder.<EntityChargedQuartz>create(EntityChargedQuartz::new, EntityClassification.MISC)
.setTrackingRange(16)
.setUpdateInterval(4)
.setShouldReceiveVelocityUpdates(true)
.build("appliedenergistics2:charged_quartz")
.setRegistryName("appliedenergistics2:charged_quartz")
);
} )
.build();
final ItemMaterial materials = (ItemMaterial) materialDef.item();
this.cell2SpatialPart = new DamagedItemDefinition( "material.cell.spatial.2", materials.createMaterial( MaterialType.CELL2_SPATIAL_PART ) );
this.cell16SpatialPart = new DamagedItemDefinition( "material.cell.spatial.16", materials.createMaterial( MaterialType.CELL16_SPATIAL_PART ) );
@@ -88,10 +88,10 @@ public final class ApiParts implements IParts
public ApiParts( FeatureFactory registry, PartModels partModels )
{
final ItemPart itemPart = new ItemPart();
registry.item( "part", () -> itemPart )
.rendering( new ItemPartRendering( partModels, itemPart ) )
IItemDefinition itemPartDef = registry.item( "part", ItemPart::new )
.rendering( new ItemPartRendering( partModels ) )
.build();
final ItemPart itemPart = (ItemPart) itemPartDef.item();
// Register all part models
for( PartType partType : PartType.values() )
@@ -126,9 +126,9 @@ public final class ApiParts implements IParts
this.fluidFormationPlane = new DamagedItemDefinition( "part.plane.fluid_formation", itemPart.createPart( PartType.FLUID_FORMATION_PLANE ) );
this.p2PTunnelME = new DamagedItemDefinition( "part.tunnel.me", itemPart.createPart( PartType.P2P_TUNNEL_ME ) );
this.p2PTunnelRedstone = new DamagedItemDefinition( "part.tunnel.redstone", itemPart.createPart( PartType.P2P_TUNNEL_REDSTONE ) );
this.p2PTunnelItems = new DamagedItemDefinition( "part.tunnel.item", itemPart.createPart( PartType.P2P_TUNNEL_ITEMS ) );
this.p2PTunnelFluids = new DamagedItemDefinition( "part.tunnel.fluid", itemPart.createPart( PartType.P2P_TUNNEL_FLUIDS ) );
this.p2PTunnelEU = new DamagedItemDefinition( "part.tunnel.eu", itemPart.createPart( PartType.P2P_TUNNEL_IC2 ) );
this.p2PTunnelItems = null; // FIXME new DamagedItemDefinition( "part.tunnel.item", itemPart.createPart( PartType.P2P_TUNNEL_ITEMS ) );
this.p2PTunnelFluids = null; // FIXME new DamagedItemDefinition( "part.tunnel.fluid", itemPart.createPart( PartType.P2P_TUNNEL_FLUIDS ) );
this.p2PTunnelEU = null; // FIXME new DamagedItemDefinition( "part.tunnel.eu", itemPart.createPart( PartType.P2P_TUNNEL_IC2 ) );
this.p2PTunnelFE = new DamagedItemDefinition( "part.tunnel.fe", itemPart.createPart( PartType.P2P_TUNNEL_FE ) );
this.p2PTunnelLight = new DamagedItemDefinition( "part.tunnel.light", itemPart.createPart( PartType.P2P_TUNNEL_LIGHT ) );
// this.p2PTunnelOpenComputers = new DamagedItemDefinition( itemMultiPart.createPart(
@@ -32,9 +32,9 @@ import net.minecraft.world.World;
public abstract class AEBaseEntityItem extends ItemEntity
{
public AEBaseEntityItem( final World world )
public AEBaseEntityItem( EntityType<? extends AEBaseEntityItem> entityType, final World world )
{
super( EntityType.ITEM, world );
super( entityType, world );
}
public AEBaseEntityItem( final World world, final double x, final double y, final double z, final ItemStack stack )
@@ -24,6 +24,7 @@ import java.util.List;
import net.minecraft.block.BlockState;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.item.ItemEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
@@ -47,7 +48,11 @@ public final class EntityChargedQuartz extends AEBaseEntityItem
private int delay = 0;
private int transformTime = 0;
public EntityChargedQuartz( final World w, final double x, final double y, final double z, final ItemStack is )
public EntityChargedQuartz(EntityType<? extends EntityChargedQuartz> entityType, World world) {
super(entityType, world);
}
public EntityChargedQuartz(final World w, final double x, final double y, final double z, final ItemStack is )
{
super( w, x, y, z, is );
}
@@ -21,6 +21,7 @@ package appeng.entity;
import net.minecraft.block.BlockState;
import net.minecraft.block.material.Material;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.item.ItemEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@@ -43,7 +44,11 @@ public final class EntityGrowingCrystal extends ItemEntity
private int progress_1000 = 0;
public EntityGrowingCrystal( final World w, final double x, final double y, final double z, final ItemStack is )
public EntityGrowingCrystal(EntityType<? extends EntityGrowingCrystal> type, World world) {
super(type, world);
}
public EntityGrowingCrystal(final World w, final double x, final double y, final double z, final ItemStack is )
{
super( w, x, y, z, is );
this.setNoDespawn();
@@ -1,57 +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.entity;
import net.minecraft.entity.Entity;
public final class EntityIds
{
private static final int TINY_TNT = 10;
private static final int SINGULARITY = 11;
private static final int CHARGED_QUARTZ = 12;
private static final int GROWING_CRYSTAL = 13;
private EntityIds()
{
}
public static int get( final Class<? extends Entity> droppedEntity )
{
if( droppedEntity == EntityTinyTNTPrimed.class )
{
return TINY_TNT;
}
if( droppedEntity == EntitySingularity.class )
{
return SINGULARITY;
}
if( droppedEntity == EntityChargedQuartz.class )
{
return CHARGED_QUARTZ;
}
if( droppedEntity == EntityGrowingCrystal.class )
{
return GROWING_CRYSTAL;
}
throw new IllegalStateException( "Missing entity id: " + droppedEntity.getName() );
}
}
@@ -23,6 +23,7 @@ import java.util.Date;
import java.util.List;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.item.ItemEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
@@ -43,10 +44,9 @@ public final class EntitySingularity extends AEBaseEntityItem
private static int randTickSeed = 0;
@Reflected
public EntitySingularity( final World w )
public EntitySingularity(EntityType<? extends EntitySingularity> entityType, final World w )
{
super( w );
super( entityType, w );
}
public EntitySingularity( final World w, final double x, final double y, final double z, final ItemStack is )
@@ -56,9 +56,8 @@ public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternIt
// rather simple client side caching.
private static final Map<ItemStack, ItemStack> SIMPLE_CACHE = new WeakHashMap<>();
public ItemEncodedPattern()
{
super(new Item.Properties().maxStackSize(1));
public ItemEncodedPattern(Properties properties) {
super(properties);
}
@Override
@@ -45,12 +45,9 @@ public class ItemPartRendering extends ItemRenderingCustomizer
private final PartModels partModels;
private final ItemPart item;
public ItemPartRendering( PartModels partModels, ItemPart item )
public ItemPartRendering( PartModels partModels )
{
this.partModels = partModels;
this.item = item;
}
@Override
@@ -137,10 +134,10 @@ public class ItemPartRendering extends ItemRenderingCustomizer
this.partModels.registerModels( partResourceLocs );
}
private ModelResourceLocation getItemMeshDefinition( ItemStack is )
{
PartType partType = this.item.getTypeByStack( is );
int variant = this.item.variantOf( is.getDamage() );
return partType.getItemModels().get( variant );
}
// FIXME private ModelResourceLocation getItemMeshDefinition( ItemStack is )
// FIXME {
// FIXME PartType partType = this.item.getTypeByStack( is );
// FIXME int variant = this.item.variantOf( is.getDamage() );
// FIXME return partType.getItemModels().get( variant );
// FIXME }
}
@@ -46,7 +46,6 @@ public class ItemCreativeStorageCell extends AEBaseItem implements ICellWorkbenc
public ItemCreativeStorageCell(Properties props)
{
super(props);
// FIXME this.setMaxStackSize( 1 );
}
@Override
@@ -44,12 +44,11 @@ import appeng.util.prioritylist.PrecisePriorityList;
public class ItemViewCell extends AEBaseItem implements ICellWorkbenchItem
{
public ItemViewCell()
{
super(new Item.Properties().maxStackSize(1));
public ItemViewCell(Properties properties) {
super(properties);
}
public static IPartitionList<IAEItemStack> createFilter( final ItemStack[] list )
public static IPartitionList<IAEItemStack> createFilter(final ItemStack[] list )
{
IPartitionList<IAEItemStack> myPartitionList = null;
@@ -49,9 +49,8 @@ import appeng.util.Platform;
public class ToolBiometricCard extends AEBaseItem implements IBiometricCard
{
public ToolBiometricCard()
{
super( new Properties().maxStackSize( 1 ) );
public ToolBiometricCard(Properties properties) {
super(properties);
}
@Override
@@ -62,9 +62,8 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard
AEColor.TRANSPARENT,
};
public ToolMemoryCard()
{
super( new Properties().maxStackSize( 1 ) );
public ToolMemoryCard(Properties properties) {
super(properties);
}
@Override
@@ -58,9 +58,8 @@ import appeng.util.Platform;
public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench
{
public ToolNetworkTool()
{
super(new Item.Properties().maxStackSize( 1 ).addToolType( ToolType.get("wrench"), 0 ));
public ToolNetworkTool(Properties properties) {
super(properties);
}
@Override
@@ -20,6 +20,7 @@ package appeng.items.tools.powered;
import net.minecraft.entity.LivingEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.DamageSource;
import net.minecraft.util.math.AxisAlignedBB;
@@ -35,9 +36,9 @@ import appeng.util.Platform;
public class ToolChargedStaff extends AEBasePoweredItem
{
public ToolChargedStaff()
public ToolChargedStaff(Item.Properties props)
{
super( AEConfig.instance().getChargedStaffBattery() );
super( AEConfig.instance().getChargedStaffBattery(), props );
}
@Override
@@ -51,6 +51,7 @@ import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.SnowballItem;
import net.minecraft.nbt.CompoundNBT;
@@ -87,9 +88,9 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
}
}
public ToolColorApplicator()
public ToolColorApplicator(Item.Properties props)
{
super( AEConfig.instance().getColorApplicatorBattery() );
super( AEConfig.instance().getColorApplicatorBattery(), props );
}
@Override
@@ -31,6 +31,7 @@ import net.minecraft.block.TNTBlock;
import net.minecraft.block.material.Material;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.util.ActionResult;
@@ -60,9 +61,9 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
private final Map<InWorldToolOperationIngredient, InWorldToolOperationResult> heatUp;
private final Map<InWorldToolOperationIngredient, InWorldToolOperationResult> coolDown;
public ToolEntropyManipulator()
public ToolEntropyManipulator(Item.Properties props)
{
super( AEConfig.instance().getEntropyManipulatorBattery() );
super( AEConfig.instance().getEntropyManipulatorBattery(), props );
this.heatUp = new HashMap<>();
this.coolDown = new HashMap<>();
@@ -29,6 +29,7 @@ import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.item.ItemEntity;
import net.minecraft.entity.passive.SheepEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.*;
@@ -73,9 +74,9 @@ import appeng.util.Platform;
public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell<IAEItemStack>
{
public ToolMatterCannon()
public ToolMatterCannon(Item.Properties props)
{
super( AEConfig.instance().getMatterCannonBattery() );
super( AEConfig.instance().getMatterCannonBattery(), props );
}
@OnlyIn( Dist.CLIENT )
@@ -24,6 +24,7 @@ import java.util.Set;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ActionResult;
import net.minecraft.util.ActionResultType;
@@ -60,9 +61,9 @@ import appeng.util.Platform;
public class ToolPortableCell extends AEBasePoweredItem implements IStorageCell<IAEItemStack>, IGuiItem, IItemGroup
{
public ToolPortableCell()
public ToolPortableCell(Item.Properties props)
{
super( AEConfig.instance().getPortableCellBattery() );
super( AEConfig.instance().getPortableCellBattery(), props );
}
@Override
@@ -24,6 +24,7 @@ import java.util.List;
import net.minecraft.client.resources.I18n;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.ActionResult;
@@ -52,9 +53,9 @@ import appeng.util.ConfigManager;
public class ToolWirelessTerminal extends AEBasePoweredItem implements IWirelessTermHandler
{
public ToolWirelessTerminal()
public ToolWirelessTerminal(Item.Properties props)
{
super( AEConfig.instance().getWirelessTerminalBattery() );
super( AEConfig.instance().getWirelessTerminalBattery(), props );
}
@Override
@@ -21,6 +21,7 @@ package appeng.items.tools.powered.powersink;
import java.text.MessageFormat;
import java.util.List;
import java.util.function.DoubleSupplier;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.item.ItemGroup;
@@ -47,14 +48,12 @@ public abstract class AEBasePoweredItem extends AEBaseItem implements IAEItemPow
{
private static final String CURRENT_POWER_NBT_KEY = "internalCurrentPower";
private static final String MAX_POWER_NBT_KEY = "internalMaxPower";
private final double powerCapacity;
private final DoubleSupplier powerCapacity;
public AEBasePoweredItem( final double powerCapacity )
public AEBasePoweredItem(final DoubleSupplier powerCapacity, Properties props )
{
super(new Properties().maxStackSize( 1 ).maxDamage( 32 ).setNoRepair());
//FIXME
// this.hasSubtypes = false;
// this.setFull3D();
super(props);
// FIXME this.setFull3D();
this.powerCapacity = powerCapacity;
}
@@ -153,7 +152,7 @@ public abstract class AEBasePoweredItem extends AEBaseItem implements IAEItemPow
@Override
public double getAEMaxPower( final ItemStack is )
{
return this.powerCapacity;
return this.powerCapacity.getAsDouble();
}
@Override
@@ -33,9 +33,9 @@ public class ToolQuartzAxe extends AxeItem
{
private final AEFeature type;
public ToolQuartzAxe( final AEFeature type )
public ToolQuartzAxe( Item.Properties props, final AEFeature type )
{
super( ItemTier.IRON, 6.0F, -3.1F, ( new Item.Properties() ).group( ItemGroup.TOOLS ) );
super( ItemTier.IRON, 6.0F, -3.1F, props );
this.type = type;
}
@@ -42,13 +42,9 @@ public class ToolQuartzCuttingKnife extends AEBaseItem implements IGuiItem
{
private final AEFeature type;
public ToolQuartzCuttingKnife( final AEFeature type )
public ToolQuartzCuttingKnife( Item.Properties props, final AEFeature type )
{
super(new Item.Properties()
.group(ItemGroup.TOOLS)
.maxStackSize(1)
.maxDamage(50)
.setNoRepair());
super(props);
this.type = type;
}
@@ -33,9 +33,9 @@ public class ToolQuartzHoe extends HoeItem
{
private final AEFeature type;
public ToolQuartzHoe( final AEFeature type )
public ToolQuartzHoe( Item.Properties props, final AEFeature type )
{
super( ItemTier.IRON, -1.0F, ( new Item.Properties() ).group( ItemGroup.TOOLS ) );
super( ItemTier.IRON, -1.0F, props);
this.type = type;
}
@@ -33,9 +33,9 @@ public class ToolQuartzPickaxe extends PickaxeItem
{
private final AEFeature type;
public ToolQuartzPickaxe( final AEFeature type )
public ToolQuartzPickaxe( Item.Properties props, final AEFeature type )
{
super( ItemTier.IRON, 1, -2.8F, ( new Item.Properties() ).group( ItemGroup.TOOLS ) );
super( ItemTier.IRON, 1, -2.8F, props );
this.type = type;
}
@@ -33,9 +33,9 @@ public class ToolQuartzSpade extends ShovelItem
{
private final AEFeature type;
public ToolQuartzSpade( final AEFeature type )
public ToolQuartzSpade( Item.Properties props, final AEFeature type )
{
super( ItemTier.IRON, 1.5F, -3.0F, ( new Item.Properties() ).group( ItemGroup.TOOLS ) );
super( ItemTier.IRON, 1.5F, -3.0F, props );
this.type = type;
}
@@ -33,9 +33,9 @@ public class ToolQuartzSword extends SwordItem
{
private final AEFeature type;
public ToolQuartzSword( AEFeature type )
public ToolQuartzSword( Item.Properties props, AEFeature type )
{
super( ItemTier.IRON, 3, -2.4F, ( new Item.Properties() ).group( ItemGroup.COMBAT ) );
super( ItemTier.IRON, 3, -2.4F, props );
this.type = type;
}
@@ -22,6 +22,7 @@ package appeng.items.tools.quartz;
import appeng.core.CreativeTab;
import net.minecraft.block.Block;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUseContext;
@@ -38,11 +39,9 @@ import appeng.util.Platform;
public class ToolQuartzWrench extends AEBaseItem implements IAEWrench
{
public ToolQuartzWrench()
public ToolQuartzWrench(Item.Properties props)
{
super( new Properties()
.group(ItemGroup.TOOLS)
.maxStackSize( 1 ) );
super( props );
}
@Override