Start of part registration.
This commit is contained in:
@@ -34,12 +34,6 @@ import appeng.core.features.registries.PartModels;
|
||||
*/
|
||||
public class CableBusRendering extends BlockRenderingCustomizer
|
||||
{
|
||||
private final PartModels partModels;
|
||||
|
||||
public CableBusRendering( PartModels partModels )
|
||||
{
|
||||
this.partModels = partModels;
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
@@ -55,7 +49,6 @@ public class CableBusRendering extends BlockRenderingCustomizer
|
||||
*/
|
||||
rendering.renderType(rt -> true);
|
||||
|
||||
rendering.builtInModel( "models/block/builtin/cable_bus", new CableBusModel( this.partModels ) );
|
||||
rendering.blockColor( new CableBusColor() );
|
||||
rendering.modelCustomizer( ( loc, model ) -> model );
|
||||
}
|
||||
|
||||
@@ -65,9 +65,6 @@ public class CableBusBakedModel implements IBakedModel
|
||||
|
||||
private final TextureAtlasSprite particleTexture;
|
||||
|
||||
private final AtlasTexture textureMap = Minecraft.getInstance().getModelManager().getAtlasTexture( AtlasTexture.LOCATION_BLOCKS_TEXTURE );
|
||||
private final TextureAtlasSprite missingTexture = textureMap.getSprite( MissingTextureSprite.getLocation() );
|
||||
|
||||
CableBusBakedModel( CableBuilder cableBuilder, FacadeBuilder facadeBuilder, Map<ResourceLocation, IBakedModel> partModels, TextureAtlasSprite particleTexture )
|
||||
{
|
||||
this.cableBuilder = cableBuilder;
|
||||
@@ -317,7 +314,7 @@ public class CableBusBakedModel implements IBakedModel
|
||||
|
||||
// If a part sub-model has no particle texture (indicated by it being the missing texture),
|
||||
// don't add it, so we don't get ugly missing texture break particles.
|
||||
if( this.missingTexture != particleTexture )
|
||||
if( isMissingTexture(particleTexture) )
|
||||
{
|
||||
result.add( particleTexture );
|
||||
}
|
||||
@@ -327,6 +324,10 @@ public class CableBusBakedModel implements IBakedModel
|
||||
return result;
|
||||
}
|
||||
|
||||
private boolean isMissingTexture(TextureAtlasSprite particleTexture) {
|
||||
return particleTexture instanceof MissingTextureSprite;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAmbientOcclusion()
|
||||
{
|
||||
|
||||
@@ -24,27 +24,24 @@ import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
|
||||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.model.IModelTransform;
|
||||
import net.minecraft.client.renderer.model.IUnbakedModel;
|
||||
import net.minecraft.client.renderer.model.Material;
|
||||
import net.minecraft.client.renderer.model.ModelBakery;
|
||||
import net.minecraft.client.renderer.model.*;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.core.features.registries.PartModels;
|
||||
import net.minecraftforge.client.model.IModelConfiguration;
|
||||
import net.minecraftforge.client.model.geometry.IModelGeometry;
|
||||
|
||||
|
||||
/**
|
||||
* The built-in model for the cable bus block.
|
||||
*/
|
||||
public class CableBusModel implements IUnbakedModel
|
||||
public class CableBusModel implements IModelGeometry<CableBusModel>
|
||||
{
|
||||
|
||||
private final PartModels partModels;
|
||||
@@ -55,25 +52,10 @@ public class CableBusModel implements IUnbakedModel
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ResourceLocation> getDependencies()
|
||||
{
|
||||
this.partModels.setInitialized( true );
|
||||
return this.partModels.getModels();
|
||||
}
|
||||
public IBakedModel bake(IModelConfiguration owner, ModelBakery bakery, Function<Material, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ItemOverrideList overrides, ResourceLocation modelLocation) {
|
||||
Map<ResourceLocation, IBakedModel> partModels = this.loadPartModels( bakery, spriteGetter, modelTransform );
|
||||
|
||||
@Override
|
||||
public Collection<Material> getTextures( Function<ResourceLocation, IUnbakedModel> modelGetter, Set<Pair<String, String>> missingTextureErrors )
|
||||
{
|
||||
return Collections.unmodifiableList( CableBuilder.getTextures() );
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IBakedModel bakeModel( ModelBakery modelBakeryIn, Function<Material, TextureAtlasSprite> spriteGetterIn, IModelTransform transformIn, ResourceLocation locationIn )
|
||||
{
|
||||
Map<ResourceLocation, IBakedModel> partModels = this.loadPartModels( modelBakeryIn, spriteGetterIn, transformIn );
|
||||
|
||||
CableBuilder cableBuilder = new CableBuilder( spriteGetterIn );
|
||||
CableBuilder cableBuilder = new CableBuilder( spriteGetter );
|
||||
FacadeBuilder facadeBuilder = new FacadeBuilder();
|
||||
|
||||
// This should normally not be used, but we *have* to provide a particle texture or otherwise damage models will
|
||||
@@ -83,13 +65,18 @@ public class CableBusModel implements IUnbakedModel
|
||||
return new CableBusBakedModel( cableBuilder, facadeBuilder, partModels, particleTexture );
|
||||
}
|
||||
|
||||
private Map<ResourceLocation, IBakedModel> loadPartModels( ModelBakery modelBakeryIn, Function<Material, TextureAtlasSprite> spriteGetterIn, IModelTransform transformIn )
|
||||
@Override
|
||||
public Collection<Material> getTextures(IModelConfiguration owner, Function<ResourceLocation, IUnbakedModel> modelGetter, Set<Pair<String, String>> missingTextureErrors) {
|
||||
return Collections.unmodifiableList( CableBuilder.getTextures() );
|
||||
}
|
||||
|
||||
private Map<ResourceLocation, IBakedModel> loadPartModels( ModelBakery bakery, Function<Material, TextureAtlasSprite> spriteGetterIn, IModelTransform transformIn )
|
||||
{
|
||||
ImmutableMap.Builder<ResourceLocation, IBakedModel> result = ImmutableMap.builder();
|
||||
|
||||
for( ResourceLocation location : this.partModels.getModels() )
|
||||
{
|
||||
result.put( location, modelBakeryIn.getBakedModel( location, transformIn, spriteGetterIn ) );
|
||||
result.put( location, bakery.getBakedModel( location, transformIn, spriteGetterIn ) );
|
||||
}
|
||||
|
||||
return result.build();
|
||||
|
||||
@@ -45,7 +45,7 @@ public final class ApiDefinitions implements IDefinitions
|
||||
|
||||
public ApiDefinitions( final PartModels partModels )
|
||||
{
|
||||
this.blocks = new ApiBlocks( this.registry, partModels );
|
||||
this.blocks = new ApiBlocks( this.registry);
|
||||
this.materials = new ApiMaterials( this.registry );
|
||||
this.items = new ApiItems( this.registry, this.materials );
|
||||
this.parts = new ApiParts( this.registry, partModels );
|
||||
|
||||
@@ -33,9 +33,11 @@ import appeng.bootstrap.components.ItemColorComponent;
|
||||
import appeng.client.ClientHelper;
|
||||
import appeng.client.render.DummyFluidItemModel;
|
||||
import appeng.client.render.SimpleModelLoader;
|
||||
import appeng.client.render.cablebus.CableBusModel;
|
||||
import appeng.client.render.crafting.CraftingCubeModelLoader;
|
||||
import appeng.client.render.model.*;
|
||||
import appeng.client.render.spatial.SpatialPylonModel;
|
||||
import appeng.core.features.registries.PartModels;
|
||||
import appeng.core.stats.AdvancementTriggers;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.worlddata.WorldData;
|
||||
@@ -195,6 +197,7 @@ public final class AppEng
|
||||
addBuiltInModel("quantum_bridge_formed", QnbFormedModel::new);
|
||||
ModelLoaderRegistry.registerLoader(new ResourceLocation(AppEng.MOD_ID, "crafting_cube"), CraftingCubeModelLoader.INSTANCE);
|
||||
ModelLoaderRegistry.registerLoader(new ResourceLocation(AppEng.MOD_ID, "uvlightmap"), UVLModelLoader.INSTANCE);
|
||||
addBuiltInModel("cable_bus", () -> new CableBusModel((PartModels) Api.INSTANCE.registries().partModels()));
|
||||
}
|
||||
|
||||
private static <T extends IModelGeometry<T>> void addBuiltInModel(String id, Supplier<T> modelFactory) {
|
||||
|
||||
@@ -71,6 +71,7 @@ import appeng.client.gui.implementations.GuiUpgradeable;
|
||||
import appeng.client.gui.implementations.GuiVibrationChamber;
|
||||
import appeng.client.gui.implementations.GuiWireless;
|
||||
import appeng.client.gui.implementations.GuiWirelessTerm;
|
||||
import appeng.client.render.cablebus.CableBusModel;
|
||||
import appeng.client.render.effects.*;
|
||||
import appeng.client.render.model.BiometricCardModel;
|
||||
import appeng.client.render.model.DriveModel;
|
||||
@@ -81,6 +82,7 @@ import appeng.container.AEBaseContainer;
|
||||
import appeng.container.ContainerOpener;
|
||||
import appeng.container.implementations.*;
|
||||
import appeng.core.features.registries.P2PTunnelRegistry;
|
||||
import appeng.core.features.registries.PartModels;
|
||||
import appeng.core.features.registries.cell.BasicCellHandler;
|
||||
import appeng.core.features.registries.cell.BasicItemCellGuiHandler;
|
||||
import appeng.core.features.registries.cell.CreativeCellHandler;
|
||||
@@ -279,6 +281,9 @@ final class Registration
|
||||
ModelLoader.addSpecialModel(BiometricCardModel.MODEL_BASE);
|
||||
ModelLoader.addSpecialModel(MemoryCardModel.MODEL_BASE);
|
||||
DriveModel.DEPENDENCIES.forEach(ModelLoader::addSpecialModel);
|
||||
|
||||
PartModels partModels = (PartModels) Api.INSTANCE.registries().partModels();
|
||||
partModels.getModels().forEach(ModelLoader::addSpecialModel);
|
||||
}
|
||||
|
||||
public void registerBlocks( RegistryEvent.Register<Block> event )
|
||||
|
||||
@@ -175,7 +175,7 @@ public final class ApiBlocks implements IBlocks
|
||||
private static final Block.Properties SKYSTONE_PROPERTIES = Block.Properties.create( Material.ROCK )
|
||||
.hardnessAndResistance( 50, 150 );
|
||||
|
||||
public ApiBlocks( FeatureFactory registry, PartModels partModels )
|
||||
public ApiBlocks(FeatureFactory registry)
|
||||
{
|
||||
this.quartzOre = registry.block( "quartz_ore", () -> new BlockQuartzOre(QUARTZ_PROPERTIES))
|
||||
.features( AEFeature.CERTUS_ORE )
|
||||
@@ -548,7 +548,7 @@ public final class ApiBlocks implements IBlocks
|
||||
.build();
|
||||
|
||||
this.multiPart = registry.block( "cable_bus", BlockCableBus::new )
|
||||
.rendering( new CableBusRendering( partModels ) )
|
||||
.rendering( new CableBusRendering() )
|
||||
// (handled in BlockCableBus.java and its setupTile())
|
||||
// .tileEntity( TileCableBus.class )
|
||||
// TODO: why the custom registration?
|
||||
|
||||
@@ -21,17 +21,25 @@ package appeng.core.api.definitions;
|
||||
|
||||
import appeng.api.definitions.IItemDefinition;
|
||||
import appeng.api.definitions.IParts;
|
||||
import appeng.api.exceptions.MissingDefinitionException;
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.api.util.AEColoredItemDefinition;
|
||||
import appeng.bootstrap.FeatureFactory;
|
||||
import appeng.core.features.ColoredItemDefinition;
|
||||
import appeng.core.features.DamagedItemDefinition;
|
||||
import appeng.core.features.ItemStackSrc;
|
||||
import appeng.core.CreativeTab;
|
||||
import appeng.core.features.*;
|
||||
import appeng.core.features.registries.PartModels;
|
||||
import appeng.fluids.parts.*;
|
||||
import appeng.items.parts.ColoredPartItem;
|
||||
import appeng.items.parts.ItemPart;
|
||||
import appeng.items.parts.ItemPartRendering;
|
||||
import appeng.items.parts.PartType;
|
||||
import appeng.parts.automation.*;
|
||||
import appeng.parts.misc.*;
|
||||
import appeng.parts.networking.*;
|
||||
import appeng.parts.p2p.*;
|
||||
import appeng.parts.reporting.*;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
|
||||
/**
|
||||
@@ -44,10 +52,6 @@ public final class ApiParts implements IParts
|
||||
private final AEColoredItemDefinition cableGlass;
|
||||
private final AEColoredItemDefinition cableDenseCovered;
|
||||
private final AEColoredItemDefinition cableDenseSmart;
|
||||
// private final AEColoredItemDefinition lumenCableSmart;
|
||||
// private final AEColoredItemDefinition lumenCableCovered;
|
||||
// private final AEColoredItemDefinition lumenCableGlass;
|
||||
// private final AEColoredItemDefinition lumenCableDense;
|
||||
private final IItemDefinition quartzFiber;
|
||||
private final IItemDefinition toggleBus;
|
||||
private final IItemDefinition invertedToggleBus;
|
||||
@@ -70,7 +74,6 @@ public final class ApiParts implements IParts
|
||||
private final IItemDefinition p2PTunnelEU;
|
||||
private final IItemDefinition p2PTunnelFE;
|
||||
private final IItemDefinition p2PTunnelLight;
|
||||
// private final IItemDefinition p2PTunnelOpenComputers;
|
||||
private final IItemDefinition cableAnchor;
|
||||
private final IItemDefinition monitor;
|
||||
private final IItemDefinition semiDarkMonitor;
|
||||
@@ -88,10 +91,9 @@ public final class ApiParts implements IParts
|
||||
|
||||
public ApiParts( FeatureFactory registry, PartModels partModels )
|
||||
{
|
||||
IItemDefinition itemPartDef = registry.item( "part", ItemPart::new )
|
||||
.rendering( new ItemPartRendering( partModels ) )
|
||||
.build();
|
||||
final ItemPart itemPart = (ItemPart) itemPartDef.item();
|
||||
// IItemDefinition itemPartDef = registry.item( "part", ItemPart::new )
|
||||
// .rendering( new ItemPartRendering( partModels ) )
|
||||
// .build();
|
||||
|
||||
// Register all part models
|
||||
for( PartType partType : PartType.values() )
|
||||
@@ -99,65 +101,68 @@ public final class ApiParts implements IParts
|
||||
partModels.registerModels( partType.getModels() );
|
||||
}
|
||||
|
||||
this.cableSmart = constructColoredDefinition( itemPart, PartType.CABLE_SMART );
|
||||
this.cableCovered = constructColoredDefinition( itemPart, PartType.CABLE_COVERED );
|
||||
this.cableGlass = constructColoredDefinition( itemPart, PartType.CABLE_GLASS );
|
||||
this.cableDenseCovered = constructColoredDefinition( itemPart, PartType.CABLE_DENSE_COVERED );
|
||||
this.cableDenseSmart = constructColoredDefinition( itemPart, PartType.CABLE_DENSE_SMART );
|
||||
// this.lumenCableSmart = Optional.absent(); // has yet to be implemented, no PartType defined for it yet
|
||||
// this.lumenCableCovered = Optional.absent(); // has yet to be implemented, no PartType defined for it yet
|
||||
// this.lumenCableGlass = Optional.absent(); // has yet to be implemented, no PartType defined for it yet
|
||||
// this.lumenCableDense = Optional.absent(); // has yet to be implemented, no PartType defined for it yet
|
||||
this.quartzFiber = new DamagedItemDefinition( "part.quartz_fiber", itemPart.createPart( PartType.QUARTZ_FIBER ) );
|
||||
this.toggleBus = new DamagedItemDefinition( "part.toggle_bus", itemPart.createPart( PartType.TOGGLE_BUS ) );
|
||||
this.invertedToggleBus = new DamagedItemDefinition( "part.toggle_bus.inverted", itemPart.createPart( PartType.INVERTED_TOGGLE_BUS ) );
|
||||
this.storageBus = new DamagedItemDefinition( "part.bus.storage", itemPart.createPart( PartType.STORAGE_BUS ) );
|
||||
this.importBus = new DamagedItemDefinition( "part.bus.import", itemPart.createPart( PartType.IMPORT_BUS ) );
|
||||
this.exportBus = new DamagedItemDefinition( "part.bus.export", itemPart.createPart( PartType.EXPORT_BUS ) );
|
||||
this.iface = new DamagedItemDefinition( "part.interface", itemPart.createPart( PartType.INTERFACE ) );
|
||||
this.fluidIface = new DamagedItemDefinition( "part.fluid_interface", itemPart.createPart( PartType.FLUID_INTERFACE ) );
|
||||
this.levelEmitter = new DamagedItemDefinition( "part.level_emitter", itemPart.createPart( PartType.LEVEL_EMITTER ) );
|
||||
this.fluidLevelEmitter = new DamagedItemDefinition( "part.fluid_level_emitter", itemPart.createPart( PartType.FLUID_LEVEL_EMITTER ) );
|
||||
this.annihilationPlane = new DamagedItemDefinition( "part.plane.annihilation", itemPart.createPart( PartType.ANNIHILATION_PLANE ) );
|
||||
this.identityAnnihilationPlane = new DamagedItemDefinition( "part.plane.annihiliation.identity", itemPart
|
||||
.createPart( PartType.IDENTITY_ANNIHILATION_PLANE ) );
|
||||
this.fluidAnnihilationPlane = new DamagedItemDefinition( "part.plane.fluid_annihilation", itemPart.createPart( PartType.FLUID_ANNIHILATION_PLANE ) );
|
||||
this.formationPlane = new DamagedItemDefinition( "part.plane.formation", itemPart.createPart( PartType.FORMATION_PLANE ) );
|
||||
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 = 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(
|
||||
// PartType.P2PTunnelOpenComputers ) );
|
||||
this.cableAnchor = new DamagedItemDefinition( "part.cable_anchor", itemPart.createPart( PartType.CABLE_ANCHOR ) );
|
||||
this.monitor = new DamagedItemDefinition( "part.monitor", itemPart.createPart( PartType.MONITOR ) );
|
||||
this.semiDarkMonitor = new DamagedItemDefinition( "part.monitor.semi_dark", itemPart.createPart( PartType.SEMI_DARK_MONITOR ) );
|
||||
this.darkMonitor = new DamagedItemDefinition( "part.monitor.dark", itemPart.createPart( PartType.DARK_MONITOR ) );
|
||||
this.interfaceTerminal = new DamagedItemDefinition( "part.terminal.interface", itemPart.createPart( PartType.INTERFACE_TERMINAL ) );
|
||||
this.patternTerminal = new DamagedItemDefinition( "part.terminal.pattern", itemPart.createPart( PartType.PATTERN_TERMINAL ) );
|
||||
this.craftingTerminal = new DamagedItemDefinition( "part.terminal.crafting", itemPart.createPart( PartType.CRAFTING_TERMINAL ) );
|
||||
this.terminal = new DamagedItemDefinition( "part.terminal", itemPart.createPart( PartType.TERMINAL ) );
|
||||
this.storageMonitor = new DamagedItemDefinition( "part.monitor.storage", itemPart.createPart( PartType.STORAGE_MONITOR ) );
|
||||
this.conversionMonitor = new DamagedItemDefinition( "part.monitor.conversion", itemPart.createPart( PartType.CONVERSION_MONITOR ) );
|
||||
this.fluidImportBus = new DamagedItemDefinition( "part.bus.import.fluid", itemPart.createPart( PartType.FLUID_IMPORT_BUS ) );
|
||||
this.fluidExportBus = new DamagedItemDefinition( "part.bus.export.fluid", itemPart.createPart( PartType.FLUID_EXPORT_BUS ) );
|
||||
this.fluidTerminal = new DamagedItemDefinition( "part.terminal.fluid", itemPart.createPart( PartType.FLUID_TERMINAL ) );
|
||||
this.fluidStorageBus = new DamagedItemDefinition( "part.bus.storage.fluid", itemPart.createPart( PartType.FLUID_STORAGE_BUS ) );
|
||||
this.cableSmart = constructColoredDefinition(registry, "smart_cable", PartType.CABLE_SMART, PartCableSmart::new);
|
||||
this.cableCovered = constructColoredDefinition(registry, "covered_cable", PartType.CABLE_COVERED, PartCableCovered::new);
|
||||
this.cableGlass = constructColoredDefinition(registry, "glass_cable", PartType.CABLE_GLASS, PartCableGlass::new);
|
||||
this.cableDenseCovered = constructColoredDefinition(registry, "dense_cable", PartType.CABLE_DENSE_COVERED, PartDenseCableCovered::new);
|
||||
this.cableDenseSmart = constructColoredDefinition(registry, "smart_dense_cable", PartType.CABLE_DENSE_SMART, PartDenseCableSmart::new);
|
||||
this.quartzFiber = createPart(registry, "quartz_fiber", PartType.QUARTZ_FIBER, PartQuartzFiber::new );
|
||||
this.toggleBus = createPart(registry, "toggle_bus", PartType.TOGGLE_BUS, PartToggleBus::new );
|
||||
this.invertedToggleBus = createPart(registry, "inverted_toggle_bus", PartType.INVERTED_TOGGLE_BUS, PartInvertedToggleBus::new );
|
||||
this.cableAnchor = createPart(registry, "cable_anchor", PartType.CABLE_ANCHOR, PartCableAnchor::new );
|
||||
this.monitor = createPart(registry, "monitor", PartType.MONITOR, PartPanel::new );
|
||||
this.semiDarkMonitor = createPart(registry, "semi_dark_monitor", PartType.SEMI_DARK_MONITOR, PartSemiDarkPanel::new );
|
||||
this.darkMonitor = createPart(registry, "dark_monitor", PartType.DARK_MONITOR, PartDarkPanel::new );
|
||||
this.storageBus = createPart(registry, "storage_bus", PartType.STORAGE_BUS, PartStorageBus::new );
|
||||
this.fluidStorageBus = createPart(registry, "fluid_storage_bus", PartType.FLUID_STORAGE_BUS, PartFluidStorageBus::new );
|
||||
this.importBus = createPart(registry, "import_bus", PartType.IMPORT_BUS, PartImportBus::new );
|
||||
this.fluidImportBus = createPart(registry, "fluid_import_bus", PartType.FLUID_IMPORT_BUS, PartFluidImportBus::new );
|
||||
this.exportBus = createPart(registry, "export_bus", PartType.EXPORT_BUS, PartExportBus::new );
|
||||
this.fluidExportBus = createPart(registry, "fluid_export_bus", PartType.FLUID_EXPORT_BUS, PartFluidExportBus::new );
|
||||
this.levelEmitter = createPart(registry, "level_emitter", PartType.LEVEL_EMITTER, PartLevelEmitter::new );
|
||||
this.fluidLevelEmitter = createPart(registry, "fluid_level_emitter", PartType.FLUID_LEVEL_EMITTER, PartFluidLevelEmitter::new );
|
||||
this.annihilationPlane = createPart(registry, "annihilation_plane", PartType.ANNIHILATION_PLANE, PartAnnihilationPlane::new );
|
||||
this.identityAnnihilationPlane = createPart(registry, "identity_annihiliation_plane", PartType.IDENTITY_ANNIHILATION_PLANE, PartIdentityAnnihilationPlane::new );
|
||||
this.fluidAnnihilationPlane = createPart(registry, "fluid_annihilation_plane", PartType.FLUID_ANNIHILATION_PLANE, PartFluidAnnihilationPlane::new );
|
||||
this.formationPlane = createPart(registry, "formation_plane", PartType.FORMATION_PLANE, PartFormationPlane::new );
|
||||
this.fluidFormationPlane = createPart(registry, "fluid_formation_plane", PartType.FLUID_FORMATION_PLANE, PartFluidFormationPlane::new );
|
||||
this.patternTerminal = createPart(registry, "pattern_terminal", PartType.PATTERN_TERMINAL, PartPatternTerminal::new );
|
||||
this.craftingTerminal = createPart(registry, "crafting_terminal", PartType.CRAFTING_TERMINAL, PartCraftingTerminal::new );
|
||||
this.terminal = createPart(registry, "terminal", PartType.TERMINAL, PartTerminal::new );
|
||||
this.storageMonitor = createPart(registry, "storage_monitor", PartType.STORAGE_MONITOR, PartStorageMonitor::new );
|
||||
this.conversionMonitor = createPart(registry, "conversion_monitor", PartType.CONVERSION_MONITOR, PartConversionMonitor::new );
|
||||
this.iface = createPart(registry, "cable_interface", PartType.INTERFACE, PartInterface::new );
|
||||
this.fluidIface = createPart(registry, "cable_fluid_interface", PartType.FLUID_INTERFACE, PartFluidInterface::new );
|
||||
this.p2PTunnelME = createPart(registry, "me_tunnel", PartType.P2P_TUNNEL_ME, PartP2PTunnelME::new );
|
||||
this.p2PTunnelRedstone = createPart(registry, "redstone_tunnel", PartType.P2P_TUNNEL_REDSTONE, PartP2PRedstone::new );
|
||||
this.p2PTunnelItems = createPart(registry, "item_tunnel", PartType.P2P_TUNNEL_ITEMS, PartP2PItems::new );
|
||||
this.p2PTunnelFluids = createPart(registry, "fluid_tunnel", PartType.P2P_TUNNEL_FLUIDS, PartP2PFluids::new );
|
||||
this.p2PTunnelEU = null; // FIXME createPart( "tunnel.eu", PartType.P2P_TUNNEL_IC2, PartP2PIC2Power::new);
|
||||
this.p2PTunnelFE = createPart(registry, "fe_tunnel", PartType.P2P_TUNNEL_FE, PartP2PFEPower::new );
|
||||
this.p2PTunnelLight = createPart(registry, "light_tunnel", PartType.P2P_TUNNEL_LIGHT, PartP2PLight::new );
|
||||
this.interfaceTerminal = createPart(registry, "interface_terminal", PartType.INTERFACE_TERMINAL, PartInterfaceTerminal::new );
|
||||
this.fluidTerminal = createPart(registry, "fluid_terminal", PartType.FLUID_TERMINAL, PartFluidTerminal::new );
|
||||
}
|
||||
|
||||
private static AEColoredItemDefinition constructColoredDefinition( final ItemPart target, final PartType type )
|
||||
private <T extends IPart> IItemDefinition createPart(FeatureFactory registry, String id, PartType type, Function<ItemStack, T> factory) {
|
||||
return registry.item(id, props -> new ItemPart<>(props, type, factory))
|
||||
.itemGroup(CreativeTab.instance)
|
||||
.build();
|
||||
}
|
||||
|
||||
private <T extends IPart> AEColoredItemDefinition constructColoredDefinition(FeatureFactory registry, String idSuffix, PartType type, Function<ItemStack, T> factory)
|
||||
{
|
||||
final ColoredItemDefinition definition = new ColoredItemDefinition();
|
||||
|
||||
for( final AEColor color : AEColor.values() )
|
||||
{
|
||||
final ItemStackSrc multiPartSource = target.createPart( type, color );
|
||||
String id = color.registryPrefix + idSuffix;
|
||||
|
||||
definition.add( color, multiPartSource );
|
||||
IItemDefinition itemDef = registry.item(id, props -> new ColoredPartItem<>(props, type, factory, color))
|
||||
.itemGroup(CreativeTab.instance)
|
||||
.build();
|
||||
|
||||
definition.add( color, new ItemStackSrc(itemDef.item(), ActivityState.Enabled) );
|
||||
}
|
||||
|
||||
return definition;
|
||||
@@ -193,34 +198,6 @@ public final class ApiParts implements IParts
|
||||
return this.cableDenseSmart;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AEColoredItemDefinition lumenCableSmart()
|
||||
{
|
||||
throw new MissingDefinitionException( "Lumen Smart Cable has yet to be implemented." );
|
||||
// return this.lumenCableSmart;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AEColoredItemDefinition lumenCableCovered()
|
||||
{
|
||||
throw new MissingDefinitionException( "Lumen Covered Cable has yet to be implemented." );
|
||||
// return this.lumenCableCovered;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AEColoredItemDefinition lumenCableGlass()
|
||||
{
|
||||
throw new MissingDefinitionException( "Lumen Glass Cable has yet to be implemented." );
|
||||
// return this.lumenCableGlass;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AEColoredItemDefinition lumenDenseCableSmart()
|
||||
{
|
||||
throw new MissingDefinitionException( "Lumen Dense Cable has yet to be implemented." );
|
||||
// return this.lumenCableDense;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition quartzFiber()
|
||||
{
|
||||
|
||||
@@ -43,9 +43,10 @@ public class PartItemPredicate extends ItemPredicate
|
||||
@Override
|
||||
public boolean test( ItemStack item )
|
||||
{
|
||||
if( ItemPart.instance != null && item.getItem() == ItemPart.instance )
|
||||
if( item.getItem() instanceof ItemPart )
|
||||
{
|
||||
return ItemPart.instance.getTypeByStack( item ) == this.partType;
|
||||
ItemPart<?> itemPart = (ItemPart<?>) item.getItem();
|
||||
return itemPart.getType() == partType;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package appeng.items.parts;
|
||||
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.util.AEColor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
public class ColoredPartItem<T extends IPart> extends ItemPart<T> {
|
||||
|
||||
private final AEColor color;
|
||||
|
||||
public ColoredPartItem(Properties properties, PartType type, Function<ItemStack, T> factory, AEColor color) {
|
||||
super(properties, type, factory);
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
public AEColor getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -43,102 +43,25 @@ import javax.annotation.Nullable;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.function.Function;
|
||||
|
||||
|
||||
public final class ItemPart extends AEBaseItem implements IPartItem, IItemGroup
|
||||
public class ItemPart<T extends IPart> extends AEBaseItem implements IPartItem<T>, IItemGroup
|
||||
{
|
||||
private static final int INITIAL_REGISTERED_CAPACITY = PartType.values().length;
|
||||
private static final Comparator<Entry<Integer, PartTypeWithVariant>> REGISTERED_COMPARATOR = new RegisteredComparator();
|
||||
|
||||
public static ItemPart instance;
|
||||
private final PartType type;
|
||||
|
||||
private final Function<ItemStack, T> factory;
|
||||
|
||||
private final Map<Integer, PartTypeWithVariant> registered;
|
||||
|
||||
public ItemPart(Properties properties) {
|
||||
public ItemPart(Properties properties, PartType type, Function<ItemStack, T> factory) {
|
||||
super(properties);
|
||||
this.type = type;
|
||||
this.factory = factory;
|
||||
this.registered = new HashMap<>( INITIAL_REGISTERED_CAPACITY );
|
||||
|
||||
// FIXME this.setHasSubtypes( true );
|
||||
|
||||
instance = this;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public final ItemStackSrc createPart( final PartType mat )
|
||||
{
|
||||
Preconditions.checkNotNull( mat );
|
||||
|
||||
return this.createPart( mat, 0 );
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public ItemStackSrc createPart( final PartType mat, final AEColor color )
|
||||
{
|
||||
Preconditions.checkNotNull( mat );
|
||||
Preconditions.checkNotNull( color );
|
||||
|
||||
final int varID = color.ordinal();
|
||||
|
||||
return this.createPart( mat, varID );
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
private ItemStackSrc createPart( final PartType mat, final int varID )
|
||||
{
|
||||
assert mat != null;
|
||||
assert varID >= 0;
|
||||
|
||||
// verify
|
||||
for( final PartTypeWithVariant p : this.registered.values() )
|
||||
{
|
||||
if( p.part == mat && p.variant == varID )
|
||||
{
|
||||
throw new IllegalStateException( "Cannot create the same material twice..." );
|
||||
}
|
||||
}
|
||||
|
||||
boolean enabled = mat.isEnabled();
|
||||
|
||||
final int partDamage = mat.getBaseDamage() + varID;
|
||||
final ActivityState state = ActivityState.from( enabled );
|
||||
final ItemStackSrc output = new ItemStackSrc( this/* FIXME, partDamage */, state );
|
||||
|
||||
final PartTypeWithVariant pti = new PartTypeWithVariant( mat, varID );
|
||||
|
||||
this.processMetaOverlap( enabled, partDamage, mat, pti );
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
private void processMetaOverlap( final boolean enabled, final int partDamage, final PartType mat, final PartTypeWithVariant pti )
|
||||
{
|
||||
assert partDamage >= 0;
|
||||
assert mat != null;
|
||||
assert pti != null;
|
||||
|
||||
final PartTypeWithVariant registeredPartType = this.registered.get( partDamage );
|
||||
if( registeredPartType != null )
|
||||
{
|
||||
throw new IllegalStateException( "Meta Overlap detected with type " + mat + " and damage " + partDamage + ". Found " + registeredPartType + " there already." );
|
||||
}
|
||||
|
||||
if( enabled )
|
||||
{
|
||||
this.registered.put( partDamage, pti );
|
||||
}
|
||||
}
|
||||
|
||||
public int getDamageByType( final PartType t )
|
||||
{
|
||||
Preconditions.checkNotNull( t );
|
||||
|
||||
for( final Entry<Integer, PartTypeWithVariant> pt : this.registered.entrySet() )
|
||||
{
|
||||
if( pt.getValue().part == t )
|
||||
{
|
||||
return pt.getKey();
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -146,9 +69,9 @@ public final class ItemPart extends AEBaseItem implements IPartItem, IItemGroup
|
||||
{
|
||||
PlayerEntity player = context.getPlayer();
|
||||
ItemStack held = player.getHeldItem( context.getHand() );
|
||||
if( this.getTypeByStack( held ) == PartType.INVALID_TYPE )
|
||||
if( held.getItem() != this )
|
||||
{
|
||||
return ActionResultType.FAIL;
|
||||
return ActionResultType.PASS;
|
||||
}
|
||||
|
||||
return AEApi.instance().partHelper().placeBus( held, context.getPos(), context.getFace(), player, context.getHand(), context.getWorld() );
|
||||
@@ -186,55 +109,13 @@ public final class ItemPart extends AEBaseItem implements IPartItem, IItemGroup
|
||||
return super.getDisplayName( is );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillItemGroup(ItemGroup group, NonNullList<ItemStack> items) {
|
||||
final List<Entry<Integer, PartTypeWithVariant>> types = new ArrayList<>( this.registered.entrySet() );
|
||||
Collections.sort( types, REGISTERED_COMPARATOR );
|
||||
|
||||
for( final Entry<Integer, PartTypeWithVariant> part : types )
|
||||
{
|
||||
items.add( new ItemStack( this, 1/* FIXME, part.getKey() */ ) );
|
||||
}
|
||||
public PartType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public PartType getTypeByStack( final ItemStack is )
|
||||
{
|
||||
Preconditions.checkNotNull( is );
|
||||
|
||||
final PartTypeWithVariant pt = this.registered.get( is.getDamage() );
|
||||
if( pt != null )
|
||||
{
|
||||
return pt.part;
|
||||
}
|
||||
|
||||
return PartType.INVALID_TYPE;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IPart createPartFromItemStack( final ItemStack is ) {
|
||||
final PartType type = this.getTypeByStack( is );
|
||||
final Class<? extends IPart> part = type.getPart();
|
||||
if( part == null )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if( type.getConstructor() == null )
|
||||
{
|
||||
type.setConstructor( part.getConstructor( ItemStack.class ) );
|
||||
}
|
||||
|
||||
return type.getConstructor().newInstance( is );
|
||||
}
|
||||
catch( final InstantiationException | NoSuchMethodException | IllegalAccessException | InvocationTargetException e )
|
||||
{
|
||||
throw new IllegalStateException( "Unable to construct IBusPart from IBusItem : " + part
|
||||
.getName() + " ; Possibly didn't have correct constructor( ItemStack )", e );
|
||||
}
|
||||
public T createPart(ItemStack is) {
|
||||
return factory.apply(is);
|
||||
}
|
||||
|
||||
public int variantOf( final int itemDamage )
|
||||
@@ -248,6 +129,13 @@ public final class ItemPart extends AEBaseItem implements IPartItem, IItemGroup
|
||||
return 0;
|
||||
}
|
||||
|
||||
private static PartType getTypeByStack(ItemStack is) {
|
||||
if (is.getItem() instanceof ItemPart) {
|
||||
return ((ItemPart<?>) is.getItem()).getType();
|
||||
}
|
||||
return PartType.INVALID_TYPE;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public String getUnlocalizedGroupName( final Set<ItemStack> others, final ItemStack is )
|
||||
@@ -258,13 +146,13 @@ public final class ItemPart extends AEBaseItem implements IPartItem, IItemGroup
|
||||
boolean exportBusFluids = false;
|
||||
boolean group = false;
|
||||
|
||||
final PartType u = this.getTypeByStack( is );
|
||||
final PartType u = getTypeByStack( is );
|
||||
|
||||
for( final ItemStack stack : others )
|
||||
{
|
||||
if( stack.getItem() == this )
|
||||
{
|
||||
final PartType pt = this.getTypeByStack( stack );
|
||||
final PartType pt = getTypeByStack( stack );
|
||||
switch( pt )
|
||||
{
|
||||
case IMPORT_BUS:
|
||||
|
||||
@@ -400,7 +400,7 @@ public enum PartType
|
||||
return false;
|
||||
}
|
||||
|
||||
Set<AEFeature> getFeature()
|
||||
public Set<AEFeature> getFeature()
|
||||
{
|
||||
return this.features;
|
||||
}
|
||||
@@ -410,11 +410,6 @@ public enum PartType
|
||||
return this.integrations;
|
||||
}
|
||||
|
||||
Class<? extends IPart> getPart()
|
||||
{
|
||||
return this.myPart;
|
||||
}
|
||||
|
||||
String getTranslationKey()
|
||||
{
|
||||
return this.name().toLowerCase();
|
||||
@@ -425,11 +420,6 @@ public enum PartType
|
||||
return this.extraName;
|
||||
}
|
||||
|
||||
Constructor<? extends IPart> getConstructor()
|
||||
{
|
||||
return this.constructor;
|
||||
}
|
||||
|
||||
void setConstructor( final Constructor<? extends IPart> constructor )
|
||||
{
|
||||
this.constructor = constructor;
|
||||
|
||||
@@ -32,6 +32,7 @@ import net.minecraft.crash.CrashReportCategory;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
@@ -102,7 +103,12 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost,
|
||||
|
||||
public PartType getType()
|
||||
{
|
||||
return ItemPart.instance.getTypeByStack( this.is );
|
||||
Item item = this.is.getItem();
|
||||
if (!(item instanceof ItemPart)) {
|
||||
return PartType.INVALID_TYPE;
|
||||
}
|
||||
|
||||
return ((ItemPart<?>) item).getType();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -138,12 +138,12 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
|
||||
|
||||
if( is.getItem() instanceof IPartItem )
|
||||
{
|
||||
final IPartItem bi = (IPartItem) is.getItem();
|
||||
final IPartItem<?> bi = (IPartItem<?>) is.getItem();
|
||||
|
||||
is = is.copy();
|
||||
is.setCount( 1 );
|
||||
|
||||
final IPart bp = bi.createPartFromItemStack( is );
|
||||
final IPart bp = bi.createPart(is);
|
||||
if( bp != null )
|
||||
{
|
||||
if( bp instanceof IPartCable )
|
||||
@@ -186,12 +186,12 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
|
||||
{
|
||||
if( is.getItem() instanceof IPartItem )
|
||||
{
|
||||
final IPartItem bi = (IPartItem) is.getItem();
|
||||
final IPartItem<?> bi = (IPartItem<?>) is.getItem();
|
||||
|
||||
is = is.copy();
|
||||
is.setCount( 1 );
|
||||
|
||||
final IPart bp = bi.createPartFromItemStack( is );
|
||||
final IPart bp = bi.createPart(is);
|
||||
if( bp instanceof IPartCable )
|
||||
{
|
||||
boolean canPlace = true;
|
||||
|
||||
@@ -19,17 +19,6 @@
|
||||
package appeng.parts.networking;
|
||||
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.EnumSet;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.util.Direction;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.SecurityPermissions;
|
||||
import appeng.api.definitions.IParts;
|
||||
@@ -46,10 +35,19 @@ import appeng.api.util.AECableType;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.api.util.IReadOnlyCollection;
|
||||
import appeng.items.parts.ItemPart;
|
||||
import appeng.items.parts.ColoredPartItem;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.parts.AEBasePart;
|
||||
import appeng.util.Platform;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.util.Direction;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.EnumSet;
|
||||
|
||||
|
||||
public class PartCable extends AEBasePart implements IPartCable
|
||||
@@ -68,7 +66,10 @@ public class PartCable extends AEBasePart implements IPartCable
|
||||
super( is );
|
||||
this.getProxy().setFlags( GridFlags.PREFERRED );
|
||||
this.getProxy().setIdlePowerUsage( 0.0 );
|
||||
this.getProxy().setColor( AEColor.values()[( (ItemPart) is.getItem() ).variantOf( is.getDamage() )] );
|
||||
if (is.getItem() instanceof ColoredPartItem) {
|
||||
ColoredPartItem<?> coloredPartItem = (ColoredPartItem<?>) is.getItem();
|
||||
this.getProxy().setColor(coloredPartItem.getColor());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -207,7 +207,7 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
|
||||
{
|
||||
if( newType.getItem() instanceof IPartItem )
|
||||
{
|
||||
final IPart testPart = ( (IPartItem) newType.getItem() ).createPartFromItemStack( newType );
|
||||
final IPart testPart = ( (IPartItem<?>) newType.getItem() ).createPart( newType );
|
||||
if( testPart instanceof PartP2PTunnel )
|
||||
{
|
||||
this.getHost().removePart( this.getSide(), true );
|
||||
@@ -216,7 +216,7 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
|
||||
|
||||
if( newBus instanceof PartP2PTunnel )
|
||||
{
|
||||
final PartP2PTunnel newTunnel = (PartP2PTunnel) newBus;
|
||||
final PartP2PTunnel<?> newTunnel = (PartP2PTunnel<?>) newBus;
|
||||
newTunnel.setOutput( true );
|
||||
|
||||
try
|
||||
|
||||
@@ -139,17 +139,17 @@ public class AEItemResolver implements ISubItemResolver
|
||||
// FIXME }
|
||||
}
|
||||
|
||||
if( itemName.startsWith( "part." ) )
|
||||
{
|
||||
final String partName = itemName.substring( itemName.indexOf( '.' ) + 1 );
|
||||
final PartType pt = PartType.valueOf( partName.toUpperCase() );
|
||||
// itemName = itemName.substring( 0, itemName.indexOf( "." ) );
|
||||
final int dVal = ItemPart.instance.getDamageByType( pt );
|
||||
if( dVal >= 0 )
|
||||
{
|
||||
return new ResolverResult( "part", dVal );
|
||||
}
|
||||
}
|
||||
// FIXME if( itemName.startsWith( "part." ) )
|
||||
// FIXME {
|
||||
// FIXME final String partName = itemName.substring( itemName.indexOf( '.' ) + 1 );
|
||||
// FIXME final PartType pt = PartType.valueOf( partName.toUpperCase() );
|
||||
// FIXME // itemName = itemName.substring( 0, itemName.indexOf( "." ) );
|
||||
// FIXME final int dVal = ItemPart.instance.getDamageByType( pt );
|
||||
// FIXME if( dVal >= 0 )
|
||||
// FIXME {
|
||||
// FIXME return new ResolverResult( "part", dVal );
|
||||
// FIXME }
|
||||
// FIXME }
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user