More compile things
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
package appeng.core;
|
||||
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
@@ -28,7 +29,10 @@ import java.util.stream.Collectors;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import net.minecraftforge.fml.common.discovery.ASMDataTable;
|
||||
import org.objectweb.asm.Type;
|
||||
|
||||
import net.minecraftforge.fml.ModList;
|
||||
import net.minecraftforge.forgespi.language.ModFileScanData;
|
||||
|
||||
import appeng.api.AEInjectable;
|
||||
import appeng.api.AEPlugin;
|
||||
@@ -40,28 +44,30 @@ import appeng.api.AEPlugin;
|
||||
class PluginLoader
|
||||
{
|
||||
|
||||
public void loadPlugins( Collection<Object> injectables, ASMDataTable asmDataTable )
|
||||
public void loadPlugins( Collection<Object> injectables )
|
||||
{
|
||||
Map<Class<?>, Object> injectableMap = mapInjectables( injectables );
|
||||
findAndInstantiatePlugins( asmDataTable, injectableMap );
|
||||
findAndInstantiatePlugins( injectableMap );
|
||||
}
|
||||
|
||||
private static void findAndInstantiatePlugins( ASMDataTable dataTable, Map<Class<?>, Object> injectableMap )
|
||||
private static void findAndInstantiatePlugins( Map<Class<?>, Object> injectableMap )
|
||||
{
|
||||
Set<ASMDataTable.ASMData> allAnnotated = dataTable.getAll( AEPlugin.class.getCanonicalName() );
|
||||
Type aType = Type.getType( AEPlugin.class );
|
||||
Set<ModFileScanData.AnnotationData> allAnnotated = ModList.get().getAllScanData().stream().map( ModFileScanData::getAnnotations ).flatMap( Collection::stream ).filter( a -> a.getAnnotationType().equals( aType ) ).filter( a -> a.getTargetType() == ElementType.TYPE ).collect( Collectors.toSet() );
|
||||
|
||||
for( ASMDataTable.ASMData candidate : allAnnotated )
|
||||
for( ModFileScanData.AnnotationData candidate : allAnnotated )
|
||||
{
|
||||
|
||||
String cName = candidate.getMemberName();
|
||||
Class<?> aClass;
|
||||
try
|
||||
{
|
||||
aClass = Class.forName( candidate.getClassName() );
|
||||
aClass = Class.forName( cName );
|
||||
}
|
||||
catch( ClassNotFoundException e )
|
||||
{
|
||||
AELog.error( e, "Couldn't find annotated AE plugin class " + candidate.getClassName() );
|
||||
throw new RuntimeException( "Couldn't find annotated AE plugin class " + candidate.getClassName(), e );
|
||||
AELog.error( e, "Couldn't find annotated AE plugin class " + cName );
|
||||
throw new RuntimeException( "Couldn't find annotated AE plugin class " + cName, e );
|
||||
}
|
||||
|
||||
// Try instantiating the plugin
|
||||
@@ -72,8 +78,8 @@ class PluginLoader
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
AELog.error( e, "Unable to instantiate AE plugin " + candidate.getClassName() );
|
||||
throw new RuntimeException( "Unable to instantiate AE plugin " + candidate.getClassName(), e );
|
||||
AELog.error( e, "Unable to instantiate AE plugin " + cName );
|
||||
throw new RuntimeException( "Unable to instantiate AE plugin " + cName, e );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ package appeng.core.api;
|
||||
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
@@ -37,7 +37,7 @@ public class ApiPart implements IPartHelper
|
||||
{
|
||||
|
||||
@Override
|
||||
public ActionResult placeBus( final ItemStack is, final BlockPos pos, final Direction side, final PlayerEntity player, final Hand hand, final World w )
|
||||
public ActionResultType placeBus( final ItemStack is, final BlockPos pos, final Direction side, final PlayerEntity player, final Hand hand, final World w )
|
||||
{
|
||||
return PartPlacement.place( is, pos, side, player, hand, w, PartPlacement.PlaceType.PLACE_ITEM, 0 );
|
||||
}
|
||||
|
||||
@@ -31,10 +31,11 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.TunnelType;
|
||||
import appeng.api.definitions.IBlocks;
|
||||
import appeng.api.definitions.IDefinitions;
|
||||
@@ -43,6 +44,7 @@ import appeng.api.definitions.IParts;
|
||||
import appeng.api.features.IP2PTunnelRegistry;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.capabilities.Capabilities;
|
||||
import appeng.core.Api;
|
||||
|
||||
|
||||
public final class P2PTunnelRegistry implements IP2PTunnelRegistry
|
||||
@@ -257,10 +259,10 @@ public final class P2PTunnelRegistry implements IP2PTunnelRegistry
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
private ItemStack getModItem( final String modID, final String name, final int meta )
|
||||
private ItemStack getModItem( final String modID, final String name )
|
||||
{
|
||||
|
||||
final Item item = Item.getByNameOrId( modID + ":" + name );
|
||||
final Item item = ForgeRegistries.ITEMS.getValue( new ResourceLocation( modID + ":" + name ) );
|
||||
|
||||
if( item == null )
|
||||
{
|
||||
|
||||
@@ -30,6 +30,7 @@ import appeng.api.AEApi;
|
||||
import appeng.api.features.ILocatable;
|
||||
import appeng.api.features.IWirelessTermHandler;
|
||||
import appeng.api.features.IWirelessTermRegistry;
|
||||
import appeng.core.Api;
|
||||
import appeng.core.localization.PlayerMessages;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.util.Platform;
|
||||
|
||||
@@ -15,6 +15,7 @@ import appeng.api.storage.IStorageChannel;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.core.Api;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ import appeng.api.storage.ICellInventoryHandler;
|
||||
import appeng.api.storage.ISaveProvider;
|
||||
import appeng.api.storage.IStorageChannel;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.core.Api;
|
||||
import appeng.items.storage.ItemCreativeStorageCell;
|
||||
import appeng.me.storage.CreativeCellInventory;
|
||||
|
||||
|
||||
@@ -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 ButtonToolTips
|
||||
@@ -162,14 +164,15 @@ public enum ButtonToolTips
|
||||
this.root = r;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public String getLocal()
|
||||
{
|
||||
return I18n.format( this.getTranslationKey() );
|
||||
return getTranslationKey().getFormattedText();
|
||||
}
|
||||
|
||||
public String getTranslationKey()
|
||||
public ITextComponent getTranslationKey()
|
||||
{
|
||||
return this.root + '.' + this.toString();
|
||||
return new TranslationTextComponent( this.root + '.' + this.toString() );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ import net.minecraft.advancements.ICriterionTrigger;
|
||||
import net.minecraft.advancements.PlayerAdvancements;
|
||||
import net.minecraft.advancements.criterion.CriterionInstance;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import appeng.core.AppEng;
|
||||
@@ -98,7 +99,7 @@ public class AppEngAdvancementTrigger implements ICriterionTrigger<AppEngAdvance
|
||||
}
|
||||
|
||||
@Override
|
||||
public void trigger( PlayerEntity parPlayer )
|
||||
public void trigger( ServerPlayerEntity parPlayer )
|
||||
{
|
||||
AppEngAdvancementTrigger.Listeners l = this.listeners.get( parPlayer.getAdvancements() );
|
||||
|
||||
|
||||
@@ -20,10 +20,11 @@ package appeng.core.stats;
|
||||
|
||||
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
|
||||
|
||||
@FunctionalInterface
|
||||
public interface IAdvancementTrigger
|
||||
{
|
||||
void trigger( PlayerEntity parPlayer );
|
||||
void trigger( ServerPlayerEntity parPlayer );
|
||||
}
|
||||
|
||||
@@ -21,11 +21,10 @@ package appeng.core.stats;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import net.minecraft.advancements.critereon.ItemPredicate;
|
||||
import net.minecraft.advancements.criterion.ItemPredicate;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.JSONUtils;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.advancements.critereon.ItemPredicates;
|
||||
|
||||
import appeng.core.AppEng;
|
||||
import appeng.items.parts.ItemPart;
|
||||
@@ -65,6 +64,6 @@ public class PartItemPredicate extends ItemPredicate
|
||||
|
||||
public static void register()
|
||||
{
|
||||
ItemPredicates.register( new ResourceLocation( AppEng.MOD_ID, "part" ), PartItemPredicate::deserialize );
|
||||
ItemPredicate.register( new ResourceLocation( AppEng.MOD_ID, "part" ), PartItemPredicate::deserialize );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,6 +84,7 @@ import appeng.container.implementations.ContainerUpgradeable;
|
||||
import appeng.container.implementations.ContainerVibrationChamber;
|
||||
import appeng.container.implementations.ContainerWireless;
|
||||
import appeng.container.implementations.ContainerWirelessTerm;
|
||||
import appeng.core.Api;
|
||||
import appeng.fluids.container.ContainerFluidFormationPlane;
|
||||
import appeng.fluids.container.ContainerFluidIO;
|
||||
import appeng.fluids.container.ContainerFluidInterface;
|
||||
|
||||
@@ -43,7 +43,7 @@ public class AppEngClientPacketHandler extends AppEngPacketHandlerBase implement
|
||||
final AppEngPacket pack = PacketTypes.getPacket( packetType ).parsePacket( packet );
|
||||
pack.clientPacketData( manager, Minecraft.getInstance().player );
|
||||
}
|
||||
catch( final InstantiationException | IllegalArgumentException | IllegalAccessException | InvocationTargetException e )
|
||||
catch( final IllegalArgumentException e )
|
||||
{
|
||||
AELog.debug( e );
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ public final class AppEngServerPacketHandler extends AppEngPacketHandlerBase imp
|
||||
final AppEngPacket pack = PacketTypes.getPacket( packetType ).parsePacket( packet );
|
||||
pack.serverPacketData( manager, player );
|
||||
}
|
||||
catch( final InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e )
|
||||
catch( final IllegalArgumentException e )
|
||||
{
|
||||
AELog.debug( e );
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ public class PacketCompassResponse extends AppEngPacket
|
||||
public PacketCompassResponse( final PacketCompassRequest req, final boolean hasResult, final boolean spin, final double radians )
|
||||
{
|
||||
|
||||
final PacketBuffer data = new ( Unpooled.buffer() );
|
||||
final PacketBuffer data = new PacketBuffer( Unpooled.buffer() );
|
||||
|
||||
data.writeInt( this.getPacketID() );
|
||||
data.writeLong( this.attunement = req.attunement );
|
||||
|
||||
@@ -24,9 +24,9 @@ import java.io.IOException;
|
||||
import io.netty.buffer.Unpooled;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.container.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.util.Hand;
|
||||
@@ -272,7 +272,7 @@ public class PacketValueConfig extends AppEngPacket
|
||||
}
|
||||
else if( this.Name.equals( "CraftingStatus" ) && this.Value.equals( "Clear" ) )
|
||||
{
|
||||
final GuiScreen gs = Minecraft.getInstance().currentScreen;
|
||||
final Screen gs = Minecraft.getInstance().currentScreen;
|
||||
if( gs instanceof GuiCraftingCPU )
|
||||
{
|
||||
( (GuiCraftingCPU) gs ).clearItems();
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
package appeng.core.worlddata;
|
||||
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
@@ -86,6 +87,6 @@ class PlayerMappingsInitializer
|
||||
*/
|
||||
public Map<Integer, UUID> getPlayerMappings()
|
||||
{
|
||||
return this.playerMappings;
|
||||
return Collections.emptyMap(); //this.playerMappings; //FIXME
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user