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
@@ -21,7 +21,6 @@ package appeng.block.storage;
import javax.annotation.Nullable;
import appeng.api.util.AEPartLocation;
import net.minecraft.block.BlockRenderType;
import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
@@ -78,7 +77,7 @@ public class BlockSkyChest extends AEBaseTileBlock<TileSkyChest>
{
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;
+39 -39
View File
@@ -392,45 +392,45 @@ public abstract class AEBaseGui extends ContainerScreen<AEBaseContainer>
return;
}
if( slot instanceof SlotPatternTerm )
{
if( mouseButton == 6 )
{
return; // prevent weird double clicks..
}
try
{
NetworkHandler.instance().sendToServer( ( (SlotPatternTerm) slot ).getRequest( hasShiftDown() ) );
}
catch( final IOException e )
{
AELog.debug( e );
}
}
else if( slot instanceof SlotCraftingTerm )
{
if( mouseButton == 6 )
{
return; // prevent weird double clicks..
}
InventoryAction action = null;
if( hasShiftDown() )
{
action = InventoryAction.CRAFT_SHIFT;
}
else
{
// Craft stack on right-click, craft single on left-click
action = ( mouseButton == 1 ) ? InventoryAction.CRAFT_STACK : InventoryAction.CRAFT_ITEM;
}
final PacketInventoryAction p = new PacketInventoryAction( action, slotIdx, 0 );
NetworkHandler.instance().sendToServer( p );
return;
}
// FIXME if( slot instanceof SlotPatternTerm )
// FIXME {
// FIXME if( mouseButton == 6 )
// FIXME {
// FIXME return; // prevent weird double clicks..
// FIXME }
// FIXME
// FIXME try
// FIXME {
// FIXME NetworkHandler.instance().sendToServer( ( (SlotPatternTerm) slot ).getRequest( hasShiftDown() ) );
// FIXME }
// FIXME catch( final IOException e )
// FIXME {
// FIXME AELog.debug( e );
// FIXME }
// FIXME }
// FIXME else if( slot instanceof SlotCraftingTerm )
// FIXME {
// FIXME if( mouseButton == 6 )
// FIXME {
// FIXME return; // prevent weird double clicks..
// FIXME }
// FIXME
// FIXME InventoryAction action = null;
// FIXME if( hasShiftDown() )
// FIXME {
// FIXME action = InventoryAction.CRAFT_SHIFT;
// FIXME }
// FIXME else
// FIXME {
// FIXME // Craft stack on right-click, craft single on left-click
// FIXME action = ( mouseButton == 1 ) ? InventoryAction.CRAFT_STACK : InventoryAction.CRAFT_ITEM;
// FIXME }
// FIXME
// FIXME final PacketInventoryAction p = new PacketInventoryAction( action, slotIdx, 0 );
// FIXME NetworkHandler.instance().sendToServer( p );
// FIXME
// FIXME return;
// FIXME }
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.Nullable;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.container.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.items.SlotItemHandler;
@@ -52,12 +48,6 @@ class Size1Slot extends SlotItemHandler
return this.delegate.getHasStack();
}
@Override
public boolean isHere( IInventory inv, int slotIn )
{
return this.delegate.isHere( inv, slotIn );
}
@Override
public int getSlotStackLimit()
{
@@ -70,14 +60,6 @@ class Size1Slot extends SlotItemHandler
return this.delegate.getItemStackLimit( stack );
}
@Override
@Nullable
@OnlyIn( Dist.CLIENT )
public String getSlotTexture()
{
return this.delegate.getSlotTexture();
}
@Override
public boolean canTakeStack( PlayerEntity playerIn )
{
@@ -91,20 +73,6 @@ class Size1Slot extends SlotItemHandler
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
public int getSlotIndex()
{
@@ -21,9 +21,7 @@ package appeng.container.slot;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.CraftingInventory;
import net.minecraft.inventory.CraftingInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.util.NonNullList;
import net.minecraft.world.World;
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.
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;
import appeng.core.Api;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.Slot;
import net.minecraft.item.Items;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntityFurnace;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.oredict.OreDictionary;
import appeng.api.AEApi;
import appeng.api.definitions.IDefinitions;
import appeng.api.definitions.IItems;
import appeng.api.definitions.IMaterials;
@@ -41,7 +40,6 @@ import appeng.api.implementations.items.IStorageComponent;
import appeng.api.implementations.items.IUpgradeModule;
import appeng.api.networking.crafting.ICraftingPatternDetails;
import appeng.api.storage.ICellWorkbenchItem;
import appeng.items.misc.ItemEncodedPattern;
import appeng.util.Platform;
@@ -88,7 +86,7 @@ public class SlotRestrictedInput extends AppEngSlot
return true;
}
public Slot setStackLimit( final int i )
public Slot setStackLimit(final int i )
{
this.stackLimit = i;
return this;
@@ -194,9 +192,9 @@ public class SlotRestrictedInput extends AppEngSlot
case VIEW_CELL:
return items.viewCell().isSameAs( i );
case ORE:
return appeng.api.Api.INSTANCE.registries().grinder().getRecipeForInput( i ) != null;
return Api.INSTANCE.registries().grinder().getRecipeForInput( i ) != null;
case FUEL:
return TileEntityFurnace.getItemBurnTime( i ) > 0;
return ForgeHooks.getBurnTime( i ) > 0;
case POWERED_TOOL:
return Platform.isChargeable( i );
case QE_SINGULARITY:
@@ -245,15 +243,15 @@ public class SlotRestrictedInput extends AppEngSlot
if( Platform.isClient() && ( this.which == PlacableItemType.ENCODED_PATTERN ) )
{
final ItemStack is = super.getStack();
if( !is.isEmpty() && is.getItem() instanceof ItemEncodedPattern )
{
final ItemEncodedPattern iep = (ItemEncodedPattern) is.getItem();
final ItemStack out = iep.getOutput( is );
if( !out.isEmpty() )
{
return out;
}
}
// FIXME if( !is.isEmpty() && is.getItem() instanceof ItemEncodedPattern )
// FIXME {
// FIXME final ItemEncodedPattern iep = (ItemEncodedPattern) is.getItem();
// FIXME final ItemStack out = iep.getOutput( is );
// FIXME if( !out.isEmpty() )
// FIXME {
// FIXME return out;
// FIXME }
// FIXME }
}
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 ItemStack ingot : OreDictionary.getOres( "ingot" + name ) )
{
if( Platform.itemComparisons().isSameItem( i, ingot ) )
{
return true;
}
}
// FIXME for( final ItemStack ingot : OreDictionary.getOres( "ingot" + name ) )
// FIXME {
// FIXME if( Platform.itemComparisons().isSameItem( i, ingot ) )
// FIXME {
// FIXME return true;
// FIXME }
// FIXME }
}
return false;
@@ -72,7 +72,8 @@ public class NetworkHandler
{
try
{
return new AppEngClientPacketHandler();
// FIXME return new AppEngClientPacketHandler();
return null;
}
catch( final Throwable t )
{
@@ -84,7 +85,8 @@ public class NetworkHandler
{
try
{
return new AppEngServerPacketHandler();
// FIXME return new AppEngServerPacketHandler();
return null;
}
catch( final Throwable t )
{
@@ -26,6 +26,7 @@ import java.util.WeakHashMap;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUseContext;
import net.minecraft.util.ActionResult;
@@ -56,7 +57,7 @@ public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternIt
public ItemEncodedPattern()
{
this.setMaxStackSize( 1 );
super(new Item.Properties().maxStackSize(1));
}
@Override
+16 -14
View File
@@ -19,10 +19,12 @@
package appeng.util;
import appeng.api.config.AccessRestriction;
import appeng.api.config.Actionable;
import appeng.api.config.PowerMultiplier;
import appeng.api.config.SecurityPermissions;
import appeng.api.definitions.IItemDefinition;
import appeng.api.implementations.items.IAEItemPowerStorage;
import appeng.api.implementations.items.IAEWrench;
import appeng.api.networking.IGrid;
import appeng.api.networking.IGridNode;
@@ -656,20 +658,20 @@ public class Platform
return false;
}
// public static boolean isChargeable( final ItemStack i )
// {
// if( i.isEmpty() )
// {
// return false;
// }
// final Item it = i.getItem();
// if( it instanceof IAEItemPowerStorage )
// {
// return ( (IAEItemPowerStorage) it ).getPowerFlow( i ) != AccessRestriction.READ;
// }
// return false;
// }
//
public static boolean isChargeable( final ItemStack i )
{
if( i.isEmpty() )
{
return false;
}
final Item it = i.getItem();
if( it instanceof IAEItemPowerStorage)
{
return ( (IAEItemPowerStorage) it ).getPowerFlow( i ) != AccessRestriction.READ;
}
return false;
}
public static PlayerEntity getPlayer(final ServerWorld w )
{
Objects.requireNonNull( w );