Custom Model Loader

This commit is contained in:
Sebastian Hartte
2020-06-01 04:02:37 +02:00
parent 077ff17078
commit 5cdeff01be
202 changed files with 942 additions and 1017 deletions
@@ -117,11 +117,11 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
ItemStack paintBall = this.getColor( is );
final IMEInventory<IAEItemStack> inv = AEApi.instance()
final IMEInventory<IAEItemStack> inv = Api.INSTANCE
.registries()
.cell()
.getCellInventory( is, null,
AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) );
if( inv != null )
{
final IAEItemStack option = inv.extractItems( AEItemStack.fromItemStack( paintBall ), Actionable.SIMULATE, new BaseActionSource() );
@@ -267,15 +267,15 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
{
ItemStack newColor = ItemStack.EMPTY;
final IMEInventory<IAEItemStack> inv = AEApi.instance()
final IMEInventory<IAEItemStack> inv = Api.INSTANCE
.registries()
.cell()
.getCellInventory( is, null,
AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) );
if( inv != null )
{
final IItemList<IAEItemStack> itemList = inv
.getAvailableItems( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList() );
.getAvailableItems( Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createList() );
if( anchor.isEmpty() )
{
final IAEItemStack firstItem = itemList.getFirstItem();
@@ -428,13 +428,13 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
{
super.addInformation( stack, world, lines, advancedTooltips );
final ICellInventoryHandler<IAEItemStack> cdi = AEApi.instance()
final ICellInventoryHandler<IAEItemStack> cdi = Api.INSTANCE
.registries()
.cell()
.getCellInventory( stack, null,
AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) );
AEApi.instance().client().addCellInformation( cdi, lines );
Api.INSTANCE.client().addCellInformation( cdi, lines );
}
@Override
@@ -501,7 +501,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
@Override
public IStorageChannel<IAEItemStack> getChannel()
{
return AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class );
return Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class );
}
@Override
@@ -93,13 +93,13 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell<
{
super.addInformation( stack, world, lines, advancedTooltips );
final ICellInventoryHandler<IAEItemStack> cdi = AEApi.instance()
final ICellInventoryHandler<IAEItemStack> cdi = Api.INSTANCE
.registries()
.cell()
.getCellInventory( stack, null,
AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) );
AEApi.instance().client().addCellInformation( cdi, lines );
Api.INSTANCE.client().addCellInformation( cdi, lines );
}
@Override
@@ -115,15 +115,15 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell<
shots += cu.getInstalledUpgrades( Upgrades.SPEED );
}
final ICellInventoryHandler<IAEItemStack> inv = AEApi.instance()
final ICellInventoryHandler<IAEItemStack> inv = Api.INSTANCE
.registries()
.cell()
.getCellInventory( p.getHeldItem( hand ), null,
AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) );
if( inv != null )
{
final IItemList<IAEItemStack> itemList = inv
.getAvailableItems( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList() );
.getAvailableItems( Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createList() );
IAEItemStack req = itemList.getFirstItem();
if( req instanceof IAEItemStack )
{
@@ -162,7 +162,7 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell<
final double d1 = Vec3d.y;
final double d2 = Vec3d.z;
final float penetration = AEApi.instance().registries().matterCannon().getPenetration( ammo ); // 196.96655f;
final float penetration = Api.INSTANCE.registries().matterCannon().getPenetration( ammo ); // 196.96655f;
if( penetration <= 0 )
{
final ItemStack type = aeAmmo.asItemStackRepresentation();
@@ -291,7 +291,7 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell<
final Block whatsThere = w.getBlockState( hitPos ).getBlock();
if( whatsThere.isReplaceable( w, hitPos ) && w.isAirBlock( hitPos ) )
{
AEApi.instance().definitions().blocks().paint().maybeBlock().ifPresent( paintBlock ->
Api.INSTANCE.definitions().blocks().paint().maybeBlock().ifPresent( paintBlock ->
{
w.setBlockState( hitPos, paintBlock.getDefaultState(), 3 );
} );
@@ -495,7 +495,7 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell<
@Override
public boolean isBlackListed( final ItemStack cellItem, final IAEItemStack requestedAddition )
{
final float pen = AEApi.instance().registries().matterCannon().getPenetration( requestedAddition.createItemStack() );
final float pen = Api.INSTANCE.registries().matterCannon().getPenetration( requestedAddition.createItemStack() );
if( pen > 0 )
{
return false;
@@ -530,6 +530,6 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell<
@Override
public IStorageChannel<IAEItemStack> getChannel()
{
return AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class );
return Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class );
}
}
@@ -83,13 +83,13 @@ public class ToolPortableCell extends AEBasePoweredItem implements IStorageCell<
{
super.addInformation( stack, world, lines, advancedTooltips );
final ICellInventoryHandler<IAEItemStack> cdi = AEApi.instance()
final ICellInventoryHandler<IAEItemStack> cdi = Api.INSTANCE
.registries()
.cell()
.getCellInventory( stack, null,
AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) );
AEApi.instance().client().addCellInformation( cdi, lines );
Api.INSTANCE.client().addCellInformation( cdi, lines );
}
@Override
@@ -137,7 +137,7 @@ public class ToolPortableCell extends AEBasePoweredItem implements IStorageCell<
@Override
public IStorageChannel<IAEItemStack> getChannel()
{
return AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class );
return Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class );
}
@Override
@@ -58,7 +58,7 @@ public class ToolWirelessTerminal extends AEBasePoweredItem implements IWireless
@Override
public ActionResult<ItemStack> onItemRightClick( final World w, final PlayerEntity player, final Hand hand )
{
AEApi.instance().registries().wireless().openWirelessTerminalGui( player.getHeldItem( hand ), w, player );
Api.INSTANCE.registries().wireless().openWirelessTerminalGui( player.getHeldItem( hand ), w, player );
return new ActionResult<>( EnumActionResult.SUCCESS, player.getHeldItem( hand ) );
}
@@ -101,7 +101,7 @@ public class ToolWirelessTerminal extends AEBasePoweredItem implements IWireless
@Override
public boolean canHandle( final ItemStack is )
{
return AEApi.instance().definitions().items().wirelessTerminal().isSameAs( is );
return Api.INSTANCE.definitions().items().wirelessTerminal().isSameAs( is );
}
@Override
@@ -20,19 +20,19 @@ package appeng.items.tools.quartz;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUseContext;
import net.minecraft.util.ActionResult;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.Direction;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import appeng.api.implementations.guiobjects.IGuiItem;
import appeng.api.implementations.guiobjects.IGuiItemObject;
import appeng.api.util.AEPartLocation;
import appeng.core.features.AEFeature;
import appeng.core.sync.GuiBridge;
import appeng.items.AEBaseItem;
import appeng.items.contents.QuartzKnifeObj;
import appeng.util.Platform;
@@ -44,19 +44,22 @@ public class ToolQuartzCuttingKnife extends AEBaseItem implements IGuiItem
public ToolQuartzCuttingKnife( final AEFeature type )
{
super(new Item.Properties()
.group(ItemGroup.TOOLS)
.maxStackSize(1)
.maxDamage(50)
.setNoRepair());
this.type = type;
this.setMaxDamage( 50 );
this.setMaxStackSize( 1 );
}
@Override
public EnumActionResult onItemUse( final PlayerEntity p, final World worldIn, final BlockPos pos, final Hand hand, final Direction side, final float hitX, final float hitY, final float hitZ )
public ActionResultType onItemUse(ItemUseContext context )
{
if( Platform.isServer() )
{
Platform.openGUI( p, null, AEPartLocation.INTERNAL, GuiBridge.GUI_QUARTZ_KNIFE );
// FIXME Platform.openGUI( p, null, AEPartLocation.INTERNAL, GuiBridge.GUI_QUARTZ_KNIFE );
}
return EnumActionResult.SUCCESS;
return ActionResultType.SUCCESS;
}
@Override
@@ -64,10 +67,10 @@ public class ToolQuartzCuttingKnife extends AEBaseItem implements IGuiItem
{
if( Platform.isServer() )
{
Platform.openGUI( p, null, AEPartLocation.INTERNAL, GuiBridge.GUI_QUARTZ_KNIFE );
// FIXME Platform.openGUI( p, null, AEPartLocation.INTERNAL, GuiBridge.GUI_QUARTZ_KNIFE );
}
p.swingArm( hand );
return new ActionResult<>( EnumActionResult.SUCCESS, p.getHeldItem( hand ) );
return new ActionResult<>( ActionResultType.SUCCESS, p.getHeldItem( hand ) );
}
@Override
@@ -76,17 +79,11 @@ public class ToolQuartzCuttingKnife extends AEBaseItem implements IGuiItem
return Platform.canRepair( this.type, a, b );
}
@Override
public boolean isRepairable()
{
return false;
}
@Override
public ItemStack getContainerItem( final ItemStack itemStack )
{
ItemStack copy = itemStack.copy();
copy.setItemDamage( itemStack.getDamage() + 1 );
copy.setDamage( itemStack.getDamage() + 1 );
return copy;
}
@@ -19,8 +19,10 @@
package appeng.items.tools.quartz;
import appeng.core.CreativeTab;
import net.minecraft.block.Block;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUseContext;
import net.minecraft.util.ActionResultType;
@@ -38,20 +40,21 @@ public class ToolQuartzWrench extends AEBaseItem implements IAEWrench
public ToolQuartzWrench()
{
super( new Properties().maxStackSize( 1 ) );
super( new Properties()
.group(ItemGroup.TOOLS)
.maxStackSize( 1 ) );
}
@Override
public ActionResultType onItemUse( ItemUseContext context )
{
final Block b = context.getWorld().getBlockState( context.getPos() ).getBlock();
if( b != null && !context.getPlayer().isShiftKeyDown() && Platform.hasPermissions( new DimensionalCoord( context.getWorld(), context.getPos() ),
if( !context.getPlayer().isCrouching() && Platform.hasPermissions( new DimensionalCoord( context.getWorld(), context.getPos() ),
context.getPlayer() ) )
{
if( Platform.isClient() )
{
// TODO 1.10-R - if we return FAIL on client, action will not be sent to server. Fix that in all
// Block#onItemUseFirst overrides.
// TODO 1.10-R - if we return FAIL on client, action will not be sent to server. Fix that in all Block#onItemUseFirst overrides.
return !context.getWorld().isRemote ? ActionResultType.SUCCESS : ActionResultType.PASS;
}