startClient works again

This commit is contained in:
Sebastian Hartte
2020-06-02 11:54:23 +02:00
parent 7747804385
commit 92fa237ce0
9 changed files with 90 additions and 117 deletions
+4
View File
@@ -213,6 +213,10 @@ sourceSets {
include 'appeng/util/IWideReadableNumberConverter.java' include 'appeng/util/IWideReadableNumberConverter.java'
include 'appeng/util/ReadableNumberConverter.java' include 'appeng/util/ReadableNumberConverter.java'
include 'appeng/container/slot/IOptionalSlot.java' include 'appeng/container/slot/IOptionalSlot.java'
include 'appeng/client/gui/Size1Slot.java'
include 'appeng/container/slot/SlotOutput.java'
include 'appeng/container/slot/AppEngCraftingSlot.java'
include 'appeng/container/slot/SlotRestrictedInput.java'
} }
compileClasspath += sourceSets.api.output compileClasspath += sourceSets.api.output
runtimeClasspath += sourceSets.api.output runtimeClasspath += sourceSets.api.output
@@ -21,7 +21,6 @@ package appeng.block.storage;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import appeng.api.util.AEPartLocation;
import net.minecraft.block.BlockRenderType; import net.minecraft.block.BlockRenderType;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
@@ -78,7 +77,7 @@ public class BlockSkyChest extends AEBaseTileBlock<TileSkyChest>
{ {
if( Platform.isServer() ) if( Platform.isServer() )
{ {
Platform.openGUI( player, this.getTileEntity( w, pos ), AEPartLocation.fromFacing(hit.getFace()), GuiBridge.GUI_SKYCHEST ); // FIXME Platform.openGUI( player, this.getTileEntity( w, pos ), AEPartLocation.fromFacing(hit.getFace()), GuiBridge.GUI_SKYCHEST );
} }
return ActionResultType.SUCCESS; return ActionResultType.SUCCESS;
+39 -39
View File
@@ -392,45 +392,45 @@ public abstract class AEBaseGui extends ContainerScreen<AEBaseContainer>
return; return;
} }
if( slot instanceof SlotPatternTerm ) // FIXME if( slot instanceof SlotPatternTerm )
{ // FIXME {
if( mouseButton == 6 ) // FIXME if( mouseButton == 6 )
{ // FIXME {
return; // prevent weird double clicks.. // FIXME return; // prevent weird double clicks..
} // FIXME }
// FIXME
try // FIXME try
{ // FIXME {
NetworkHandler.instance().sendToServer( ( (SlotPatternTerm) slot ).getRequest( hasShiftDown() ) ); // FIXME NetworkHandler.instance().sendToServer( ( (SlotPatternTerm) slot ).getRequest( hasShiftDown() ) );
} // FIXME }
catch( final IOException e ) // FIXME catch( final IOException e )
{ // FIXME {
AELog.debug( e ); // FIXME AELog.debug( e );
} // FIXME }
} // FIXME }
else if( slot instanceof SlotCraftingTerm ) // FIXME else if( slot instanceof SlotCraftingTerm )
{ // FIXME {
if( mouseButton == 6 ) // FIXME if( mouseButton == 6 )
{ // FIXME {
return; // prevent weird double clicks.. // FIXME return; // prevent weird double clicks..
} // FIXME }
// FIXME
InventoryAction action = null; // FIXME InventoryAction action = null;
if( hasShiftDown() ) // FIXME if( hasShiftDown() )
{ // FIXME {
action = InventoryAction.CRAFT_SHIFT; // FIXME action = InventoryAction.CRAFT_SHIFT;
} // FIXME }
else // FIXME else
{ // FIXME {
// Craft stack on right-click, craft single on left-click // FIXME // Craft stack on right-click, craft single on left-click
action = ( mouseButton == 1 ) ? InventoryAction.CRAFT_STACK : InventoryAction.CRAFT_ITEM; // FIXME action = ( mouseButton == 1 ) ? InventoryAction.CRAFT_STACK : InventoryAction.CRAFT_ITEM;
} // FIXME }
// FIXME
final PacketInventoryAction p = new PacketInventoryAction( action, slotIdx, 0 ); // FIXME final PacketInventoryAction p = new PacketInventoryAction( action, slotIdx, 0 );
NetworkHandler.instance().sendToServer( p ); // FIXME NetworkHandler.instance().sendToServer( p );
// FIXME
return; // FIXME return;
} // FIXME }
if( InputMappings.isKeyDown(Minecraft.getInstance().getMainWindow().getHandle(), GLFW.GLFW_KEY_SPACE) ) if( InputMappings.isKeyDown(Minecraft.getInstance().getMainWindow().getHandle(), GLFW.GLFW_KEY_SPACE) )
{ {
@@ -3,14 +3,10 @@ package appeng.client.gui;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.container.Slot; import net.minecraft.inventory.container.Slot;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.items.SlotItemHandler; import net.minecraftforge.items.SlotItemHandler;
@@ -52,12 +48,6 @@ class Size1Slot extends SlotItemHandler
return this.delegate.getHasStack(); return this.delegate.getHasStack();
} }
@Override
public boolean isHere( IInventory inv, int slotIn )
{
return this.delegate.isHere( inv, slotIn );
}
@Override @Override
public int getSlotStackLimit() public int getSlotStackLimit()
{ {
@@ -70,14 +60,6 @@ class Size1Slot extends SlotItemHandler
return this.delegate.getItemStackLimit( stack ); return this.delegate.getItemStackLimit( stack );
} }
@Override
@Nullable
@OnlyIn( Dist.CLIENT )
public String getSlotTexture()
{
return this.delegate.getSlotTexture();
}
@Override @Override
public boolean canTakeStack( PlayerEntity playerIn ) public boolean canTakeStack( PlayerEntity playerIn )
{ {
@@ -91,20 +73,6 @@ class Size1Slot extends SlotItemHandler
return this.delegate.isEnabled(); return this.delegate.isEnabled();
} }
@Override
@OnlyIn( Dist.CLIENT )
public ResourceLocation getBackgroundLocation()
{
return this.delegate.getBackgroundLocation();
}
@Override
@OnlyIn( Dist.CLIENT )
public TextureAtlasSprite getBackgroundSprite()
{
return this.delegate.getBackgroundSprite();
}
@Override @Override
public int getSlotIndex() public int getSlotIndex()
{ {
@@ -21,9 +21,7 @@ package appeng.container.slot;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.CraftingInventory; import net.minecraft.inventory.CraftingInventory;
import net.minecraft.inventory.CraftingInventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.util.NonNullList; import net.minecraft.util.NonNullList;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fml.hooks.BasicEventHooks; import net.minecraftforge.fml.hooks.BasicEventHooks;
@@ -202,6 +200,7 @@ public class AppEngCraftingSlot extends AppEngSlot
// TODO: This is really hacky and NEEDS to be solved with a full container/gui refactoring. // TODO: This is really hacky and NEEDS to be solved with a full container/gui refactoring.
protected NonNullList<ItemStack> getRemainingItems( CraftingInventory ic, World world ) protected NonNullList<ItemStack> getRemainingItems( CraftingInventory ic, World world )
{ {
return CraftingManager.getRemainingItems( ic, world ); // FIXME return CraftingManager.getRemainingItems( ic, world );
return null;
} }
} }
@@ -19,17 +19,16 @@
package appeng.container.slot; package appeng.container.slot;
import appeng.core.Api;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.Slot;
import net.minecraft.item.Items; import net.minecraft.item.Items;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntityFurnace;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.oredict.OreDictionary;
import appeng.api.AEApi;
import appeng.api.definitions.IDefinitions; import appeng.api.definitions.IDefinitions;
import appeng.api.definitions.IItems; import appeng.api.definitions.IItems;
import appeng.api.definitions.IMaterials; import appeng.api.definitions.IMaterials;
@@ -41,7 +40,6 @@ import appeng.api.implementations.items.IStorageComponent;
import appeng.api.implementations.items.IUpgradeModule; import appeng.api.implementations.items.IUpgradeModule;
import appeng.api.networking.crafting.ICraftingPatternDetails; import appeng.api.networking.crafting.ICraftingPatternDetails;
import appeng.api.storage.ICellWorkbenchItem; import appeng.api.storage.ICellWorkbenchItem;
import appeng.items.misc.ItemEncodedPattern;
import appeng.util.Platform; import appeng.util.Platform;
@@ -88,7 +86,7 @@ public class SlotRestrictedInput extends AppEngSlot
return true; return true;
} }
public Slot setStackLimit( final int i ) public Slot setStackLimit(final int i )
{ {
this.stackLimit = i; this.stackLimit = i;
return this; return this;
@@ -194,9 +192,9 @@ public class SlotRestrictedInput extends AppEngSlot
case VIEW_CELL: case VIEW_CELL:
return items.viewCell().isSameAs( i ); return items.viewCell().isSameAs( i );
case ORE: case ORE:
return appeng.api.Api.INSTANCE.registries().grinder().getRecipeForInput( i ) != null; return Api.INSTANCE.registries().grinder().getRecipeForInput( i ) != null;
case FUEL: case FUEL:
return TileEntityFurnace.getItemBurnTime( i ) > 0; return ForgeHooks.getBurnTime( i ) > 0;
case POWERED_TOOL: case POWERED_TOOL:
return Platform.isChargeable( i ); return Platform.isChargeable( i );
case QE_SINGULARITY: case QE_SINGULARITY:
@@ -245,15 +243,15 @@ public class SlotRestrictedInput extends AppEngSlot
if( Platform.isClient() && ( this.which == PlacableItemType.ENCODED_PATTERN ) ) if( Platform.isClient() && ( this.which == PlacableItemType.ENCODED_PATTERN ) )
{ {
final ItemStack is = super.getStack(); final ItemStack is = super.getStack();
if( !is.isEmpty() && is.getItem() instanceof ItemEncodedPattern ) // FIXME if( !is.isEmpty() && is.getItem() instanceof ItemEncodedPattern )
{ // FIXME {
final ItemEncodedPattern iep = (ItemEncodedPattern) is.getItem(); // FIXME final ItemEncodedPattern iep = (ItemEncodedPattern) is.getItem();
final ItemStack out = iep.getOutput( is ); // FIXME final ItemStack out = iep.getOutput( is );
if( !out.isEmpty() ) // FIXME if( !out.isEmpty() )
{ // FIXME {
return out; // FIXME return out;
} // FIXME }
} // FIXME }
} }
return super.getStack(); return super.getStack();
} }
@@ -267,13 +265,13 @@ public class SlotRestrictedInput extends AppEngSlot
for( final String name : new String[] { "Copper", "Tin", "Obsidian", "Iron", "Lead", "Bronze", "Brass", "Nickel", "Aluminium" } ) for( final String name : new String[] { "Copper", "Tin", "Obsidian", "Iron", "Lead", "Bronze", "Brass", "Nickel", "Aluminium" } )
{ {
for( final ItemStack ingot : OreDictionary.getOres( "ingot" + name ) ) // FIXME for( final ItemStack ingot : OreDictionary.getOres( "ingot" + name ) )
{ // FIXME {
if( Platform.itemComparisons().isSameItem( i, ingot ) ) // FIXME if( Platform.itemComparisons().isSameItem( i, ingot ) )
{ // FIXME {
return true; // FIXME return true;
} // FIXME }
} // FIXME }
} }
return false; return false;
@@ -72,7 +72,8 @@ public class NetworkHandler
{ {
try try
{ {
return new AppEngClientPacketHandler(); // FIXME return new AppEngClientPacketHandler();
return null;
} }
catch( final Throwable t ) catch( final Throwable t )
{ {
@@ -84,7 +85,8 @@ public class NetworkHandler
{ {
try try
{ {
return new AppEngServerPacketHandler(); // FIXME return new AppEngServerPacketHandler();
return null;
} }
catch( final Throwable t ) catch( final Throwable t )
{ {
@@ -26,6 +26,7 @@ import java.util.WeakHashMap;
import net.minecraft.client.util.ITooltipFlag; import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUseContext; import net.minecraft.item.ItemUseContext;
import net.minecraft.util.ActionResult; import net.minecraft.util.ActionResult;
@@ -56,7 +57,7 @@ public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternIt
public ItemEncodedPattern() public ItemEncodedPattern()
{ {
this.setMaxStackSize( 1 ); super(new Item.Properties().maxStackSize(1));
} }
@Override @Override
+16 -14
View File
@@ -19,10 +19,12 @@
package appeng.util; package appeng.util;
import appeng.api.config.AccessRestriction;
import appeng.api.config.Actionable; import appeng.api.config.Actionable;
import appeng.api.config.PowerMultiplier; import appeng.api.config.PowerMultiplier;
import appeng.api.config.SecurityPermissions; import appeng.api.config.SecurityPermissions;
import appeng.api.definitions.IItemDefinition; import appeng.api.definitions.IItemDefinition;
import appeng.api.implementations.items.IAEItemPowerStorage;
import appeng.api.implementations.items.IAEWrench; import appeng.api.implementations.items.IAEWrench;
import appeng.api.networking.IGrid; import appeng.api.networking.IGrid;
import appeng.api.networking.IGridNode; import appeng.api.networking.IGridNode;
@@ -656,20 +658,20 @@ public class Platform
return false; return false;
} }
// public static boolean isChargeable( final ItemStack i ) public static boolean isChargeable( final ItemStack i )
// { {
// if( i.isEmpty() ) if( i.isEmpty() )
// { {
// return false; return false;
// } }
// final Item it = i.getItem(); final Item it = i.getItem();
// if( it instanceof IAEItemPowerStorage ) if( it instanceof IAEItemPowerStorage)
// { {
// return ( (IAEItemPowerStorage) it ).getPowerFlow( i ) != AccessRestriction.READ; return ( (IAEItemPowerStorage) it ).getPowerFlow( i ) != AccessRestriction.READ;
// } }
// return false; return false;
// } }
//
public static PlayerEntity getPlayer(final ServerWorld w ) public static PlayerEntity getPlayer(final ServerWorld w )
{ {
Objects.requireNonNull( w ); Objects.requireNonNull( w );