Connected Glass
This commit is contained in:
@@ -41,7 +41,7 @@ import net.minecraftforge.common.util.FakePlayer;
|
||||
|
||||
import appeng.api.implementations.tiles.ICrankable;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.core.stats.Stats;
|
||||
import appeng.core.stats.AeStats;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import appeng.tile.grindstone.TileCrank;
|
||||
|
||||
@@ -72,7 +72,7 @@ public class BlockCrank extends AEBaseTileBlock
|
||||
{
|
||||
if( ( (TileCrank) tile ).power() )
|
||||
{
|
||||
Stats.TurnedCranks.addToPlayer( player, 1 );
|
||||
AeStats.TurnedCranks.addToPlayer( player, 1 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.model.ModelResourceLocation;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
@@ -21,7 +21,9 @@ package appeng.bootstrap;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.bootstrap.components.BlockColorComponent;
|
||||
import appeng.bootstrap.components.RenderTypeComponent;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.color.IBlockColor;
|
||||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.model.IUnbakedModel;
|
||||
@@ -54,6 +56,9 @@ class BlockRendering implements IBlockRendering
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
private Map<String, IUnbakedModel> builtInModels = new HashMap<>();
|
||||
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
private RenderType renderType;
|
||||
|
||||
@Override
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public IBlockRendering modelCustomizer( BiFunction<ResourceLocation, IBakedModel, IBakedModel> customizer )
|
||||
@@ -85,7 +90,13 @@ class BlockRendering implements IBlockRendering
|
||||
return this;
|
||||
}
|
||||
|
||||
// FIXME @OnlyIn( Dist.CLIENT )
|
||||
@Override
|
||||
public IBlockRendering renderType(RenderType type) {
|
||||
this.renderType = type;
|
||||
return this;
|
||||
}
|
||||
|
||||
// FIXME @OnlyIn( Dist.CLIENT )
|
||||
// FIXME @Override
|
||||
// FIXME public IBlockRendering stateMapper( IStateMapper mapper )
|
||||
// FIXME {
|
||||
@@ -123,6 +134,10 @@ class BlockRendering implements IBlockRendering
|
||||
factory.addBootstrapComponent( new BlockColorComponent( block, this.blockColor ) );
|
||||
}
|
||||
|
||||
if (this.renderType != null) {
|
||||
factory.addBootstrapComponent( new RenderTypeComponent( block, this.renderType));
|
||||
}
|
||||
|
||||
// FIXME if( this.stateMapper != null )
|
||||
// FIXME {
|
||||
// FIXME factory.addBootstrapComponent( new StateMapperComponent( block, this.stateMapper ) );
|
||||
|
||||
@@ -23,6 +23,7 @@ import java.util.function.BiFunction;
|
||||
import java.util.function.Function;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ package appeng.bootstrap;
|
||||
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.color.IBlockColor;
|
||||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.model.IUnbakedModel;
|
||||
@@ -55,4 +56,7 @@ public interface IBlockRendering
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
IBlockRendering builtInModel( String name, IUnbakedModel model );
|
||||
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
IBlockRendering renderType(RenderType type);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package appeng.bootstrap.components;
|
||||
|
||||
import appeng.bootstrap.IBootstrapComponent;
|
||||
|
||||
/**
|
||||
* Will be run during {@link net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent}.
|
||||
*/
|
||||
public interface IClientSetupComponent extends IBootstrapComponent {
|
||||
|
||||
void setup();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package appeng.bootstrap.components;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.RenderTypeLookup;
|
||||
|
||||
/**
|
||||
* Sets the rendering type for a block.
|
||||
*/
|
||||
public class RenderTypeComponent implements IClientSetupComponent {
|
||||
|
||||
private final Block block;
|
||||
|
||||
private final RenderType renderType;
|
||||
|
||||
public RenderTypeComponent(Block block, RenderType renderType) {
|
||||
this.block = block;
|
||||
this.renderType = renderType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setup() {
|
||||
RenderTypeLookup.setRenderLayer(block, renderType);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -119,6 +119,7 @@ class GlassBakedModel implements IDynamicBakedModel
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
// TODO: This could just use the Random instance we're given...
|
||||
final int cx = Math.abs( glassState.getX() % 10 );
|
||||
final int cy = Math.abs( glassState.getY() % 10 );
|
||||
final int cz = Math.abs( glassState.getZ() % 10 );
|
||||
@@ -229,11 +230,10 @@ class GlassBakedModel implements IDynamicBakedModel
|
||||
|
||||
// Apply the u,v shift.
|
||||
// This mirrors the logic from OffsetIcon from 1.7
|
||||
float u1 = MathHelper.clamp( 0 - uOffset, 0, 16 );
|
||||
float u2 = MathHelper.clamp( 16 - uOffset, 0, 16 );
|
||||
float v1 = MathHelper.clamp( 0 - vOffset, 0, 16 );
|
||||
float v2 = MathHelper.clamp( 16 - vOffset, 0, 16 );
|
||||
|
||||
float u1 = MathHelper.clamp( 0 /*- uOffset*/, 0, 16 );
|
||||
float u2 = MathHelper.clamp( 16 /*- uOffset*/, 0, 16 );
|
||||
float v1 = MathHelper.clamp( 0 /*- vOffset*/, 0, 16 );
|
||||
float v2 = MathHelper.clamp( 16 /*- vOffset*/, 0, 16 );
|
||||
|
||||
BakedQuadBuilder builder = new BakedQuadBuilder(sprite);
|
||||
builder.setQuadOrientation(side);
|
||||
@@ -263,6 +263,9 @@ class GlassBakedModel implements IDynamicBakedModel
|
||||
case COLOR:
|
||||
builder.put( e, 1.0f, 1.0f, 1.0f, 1.0f );
|
||||
break;
|
||||
case NORMAL:
|
||||
builder.put( e, (float) normal.x, (float) normal.y, (float) normal.z, 0f );
|
||||
break;
|
||||
case UV:
|
||||
if( el.getIndex() == 0 )
|
||||
{
|
||||
@@ -271,9 +274,6 @@ class GlassBakedModel implements IDynamicBakedModel
|
||||
builder.put( e, u, v, 0f, 1f );
|
||||
break;
|
||||
}
|
||||
case NORMAL:
|
||||
builder.put( e, (float) normal.x, (float) normal.y, (float) normal.z, 0f );
|
||||
break;
|
||||
default:
|
||||
builder.put( e );
|
||||
break;
|
||||
|
||||
@@ -32,6 +32,7 @@ import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.container.Container;
|
||||
import net.minecraft.inventory.container.IContainerListener;
|
||||
import net.minecraft.inventory.container.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
@@ -22,7 +22,7 @@ package appeng.container.implementations;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.inventory.container.Slot;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.config.SecurityPermissions;
|
||||
|
||||
@@ -23,8 +23,8 @@ import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.InventoryBasic;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.inventory.Inventory;
|
||||
import net.minecraft.inventory.container.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
@@ -36,7 +36,7 @@ import appeng.util.helpers.ItemHandlerUtil;
|
||||
|
||||
public class AppEngSlot extends Slot
|
||||
{
|
||||
private static IInventory emptyInventory = new InventoryBasic( "[Null]", true, 0 );
|
||||
private static IInventory emptyInventory = new Inventory(0);
|
||||
private final IItemHandler itemHandler;
|
||||
private final int index;
|
||||
|
||||
|
||||
@@ -21,6 +21,8 @@ package appeng.core;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import appeng.bootstrap.components.IBlockRegistrationComponent;
|
||||
import appeng.bootstrap.components.IClientSetupComponent;
|
||||
import appeng.client.ClientHelper;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.server.ServerHelper;
|
||||
@@ -28,9 +30,12 @@ import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.particles.ParticleType;
|
||||
import net.minecraft.stats.StatType;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.RegistryEvent;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.eventbus.api.IEventBus;
|
||||
import net.minecraftforge.fml.CrashReportExtender;
|
||||
import net.minecraftforge.fml.DistExecutor;
|
||||
@@ -41,7 +46,11 @@ import net.minecraftforge.fml.config.ModConfig;
|
||||
|
||||
import appeng.core.crash.ModCrashEnhancement;
|
||||
import appeng.services.export.ExportConfig;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
import net.minecraftforge.fml.loading.FMLEnvironment;
|
||||
import net.minecraftforge.registries.IForgeRegistry;
|
||||
|
||||
@Mod(AppEng.MOD_ID)
|
||||
public final class AppEng
|
||||
@@ -95,9 +104,22 @@ public final class AppEng
|
||||
modEventBus.addGenericListener(ParticleType.class, registration::registerParticleTypes);
|
||||
modEventBus.addListener(registration::registerParticleFactories);
|
||||
|
||||
modEventBus.addListener(this::commonSetup);
|
||||
|
||||
// Register client-only events
|
||||
DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> modEventBus.addListener(this::clientSetup));
|
||||
DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> modEventBus.addListener(registration::modelRegistryEvent));
|
||||
}
|
||||
|
||||
private void commonSetup(FMLCommonSetupEvent event) {
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
private void clientSetup(FMLClientSetupEvent event) {
|
||||
final ApiDefinitions definitions = Api.INSTANCE.definitions();
|
||||
definitions.getRegistry().getBootstrapComponents( IClientSetupComponent.class ).forEachRemaining(IClientSetupComponent::setup);
|
||||
}
|
||||
|
||||
// @Nonnull
|
||||
// public static AppEng instance()
|
||||
// {
|
||||
|
||||
@@ -26,6 +26,7 @@ import appeng.bootstrap.components.IItemRegistrationComponent;
|
||||
import appeng.bootstrap.components.IModelRegistrationComponent;
|
||||
import appeng.client.render.effects.ChargedOreFX;
|
||||
import appeng.client.render.model.GlassModelLoader;
|
||||
import appeng.core.stats.AeStats;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.ItemModelMesher;
|
||||
@@ -33,7 +34,11 @@ import net.minecraft.client.renderer.model.ModelResourceLocation;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.particles.ParticleType;
|
||||
import net.minecraft.stats.IStatFormatter;
|
||||
import net.minecraft.stats.StatType;
|
||||
import net.minecraft.stats.Stats;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.client.event.ModelRegistryEvent;
|
||||
@@ -49,6 +54,8 @@ final class Registration
|
||||
|
||||
public Registration() {
|
||||
ModelLoaderRegistry.registerLoader(new ResourceLocation(AppEng.MOD_ID, "glass"), GlassModelLoader.INSTANCE);
|
||||
|
||||
AeStats.register();
|
||||
}
|
||||
|
||||
// DimensionType storageDimensionType;
|
||||
@@ -260,7 +267,7 @@ final class Registration
|
||||
registry.register(ChargedOreFX.TYPE);
|
||||
}
|
||||
|
||||
public void registerParticleFactories(ParticleFactoryRegisterEvent evt) {
|
||||
public void registerParticleFactories(ParticleFactoryRegisterEvent event) {
|
||||
Minecraft.getInstance().particles.registerFactory(ChargedOreFX.TYPE, ChargedOreFX.Factory::new);
|
||||
}
|
||||
|
||||
|
||||
@@ -26,13 +26,16 @@ import appeng.bootstrap.BlockRenderingCustomizer;
|
||||
import appeng.bootstrap.FeatureFactory;
|
||||
import appeng.bootstrap.IBlockRendering;
|
||||
import appeng.bootstrap.IItemRendering;
|
||||
import appeng.client.render.model.GlassModel;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.features.registries.PartModels;
|
||||
import appeng.decorative.AEDecorativeBlock;
|
||||
import appeng.decorative.solid.*;
|
||||
import appeng.decorative.solid.BlockChargedQuartzOre;
|
||||
import appeng.decorative.solid.BlockQuartzGlass;
|
||||
import appeng.decorative.solid.BlockQuartzOre;
|
||||
import appeng.decorative.solid.BlockQuartzPillar;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -140,16 +143,13 @@ public final class ApiBlocks implements IBlocks
|
||||
|
||||
this.quartzGlass = registry.features( AEFeature.QUARTZ_GLASS )
|
||||
.block( "quartz_glass", BlockQuartzGlass::new )
|
||||
// .useCustomItemModel()
|
||||
// .rendering( new BlockRenderingCustomizer()
|
||||
// {
|
||||
// @Override
|
||||
// @OnlyIn( Dist.CLIENT)
|
||||
// public void customize(IBlockRendering rendering, IItemRendering itemRendering )
|
||||
// {
|
||||
// rendering.builtInModel( "models/block/builtin/quartz_glass", new GlassModel() );
|
||||
// }
|
||||
// } )
|
||||
.rendering(new BlockRenderingCustomizer() {
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void customize(IBlockRendering rendering, IItemRendering itemRendering) {
|
||||
rendering.renderType(RenderType.getCutout());
|
||||
}
|
||||
})
|
||||
.build();
|
||||
// this.quartzVibrantGlass = deco.block( "quartz_vibrant_glass", BlockQuartzLamp::new )
|
||||
// .addFeatures( AEFeature.DECORATIVE_LIGHTS, AEFeature.QUARTZ_GLASS )
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.core.stats;
|
||||
|
||||
|
||||
import appeng.core.AppEng;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.stats.IStatFormatter;
|
||||
import net.minecraft.stats.Stats;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
|
||||
public enum AeStats
|
||||
{
|
||||
|
||||
// done
|
||||
ItemsInserted("items_inserted"),
|
||||
|
||||
// done
|
||||
ItemsExtracted("items_extracted"),
|
||||
|
||||
// done
|
||||
TurnedCranks("turned_cranks");
|
||||
|
||||
private final ResourceLocation registryName;
|
||||
|
||||
AeStats(String id) {
|
||||
this.registryName = new ResourceLocation(AppEng.MOD_ID, id);
|
||||
}
|
||||
|
||||
public void addToPlayer(final PlayerEntity player, final int howMany )
|
||||
{
|
||||
player.addStat( this.registryName, howMany );
|
||||
}
|
||||
|
||||
public ResourceLocation getRegistryName() {
|
||||
return registryName;
|
||||
}
|
||||
|
||||
public static void register() {
|
||||
for (AeStats stat : AeStats.values()) {
|
||||
// Compare with net.minecraft.stats.Stats#registerCustom
|
||||
ResourceLocation registryName = stat.getRegistryName();
|
||||
Registry.register(Registry.CUSTOM_STAT, registryName.getPath(), registryName);
|
||||
Stats.CUSTOM.get(registryName, IStatFormatter.DEFAULT);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.core.stats;
|
||||
|
||||
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.stats.StatBasic;
|
||||
import net.minecraft.util.text.TextComponentTranslation;
|
||||
|
||||
|
||||
public enum Stats
|
||||
{
|
||||
|
||||
// done
|
||||
ItemsInserted,
|
||||
|
||||
// done
|
||||
ItemsExtracted,
|
||||
|
||||
// done
|
||||
TurnedCranks;
|
||||
|
||||
private StatBasic stat;
|
||||
|
||||
Stats()
|
||||
{
|
||||
}
|
||||
|
||||
public void addToPlayer( final PlayerEntity player, final int howMany )
|
||||
{
|
||||
player.addStat( this.stat, howMany );
|
||||
}
|
||||
|
||||
public static void register()
|
||||
{
|
||||
for( final Stats s : Stats.values() )
|
||||
{
|
||||
if( s.stat == null )
|
||||
{
|
||||
s.stat = new StatBasic( "stat.ae2." + s.name(), new TextComponentTranslation( "stat.ae2." + s.name() ) );
|
||||
s.stat.registerStat();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -34,7 +34,6 @@ import appeng.core.AEConfig;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.sync.network.INetworkInfo;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
|
||||
|
||||
public abstract class AppEngPacket
|
||||
@@ -48,7 +47,8 @@ public abstract class AppEngPacket
|
||||
|
||||
public final int getPacketID()
|
||||
{
|
||||
return AppEngPacketHandlerBase.PacketTypes.getID( this.getClass() ).ordinal();
|
||||
throw new IllegalStateException();
|
||||
// FIXME return AppEngPacketHandlerBase.PacketTypes.getID( this.getClass() ).ordinal();
|
||||
}
|
||||
|
||||
public void clientPacketData( final INetworkInfo network, final PlayerEntity player )
|
||||
@@ -74,7 +74,8 @@ public abstract class AppEngPacket
|
||||
AELog.info( this.getClass().getName() + " : " + p.readableBytes() );
|
||||
}
|
||||
|
||||
return direction.buildPacket( Pair.of( p, 0 ), NetworkHandler.instance().getChannel() ).getThis();
|
||||
// FIXME return direction.buildPacket( Pair.of( p, 0 ), NetworkHandler.instance().getChannel() ).getThis();
|
||||
return null;
|
||||
}
|
||||
|
||||
// TODO: Figure out why Forge/Minecraft on the server sets the stream data buffer to PooledUnsafeDirectByteBuf
|
||||
|
||||
@@ -22,7 +22,6 @@ package appeng.core.sync.network;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.network.INetHandler;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraftforge.fml.network.PacketDispatcher;
|
||||
|
||||
|
||||
public interface IPacketHandler
|
||||
|
||||
@@ -29,18 +29,14 @@ import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
import appeng.api.definitions.IComparableDefinition;
|
||||
import appeng.api.definitions.IItems;
|
||||
import appeng.api.implementations.items.IMemoryCard;
|
||||
import appeng.api.implementations.items.MemoryCardMessages;
|
||||
import appeng.block.networking.BlockCableBus;
|
||||
import appeng.core.Api;
|
||||
import appeng.core.sync.AppEngPacket;
|
||||
import appeng.core.sync.network.INetworkInfo;
|
||||
import appeng.items.tools.ToolNetworkTool;
|
||||
import appeng.items.tools.powered.ToolColorApplicator;
|
||||
|
||||
|
||||
public class PacketClick extends AppEngPacket
|
||||
@@ -120,34 +116,34 @@ public class PacketClick extends AppEngPacket
|
||||
if( this.leftClick )
|
||||
{
|
||||
final Block block = player.world.getBlockState( pos ).getBlock();
|
||||
if( block instanceof BlockCableBus )
|
||||
{
|
||||
( (BlockCableBus) block ).onBlockClickPacket( player.world, pos, player, this.hand, new Vec3d( this.hitX, this.hitY, this.hitZ ) );
|
||||
}
|
||||
// FIXME if( block instanceof BlockCableBus )
|
||||
// FIXME {
|
||||
// FIXME ( (BlockCableBus) block ).onBlockClickPacket( player.world, pos, player, this.hand, new Vec3d( this.hitX, this.hitY, this.hitZ ) );
|
||||
// FIXME }
|
||||
}
|
||||
else
|
||||
{
|
||||
if( !is.isEmpty() )
|
||||
{
|
||||
if( is.getItem() instanceof ToolNetworkTool )
|
||||
{
|
||||
final ToolNetworkTool tnt = (ToolNetworkTool) is.getItem();
|
||||
tnt.serverSideToolLogic( is, player, this.hand, player.world, pos, this.side, this.hitX, this.hitY,
|
||||
this.hitZ );
|
||||
}
|
||||
// FIXME if( is.getItem() instanceof ToolNetworkTool )
|
||||
// FIXME {
|
||||
// FIXME final ToolNetworkTool tnt = (ToolNetworkTool) is.getItem();
|
||||
// FIXME tnt.serverSideToolLogic( is, player, this.hand, player.world, pos, this.side, this.hitX, this.hitY,
|
||||
// FIXME this.hitZ );
|
||||
// FIXME }
|
||||
|
||||
else if( maybeMemoryCard.isSameAs( is ) )
|
||||
/* FIXME else */ if( maybeMemoryCard.isSameAs( is ) )
|
||||
{
|
||||
final IMemoryCard mem = (IMemoryCard) is.getItem();
|
||||
mem.notifyUser( player, MemoryCardMessages.SETTINGS_CLEARED );
|
||||
is.setTag( null );
|
||||
}
|
||||
|
||||
else if( maybeColorApplicator.isSameAs( is ) )
|
||||
{
|
||||
final ToolColorApplicator mem = (ToolColorApplicator) is.getItem();
|
||||
mem.cycleColors( is, mem.getColor( is ), 1 );
|
||||
}
|
||||
// FIXME else if( maybeColorApplicator.isSameAs( is ) )
|
||||
// FIXME {
|
||||
// FIXME final ToolColorApplicator mem = (ToolColorApplicator) is.getItem();
|
||||
// FIXME mem.cycleColors( is, mem.getColor( is ), 1 );
|
||||
// FIXME }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,6 @@ import appeng.api.util.DimensionalCoord;
|
||||
import appeng.core.sync.AppEngPacket;
|
||||
import appeng.core.sync.network.INetworkInfo;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.worlddata.WorldData;
|
||||
import appeng.services.compass.ICompassCallback;
|
||||
|
||||
|
||||
@@ -79,6 +78,6 @@ public class PacketCompassRequest extends AppEngPacket implements ICompassCallba
|
||||
this.talkBackTo = player;
|
||||
|
||||
final DimensionalCoord loc = new DimensionalCoord( player.world, this.cx << 4, this.cdy << 5, this.cz << 4 );
|
||||
WorldData.instance().compassData().service().getCompassDirection( loc, 174, this );
|
||||
// FIXME WorldData.instance().compassData().service().getCompassDirection( loc, 174, this );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,6 @@ import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import appeng.client.gui.implementations.GuiInterfaceTerminal;
|
||||
import appeng.core.sync.AppEngPacket;
|
||||
import appeng.core.sync.network.INetworkInfo;
|
||||
|
||||
@@ -113,9 +112,9 @@ public class PacketCompressedNBT extends AppEngPacket
|
||||
{
|
||||
final Screen gs = Minecraft.getInstance().currentScreen;
|
||||
|
||||
if( gs instanceof GuiInterfaceTerminal )
|
||||
{
|
||||
( (GuiInterfaceTerminal) gs ).postUpdate( this.in );
|
||||
}
|
||||
// FIXME if( gs instanceof GuiInterfaceTerminal )
|
||||
// FIXME {
|
||||
// FIXME ( (GuiInterfaceTerminal) gs ).postUpdate( this.in );
|
||||
// FIXME }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,6 @@ import net.minecraft.network.PacketBuffer;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.util.IConfigManager;
|
||||
import appeng.api.util.IConfigurableObject;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.core.sync.AppEngPacket;
|
||||
import appeng.core.sync.network.INetworkInfo;
|
||||
import appeng.util.Platform;
|
||||
@@ -65,15 +64,15 @@ public final class PacketConfigButton extends AppEngPacket
|
||||
public void serverPacketData( final INetworkInfo manager, final PlayerEntity player )
|
||||
{
|
||||
final ServerPlayerEntity sender = (ServerPlayerEntity) player;
|
||||
if( sender.openContainer instanceof AEBaseContainer )
|
||||
{
|
||||
final AEBaseContainer baseContainer = (AEBaseContainer) sender.openContainer;
|
||||
if( baseContainer.getTarget() instanceof IConfigurableObject )
|
||||
{
|
||||
final IConfigManager cm = ( (IConfigurableObject) baseContainer.getTarget() ).getConfigManager();
|
||||
final Enum<?> newState = Platform.rotateEnum( cm.getSetting( this.option ), this.rotationDirection, this.option.getPossibleValues() );
|
||||
cm.putSetting( this.option, newState );
|
||||
}
|
||||
}
|
||||
// FIXME if( sender.openContainer instanceof AEBaseContainer )
|
||||
// FIXME {
|
||||
// FIXME final AEBaseContainer baseContainer = (AEBaseContainer) sender.openContainer;
|
||||
// FIXME if( baseContainer.getTarget() instanceof IConfigurableObject )
|
||||
// FIXME {
|
||||
// FIXME final IConfigManager cm = ( (IConfigurableObject) baseContainer.getTarget() ).getConfigManager();
|
||||
// FIXME final Enum<?> newState = Platform.rotateEnum( cm.getSetting( this.option ), this.rotationDirection, this.option.getPossibleValues() );
|
||||
// FIXME cm.putSetting( this.option, newState );
|
||||
// FIXME }
|
||||
// FIXME }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,8 +34,6 @@ import appeng.api.networking.crafting.ICraftingGrid;
|
||||
import appeng.api.networking.crafting.ICraftingJob;
|
||||
import appeng.api.networking.security.IActionHost;
|
||||
import appeng.container.ContainerOpenContext;
|
||||
import appeng.container.implementations.ContainerCraftAmount;
|
||||
import appeng.container.implementations.ContainerCraftConfirm;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.sync.AppEngPacket;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
|
||||
@@ -71,7 +71,7 @@ public final class WorldData implements IWorldData
|
||||
private final File spawnDirectory;
|
||||
private final File compassDirectory;
|
||||
|
||||
private final Configuration sharedConfig;
|
||||
// FIXME private final Configuration sharedConfig;
|
||||
|
||||
private WorldData( @Nonnull final File worldDirectory )
|
||||
{
|
||||
|
||||
@@ -19,83 +19,30 @@
|
||||
package appeng.decorative.solid;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import appeng.helpers.AEGlassMaterial;
|
||||
import net.minecraft.block.AbstractGlassBlock;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.client.model.data.ModelProperty;
|
||||
|
||||
import appeng.block.AEBaseBlock;
|
||||
public class BlockQuartzGlass extends AbstractGlassBlock {
|
||||
|
||||
public class BlockQuartzGlass extends AEBaseBlock
|
||||
{
|
||||
|
||||
public BlockQuartzGlass()
|
||||
{
|
||||
super( Properties.create(Material.GLASS) );
|
||||
// FIXME this.setLightOpacity( 0 );
|
||||
this.setOpaque( false );
|
||||
public BlockQuartzGlass() {
|
||||
super(Block.Properties.create(Material.GLASS).hardnessAndResistance(2.2F).sound(SoundType.GLASS).notSolid());
|
||||
}
|
||||
|
||||
// @Override
|
||||
// protected BlockStateContainer createBlockState()
|
||||
// {
|
||||
// IProperty[] listedProperties = new IProperty[0];
|
||||
// IUnlistedProperty[] unlistedProperties = new IUnlistedProperty[] { GLASS_STATE };
|
||||
// return new ExtendedBlockState( this, listedProperties, unlistedProperties );
|
||||
// }
|
||||
@Override
|
||||
public boolean isSideInvisible(BlockState state, BlockState adjacentBlockState, Direction side) {
|
||||
final Material mat = adjacentBlockState.getMaterial();
|
||||
if (mat == Material.GLASS || mat == AEGlassMaterial.INSTANCE) {
|
||||
if (adjacentBlockState.getRenderType() == state.getRenderType()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME @Override
|
||||
// FIXME public BlockRenderLayer getBlockLayer()
|
||||
// FIXME {
|
||||
// FIXME return BlockRenderLayer.CUTOUT;
|
||||
// FIXME }
|
||||
|
||||
// FIXME @Override
|
||||
// FIXME public boolean shouldSideBeRendered( final BlockState state, final IBlockReader w, final BlockPos pos, final Direction side )
|
||||
// FIXME {
|
||||
// FIXME BlockPos adjacentPos = pos.offset( side );
|
||||
// FIXME
|
||||
// FIXME final Material mat = w.getBlockState( adjacentPos ).getMaterial();
|
||||
// FIXME
|
||||
// FIXME if( mat == Material.GLASS || mat == AEGlassMaterial.INSTANCE )
|
||||
// FIXME {
|
||||
// FIXME if( w.getBlockState( adjacentPos ).getRenderType() == this.getRenderType( state ) )
|
||||
// FIXME {
|
||||
// FIXME return false;
|
||||
// FIXME }
|
||||
// FIXME }
|
||||
// FIXME
|
||||
// FIXME return super.shouldSideBeRendered( state, w, pos, side );
|
||||
// FIXME }
|
||||
|
||||
// BEGIN: Copied from AbstractGlassBlock
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public float getAmbientOcclusionLightValue(BlockState state, IBlockReader worldIn, BlockPos pos) {
|
||||
return 1.0F;
|
||||
return super.isSideInvisible(state, adjacentBlockState, side);
|
||||
}
|
||||
|
||||
public boolean propagatesSkylightDown(BlockState state, IBlockReader reader, BlockPos pos) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean causesSuffocation(BlockState state, IBlockReader worldIn, BlockPos pos) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isNormalCube(BlockState state, IBlockReader worldIn, BlockPos pos) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean canEntitySpawn(BlockState state, IBlockReader worldIn, BlockPos pos, EntityType<?> type) {
|
||||
return false;
|
||||
}
|
||||
// END: Copied from AbstractGlassBlock
|
||||
|
||||
}
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.decorative.solid;
|
||||
|
||||
|
||||
import net.minecraftforge.common.property.IUnlistedProperty;
|
||||
|
||||
|
||||
/**
|
||||
* This unlisted property is used to transport the connected texture state into our model class.
|
||||
*/
|
||||
public class UnlistedGlassStateProperty implements IUnlistedProperty<GlassState>
|
||||
{
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return "glass_state";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid( GlassState value )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<GlassState> getType()
|
||||
{
|
||||
return GlassState.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String valueToString( GlassState value )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -40,7 +40,6 @@ import appeng.client.ActionKey;
|
||||
import appeng.client.EffectType;
|
||||
import appeng.core.CommonHelper;
|
||||
import appeng.core.sync.AppEngPacket;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
@@ -100,7 +99,7 @@ public class ServerHelper extends CommonHelper
|
||||
final double dZ = z - entityplayermp.getPosZ();
|
||||
if( dX * dX + dY * dY + dZ * dZ < dist * dist )
|
||||
{
|
||||
NetworkHandler.instance().sendTo( packet, entityplayermp );
|
||||
// FIXME NetworkHandler.instance().sendTo( packet, entityplayermp );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,26 +31,29 @@ import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import appeng.core.Api;
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraftforge.event.world.WorldEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.services.compass.CompassReader;
|
||||
import appeng.services.compass.ICompassCallback;
|
||||
import appeng.util.Platform;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
|
||||
|
||||
public final class CompassService
|
||||
{
|
||||
private static final int CHUNK_SIZE = 16;
|
||||
|
||||
private final Map<World, CompassReader> worldSet = new HashMap<>( 10 );
|
||||
private final Map<IWorld, CompassReader> worldSet = new HashMap<>( 10 );
|
||||
private final ExecutorService executor;
|
||||
|
||||
/**
|
||||
@@ -132,7 +135,7 @@ public final class CompassService
|
||||
final int hi_y = low_y + 32;
|
||||
|
||||
// lower level...
|
||||
final Chunk c = w.getChunkFromChunkCoords( cx, cz );
|
||||
final Chunk c = w.getChunk( cx, cz );
|
||||
|
||||
Optional<Block> maybeBlock = Api.INSTANCE.definitions().blocks().skyStoneBlock().maybeBlock();
|
||||
if( maybeBlock.isPresent() )
|
||||
@@ -144,7 +147,7 @@ public final class CompassService
|
||||
{
|
||||
for( int k = low_y; k < hi_y; k++ )
|
||||
{
|
||||
final Block blk = c.getBlockState( i, k, j ).getBlock();
|
||||
final Block blk = c.getBlockState( new BlockPos(i, k, j) ).getBlock();
|
||||
if( blk == skyStoneBlock )
|
||||
{
|
||||
return this.executor.submit( new CMUpdatePost( w, cx, cz, cdy, true ) );
|
||||
@@ -179,7 +182,7 @@ public final class CompassService
|
||||
}
|
||||
}
|
||||
|
||||
private CompassReader getReader( final World w )
|
||||
private CompassReader getReader( final IWorld w )
|
||||
{
|
||||
CompassReader cr = this.worldSet.get( w );
|
||||
|
||||
|
||||
@@ -21,9 +21,7 @@ package appeng.util;
|
||||
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.PowerMultiplier;
|
||||
import appeng.api.config.SearchBoxMode;
|
||||
import appeng.api.config.SecurityPermissions;
|
||||
import appeng.api.config.SortOrder;
|
||||
import appeng.api.definitions.IItemDefinition;
|
||||
import appeng.api.implementations.items.IAEWrench;
|
||||
import appeng.api.networking.IGridNode;
|
||||
@@ -35,32 +33,31 @@ import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.core.Api;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.stats.Stats;
|
||||
import appeng.core.stats.AeStats;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.me.helpers.AENetworkProxy;
|
||||
import appeng.util.helpers.ItemComparisonHelper;
|
||||
import appeng.util.item.AEItemStack;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.fml.common.thread.SidedThreadGroups;
|
||||
import net.minecraftforge.fml.loading.FMLEnvironment;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.WeakHashMap;
|
||||
import java.util.*;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
@@ -481,40 +478,40 @@ public class Platform
|
||||
return Math.abs( RANDOM_GENERATOR.nextInt() );
|
||||
}
|
||||
|
||||
// @OnlyIn( Dist.CLIENT )
|
||||
// public static List<ITextComponent> getTooltip( final Object o )
|
||||
// {
|
||||
// if( o == null )
|
||||
// {
|
||||
// return Collections.emptyList();
|
||||
// }
|
||||
//
|
||||
// ItemStack itemStack = ItemStack.EMPTY;
|
||||
// if( o instanceof AEItemStack )
|
||||
// {
|
||||
// final AEItemStack ais = (AEItemStack) o;
|
||||
// return ais.getToolTip();
|
||||
// }
|
||||
// else if( o instanceof ItemStack )
|
||||
// {
|
||||
// itemStack = (ItemStack) o;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// return Collections.emptyList();
|
||||
// }
|
||||
//
|
||||
// try
|
||||
// {
|
||||
// ITooltipFlag.TooltipFlags tooltipFlag = Minecraft
|
||||
// .getInstance().gameSettings.advancedItemTooltips ? ITooltipFlag.TooltipFlags.ADVANCED : ITooltipFlag.TooltipFlags.NORMAL;
|
||||
// return itemStack.getTooltip(Minecraft.getInstance().player, tooltipFlag);
|
||||
// }
|
||||
// catch( final Exception errB )
|
||||
// {
|
||||
// return Collections.emptyList();
|
||||
// }
|
||||
// }
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public static List<ITextComponent> getTooltip(final Object o )
|
||||
{
|
||||
if( o == null )
|
||||
{
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
ItemStack itemStack = ItemStack.EMPTY;
|
||||
if( o instanceof AEItemStack )
|
||||
{
|
||||
final AEItemStack ais = (AEItemStack) o;
|
||||
return ais.getToolTip();
|
||||
}
|
||||
else if( o instanceof ItemStack )
|
||||
{
|
||||
itemStack = (ItemStack) o;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
ITooltipFlag.TooltipFlags tooltipFlag = Minecraft
|
||||
.getInstance().gameSettings.advancedItemTooltips ? ITooltipFlag.TooltipFlags.ADVANCED : ITooltipFlag.TooltipFlags.NORMAL;
|
||||
return itemStack.getTooltip(Minecraft.getInstance().player, tooltipFlag);
|
||||
}
|
||||
catch( final Exception errB )
|
||||
{
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
//
|
||||
// public static String getModId( final IAEItemStack is )
|
||||
// {
|
||||
@@ -1080,7 +1077,7 @@ public class Platform
|
||||
|
||||
if( ret != null )
|
||||
{
|
||||
src.player().ifPresent( player -> Stats.ItemsExtracted.addToPlayer( player, (int) ret.getStackSize() ) );
|
||||
src.player().ifPresent( player -> AeStats.ItemsExtracted.addToPlayer( player, (int) ret.getStackSize() ) );
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@@ -1134,7 +1131,7 @@ public class Platform
|
||||
src.player().ifPresent( player ->
|
||||
{
|
||||
final long diff = original - split.getStackSize();
|
||||
Stats.ItemsInserted.addToPlayer( player, (int) diff );
|
||||
AeStats.ItemsInserted.addToPlayer( player, (int) diff );
|
||||
} );
|
||||
|
||||
return split;
|
||||
@@ -1145,7 +1142,7 @@ public class Platform
|
||||
src.player().ifPresent( player ->
|
||||
{
|
||||
final long diff = ret == null ? input.getStackSize() : input.getStackSize() - ret.getStackSize();
|
||||
Stats.ItemsInserted.addToPlayer( player, (int) diff );
|
||||
AeStats.ItemsInserted.addToPlayer( player, (int) diff );
|
||||
} );
|
||||
|
||||
return ret;
|
||||
@@ -1335,36 +1332,36 @@ public class Platform
|
||||
// );
|
||||
// }
|
||||
//
|
||||
public static boolean canAccess( final AENetworkProxy gridProxy, final IActionSource src )
|
||||
{
|
||||
try
|
||||
{
|
||||
if( src.player().isPresent() )
|
||||
{
|
||||
return gridProxy.getSecurity().hasPermission( src.player().get(), SecurityPermissions.BUILD );
|
||||
}
|
||||
else if( src.machine().isPresent() )
|
||||
{
|
||||
final IActionHost te = src.machine().get();
|
||||
final IGridNode n = te.getActionableNode();
|
||||
if( n == null )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final int playerID = n.getPlayerID();
|
||||
return gridProxy.getSecurity().hasPermission( playerID, SecurityPermissions.BUILD );
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch( final GridAccessException gae )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// public static boolean canAccess( final AENetworkProxy gridProxy, final IActionSource src )
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// if( src.player().isPresent() )
|
||||
// {
|
||||
// return gridProxy.getSecurity().hasPermission( src.player().get(), SecurityPermissions.BUILD );
|
||||
// }
|
||||
// else if( src.machine().isPresent() )
|
||||
// {
|
||||
// final IActionHost te = src.machine().get();
|
||||
// final IGridNode n = te.getActionableNode();
|
||||
// if( n == null )
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// final int playerID = n.getPlayerID();
|
||||
// return gridProxy.getSecurity().hasPermission( playerID, SecurityPermissions.BUILD );
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
// catch( final GridAccessException gae )
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public static ItemStack extractItemsByRecipe(final IEnergySource energySrc, final IActionSource mySrc, final IMEMonitor<IAEItemStack> src, final World w, final IRecipe r, final ItemStack output, final CraftingInventory ci, final ItemStack providedTemplate, final int slot, final IItemList<IAEItemStack> items, final Actionable realForFake, final IPartitionList<IAEItemStack> filter )
|
||||
// {
|
||||
|
||||
@@ -25,6 +25,7 @@ import java.util.Objects;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import appeng.core.Api;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
@@ -32,6 +33,7 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.items.ItemHandlerHelper;
|
||||
@@ -51,7 +53,7 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
private String displayName;
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
private List<String> tooltip;
|
||||
private List<ITextComponent> tooltip;
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
private ResourceLocation uniqueID;
|
||||
|
||||
@@ -264,7 +266,7 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
|
||||
}
|
||||
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public List<String> getToolTip()
|
||||
public List<ITextComponent> getToolTip()
|
||||
{
|
||||
if( this.tooltip == null )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user