Renamed items, added back waila.
This commit is contained in:
@@ -20,6 +20,8 @@ package appeng.core.localization;
|
||||
|
||||
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
|
||||
|
||||
public enum WailaText
|
||||
@@ -64,4 +66,14 @@ public enum WailaText
|
||||
return this.root + '.' + this.toString();
|
||||
}
|
||||
|
||||
public ITextComponent textComponent()
|
||||
{
|
||||
return new TranslationTextComponent(this.root + '.' + this.toString());
|
||||
}
|
||||
|
||||
public ITextComponent textComponent(Object... args)
|
||||
{
|
||||
return new TranslationTextComponent(this.root + '.' + this.toString(), args);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* 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.integration.modules.waila;
|
||||
|
||||
|
||||
import mcp.mobius.waila.api.IComponentProvider;
|
||||
import mcp.mobius.waila.api.IDataAccessor;
|
||||
import mcp.mobius.waila.api.IPluginConfig;
|
||||
import mcp.mobius.waila.api.IServerDataProvider;
|
||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* Base implementation for {@link mcp.mobius.waila.api.IComponentProvider}
|
||||
*
|
||||
* @author thatsIch
|
||||
* @version rv2
|
||||
* @since rv2
|
||||
*/
|
||||
public abstract class BaseWailaDataProvider implements IComponentProvider, IServerDataProvider<TileEntity>
|
||||
{
|
||||
|
||||
@Override
|
||||
public ItemStack getStack( final IDataAccessor accessor, final IPluginConfig config )
|
||||
{
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void appendServerData(CompoundNBT compoundNBT, ServerPlayerEntity serverPlayerEntity, World world, TileEntity tileEntity) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void appendHead(List<ITextComponent> tooltip, IDataAccessor accessor, IPluginConfig config) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void appendBody(List<ITextComponent> tooltip, IDataAccessor accessor, IPluginConfig config) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void appendTail(List<ITextComponent> tooltip, IDataAccessor accessor, IPluginConfig config) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,179 @@
|
||||
/*
|
||||
* 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.integration.modules.waila;
|
||||
|
||||
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.integration.modules.waila.part.*;
|
||||
import com.google.common.collect.Lists;
|
||||
import mcp.mobius.waila.api.IComponentProvider;
|
||||
import mcp.mobius.waila.api.IDataAccessor;
|
||||
import mcp.mobius.waila.api.IPluginConfig;
|
||||
import mcp.mobius.waila.api.IServerDataProvider;
|
||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
|
||||
/**
|
||||
* Delegation provider for parts through {@link IPartWailaDataProvider}
|
||||
*
|
||||
* @author thatsIch
|
||||
* @version rv2
|
||||
* @since rv2
|
||||
*/
|
||||
public final class PartWailaDataProvider implements IComponentProvider, IServerDataProvider<TileEntity>
|
||||
{
|
||||
/**
|
||||
* Contains all providers
|
||||
*/
|
||||
private final List<IPartWailaDataProvider> providers;
|
||||
|
||||
/**
|
||||
* Can access parts through view-hits
|
||||
*/
|
||||
private final PartAccessor accessor = new PartAccessor();
|
||||
|
||||
/**
|
||||
* Traces views hit on blocks
|
||||
*/
|
||||
private final Tracer tracer = new Tracer();
|
||||
|
||||
/**
|
||||
* Initializes the provider list with all wanted providers
|
||||
*/
|
||||
public PartWailaDataProvider()
|
||||
{
|
||||
final IPartWailaDataProvider channel = new ChannelWailaDataProvider();
|
||||
final IPartWailaDataProvider storageMonitor = new StorageMonitorWailaDataProvider();
|
||||
final IPartWailaDataProvider powerState = new PowerStateWailaDataProvider();
|
||||
final IPartWailaDataProvider p2pState = new P2PStateWailaDataProvider();
|
||||
final IPartWailaDataProvider partStack = new PartStackWailaDataProvider();
|
||||
|
||||
this.providers = Lists.newArrayList( channel, storageMonitor, powerState, partStack, p2pState );
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStack( final IDataAccessor accessor, final IPluginConfig config )
|
||||
{
|
||||
final TileEntity te = accessor.getTileEntity();
|
||||
final RayTraceResult mop = accessor.getHitResult();
|
||||
|
||||
final Optional<IPart> maybePart = this.accessor.getMaybePart( te, mop );
|
||||
|
||||
if( maybePart.isPresent() )
|
||||
{
|
||||
final IPart part = maybePart.get();
|
||||
|
||||
ItemStack wailaStack = ItemStack.EMPTY;
|
||||
|
||||
for( final IPartWailaDataProvider provider : this.providers )
|
||||
{
|
||||
wailaStack = provider.getStack( part, config, wailaStack );
|
||||
}
|
||||
return wailaStack;
|
||||
}
|
||||
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void appendHead( List<ITextComponent> currentToolTip, final IDataAccessor accessor, final IPluginConfig config )
|
||||
{
|
||||
final TileEntity te = accessor.getTileEntity();
|
||||
final RayTraceResult mop = accessor.getHitResult();
|
||||
|
||||
final Optional<IPart> maybePart = this.accessor.getMaybePart( te, mop );
|
||||
|
||||
if( maybePart.isPresent() )
|
||||
{
|
||||
final IPart part = maybePart.get();
|
||||
|
||||
for( final IPartWailaDataProvider provider : this.providers )
|
||||
{
|
||||
provider.appendHead( part, currentToolTip, accessor, config );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void appendBody(List<ITextComponent> tooltip, final IDataAccessor accessor, final IPluginConfig config )
|
||||
{
|
||||
final TileEntity te = accessor.getTileEntity();
|
||||
final RayTraceResult mop = accessor.getHitResult();
|
||||
|
||||
final Optional<IPart> maybePart = this.accessor.getMaybePart( te, mop );
|
||||
|
||||
if( maybePart.isPresent() )
|
||||
{
|
||||
final IPart part = maybePart.get();
|
||||
|
||||
for( final IPartWailaDataProvider provider : this.providers )
|
||||
{
|
||||
provider.appendBody( part, tooltip, accessor, config );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void appendTail( List<ITextComponent> tooltip, final IDataAccessor accessor, final IPluginConfig config )
|
||||
{
|
||||
final TileEntity te = accessor.getTileEntity();
|
||||
final RayTraceResult mop = accessor.getHitResult();
|
||||
|
||||
final Optional<IPart> maybePart = this.accessor.getMaybePart( te, mop );
|
||||
|
||||
if( maybePart.isPresent() )
|
||||
{
|
||||
final IPart part = maybePart.get();
|
||||
|
||||
for( final IPartWailaDataProvider provider : this.providers )
|
||||
{
|
||||
provider.appendTail( part, tooltip, accessor, config );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void appendServerData(CompoundNBT tag, ServerPlayerEntity player, World world, TileEntity te) {
|
||||
final RayTraceResult mop = this.tracer.retraceBlock( world, player, te.getPos() );
|
||||
|
||||
if( mop != null )
|
||||
{
|
||||
final Optional<IPart> maybePart = this.accessor.getMaybePart( te, mop );
|
||||
|
||||
if( maybePart.isPresent() )
|
||||
{
|
||||
final IPart part = maybePart.get();
|
||||
|
||||
for( final IPartWailaDataProvider provider : this.providers )
|
||||
{
|
||||
provider.appendServerData( player, part, te, tag, world, te.getPos() );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
/*
|
||||
* 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.integration.modules.waila;
|
||||
|
||||
|
||||
import appeng.integration.modules.waila.tile.ChargerWailaDataProvider;
|
||||
import appeng.integration.modules.waila.tile.CraftingMonitorWailaDataProvider;
|
||||
import appeng.integration.modules.waila.tile.PowerStateWailaDataProvider;
|
||||
import appeng.integration.modules.waila.tile.PowerStorageWailaDataProvider;
|
||||
import com.google.common.collect.Lists;
|
||||
import mcp.mobius.waila.api.IComponentProvider;
|
||||
import mcp.mobius.waila.api.IDataAccessor;
|
||||
import mcp.mobius.waila.api.IPluginConfig;
|
||||
import mcp.mobius.waila.api.IServerDataProvider;
|
||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* Delegation provider for tiles through {@link mcp.mobius.waila.api.IComponentProvider}
|
||||
*
|
||||
* @author thatsIch
|
||||
* @version rv2
|
||||
* @since rv2
|
||||
*/
|
||||
public final class TileWailaDataProvider implements IComponentProvider, IServerDataProvider<TileEntity>
|
||||
{
|
||||
/**
|
||||
* Contains all providers
|
||||
*/
|
||||
private final List<BaseWailaDataProvider> providers;
|
||||
|
||||
/**
|
||||
* Initializes the provider list with all wanted providers
|
||||
*/
|
||||
public TileWailaDataProvider()
|
||||
{
|
||||
final BaseWailaDataProvider charger = new ChargerWailaDataProvider();
|
||||
final BaseWailaDataProvider energyCell = new PowerStorageWailaDataProvider();
|
||||
final BaseWailaDataProvider craftingBlock = new PowerStateWailaDataProvider();
|
||||
final BaseWailaDataProvider craftingMonitor = new CraftingMonitorWailaDataProvider();
|
||||
|
||||
this.providers = Lists.newArrayList( charger, energyCell, craftingBlock, craftingMonitor );
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStack( final IDataAccessor accessor, final IPluginConfig config )
|
||||
{
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void appendHead(List<ITextComponent> currentToolTip, final IDataAccessor accessor, final IPluginConfig config )
|
||||
{
|
||||
for( final BaseWailaDataProvider provider : this.providers )
|
||||
{
|
||||
provider.appendHead(currentToolTip, accessor, config);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void appendBody( List<ITextComponent> currentToolTip, final IDataAccessor accessor, final IPluginConfig config )
|
||||
{
|
||||
for( final BaseWailaDataProvider provider : this.providers )
|
||||
{
|
||||
provider.appendBody(currentToolTip, accessor, config);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void appendTail( List<ITextComponent> currentToolTip, final IDataAccessor accessor, final IPluginConfig config )
|
||||
{
|
||||
for( final BaseWailaDataProvider provider : this.providers )
|
||||
{
|
||||
provider.appendTail(currentToolTip, accessor, config);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void appendServerData(CompoundNBT tag, ServerPlayerEntity player, World world, TileEntity te) {
|
||||
|
||||
for( final BaseWailaDataProvider provider : this.providers )
|
||||
{
|
||||
provider.appendServerData(tag, player, world, te);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* 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.integration.modules.waila;
|
||||
|
||||
|
||||
import mcp.mobius.waila.api.*;
|
||||
import appeng.tile.AEBaseTile;
|
||||
|
||||
@WailaPlugin
|
||||
public class WailaModule implements IWailaPlugin
|
||||
{
|
||||
|
||||
public void register( final IRegistrar registrar )
|
||||
{
|
||||
final PartWailaDataProvider partHost = new PartWailaDataProvider();
|
||||
|
||||
registrar.registerStackProvider( partHost, AEBaseTile.class );
|
||||
registrar.registerComponentProvider( partHost, TooltipPosition.BODY, AEBaseTile.class );
|
||||
registrar.registerBlockDataProvider( partHost, AEBaseTile.class );
|
||||
|
||||
final TileWailaDataProvider tile = new TileWailaDataProvider();
|
||||
registrar.registerComponentProvider( tile, TooltipPosition.BODY, AEBaseTile.class );
|
||||
registrar.registerBlockDataProvider( tile, AEBaseTile.class );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* 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.integration.modules.waila.part;
|
||||
|
||||
|
||||
import appeng.api.parts.IPart;
|
||||
import mcp.mobius.waila.api.IDataAccessor;
|
||||
import mcp.mobius.waila.api.IPluginConfig;
|
||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* Default implementation of {@link appeng.integration.modules.waila.part.IPartWailaDataProvider}
|
||||
*
|
||||
* @author thatsIch
|
||||
* @version rv2
|
||||
* @since rv2
|
||||
*/
|
||||
public abstract class BasePartWailaDataProvider implements IPartWailaDataProvider
|
||||
{
|
||||
@Override
|
||||
public ItemStack getStack( final IPart part, final IPluginConfig config, final ItemStack partStack )
|
||||
{
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void appendHead(final IPart part, final List<ITextComponent> tooltip, final IDataAccessor accessor, final IPluginConfig config )
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void appendBody(final IPart part, final List<ITextComponent> tooltip, final IDataAccessor accessor, final IPluginConfig config )
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void appendTail(final IPart part, final List<ITextComponent> tooltip, final IDataAccessor accessor, final IPluginConfig config )
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void appendServerData(ServerPlayerEntity player, IPart part, TileEntity te, CompoundNBT tag, World world, BlockPos pos) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,153 @@
|
||||
/*
|
||||
* 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.integration.modules.waila.part;
|
||||
|
||||
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.core.localization.WailaText;
|
||||
import appeng.parts.networking.PartCableSmart;
|
||||
import appeng.parts.networking.PartDenseCableSmart;
|
||||
import it.unimi.dsi.fastutil.objects.Object2ByteMap;
|
||||
import it.unimi.dsi.fastutil.objects.Object2ByteOpenHashMap;
|
||||
import mcp.mobius.waila.api.IDataAccessor;
|
||||
import mcp.mobius.waila.api.IPluginConfig;
|
||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* Channel-information provider for WAILA
|
||||
*
|
||||
* @author thatsIch
|
||||
* @version rv2
|
||||
* @since rv2
|
||||
*/
|
||||
public final class ChannelWailaDataProvider extends BasePartWailaDataProvider
|
||||
{
|
||||
/**
|
||||
* Channel key used for the transferred {@link net.minecraft.nbt.CompoundNBT}
|
||||
*/
|
||||
private static final String ID_USED_CHANNELS = "usedChannels";
|
||||
|
||||
/**
|
||||
* Used cache for channels if the channel was not transmitted through the server.
|
||||
* <p/>
|
||||
* This is useful, when a player just started to look at a tile and thus just requested the new information from the
|
||||
* server.
|
||||
* <p/>
|
||||
* The cache will be updated from the server.
|
||||
*/
|
||||
private final Object2ByteMap<IPart> cache = new Object2ByteOpenHashMap<>();
|
||||
|
||||
/**
|
||||
* Adds the used and max channel to the tool tip
|
||||
*
|
||||
* @param part being looked at part
|
||||
* @param tooltip current tool tip
|
||||
* @param accessor wrapper for various world information
|
||||
* @param config config to react to various settings
|
||||
*/
|
||||
@Override
|
||||
public void appendBody(final IPart part, final List<ITextComponent> tooltip, final IDataAccessor accessor, final IPluginConfig config )
|
||||
{
|
||||
if( part instanceof PartCableSmart || part instanceof PartDenseCableSmart )
|
||||
{
|
||||
final CompoundNBT tag = accessor.getServerData();
|
||||
|
||||
final byte usedChannels = this.getUsedChannels( part, tag, this.cache );
|
||||
|
||||
if( usedChannels >= 0 )
|
||||
{
|
||||
final byte maxChannels = (byte) ( ( part instanceof PartDenseCableSmart ) ? 32 : 8 );
|
||||
|
||||
final ITextComponent formattedToolTip = WailaText.Channels.textComponent(usedChannels, maxChannels);
|
||||
tooltip.add( formattedToolTip );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines the source of the channel.
|
||||
* <p/>
|
||||
* If the client received information of the channels on the server, they are used, else if the cache contains a
|
||||
* previous stored value, this will be used. Default value is 0.
|
||||
*
|
||||
* @param part part to be looked at
|
||||
* @param tag tag maybe containing the channel information
|
||||
* @param cache cache with previous knowledge
|
||||
*
|
||||
* @return used channels on the cable
|
||||
*/
|
||||
private byte getUsedChannels( final IPart part, final CompoundNBT tag, final Object2ByteMap<IPart> cache )
|
||||
{
|
||||
final byte usedChannels;
|
||||
|
||||
if( tag.contains( ID_USED_CHANNELS ) )
|
||||
{
|
||||
usedChannels = tag.getByte( ID_USED_CHANNELS );
|
||||
this.cache.put( part, usedChannels );
|
||||
}
|
||||
else if( this.cache.containsKey( part ) )
|
||||
{
|
||||
usedChannels = this.cache.get( part );
|
||||
}
|
||||
else
|
||||
{
|
||||
usedChannels = -1;
|
||||
}
|
||||
|
||||
return usedChannels;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called on server to transfer information from server to client.
|
||||
* <p/>
|
||||
* If the part is a cable, it writes the channel information in the {@code #tag} using the {@code ID_USED_CHANNELS}
|
||||
* key.
|
||||
*
|
||||
* @param player player looking at the part
|
||||
* @param part part being looked at
|
||||
* @param te host of the part
|
||||
* @param tag transferred tag which is send to the client
|
||||
* @param world world of the part
|
||||
* @param pos pos of the part
|
||||
*/
|
||||
@Override
|
||||
public void appendServerData(ServerPlayerEntity player, IPart part, TileEntity te, CompoundNBT tag, World world, BlockPos pos) {
|
||||
if( part instanceof PartCableSmart || part instanceof PartDenseCableSmart )
|
||||
{
|
||||
final CompoundNBT tempTag = new CompoundNBT();
|
||||
|
||||
part.writeToNBT( tempTag );
|
||||
|
||||
if( tempTag.contains( ID_USED_CHANNELS ) )
|
||||
{
|
||||
final byte usedChannels = tempTag.getByte( ID_USED_CHANNELS );
|
||||
|
||||
tag.putByte( ID_USED_CHANNELS, usedChannels );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* 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.integration.modules.waila.part;
|
||||
|
||||
|
||||
import appeng.api.parts.IPart;
|
||||
import mcp.mobius.waila.api.IDataAccessor;
|
||||
import mcp.mobius.waila.api.IPluginConfig;
|
||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* An abstraction layer of the {@link appeng.integration.modules.waila.part.IPartWailaDataProvider} for
|
||||
* {@link appeng.api.parts.IPart}.
|
||||
*
|
||||
* @author thatsIch
|
||||
* @version rv2
|
||||
* @since rv2
|
||||
*/
|
||||
public interface IPartWailaDataProvider
|
||||
{
|
||||
ItemStack getStack( IPart part, IPluginConfig config, ItemStack partStack );
|
||||
|
||||
void appendHead(IPart part, List<ITextComponent> tooltip, IDataAccessor accessor, IPluginConfig config );
|
||||
|
||||
void appendBody(IPart part, List<ITextComponent> tooltip, IDataAccessor accessor, IPluginConfig config );
|
||||
|
||||
void appendTail(IPart part, List<ITextComponent> tooltip, IDataAccessor accessor, IPluginConfig config );
|
||||
|
||||
void appendServerData(ServerPlayerEntity player, IPart part, TileEntity te, CompoundNBT tag, World world, BlockPos pos );
|
||||
}
|
||||
@@ -0,0 +1,166 @@
|
||||
/*
|
||||
* 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.integration.modules.waila.part;
|
||||
|
||||
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.core.localization.WailaText;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.parts.p2p.PartP2PTunnel;
|
||||
import appeng.util.Platform;
|
||||
import com.google.common.collect.Iterators;
|
||||
import mcp.mobius.waila.api.IDataAccessor;
|
||||
import mcp.mobius.waila.api.IPluginConfig;
|
||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* Provides information about a P2P tunnel to WAILA.
|
||||
*/
|
||||
public final class P2PStateWailaDataProvider extends BasePartWailaDataProvider
|
||||
{
|
||||
|
||||
private static final int STATE_UNLINKED = 0;
|
||||
private static final int STATE_OUTPUT = 1;
|
||||
private static final int STATE_INPUT = 2;
|
||||
public static final String TAG_P2P_STATE = "p2p_state";
|
||||
public static final String TAG_P2P_FREQUENCY = "p2p_frequency";
|
||||
|
||||
/**
|
||||
* Adds state to the tooltip
|
||||
*
|
||||
* @param part part with state
|
||||
* @param tooltip to be added to tooltip
|
||||
* @param accessor wrapper for various information
|
||||
* @param config config settings
|
||||
*/
|
||||
@Override
|
||||
public void appendBody(final IPart part, final List<ITextComponent> tooltip, final IDataAccessor accessor, final IPluginConfig config )
|
||||
{
|
||||
if( part instanceof PartP2PTunnel )
|
||||
{
|
||||
CompoundNBT nbtData = accessor.getServerData();
|
||||
if( nbtData.contains( TAG_P2P_STATE ) )
|
||||
{
|
||||
int[] stateArr = nbtData.getIntArray( TAG_P2P_STATE );
|
||||
if( stateArr.length == 2 )
|
||||
{
|
||||
int state = stateArr[0];
|
||||
int outputs = stateArr[1];
|
||||
|
||||
switch( state )
|
||||
{
|
||||
case STATE_UNLINKED:
|
||||
tooltip.add( WailaText.P2PUnlinked.textComponent() );
|
||||
break;
|
||||
case STATE_OUTPUT:
|
||||
tooltip.add( WailaText.P2POutput.textComponent() );
|
||||
break;
|
||||
case STATE_INPUT:
|
||||
tooltip.add( getOutputText( outputs ) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
final short freq = nbtData.getShort( TAG_P2P_FREQUENCY );
|
||||
final String freqTooltip = Platform.p2p().toHexString( freq );
|
||||
tooltip.add( new TranslationTextComponent( "gui.tooltips.appliedenergistics2.P2PFrequency", freqTooltip ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void appendServerData(ServerPlayerEntity player, IPart part, TileEntity te, CompoundNBT tag, World world, BlockPos pos) {
|
||||
if( part instanceof PartP2PTunnel )
|
||||
{
|
||||
final PartP2PTunnel<?> tunnel = (PartP2PTunnel<?>) part;
|
||||
|
||||
if( !tunnel.isPowered() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Frquency
|
||||
final short frequency = tunnel.getFrequency();
|
||||
tag.putShort( TAG_P2P_FREQUENCY, frequency );
|
||||
|
||||
// The default state
|
||||
int state = STATE_UNLINKED;
|
||||
int outputCount = 0;
|
||||
|
||||
if( !tunnel.isOutput() )
|
||||
{
|
||||
outputCount = getOutputCount( tunnel );
|
||||
if( outputCount > 0 )
|
||||
{
|
||||
// Only set it to INPUT if we know there are any outputs
|
||||
state = STATE_INPUT;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
PartP2PTunnel<?> input = tunnel.getInput();
|
||||
if( input != null )
|
||||
{
|
||||
state = STATE_OUTPUT;
|
||||
}
|
||||
}
|
||||
|
||||
tag.putIntArray( TAG_P2P_STATE, new int[] {
|
||||
state,
|
||||
outputCount
|
||||
} );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private static int getOutputCount( PartP2PTunnel<?> tunnel )
|
||||
{
|
||||
try
|
||||
{
|
||||
return Iterators.size( tunnel.getOutputs().iterator() );
|
||||
}
|
||||
catch( GridAccessException e )
|
||||
{
|
||||
// Well... unknown size it is!
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
private static ITextComponent getOutputText( int outputs )
|
||||
{
|
||||
if( outputs <= 1 )
|
||||
{
|
||||
return WailaText.P2PInputOneOutput.textComponent();
|
||||
}
|
||||
else
|
||||
{
|
||||
return WailaText.P2PInputManyOutputs.textComponent(outputs);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2015, 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.integration.modules.waila.part;
|
||||
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.parts.IPartHost;
|
||||
import appeng.api.parts.SelectedPart;
|
||||
|
||||
|
||||
/**
|
||||
* Accessor to access specific parts for WAILA
|
||||
*
|
||||
* @author thatsIch
|
||||
* @version rv2
|
||||
* @since rv2
|
||||
*/
|
||||
public final class PartAccessor
|
||||
{
|
||||
/**
|
||||
* Hits a {@link IPartHost} with {@link BlockPos}.
|
||||
* <p/>
|
||||
* You can derive the looked at {@link IPart} by doing that. If a facade is being looked at, it is
|
||||
* defined as being absent.
|
||||
*
|
||||
* @param te being looked at {@link TileEntity}
|
||||
* @param rtr type of ray-trace
|
||||
*
|
||||
* @return maybe the looked at {@link IPart}
|
||||
*/
|
||||
public Optional<IPart> getMaybePart( final TileEntity te, final RayTraceResult rtr )
|
||||
{
|
||||
if( te instanceof IPartHost && rtr instanceof BlockRayTraceResult)
|
||||
{
|
||||
BlockPos pos = ((BlockRayTraceResult) rtr).getPos();
|
||||
final Vec3d position = rtr.getHitVec().add( -pos.getX(), -pos.getY(), -pos.getZ() );
|
||||
final IPartHost host = (IPartHost) te;
|
||||
final SelectedPart sp = host.selectPart( position );
|
||||
|
||||
if( sp.part != null )
|
||||
{
|
||||
return Optional.of( sp.part );
|
||||
}
|
||||
}
|
||||
|
||||
return Optional.empty();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2015, 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.integration.modules.waila.part;
|
||||
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import mcp.mobius.waila.api.IPluginConfig;
|
||||
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.parts.PartItemStack;
|
||||
|
||||
|
||||
/**
|
||||
* Part ItemStack provider for WAILA
|
||||
*
|
||||
* @author TheJulianJES
|
||||
* @version rv2
|
||||
* @since rv2
|
||||
*/
|
||||
public class PartStackWailaDataProvider extends BasePartWailaDataProvider
|
||||
{
|
||||
|
||||
@Override
|
||||
public ItemStack getStack( final IPart part, final IPluginConfig config, ItemStack partStack )
|
||||
{
|
||||
partStack = part.getItemStack( PartItemStack.PICK );
|
||||
return partStack;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* 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.integration.modules.waila.part;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mcp.mobius.waila.api.IPluginConfig;
|
||||
import mcp.mobius.waila.api.IDataAccessor;
|
||||
|
||||
import appeng.api.implementations.IPowerChannelState;
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.core.localization.WailaText;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
|
||||
|
||||
/**
|
||||
* Power state provider for WAILA
|
||||
*
|
||||
* @author thatsIch
|
||||
* @version rv2
|
||||
* @since rv2
|
||||
*/
|
||||
public final class PowerStateWailaDataProvider extends BasePartWailaDataProvider
|
||||
{
|
||||
/**
|
||||
* Adds state to the tooltip
|
||||
*
|
||||
* @param part part with state
|
||||
* @param tooltip to be added to tooltip
|
||||
* @param accessor wrapper for various information
|
||||
* @param config config settings
|
||||
*/
|
||||
@Override
|
||||
public void appendBody(final IPart part, final List<ITextComponent> tooltip, final IDataAccessor accessor, final IPluginConfig config )
|
||||
{
|
||||
if( part instanceof IPowerChannelState )
|
||||
{
|
||||
final IPowerChannelState state = (IPowerChannelState) part;
|
||||
|
||||
tooltip.add( this.getToolTip( state.isActive(), state.isPowered() ) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the corresponding tool tip for different values of {@code #isActive} and {@code #isPowered}
|
||||
*
|
||||
* @param isActive if part is active
|
||||
* @param isPowered if part is powered
|
||||
*
|
||||
* @return tooltip of the state
|
||||
*/
|
||||
private ITextComponent getToolTip( final boolean isActive, final boolean isPowered )
|
||||
{
|
||||
if( isActive && isPowered )
|
||||
{
|
||||
return WailaText.DeviceOnline.textComponent();
|
||||
}
|
||||
else if( isPowered )
|
||||
{
|
||||
return WailaText.DeviceMissingChannel.textComponent();
|
||||
}
|
||||
else
|
||||
{
|
||||
return WailaText.DeviceOffline.textComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
* 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.integration.modules.waila.part;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mcp.mobius.waila.api.IPluginConfig;
|
||||
import mcp.mobius.waila.api.IDataAccessor;
|
||||
|
||||
import appeng.api.implementations.parts.IPartStorageMonitor;
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.core.localization.WailaText;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
|
||||
|
||||
/**
|
||||
* Storage monitor provider for WAILA
|
||||
*
|
||||
* @author thatsIch
|
||||
* @version rv2
|
||||
* @since rv2
|
||||
*/
|
||||
public final class StorageMonitorWailaDataProvider extends BasePartWailaDataProvider
|
||||
{
|
||||
/**
|
||||
* Displays the stack if present and if the monitor is locked.
|
||||
* Can handle fluids and items.
|
||||
*
|
||||
* @param part maybe storage monitor
|
||||
* @param tooltip to be written to tooltip
|
||||
* @param accessor information wrapper
|
||||
* @param config config option
|
||||
*/
|
||||
@Override
|
||||
public void appendBody(final IPart part, final List<ITextComponent> tooltip, final IDataAccessor accessor, final IPluginConfig config )
|
||||
{
|
||||
if( part instanceof IPartStorageMonitor )
|
||||
{
|
||||
final IPartStorageMonitor monitor = (IPartStorageMonitor) part;
|
||||
|
||||
final IAEStack<?> displayed = monitor.getDisplayed();
|
||||
final boolean isLocked = monitor.isLocked();
|
||||
|
||||
// TODO: generalize
|
||||
if( displayed instanceof IAEItemStack )
|
||||
{
|
||||
final IAEItemStack ais = (IAEItemStack) displayed;
|
||||
tooltip.add( WailaText.Showing.textComponent().appendText(": ").appendSibling(ais.asItemStackRepresentation().getDisplayName()) );
|
||||
}
|
||||
else if( displayed instanceof IAEFluidStack )
|
||||
{
|
||||
final IAEFluidStack ais = (IAEFluidStack) displayed;
|
||||
tooltip.add( WailaText.Showing.textComponent().appendText(": ").appendSibling(ais.getFluid().getAttributes().getDisplayName( ais.getFluidStack() )) );
|
||||
}
|
||||
|
||||
tooltip.add( ( isLocked ) ? WailaText.Locked.textComponent() : WailaText.Unlocked.textComponent() );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
/*
|
||||
* 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.integration.modules.waila.part;
|
||||
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
|
||||
/**
|
||||
* Tracer for players hitting blocks
|
||||
*
|
||||
* @author thatsIch
|
||||
* @version rv2
|
||||
* @since rv2
|
||||
*/
|
||||
public final class Tracer
|
||||
{
|
||||
/**
|
||||
* Trace view of players to blocks.
|
||||
* Ignore all which are out of reach.
|
||||
*
|
||||
* @param world word of block
|
||||
* @param player player viewing block
|
||||
* @param pos pos of block
|
||||
*
|
||||
* @return trace movement. Can be null
|
||||
*/
|
||||
public RayTraceResult retraceBlock(final World world, final PlayerEntity player, BlockPos pos )
|
||||
{
|
||||
BlockState blockState = world.getBlockState( pos );
|
||||
|
||||
final Vec3d headVec = this.getCorrectedHeadVec( player );
|
||||
final Vec3d lookVec = player.getLook( 1.0F );
|
||||
final double reach = this.getBlockReachDistance_server( player );
|
||||
final Vec3d endVec = headVec.add( lookVec.x * reach, lookVec.y * reach, lookVec.z * reach );
|
||||
|
||||
return blockState.getCollisionShape(world, pos).rayTrace( headVec, endVec, pos );
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the view point of a player
|
||||
*
|
||||
* @param player player with head
|
||||
*
|
||||
* @return view point of player
|
||||
*/
|
||||
private Vec3d getCorrectedHeadVec( final PlayerEntity player )
|
||||
{
|
||||
double x = player.getPosX();
|
||||
double y = player.getPosY();
|
||||
double z = player.getPosZ();
|
||||
|
||||
if( player.world.isRemote )
|
||||
{
|
||||
// compatibility with eye height changing mods
|
||||
y += player.getEyeHeight() - player.getEyeHeight();
|
||||
}
|
||||
else
|
||||
{
|
||||
y += player.getEyeHeight();
|
||||
if( player instanceof ServerPlayerEntity && player.isSneaking() )
|
||||
{
|
||||
y -= 0.08;
|
||||
}
|
||||
}
|
||||
return new Vec3d( x, y, z );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param player multi-player player
|
||||
*
|
||||
* @return block reach distance of player
|
||||
*/
|
||||
private double getBlockReachDistance_server( final PlayerEntity player )
|
||||
{
|
||||
return player.getAttribute(net.minecraft.entity.player.PlayerEntity.REACH_DISTANCE).getValue();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* 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.integration.modules.waila.tile;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
import mcp.mobius.waila.api.IPluginConfig;
|
||||
import mcp.mobius.waila.api.IDataAccessor;
|
||||
|
||||
import appeng.core.localization.WailaText;
|
||||
import appeng.integration.modules.waila.BaseWailaDataProvider;
|
||||
import appeng.tile.misc.TileCharger;
|
||||
|
||||
|
||||
/**
|
||||
* Charger provider for WAILA
|
||||
*
|
||||
* @author thatsIch
|
||||
* @version rv2
|
||||
* @since rv2
|
||||
*/
|
||||
public final class ChargerWailaDataProvider extends BaseWailaDataProvider
|
||||
{
|
||||
|
||||
@Override
|
||||
public void appendBody(List<ITextComponent> tooltip, IDataAccessor accessor, IPluginConfig config) {
|
||||
|
||||
final TileEntity te = accessor.getTileEntity();
|
||||
if( te instanceof TileCharger )
|
||||
{
|
||||
final TileCharger charger = (TileCharger) te;
|
||||
final IItemHandler chargerInventory = charger.getInternalInventory();
|
||||
final ItemStack chargingItem = chargerInventory.getStackInSlot( 0 );
|
||||
|
||||
if( !chargingItem.isEmpty() )
|
||||
{
|
||||
final ITextComponent currentInventory = chargingItem.getDisplayName();
|
||||
final PlayerEntity player = accessor.getPlayer();
|
||||
|
||||
tooltip.add( WailaText.Contains.textComponent().appendText(": ")
|
||||
.appendSibling(currentInventory) );
|
||||
ITooltipFlag.TooltipFlags tooltipFlag = Minecraft
|
||||
.getInstance().gameSettings.advancedItemTooltips ? ITooltipFlag.TooltipFlags.ADVANCED : ITooltipFlag.TooltipFlags.NORMAL;
|
||||
chargingItem.getItem().addInformation( chargingItem, player.world, tooltip, tooltipFlag );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* 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.integration.modules.waila.tile;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import mcp.mobius.waila.api.IPluginConfig;
|
||||
import mcp.mobius.waila.api.IDataAccessor;
|
||||
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.core.localization.WailaText;
|
||||
import appeng.integration.modules.waila.BaseWailaDataProvider;
|
||||
import appeng.tile.crafting.TileCraftingMonitorTile;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
|
||||
|
||||
/**
|
||||
* Crafting-monitor provider for WAILA
|
||||
*
|
||||
* @author thatsIch
|
||||
* @version rv2
|
||||
* @since rv2
|
||||
*/
|
||||
public final class CraftingMonitorWailaDataProvider extends BaseWailaDataProvider
|
||||
{
|
||||
|
||||
@Override
|
||||
public void appendBody(List<ITextComponent> tooltip, IDataAccessor accessor, IPluginConfig config) {
|
||||
final TileEntity te = accessor.getTileEntity();
|
||||
if( te instanceof TileCraftingMonitorTile )
|
||||
{
|
||||
final TileCraftingMonitorTile monitor = (TileCraftingMonitorTile) te;
|
||||
final IAEItemStack displayStack = monitor.getJobProgress();
|
||||
|
||||
if( displayStack != null )
|
||||
{
|
||||
final ITextComponent currentCrafting = displayStack.asItemStackRepresentation().getDisplayName();
|
||||
|
||||
tooltip.add( WailaText.Crafting.textComponent().appendText(": ").appendSibling(currentCrafting) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* 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.integration.modules.waila.tile;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import mcp.mobius.waila.api.IPluginConfig;
|
||||
import mcp.mobius.waila.api.IDataAccessor;
|
||||
|
||||
import appeng.api.implementations.IPowerChannelState;
|
||||
import appeng.core.localization.WailaText;
|
||||
import appeng.integration.modules.waila.BaseWailaDataProvider;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
|
||||
|
||||
/**
|
||||
* Power state provider for WAILA
|
||||
*
|
||||
* @author thatsIch
|
||||
* @version rv2
|
||||
* @since rv2
|
||||
*/
|
||||
public final class PowerStateWailaDataProvider extends BaseWailaDataProvider
|
||||
{
|
||||
|
||||
@Override
|
||||
public void appendBody(List<ITextComponent> tooltip, IDataAccessor accessor, IPluginConfig config) {
|
||||
final TileEntity te = accessor.getTileEntity();
|
||||
|
||||
if( te instanceof IPowerChannelState )
|
||||
{
|
||||
final IPowerChannelState state = (IPowerChannelState) te;
|
||||
|
||||
final boolean isActive = state.isActive();
|
||||
final boolean isPowered = state.isPowered();
|
||||
|
||||
if( isActive && isPowered )
|
||||
{
|
||||
tooltip.add( WailaText.DeviceOnline.textComponent() );
|
||||
}
|
||||
else if( isPowered )
|
||||
{
|
||||
tooltip.add( WailaText.DeviceMissingChannel.textComponent() );
|
||||
}
|
||||
else
|
||||
{
|
||||
tooltip.add( WailaText.DeviceOffline.textComponent() );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+151
@@ -0,0 +1,151 @@
|
||||
/*
|
||||
* 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.integration.modules.waila.tile;
|
||||
|
||||
|
||||
import appeng.api.networking.energy.IAEPowerStorage;
|
||||
import appeng.core.localization.WailaText;
|
||||
import appeng.integration.modules.waila.BaseWailaDataProvider;
|
||||
import appeng.util.Platform;
|
||||
import it.unimi.dsi.fastutil.objects.Object2LongMap;
|
||||
import it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap;
|
||||
import mcp.mobius.waila.api.IDataAccessor;
|
||||
import mcp.mobius.waila.api.IPluginConfig;
|
||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* Power storage provider for WAILA
|
||||
*
|
||||
* @author thatsIch
|
||||
* @version rv2
|
||||
* @since rv2
|
||||
*/
|
||||
public final class PowerStorageWailaDataProvider extends BaseWailaDataProvider
|
||||
{
|
||||
/**
|
||||
* Power key used for the transferred {@link net.minecraft.nbt.CompoundNBT}
|
||||
*/
|
||||
private static final String ID_CURRENT_POWER = "currentPower";
|
||||
|
||||
/**
|
||||
* Used cache for power if the power was not transmitted through the server.
|
||||
* <p/>
|
||||
* This is useful, when a player just started to look at a tile and thus just requested the new information from the
|
||||
* server.
|
||||
* <p/>
|
||||
* The cache will be updated from the server.
|
||||
*/
|
||||
private final Object2LongMap<TileEntity> cache = new Object2LongOpenHashMap<>();
|
||||
|
||||
@Override
|
||||
public void appendBody(List<ITextComponent> tooltip, IDataAccessor accessor, IPluginConfig config) {
|
||||
// Removes RF tooltip on WAILA 1.5.9+
|
||||
// FIXME ( (ITaggedList<String, String>) tooltip ).removeEntries( "RFEnergyStorage" );
|
||||
|
||||
final TileEntity te = accessor.getTileEntity();
|
||||
if( te instanceof IAEPowerStorage )
|
||||
{
|
||||
final IAEPowerStorage storage = (IAEPowerStorage) te;
|
||||
|
||||
final double maxPower = storage.getAEMaxPower();
|
||||
if( maxPower > 0 )
|
||||
{
|
||||
final CompoundNBT tag = accessor.getServerData();
|
||||
|
||||
final long internalCurrentPower = this.getInternalCurrentPower( tag, te );
|
||||
|
||||
if( internalCurrentPower >= 0 )
|
||||
{
|
||||
final long internalMaxPower = (long) ( 100 * maxPower );
|
||||
|
||||
final String formatCurrentPower = Platform.formatPowerLong( internalCurrentPower, false );
|
||||
final String formatMaxPower = Platform.formatPowerLong( internalMaxPower, false );
|
||||
|
||||
tooltip.add( WailaText.Contains.textComponent().appendText(": " + formatCurrentPower + " / " + formatMaxPower));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called on server to transfer information from server to client.
|
||||
* <p/>
|
||||
* If the {@link net.minecraft.tileentity.TileEntity} is a {@link appeng.api.networking.energy.IAEPowerStorage}, it
|
||||
* writes the power information to the {@code #tag} using the {@code #ID_CURRENT_POWER} key.
|
||||
*
|
||||
* @param serverPlayerEntity player looking at the power storage
|
||||
* @param te power storage
|
||||
* @param tag transferred tag which is send to the client
|
||||
* @param world world of the power storage
|
||||
*/
|
||||
@Override
|
||||
public void appendServerData(CompoundNBT tag, ServerPlayerEntity serverPlayerEntity, World world, TileEntity te)
|
||||
{
|
||||
if( te instanceof IAEPowerStorage )
|
||||
{
|
||||
final IAEPowerStorage storage = (IAEPowerStorage) te;
|
||||
|
||||
if( storage.getAEMaxPower() > 0 )
|
||||
{
|
||||
final long internalCurrentPower = (long) ( 100 * storage.getAECurrentPower() );
|
||||
|
||||
tag.putLong( ID_CURRENT_POWER, internalCurrentPower );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines the current power.
|
||||
* <p/>
|
||||
* If the client received power information on the server, they are used, else if the cache contains a previous
|
||||
* stored value, this will be used. Default value is 0.
|
||||
*
|
||||
* @param te te to be looked at
|
||||
* @param tag tag maybe containing the channel information
|
||||
*
|
||||
* @return used channels on the cable
|
||||
*/
|
||||
private long getInternalCurrentPower( final CompoundNBT tag, final TileEntity te )
|
||||
{
|
||||
final long internalCurrentPower;
|
||||
|
||||
if( tag.contains( ID_CURRENT_POWER ) )
|
||||
{
|
||||
internalCurrentPower = tag.getLong( ID_CURRENT_POWER );
|
||||
this.cache.put( te, internalCurrentPower );
|
||||
}
|
||||
else if( this.cache.containsKey( te ) )
|
||||
{
|
||||
internalCurrentPower = this.cache.get( te );
|
||||
}
|
||||
else
|
||||
{
|
||||
internalCurrentPower = -1;
|
||||
}
|
||||
|
||||
return internalCurrentPower;
|
||||
}
|
||||
}
|
||||
@@ -92,7 +92,9 @@ public final class ItemMaterial extends AEBaseItem implements IStorageComponent,
|
||||
if( materialType == MaterialType.NAME_PRESS )
|
||||
{
|
||||
final CompoundNBT c = stack.getOrCreateTag();
|
||||
lines.add( new StringTextComponent( c.getString( "InscribeName" ) ) );
|
||||
if (c.contains("InscriberName")) {
|
||||
lines.add(new StringTextComponent(c.getString("InscribeName")));
|
||||
}
|
||||
}
|
||||
|
||||
final Upgrades u = this.getType( stack );
|
||||
|
||||
@@ -36,86 +36,86 @@ import appeng.entity.EntitySingularity;
|
||||
|
||||
public enum MaterialType
|
||||
{
|
||||
CERTUS_QUARTZ_CRYSTAL("material_certus_quartz_crystal", EnumSet.of( AEFeature.CERTUS ), "crystalCertusQuartz" ),
|
||||
CERTUS_QUARTZ_CRYSTAL_CHARGED("material_certus_quartz_crystal_charged", EnumSet.of( AEFeature.CERTUS ), EntityChargedQuartz.class ),
|
||||
CERTUS_QUARTZ_CRYSTAL("certus_quartz_crystal", EnumSet.of( AEFeature.CERTUS ), "crystalCertusQuartz" ),
|
||||
CERTUS_QUARTZ_CRYSTAL_CHARGED("charged_certus_quartz_crystal", EnumSet.of( AEFeature.CERTUS ), EntityChargedQuartz.class ),
|
||||
|
||||
CERTUS_QUARTZ_DUST("material_certus_quartz_dust", EnumSet.of( AEFeature.DUSTS, AEFeature.CERTUS ), "dustCertusQuartz" ),
|
||||
NETHER_QUARTZ_DUST("material_nether_quartz_dust", EnumSet.of( AEFeature.DUSTS ), "dustNetherQuartz,dustQuartz" ),
|
||||
FLOUR("material_flour", EnumSet.of( AEFeature.FLOUR ), "dustWheat" ),
|
||||
GOLD_DUST("material_gold_dust", EnumSet.of( AEFeature.DUSTS ), "dustGold" ),
|
||||
IRON_DUST("material_iron_dust", EnumSet.of( AEFeature.DUSTS ), "dustIron" ),
|
||||
CERTUS_QUARTZ_DUST("certus_quartz_dust", EnumSet.of( AEFeature.DUSTS, AEFeature.CERTUS ), "dustCertusQuartz" ),
|
||||
NETHER_QUARTZ_DUST("nether_quartz_dust", EnumSet.of( AEFeature.DUSTS ), "dustNetherQuartz,dustQuartz" ),
|
||||
FLOUR("flour", EnumSet.of( AEFeature.FLOUR ), "dustWheat" ),
|
||||
GOLD_DUST("gold_dust", EnumSet.of( AEFeature.DUSTS ), "dustGold" ),
|
||||
IRON_DUST("iron_dust", EnumSet.of( AEFeature.DUSTS ), "dustIron" ),
|
||||
|
||||
SILICON("material_silicon", EnumSet.of( AEFeature.SILICON ), "itemSilicon" ),
|
||||
MATTER_BALL("material_matter_ball", EnumSet.of( AEFeature.MATTER_BALL ) ),
|
||||
SILICON("silicon", EnumSet.of( AEFeature.SILICON ), "itemSilicon" ),
|
||||
MATTER_BALL("matter_ball", EnumSet.of( AEFeature.MATTER_BALL ) ),
|
||||
|
||||
FLUIX_CRYSTAL("material_fluix_crystal", EnumSet.of( AEFeature.FLUIX ), "crystalFluix" ),
|
||||
FLUIX_DUST("material_fluix_dust", EnumSet.of( AEFeature.FLUIX, AEFeature.DUSTS ), "dustFluix" ),
|
||||
FLUIX_PEARL("material_fluix_pearl", EnumSet.of( AEFeature.FLUIX ), "pearlFluix" ),
|
||||
FLUIX_CRYSTAL("fluix_crystal", EnumSet.of( AEFeature.FLUIX ), "crystalFluix" ),
|
||||
FLUIX_DUST("fluix_dust", EnumSet.of( AEFeature.FLUIX, AEFeature.DUSTS ), "dustFluix" ),
|
||||
FLUIX_PEARL("fluix_pearl", EnumSet.of( AEFeature.FLUIX ), "pearlFluix" ),
|
||||
|
||||
PURIFIED_CERTUS_QUARTZ_CRYSTAL("material_purified_certus_quartz_crystal", EnumSet.of( AEFeature.CERTUS,
|
||||
PURIFIED_CERTUS_QUARTZ_CRYSTAL("purified_certus_quartz_crystal", EnumSet.of( AEFeature.CERTUS,
|
||||
AEFeature.PURE_CRYSTALS ), "crystalPureCertusQuartz" ),
|
||||
PURIFIED_NETHER_QUARTZ_CRYSTAL("material_purified_nether_quartz_crystal", EnumSet.of( AEFeature.PURE_CRYSTALS ), "crystalPureNetherQuartz" ),
|
||||
PURIFIED_FLUIX_CRYSTAL("material_purified_fluix_crystal", EnumSet.of( AEFeature.FLUIX, AEFeature.PURE_CRYSTALS ), "crystalPureFluix" ),
|
||||
PURIFIED_NETHER_QUARTZ_CRYSTAL("purified_nether_quartz_crystal", EnumSet.of( AEFeature.PURE_CRYSTALS ), "crystalPureNetherQuartz" ),
|
||||
PURIFIED_FLUIX_CRYSTAL("purified_fluix_crystal", EnumSet.of( AEFeature.FLUIX, AEFeature.PURE_CRYSTALS ), "crystalPureFluix" ),
|
||||
|
||||
CALCULATION_PROCESSOR_PRESS("material_calculation_processor_press", EnumSet.of( AEFeature.PRESSES ) ),
|
||||
ENGINEERING_PROCESSOR_PRESS("material_engineering_processor_press", EnumSet.of( AEFeature.PRESSES ) ),
|
||||
LOGIC_PROCESSOR_PRESS("material_logic_processor_press", EnumSet.of( AEFeature.PRESSES ) ),
|
||||
CALCULATION_PROCESSOR_PRESS("calculation_processor_press", EnumSet.of( AEFeature.PRESSES ) ),
|
||||
ENGINEERING_PROCESSOR_PRESS("engineering_processor_press", EnumSet.of( AEFeature.PRESSES ) ),
|
||||
LOGIC_PROCESSOR_PRESS("logic_processor_press", EnumSet.of( AEFeature.PRESSES ) ),
|
||||
|
||||
CALCULATION_PROCESSOR_PRINT("material_calculation_processor_print", EnumSet.of( AEFeature.PRINTED_CIRCUITS ) ),
|
||||
ENGINEERING_PROCESSOR_PRINT("material_engineering_processor_print", EnumSet.of( AEFeature.PRINTED_CIRCUITS ) ),
|
||||
LOGIC_PROCESSOR_PRINT("material_logic_processor_print", EnumSet.of( AEFeature.PRINTED_CIRCUITS ) ),
|
||||
CALCULATION_PROCESSOR_PRINT("calculation_processor_print", EnumSet.of( AEFeature.PRINTED_CIRCUITS ) ),
|
||||
ENGINEERING_PROCESSOR_PRINT("engineering_processor_print", EnumSet.of( AEFeature.PRINTED_CIRCUITS ) ),
|
||||
LOGIC_PROCESSOR_PRINT("logic_processor_print", EnumSet.of( AEFeature.PRINTED_CIRCUITS ) ),
|
||||
|
||||
SILICON_PRESS("material_silicon_press", EnumSet.of( AEFeature.PRESSES ) ),
|
||||
SILICON_PRINT("material_silicon_print", EnumSet.of( AEFeature.PRINTED_CIRCUITS ) ),
|
||||
SILICON_PRESS("silicon_press", EnumSet.of( AEFeature.PRESSES ) ),
|
||||
SILICON_PRINT("silicon_print", EnumSet.of( AEFeature.PRINTED_CIRCUITS ) ),
|
||||
|
||||
NAME_PRESS("material_name_press", EnumSet.of( AEFeature.PRESSES ) ),
|
||||
NAME_PRESS("name_press", EnumSet.of( AEFeature.PRESSES ) ),
|
||||
|
||||
LOGIC_PROCESSOR("material_logic_processor", EnumSet.of( AEFeature.PROCESSORS ) ),
|
||||
CALCULATION_PROCESSOR("material_calculation_processor", EnumSet.of( AEFeature.PROCESSORS ) ),
|
||||
ENGINEERING_PROCESSOR("material_engineering_processor", EnumSet.of( AEFeature.PROCESSORS ) ),
|
||||
LOGIC_PROCESSOR("logic_processor", EnumSet.of( AEFeature.PROCESSORS ) ),
|
||||
CALCULATION_PROCESSOR("calculation_processor", EnumSet.of( AEFeature.PROCESSORS ) ),
|
||||
ENGINEERING_PROCESSOR("engineering_processor", EnumSet.of( AEFeature.PROCESSORS ) ),
|
||||
|
||||
// Basic Cards
|
||||
BASIC_CARD("material_basic_card", EnumSet.of( AEFeature.BASIC_CARDS ) ),
|
||||
CARD_REDSTONE("material_card_redstone", EnumSet.of( AEFeature.BASIC_CARDS ) ),
|
||||
CARD_CAPACITY("material_card_capacity", EnumSet.of( AEFeature.BASIC_CARDS ) ),
|
||||
BASIC_CARD("basic_card", EnumSet.of( AEFeature.BASIC_CARDS ) ),
|
||||
CARD_REDSTONE("redstone_card", EnumSet.of( AEFeature.BASIC_CARDS ) ),
|
||||
CARD_CAPACITY("capacity_card", EnumSet.of( AEFeature.BASIC_CARDS ) ),
|
||||
|
||||
// Adv Cards
|
||||
ADVANCED_CARD("material_advanced_card", EnumSet.of( AEFeature.ADVANCED_CARDS ) ),
|
||||
CARD_FUZZY("material_card_fuzzy", EnumSet.of( AEFeature.ADVANCED_CARDS ) ),
|
||||
CARD_SPEED("material_card_speed", EnumSet.of( AEFeature.ADVANCED_CARDS ) ),
|
||||
CARD_INVERTER("material_card_inverter", EnumSet.of( AEFeature.ADVANCED_CARDS ) ),
|
||||
ADVANCED_CARD("advanced_card", EnumSet.of( AEFeature.ADVANCED_CARDS ) ),
|
||||
CARD_FUZZY("fuzzy_card", EnumSet.of( AEFeature.ADVANCED_CARDS ) ),
|
||||
CARD_SPEED("speed_card", EnumSet.of( AEFeature.ADVANCED_CARDS ) ),
|
||||
CARD_INVERTER("inverter_card", EnumSet.of( AEFeature.ADVANCED_CARDS ) ),
|
||||
|
||||
CELL2_SPATIAL_PART("material_cell2_spatial_part", EnumSet.of( AEFeature.SPATIAL_IO ) ),
|
||||
CELL16_SPATIAL_PART("material_cell16_spatial_part", EnumSet.of( AEFeature.SPATIAL_IO ) ),
|
||||
CELL128_SPATIAL_PART("material_cell128_spatial_part", EnumSet.of( AEFeature.SPATIAL_IO ) ),
|
||||
CELL2_SPATIAL_PART("spatial_cell2_part", EnumSet.of( AEFeature.SPATIAL_IO ) ),
|
||||
CELL16_SPATIAL_PART("spatial_cell16_part", EnumSet.of( AEFeature.SPATIAL_IO ) ),
|
||||
CELL128_SPATIAL_PART("spatial_cell128_part", EnumSet.of( AEFeature.SPATIAL_IO ) ),
|
||||
|
||||
CELL1K_PART("material_cell1k_part", EnumSet.of( AEFeature.STORAGE_CELLS ) ),
|
||||
CELL4K_PART("material_cell4k_part", EnumSet.of( AEFeature.STORAGE_CELLS ) ),
|
||||
CELL16K_PART("material_cell16k_part", EnumSet.of( AEFeature.STORAGE_CELLS ) ),
|
||||
CELL64K_PART("material_cell64k_part", EnumSet.of( AEFeature.STORAGE_CELLS ) ),
|
||||
EMPTY_STORAGE_CELL("material_empty_storage_cell", EnumSet.of( AEFeature.STORAGE_CELLS ) ),
|
||||
CELL1K_PART("cell1k_part", EnumSet.of( AEFeature.STORAGE_CELLS ) ),
|
||||
CELL4K_PART("cell4k_part", EnumSet.of( AEFeature.STORAGE_CELLS ) ),
|
||||
CELL16K_PART("cell16k_part", EnumSet.of( AEFeature.STORAGE_CELLS ) ),
|
||||
CELL64K_PART("cell64k_part", EnumSet.of( AEFeature.STORAGE_CELLS ) ),
|
||||
EMPTY_STORAGE_CELL("empty_storage_cell", EnumSet.of( AEFeature.STORAGE_CELLS ) ),
|
||||
|
||||
WOODEN_GEAR("material_wooden_gear", EnumSet.of( AEFeature.GRIND_STONE ), "gearWood" ),
|
||||
WOODEN_GEAR("wooden_gear", EnumSet.of( AEFeature.GRIND_STONE ), "gearWood" ),
|
||||
|
||||
WIRELESS_RECEIVER("material_wireless_receiver", EnumSet.of( AEFeature.WIRELESS_ACCESS_TERMINAL ) ),
|
||||
WIRELESS_BOOSTER("material_wireless_booster", EnumSet.of( AEFeature.WIRELESS_ACCESS_TERMINAL ) ),
|
||||
WIRELESS_RECEIVER("wireless_receiver", EnumSet.of( AEFeature.WIRELESS_ACCESS_TERMINAL ) ),
|
||||
WIRELESS_BOOSTER("wireless_booster", EnumSet.of( AEFeature.WIRELESS_ACCESS_TERMINAL ) ),
|
||||
|
||||
FORMATION_CORE("material_formation_core", EnumSet.of( AEFeature.CORES ) ),
|
||||
ANNIHILATION_CORE("material_annihilation_core", EnumSet.of( AEFeature.CORES ) ),
|
||||
FORMATION_CORE("formation_core", EnumSet.of( AEFeature.CORES ) ),
|
||||
ANNIHILATION_CORE("annihilation_core", EnumSet.of( AEFeature.CORES ) ),
|
||||
|
||||
SKY_DUST("material_sky_dust", EnumSet.of( AEFeature.DUSTS ) ),
|
||||
SKY_DUST("sky_dust", EnumSet.of( AEFeature.DUSTS ) ),
|
||||
|
||||
ENDER_DUST("material_ender_dust", EnumSet.of( AEFeature.QUANTUM_NETWORK_BRIDGE ), "dustEnder,dustEnderPearl", EntitySingularity.class ),
|
||||
SINGULARITY("material_singularity", EnumSet.of( AEFeature.QUANTUM_NETWORK_BRIDGE ), EntitySingularity.class ),
|
||||
QUANTUM_ENTANGLED_SINGULARITY("material_quantum_entangled_singularity", EnumSet.of( AEFeature.QUANTUM_NETWORK_BRIDGE ), EntitySingularity.class ),
|
||||
ENDER_DUST("ender_dust", EnumSet.of( AEFeature.QUANTUM_NETWORK_BRIDGE ), "dustEnder,dustEnderPearl", EntitySingularity.class ),
|
||||
SINGULARITY("singularity", EnumSet.of( AEFeature.QUANTUM_NETWORK_BRIDGE ), EntitySingularity.class ),
|
||||
QUANTUM_ENTANGLED_SINGULARITY("quantum_entangled_singularity", EnumSet.of( AEFeature.QUANTUM_NETWORK_BRIDGE ), EntitySingularity.class ),
|
||||
|
||||
BLANK_PATTERN("material_blank_pattern", EnumSet.of( AEFeature.PATTERNS ) ),
|
||||
CARD_CRAFTING("material_card_crafting", EnumSet.of( AEFeature.ADVANCED_CARDS, AEFeature.CRAFTING_CPU ) ),
|
||||
BLANK_PATTERN("blank_pattern", EnumSet.of( AEFeature.PATTERNS ) ),
|
||||
CARD_CRAFTING("crafting_card", EnumSet.of( AEFeature.ADVANCED_CARDS, AEFeature.CRAFTING_CPU ) ),
|
||||
|
||||
FLUID_CELL1K_PART("material_fluid_cell1k_part", EnumSet.of( AEFeature.STORAGE_CELLS ) ),
|
||||
FLUID_CELL4K_PART("material_fluid_cell4k_part", EnumSet.of( AEFeature.STORAGE_CELLS ) ),
|
||||
FLUID_CELL16K_PART("material_fluid_cell16k_part", EnumSet.of( AEFeature.STORAGE_CELLS ) ),
|
||||
FLUID_CELL64K_PART("material_fluid_cell64k_part", EnumSet.of( AEFeature.STORAGE_CELLS ) );
|
||||
FLUID_CELL1K_PART("fluid_cell1k_part", EnumSet.of( AEFeature.STORAGE_CELLS ) ),
|
||||
FLUID_CELL4K_PART("fluid_cell4k_part", EnumSet.of( AEFeature.STORAGE_CELLS ) ),
|
||||
FLUID_CELL16K_PART("fluid_cell16k_part", EnumSet.of( AEFeature.STORAGE_CELLS ) ),
|
||||
FLUID_CELL64K_PART("fluid_cell64k_part", EnumSet.of( AEFeature.STORAGE_CELLS ) );
|
||||
|
||||
private final Set<AEFeature> features;
|
||||
private final ResourceLocation registryName;
|
||||
|
||||
@@ -48,20 +48,14 @@ import java.util.function.Function;
|
||||
|
||||
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();
|
||||
|
||||
private final PartType type;
|
||||
|
||||
private final Function<ItemStack, T> factory;
|
||||
|
||||
private final Map<Integer, PartTypeWithVariant> registered;
|
||||
|
||||
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 );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -77,38 +71,6 @@ public class ItemPart<T extends IPart> extends AEBaseItem implements IPartItem<T
|
||||
return AEApi.instance().partHelper().placeBus( held, context.getPos(), context.getFace(), player, context.getHand(), context.getWorld() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTranslationKey( final ItemStack is )
|
||||
{
|
||||
Preconditions.checkNotNull( is );
|
||||
return "item.appliedenergistics2.multi_part." + this.getTypeByStack( is ).getTranslationKey().toLowerCase();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITextComponent getDisplayName(final ItemStack is )
|
||||
{
|
||||
final PartType pt = this.getTypeByStack( is );
|
||||
|
||||
if( pt.isCable() )
|
||||
{
|
||||
final AEColor[] variants = AEColor.values();
|
||||
|
||||
final int itemDamage = is.getDamage();
|
||||
final PartTypeWithVariant registeredPartType = this.registered.get( itemDamage );
|
||||
if( registeredPartType != null )
|
||||
{
|
||||
return super.getDisplayName( is ).appendText(" - ").appendSibling(new TranslationTextComponent(variants[registeredPartType.variant].translationKey));
|
||||
}
|
||||
}
|
||||
|
||||
if( pt.getExtraName() != null )
|
||||
{
|
||||
return super.getDisplayName( is ).appendText(" - ").appendSibling(pt.getExtraName().textComponent());
|
||||
}
|
||||
|
||||
return super.getDisplayName( is );
|
||||
}
|
||||
|
||||
public PartType getType() {
|
||||
return type;
|
||||
}
|
||||
@@ -118,17 +80,6 @@ public class ItemPart<T extends IPart> extends AEBaseItem implements IPartItem<T
|
||||
return factory.apply(is);
|
||||
}
|
||||
|
||||
public int variantOf( final int itemDamage )
|
||||
{
|
||||
final PartTypeWithVariant registeredPartType = this.registered.get( itemDamage );
|
||||
if( registeredPartType != null )
|
||||
{
|
||||
return registeredPartType.variant;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
private static PartType getTypeByStack(ItemStack is) {
|
||||
if (is.getItem() instanceof ItemPart) {
|
||||
return ((ItemPart<?>) is.getItem()).getType();
|
||||
@@ -200,43 +151,4 @@ public class ItemPart<T extends IPart> extends AEBaseItem implements IPartItem<T
|
||||
return null;
|
||||
}
|
||||
|
||||
private static final class PartTypeWithVariant
|
||||
{
|
||||
private final PartType part;
|
||||
private final int variant;
|
||||
|
||||
private PartTypeWithVariant( final PartType part, final int variant )
|
||||
{
|
||||
assert part != null;
|
||||
assert variant >= 0;
|
||||
|
||||
this.part = part;
|
||||
this.variant = variant;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "PartTypeWithVariant{" + "part=" + this.part + ", variant=" + this.variant + '}';
|
||||
}
|
||||
}
|
||||
|
||||
private static final class RegisteredComparator implements Comparator<Entry<Integer, PartTypeWithVariant>>
|
||||
{
|
||||
@Override
|
||||
public int compare( final Entry<Integer, PartTypeWithVariant> o1, final Entry<Integer, PartTypeWithVariant> o2 )
|
||||
{
|
||||
final String string1 = o1.getValue().part.name();
|
||||
final String string2 = o2.getValue().part.name();
|
||||
final int comparedString = string1.compareTo( string2 );
|
||||
|
||||
if( comparedString == 0 )
|
||||
{
|
||||
return Integer.compare( o1.getKey(), o2.getKey() );
|
||||
}
|
||||
|
||||
return comparedString;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -32,9 +32,7 @@ import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.api.features.AEFeature;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.parts.automation.PartAnnihilationPlane;
|
||||
import appeng.parts.automation.PartExportBus;
|
||||
import appeng.parts.automation.PartFormationPlane;
|
||||
@@ -122,12 +120,12 @@ public enum PartType
|
||||
|
||||
QUARTZ_FIBER(EnumSet.of( AEFeature.QUARTZ_FIBER ), EnumSet.noneOf( IntegrationType.class ), PartQuartzFiber.class ),
|
||||
|
||||
MONITOR(EnumSet.of( AEFeature.PANELS ), EnumSet.noneOf( IntegrationType.class ), PartPanel.class, "itemIlluminatedPanel" ),
|
||||
MONITOR(EnumSet.of( AEFeature.PANELS ), EnumSet.noneOf( IntegrationType.class ), PartPanel.class),
|
||||
|
||||
SEMI_DARK_MONITOR(EnumSet.of( AEFeature.PANELS ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartSemiDarkPanel.class, "itemIlluminatedPanel" ),
|
||||
.noneOf( IntegrationType.class ), PartSemiDarkPanel.class),
|
||||
|
||||
DARK_MONITOR(EnumSet.of( AEFeature.PANELS ), EnumSet.noneOf( IntegrationType.class ), PartDarkPanel.class, "itemIlluminatedPanel" ),
|
||||
DARK_MONITOR(EnumSet.of( AEFeature.PANELS ), EnumSet.noneOf( IntegrationType.class ), PartDarkPanel.class),
|
||||
|
||||
STORAGE_BUS(EnumSet.of( AEFeature.STORAGE_BUS ), EnumSet.noneOf( IntegrationType.class ), PartStorageBus.class ),
|
||||
FLUID_STORAGE_BUS(EnumSet.of( AEFeature.FLUID_STORAGE_BUS ), EnumSet
|
||||
@@ -175,74 +173,25 @@ public enum PartType
|
||||
FLUID_INTERFACE(EnumSet.of( AEFeature.FLUID_INTERFACE ), EnumSet.noneOf( IntegrationType.class ), PartFluidInterface.class ),
|
||||
|
||||
P2P_TUNNEL_ME(EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_ME ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartP2PTunnelME.class, GuiText.METunnel )
|
||||
{
|
||||
@Override
|
||||
String getTranslationKey()
|
||||
{
|
||||
return "p2p_tunnel";
|
||||
}
|
||||
},
|
||||
.noneOf( IntegrationType.class ), PartP2PTunnelME.class),
|
||||
|
||||
P2P_TUNNEL_REDSTONE(EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_REDSTONE ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartP2PRedstone.class, GuiText.RedstoneTunnel )
|
||||
{
|
||||
@Override
|
||||
String getTranslationKey()
|
||||
{
|
||||
return "p2p_tunnel";
|
||||
}
|
||||
},
|
||||
.noneOf( IntegrationType.class ), PartP2PRedstone.class),
|
||||
|
||||
P2P_TUNNEL_ITEM(EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_ITEMS ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartP2PItems.class, GuiText.ItemTunnel )
|
||||
{
|
||||
@Override
|
||||
String getTranslationKey()
|
||||
{
|
||||
return "p2p_tunnel";
|
||||
}
|
||||
},
|
||||
.noneOf( IntegrationType.class ), PartP2PItems.class),
|
||||
|
||||
P2P_TUNNEL_FLUID(EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_FLUIDS ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartP2PFluids.class, GuiText.FluidTunnel )
|
||||
{
|
||||
@Override
|
||||
String getTranslationKey()
|
||||
{
|
||||
return "p2p_tunnel";
|
||||
}
|
||||
},
|
||||
.noneOf( IntegrationType.class ), PartP2PFluids.class),
|
||||
|
||||
//FIXME P2P_TUNNEL_IC2( 465, "p2p_tunnel_ic2", EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_EU ), EnumSet
|
||||
//FIXME .of( IntegrationType.IC2 ), PartP2PIC2Power.class, GuiText.EUTunnel )
|
||||
//FIXME {
|
||||
//FIXME @Override
|
||||
//FIXME String getTranslationKey()
|
||||
//FIXME {
|
||||
//FIXME return "p2p_tunnel";
|
||||
//FIXME }
|
||||
//FIXME },
|
||||
//FIXME .of( IntegrationType.IC2 ), PartP2PIC2Power.class ),
|
||||
|
||||
P2P_TUNNEL_LIGHT(EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_LIGHT ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartP2PLight.class, GuiText.LightTunnel )
|
||||
{
|
||||
@Override
|
||||
String getTranslationKey()
|
||||
{
|
||||
return "p2p_tunnel";
|
||||
}
|
||||
},
|
||||
.noneOf( IntegrationType.class ), PartP2PLight.class),
|
||||
|
||||
P2P_TUNNEL_FE(EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_FE ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartP2PFEPower.class, GuiText.FETunnel )
|
||||
{
|
||||
@Override
|
||||
String getTranslationKey()
|
||||
{
|
||||
return "p2p_tunnel";
|
||||
}
|
||||
},
|
||||
.noneOf( IntegrationType.class ), PartP2PFEPower.class),
|
||||
|
||||
// P2PTunnelOpenComputers( 468, EnumSet.of( AEFeature.P2PTunnel, AEFeature.P2PTunnelOpenComputers ), EnumSet.of(
|
||||
// IntegrationType.OpenComputers ), PartP2POpenComputers.class, GuiText.OCTunnel ),
|
||||
@@ -254,32 +203,13 @@ public enum PartType
|
||||
|
||||
private final Set<AEFeature> features;
|
||||
private final Set<IntegrationType> integrations;
|
||||
private final GuiText extraName;
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
private final Set<ResourceLocation> models;
|
||||
private final String oreName;
|
||||
|
||||
PartType(final Set<AEFeature> features, final Set<IntegrationType> integrations, final Class<? extends IPart> c)
|
||||
{
|
||||
this(features, integrations, c, null, null );
|
||||
}
|
||||
|
||||
PartType(final Set<AEFeature> features, final Set<IntegrationType> integrations, final Class<? extends IPart> c, final String oreDict)
|
||||
{
|
||||
this(features, integrations, c, null, oreDict );
|
||||
}
|
||||
|
||||
PartType(final Set<AEFeature> features, final Set<IntegrationType> integrations, final Class<? extends IPart> c, final GuiText en)
|
||||
{
|
||||
this(features, integrations, c, en, null );
|
||||
}
|
||||
|
||||
PartType(final Set<AEFeature> features, final Set<IntegrationType> integrations, final Class<? extends IPart> c, final GuiText en, final String oreDict)
|
||||
{
|
||||
this.features = Collections.unmodifiableSet( features );
|
||||
this.integrations = Collections.unmodifiableSet( integrations );
|
||||
this.extraName = en;
|
||||
this.oreName = oreDict;
|
||||
|
||||
if( c != null )
|
||||
{
|
||||
@@ -306,21 +236,6 @@ public enum PartType
|
||||
return this.integrations;
|
||||
}
|
||||
|
||||
String getTranslationKey()
|
||||
{
|
||||
return this.name().toLowerCase();
|
||||
}
|
||||
|
||||
GuiText getExtraName()
|
||||
{
|
||||
return this.extraName;
|
||||
}
|
||||
|
||||
public String getOreName()
|
||||
{
|
||||
return this.oreName;
|
||||
}
|
||||
|
||||
public Set<ResourceLocation> getModels()
|
||||
{
|
||||
return this.models;
|
||||
|
||||
@@ -1556,7 +1556,7 @@ public class Platform
|
||||
//
|
||||
// // public static void addStat( final int playerID, final Achievement achievement )
|
||||
// // {
|
||||
// // final EntityPlayer p = AEApi.instance().registries().players().findPlayer( playerID );
|
||||
// // final PlayerEntity p = AEApi.instance().registries().players().findPlayer( playerID );
|
||||
// // if( p != null )
|
||||
// // {
|
||||
// // p.addStat( achievement, 1 );
|
||||
|
||||
Reference in New Issue
Block a user