1.15 port

This commit is contained in:
yueh
2020-05-18 14:02:45 +02:00
parent 0ea86c939c
commit 16d6d55d7f
630 changed files with 4211 additions and 12664 deletions
@@ -24,10 +24,10 @@ import java.util.Optional;
import com.google.common.base.Preconditions;
import net.minecraft.block.Block;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.BlockItem;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.IBlockReader;
import appeng.api.definitions.IBlockDefinition;
@@ -36,7 +36,7 @@ public class BlockDefinition extends ItemDefinition implements IBlockDefinition
{
private final Optional<Block> block;
public BlockDefinition( String registryName, Block block, ItemBlock item )
public BlockDefinition( String registryName, Block block, BlockItem item )
{
super( registryName, item );
this.block = Optional.ofNullable( block );
@@ -49,9 +49,9 @@ public class BlockDefinition extends ItemDefinition implements IBlockDefinition
}
@Override
public final Optional<ItemBlock> maybeItemBlock()
public Optional<BlockItem> maybeBlockItem()
{
return this.block.map( ItemBlock::new );
return this.block.map( BlockItem::new );
}
@Override
@@ -63,7 +63,7 @@ public class BlockDefinition extends ItemDefinition implements IBlockDefinition
}
@Override
public final boolean isSameAs( final IBlockAccess world, final BlockPos pos )
public final boolean isSameAs( final IBlockReader world, final BlockPos pos )
{
return this.block.isPresent() && world.getBlockState( pos ).getBlock() == this.block.get();
}
@@ -32,18 +32,15 @@ public class BlockStackSrc implements IStackSrc
{
private final Block block;
private final int damage;
private final boolean enabled;
public BlockStackSrc( final Block block, final int damage, final ActivityState state )
public BlockStackSrc( final Block block, final ActivityState state )
{
Preconditions.checkNotNull( block );
Preconditions.checkArgument( damage >= 0 );
Preconditions.checkNotNull( state );
Preconditions.checkArgument( state == ActivityState.Enabled || state == ActivityState.Disabled );
this.block = block;
this.damage = damage;
this.enabled = state == ActivityState.Enabled;
}
@@ -51,7 +48,7 @@ public class BlockStackSrc implements IStackSrc
@Override
public ItemStack stack( final int i )
{
return new ItemStack( this.block, i, this.damage );
return new ItemStack( this.block, i );
}
@Override
@@ -60,12 +57,6 @@ public class BlockStackSrc implements IStackSrc
return null;
}
@Override
public int getDamage()
{
return this.damage;
}
@Override
public boolean isEnabled()
{
@@ -97,6 +97,6 @@ public final class ColoredItemDefinition implements AEColoredItemDefinition
return false;
}
return comparableItem.getItem() == is.getItem() && comparableItem.getItemDamage() == is.getDamage();
return comparableItem.getItem() == is.getItem();
}
}
@@ -84,7 +84,7 @@ public final class DamagedItemDefinition implements IItemDefinition
return false;
}
return this.isEnabled() && comparableStack.getItem() == this.source.get().getItem() && comparableStack.getItemDamage() == this.source.get().getDamage();
return this.isEnabled() && comparableStack.getItem() == this.source.get().getItem();
}
}
@@ -30,7 +30,5 @@ public interface IStackSrc
Item getItem();
int getDamage();
boolean isEnabled();
}
@@ -31,18 +31,15 @@ public class ItemStackSrc implements IStackSrc
{
private final Item item;
private final int damage;
private final boolean enabled;
public ItemStackSrc( final Item item, final int damage, final ActivityState state )
public ItemStackSrc( final Item item, final ActivityState state )
{
Preconditions.checkNotNull( item );
Preconditions.checkArgument( damage >= 0 );
Preconditions.checkNotNull( state );
Preconditions.checkArgument( state == ActivityState.Enabled || state == ActivityState.Disabled );
this.item = item;
this.damage = damage;
this.enabled = state == ActivityState.Enabled;
}
@@ -50,7 +47,7 @@ public class ItemStackSrc implements IStackSrc
@Override
public ItemStack stack( final int i )
{
return new ItemStack( this.item, i, this.damage );
return new ItemStack( this.item, i );
}
@Override
@@ -59,12 +56,6 @@ public class ItemStackSrc implements IStackSrc
return this.item;
}
@Override
public int getDamage()
{
return this.damage;
}
@Override
public boolean isEnabled()
{
@@ -52,12 +52,6 @@ public class MaterialStackSrc implements IStackSrc
return this.src.getItemInstance();
}
@Override
public int getDamage()
{
return this.src.getDamageValue();
}
@Override
public boolean isEnabled()
{
@@ -23,7 +23,7 @@ import java.util.Optional;
import javax.annotation.Nonnull;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.BlockItem;
import net.minecraft.tileentity.TileEntity;
import appeng.api.definitions.ITileDefinition;
@@ -35,7 +35,7 @@ public final class TileDefinition extends BlockDefinition implements ITileDefini
private final Optional<AEBaseTileBlock> block;
public TileDefinition( @Nonnull String registryName, AEBaseTileBlock block, ItemBlock item )
public TileDefinition( @Nonnull String registryName, AEBaseTileBlock block, BlockItem item )
{
super( registryName, block, item );
this.block = Optional.ofNullable( block );
@@ -23,7 +23,7 @@ import java.util.HashMap;
import java.util.Map;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import appeng.api.events.LocatableEventAnnounce;
import appeng.api.events.LocatableEventAnnounce.LocatableEvent;
@@ -21,8 +21,8 @@ package appeng.core.features.registries;
import java.util.HashMap;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import appeng.api.features.IMatterCannonAmmoRegistry;
import appeng.recipes.ores.IOreListener;
@@ -81,7 +81,7 @@ public class MovableTileRegistry implements IMovableRegistry
( (IMovableTile) te ).prepareToMove();
}
te.invalidate();
te.remove();
return true;
}
@@ -26,14 +26,13 @@ import java.util.Map.Entry;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.block.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.item.Items;
import net.minecraft.util.Direction;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
import net.minecraftforge.oredict.OreDictionary;
import appeng.api.AEApi;
import appeng.api.config.TunnelType;
@@ -99,15 +98,11 @@ public final class P2PTunnelRegistry implements IP2PTunnelRegistry
this.addNewAttunement( new ItemStack( Items.REDSTONE ), TunnelType.REDSTONE );
this.addNewAttunement( new ItemStack( Items.REPEATER ), TunnelType.REDSTONE );
this.addNewAttunement( new ItemStack( Blocks.REDSTONE_LAMP ), TunnelType.REDSTONE );
this.addNewAttunement( new ItemStack( Blocks.UNPOWERED_COMPARATOR ), TunnelType.REDSTONE );
this.addNewAttunement( new ItemStack( Blocks.POWERED_COMPARATOR ), TunnelType.REDSTONE );
this.addNewAttunement( new ItemStack( Blocks.POWERED_REPEATER ), TunnelType.REDSTONE );
this.addNewAttunement( new ItemStack( Blocks.UNPOWERED_REPEATER ), TunnelType.REDSTONE );
this.addNewAttunement( new ItemStack( Blocks.COMPARATOR ), TunnelType.REDSTONE );
this.addNewAttunement( new ItemStack( Blocks.DAYLIGHT_DETECTOR ), TunnelType.REDSTONE );
this.addNewAttunement( new ItemStack( Blocks.REDSTONE_WIRE ), TunnelType.REDSTONE );
this.addNewAttunement( new ItemStack( Blocks.REDSTONE_BLOCK ), TunnelType.REDSTONE );
this.addNewAttunement( new ItemStack( Blocks.LEVER ), TunnelType.REDSTONE );
this.addNewAttunement( this.getModItem( "enderio", "itemredstoneconduit", OreDictionary.WILDCARD_VALUE ), TunnelType.REDSTONE );
/**
* attune based on lots of random item related stuff
@@ -124,7 +119,6 @@ public final class P2PTunnelRegistry implements IP2PTunnelRegistry
this.addNewAttunement( new ItemStack( Blocks.TRAPPED_CHEST ), TunnelType.ITEM );
this.addNewAttunement( this.getModItem( "extrautilities", "extractor_base", 0 ), TunnelType.ITEM );
this.addNewAttunement( this.getModItem( "mekanism", "parttransmitter", 9 ), TunnelType.ITEM );
this.addNewAttunement( this.getModItem( "enderio", "itemitemconduit", OreDictionary.WILDCARD_VALUE ), TunnelType.ITEM );
this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_32", 0 ), TunnelType.ITEM ); // itemduct
this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_32", 1 ), TunnelType.ITEM ); // itemduct
// (opaque)
@@ -144,8 +138,6 @@ public final class P2PTunnelRegistry implements IP2PTunnelRegistry
this.addNewAttunement( this.getModItem( "mekanism", "machineblock2", 11 ), TunnelType.FLUID );
this.addNewAttunement( this.getModItem( "mekanism", "parttransmitter", 4 ), TunnelType.FLUID );
this.addNewAttunement( this.getModItem( "extrautilities", "extractor_base", 6 ), TunnelType.FLUID );
this.addNewAttunement( this.getModItem( "extrautilities", "drum", OreDictionary.WILDCARD_VALUE ), TunnelType.FLUID );
this.addNewAttunement( this.getModItem( "enderio", "itemliquidconduit", OreDictionary.WILDCARD_VALUE ), TunnelType.FLUID );
this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_16", 0 ), TunnelType.FLUID ); // fluiduct
this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_16", 1 ), TunnelType.FLUID ); // fluiduct
// (opaque)
@@ -228,7 +220,7 @@ public final class P2PTunnelRegistry implements IP2PTunnelRegistry
{
final ItemStack is = entry.getKey();
if( is.getItem() == trigger.getItem() && is.getItemDamage() == OreDictionary.WILDCARD_VALUE )
if( is.getItem() == trigger.getItem() )
{
return entry.getValue();
}
@@ -240,11 +232,11 @@ public final class P2PTunnelRegistry implements IP2PTunnelRegistry
}
// Next, check if the Item you're holding supports any registered capability
for( EnumFacing face : EnumFacing.VALUES )
for( Direction face : Direction.values() )
{
for( Entry<Capability<?>, TunnelType> entry : this.capTunnels.entrySet() )
{
if( trigger.hasCapability( entry.getKey(), face ) )
if( trigger.getCapability( entry.getKey(), face ).isPresent() )
{
return entry.getValue();
}
@@ -254,7 +246,7 @@ public final class P2PTunnelRegistry implements IP2PTunnelRegistry
// Use the mod id as last option.
for( final Entry<String, TunnelType> entry : this.modIdTunnels.entrySet() )
{
if( trigger.getItem().getRegistryName() != null && trigger.getItem().getRegistryName().getResourceDomain().equals( entry.getKey() ) )
if( trigger.getItem().getRegistryName() != null && trigger.getItem().getRegistryName().getNamespace().equals( entry.getKey() ) )
{
return entry.getValue();
}
@@ -275,7 +267,7 @@ public final class P2PTunnelRegistry implements IP2PTunnelRegistry
return ItemStack.EMPTY;
}
final ItemStack myItemStack = new ItemStack( item, 1, meta );
final ItemStack myItemStack = new ItemStack( item, 1 );
return myItemStack;
}
@@ -23,7 +23,7 @@ import javax.annotation.Nullable;
import com.mojang.authlib.GameProfile;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.PlayerEntity;
import appeng.api.features.IPlayerRegistry;
import appeng.core.worlddata.WorldData;
@@ -44,14 +44,14 @@ public class PlayerRegistry implements IPlayerRegistry
}
@Override
public int getID( final EntityPlayer player )
public int getID( final PlayerEntity player )
{
return this.getID( player.getGameProfile() );
}
@Nullable
@Override
public EntityPlayer findPlayer( final int playerID )
public PlayerEntity findPlayer( final int playerID )
{
return WorldData.instance().playerData().getPlayerFromID( playerID );
}
@@ -22,9 +22,9 @@ package appeng.core.features.registries;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraft.world.IBlockReader;
import appeng.api.AEApi;
import appeng.api.features.ILocatable;
@@ -80,7 +80,7 @@ public final class WirelessRegistry implements IWirelessTermRegistry
}
@Override
public void openWirelessTerminalGui( final ItemStack item, final World w, final EntityPlayer player )
public void openWirelessTerminalGui( ItemStack item, IBlockReader world, PlayerEntity player )
{
if( Platform.isClient() )
{
@@ -22,7 +22,7 @@ package appeng.core.features.registries;
import java.util.HashSet;
import net.minecraft.world.World;
import net.minecraft.world.WorldProvider;
import net.minecraft.world.dimension.Dimension;
import appeng.api.features.IWorldGen;
@@ -45,7 +45,7 @@ public final class WorldGenRegistry implements IWorldGen
}
@Override
public void disableWorldGenForProviderID( final WorldGenType type, final Class<? extends WorldProvider> provider )
public void disableWorldGenForProviderID( WorldGenType type, Class<? extends Dimension> provider )
{
if( type == null )
{
@@ -95,9 +95,9 @@ public final class WorldGenRegistry implements IWorldGen
throw new IllegalArgumentException( "Bad Provider Passed" );
}
final boolean isBadProvider = this.types[type.ordinal()].badProviders.contains( w.provider.getClass() );
final boolean isBadDimension = this.types[type.ordinal()].badDimensions.contains( w.provider.getDimension() );
final boolean isGoodDimension = this.types[type.ordinal()].enabledDimensions.contains( w.provider.getDimension() );
final boolean isBadProvider = this.types[type.ordinal()].badProviders.contains( w.dimension.getClass() );
final boolean isBadDimension = this.types[type.ordinal()].badDimensions.contains( w.dimension.getDimension() );
final boolean isGoodDimension = this.types[type.ordinal()].enabledDimensions.contains( w.dimension.getDimension() );
if( isBadProvider || isBadDimension )
{
@@ -115,7 +115,7 @@ public final class WorldGenRegistry implements IWorldGen
private static class TypeSet
{
final HashSet<Class<? extends WorldProvider>> badProviders = new HashSet<>();
final HashSet<Class<? extends Dimension>> badProviders = new HashSet<>();
final HashSet<Integer> badDimensions = new HashSet<>();
final HashSet<Integer> enabledDimensions = new HashSet<>();
}
@@ -2,7 +2,7 @@
package appeng.core.features.registries.cell;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
@@ -28,7 +28,7 @@ public class BasicItemCellGuiHandler implements ICellGuiHandler
}
@Override
public void openChestGui( final EntityPlayer player, final IChestOrDrive chest, final ICellHandler cellHandler, final IMEInventoryHandler inv, final ItemStack is, final IStorageChannel chan )
public void openChestGui( final PlayerEntity player, final IChestOrDrive chest, final ICellHandler cellHandler, final IMEInventoryHandler inv, final ItemStack is, final IStorageChannel chan )
{
Platform.openGUI( player, (TileEntity) chest, AEPartLocation.fromFacing( chest.getUp() ), GuiBridge.GUI_ME );
}
@@ -29,10 +29,10 @@ import javax.annotation.Nonnull;
import com.google.common.base.Preconditions;
import com.google.common.collect.Maps;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.block.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import appeng.api.features.IGrinderRecipe;
import appeng.api.features.IGrinderRecipeBuilder;
@@ -67,9 +67,9 @@ public final class GrinderRecipeManager implements IGrinderRegistry, IOreListene
this.addDustRatio( "Coal", 1 );
this.addOre( "Coal", new ItemStack( Items.COAL ) );
this.addOre( "Charcoal", new ItemStack( Items.COAL, 1, 1 ) );
this.addOre( "Charcoal", new ItemStack( Items.COAL, 1 ) );
this.addOre( "NetherQuartz", new ItemStack( Blocks.QUARTZ_ORE ) );
this.addOre( "NetherQuartz", new ItemStack( Blocks.NETHER_QUARTZ_ORE ) );
this.addIngot( "NetherQuartz", new ItemStack( Items.QUARTZ ) );
this.addOre( "Gold", new ItemStack( Blocks.GOLD_ORE ) );
@@ -138,7 +138,7 @@ public final class GrinderRecipeManager implements IGrinderRegistry, IOreListene
return null;
}
this.log( "Recipe for '%1$s' found '%2$s'", input.getUnlocalizedName(), Platform.getItemDisplayName( recipe.getOutput() ) );
this.log( "Recipe for '%1$s' found '%2$s'", input.getTranslationKey(), Platform.getItemDisplayName( recipe.getOutput() ) );
return recipe;
}
@@ -344,7 +344,6 @@ public final class GrinderRecipeManager implements IGrinderRegistry, IOreListene
private static class CacheKey
{
private final Item item;
private final int damage;
CacheKey( ItemStack input )
{
@@ -352,7 +351,6 @@ public final class GrinderRecipeManager implements IGrinderRegistry, IOreListene
Preconditions.checkNotNull( input.getItem() );
this.item = input.getItem();
this.damage = input.getItemDamage();
}
@Override
@@ -360,7 +358,6 @@ public final class GrinderRecipeManager implements IGrinderRegistry, IOreListene
{
final int prime = 31;
int result = 1;
result = prime * result + this.damage;
result = prime * result + ( ( this.item == null ) ? 0 : this.item.hashCode() );
return result;
}
@@ -379,11 +376,6 @@ public final class GrinderRecipeManager implements IGrinderRegistry, IOreListene
CacheKey other = (CacheKey) obj;
if( this.damage != other.damage )
{
return false;
}
if( this.item == null )
{
if( other.item != null )