1.15 port
This commit is contained in:
@@ -23,19 +23,19 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumBlockRenderType;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
@@ -67,7 +67,7 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumActionResult onItemUseFirst( final EntityPlayer player, final World world, final BlockPos pos, final EnumFacing side, final float hitX, final float hitY, final float hitZ, final EnumHand hand )
|
||||
public EnumActionResult onItemUseFirst( final PlayerEntity player, final World world, final BlockPos pos, final Direction side, final float hitX, final float hitY, final float hitZ, final Hand hand )
|
||||
{
|
||||
return AEApi.instance().partHelper().placeBus( player.getHeldItem( hand ), pos, side, player, hand, world );
|
||||
}
|
||||
@@ -133,7 +133,7 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean hasSimpleModel( IBlockState blockState )
|
||||
private static boolean hasSimpleModel( BlockState blockState )
|
||||
{
|
||||
if( blockState.getRenderType() != EnumBlockRenderType.MODEL || blockState instanceof IExtendedBlockState )
|
||||
{
|
||||
@@ -160,7 +160,7 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
||||
|
||||
// Try to get the block state based on the item stack's meta. If this fails, don't consider it for a facade
|
||||
// This for example fails for Pistons because they hardcoded an invalid meta value in vanilla
|
||||
IBlockState blockState;
|
||||
BlockState blockState;
|
||||
try
|
||||
{
|
||||
blockState = block.getStateFromMeta( metadata );
|
||||
@@ -175,7 +175,7 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
||||
final boolean isWhiteListed = FacadeConfig.instance().isWhiteListed( block, metadata );
|
||||
final boolean isModel = blockState.getRenderType() == EnumBlockRenderType.MODEL;
|
||||
|
||||
final IBlockState defaultState = block.getDefaultState();
|
||||
final BlockState defaultState = block.getDefaultState();
|
||||
final boolean isTileEntity = block.hasTileEntity( defaultState );
|
||||
final boolean isFullCube = block.isFullCube( defaultState );
|
||||
|
||||
@@ -190,7 +190,7 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
||||
}
|
||||
|
||||
final ItemStack is = new ItemStack( this );
|
||||
final NBTTagCompound data = new NBTTagCompound();
|
||||
final CompoundNBT data = new CompoundNBT();
|
||||
data.setString( TAG_ITEM_ID, itemStack.getItem().getRegistryName().toString() );
|
||||
data.setInteger( TAG_DAMAGE, itemStack.getItemDamage() );
|
||||
is.setTagCompound( data );
|
||||
@@ -214,7 +214,7 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
||||
public ItemStack getTextureItem( ItemStack is )
|
||||
{
|
||||
|
||||
NBTTagCompound nbt = is.getTagCompound();
|
||||
CompoundNBT nbt = is.getTagCompound();
|
||||
|
||||
if( nbt == null )
|
||||
{
|
||||
@@ -260,7 +260,7 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getTextureBlockState( ItemStack is )
|
||||
public BlockState getTextureBlockState( ItemStack is )
|
||||
{
|
||||
|
||||
ItemStack baseItemStack = this.getTextureItem( is );
|
||||
@@ -322,7 +322,7 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
final NBTTagCompound facadeTag = new NBTTagCompound();
|
||||
final CompoundNBT facadeTag = new CompoundNBT();
|
||||
facadeTag.setString( TAG_ITEM_ID, item.getRegistryName().toString() );
|
||||
facadeTag.setInteger( TAG_DAMAGE, ids[1] );
|
||||
facadeStack.setTagCompound( facadeTag );
|
||||
@@ -333,7 +333,7 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
||||
@Override
|
||||
public boolean useAlphaPass( final ItemStack is )
|
||||
{
|
||||
IBlockState blockState = this.getTextureBlockState( is );
|
||||
BlockState blockState = this.getTextureBlockState( is );
|
||||
|
||||
if( blockState == null )
|
||||
{
|
||||
|
||||
@@ -33,18 +33,16 @@ import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.implementations.items.IItemGroup;
|
||||
@@ -154,7 +152,7 @@ public final class ItemPart extends AEBaseItem implements IPartItem, IItemGroup
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumActionResult onItemUse( final EntityPlayer player, final World w, final BlockPos pos, final EnumHand hand, final EnumFacing side, final float hitX, final float hitY, final float hitZ )
|
||||
public EnumActionResult onItemUse( final PlayerEntity player, final World w, final BlockPos pos, final Hand hand, final Direction side, final float hitX, final float hitY, final float hitZ )
|
||||
{
|
||||
if( this.getTypeByStack( player.getHeldItem( hand ) ) == PartType.INVALID_TYPE )
|
||||
{
|
||||
@@ -165,10 +163,10 @@ public final class ItemPart extends AEBaseItem implements IPartItem, IItemGroup
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName( final ItemStack is )
|
||||
public String getTranslationKey( final ItemStack is )
|
||||
{
|
||||
Preconditions.checkNotNull( is );
|
||||
return "item.appliedenergistics2.multi_part." + this.getTypeByStack( is ).getUnlocalizedName().toLowerCase();
|
||||
return "item.appliedenergistics2.multi_part." + this.getTypeByStack( is ).getTranslationKey().toLowerCase();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -378,20 +376,4 @@ public final class ItemPart extends AEBaseItem implements IPartItem, IItemGroup
|
||||
}
|
||||
}
|
||||
|
||||
public void registerOreDicts()
|
||||
{
|
||||
for( final PartTypeWithVariant mt : ImmutableSet.copyOf( this.registered.values() ) )
|
||||
{
|
||||
if( mt.part.getOreName() != null )
|
||||
{
|
||||
final String[] names = mt.part.getOreName().split( "," );
|
||||
|
||||
for( final String name : names )
|
||||
{
|
||||
OreDictionary.registerOre( name, new ItemStack( this, 1, mt.part.getBaseDamage() + mt.variant ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -27,8 +27,8 @@ import java.util.stream.Collectors;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.bootstrap.IItemRendering;
|
||||
@@ -55,7 +55,7 @@ public class ItemPartRendering extends ItemRenderingCustomizer
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public void customize( IItemRendering rendering )
|
||||
{
|
||||
|
||||
|
||||
@@ -32,8 +32,8 @@ import com.google.common.collect.ImmutableList;
|
||||
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.util.AEColor;
|
||||
@@ -100,7 +100,7 @@ public enum PartType
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
protected List<ModelResourceLocation> createItemModels( String baseName )
|
||||
{
|
||||
return Arrays.stream( AEColor.values() )
|
||||
@@ -118,7 +118,7 @@ public enum PartType
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
protected List<ModelResourceLocation> createItemModels( String baseName )
|
||||
{
|
||||
return Arrays.stream( AEColor.values() )
|
||||
@@ -136,7 +136,7 @@ public enum PartType
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
protected List<ModelResourceLocation> createItemModels( String baseName )
|
||||
{
|
||||
return Arrays.stream( AEColor.values() )
|
||||
@@ -155,7 +155,7 @@ public enum PartType
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
protected List<ModelResourceLocation> createItemModels( String baseName )
|
||||
{
|
||||
return Arrays.stream( AEColor.values() )
|
||||
@@ -174,7 +174,7 @@ public enum PartType
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
protected List<ModelResourceLocation> createItemModels( String baseName )
|
||||
{
|
||||
return Arrays.stream( AEColor.values() )
|
||||
@@ -247,7 +247,7 @@ public enum PartType
|
||||
.noneOf( IntegrationType.class ), PartP2PTunnelME.class, GuiText.METunnel )
|
||||
{
|
||||
@Override
|
||||
String getUnlocalizedName()
|
||||
String getTranslationKey()
|
||||
{
|
||||
return "p2p_tunnel";
|
||||
}
|
||||
@@ -257,7 +257,7 @@ public enum PartType
|
||||
.noneOf( IntegrationType.class ), PartP2PRedstone.class, GuiText.RedstoneTunnel )
|
||||
{
|
||||
@Override
|
||||
String getUnlocalizedName()
|
||||
String getTranslationKey()
|
||||
{
|
||||
return "p2p_tunnel";
|
||||
}
|
||||
@@ -267,7 +267,7 @@ public enum PartType
|
||||
.noneOf( IntegrationType.class ), PartP2PItems.class, GuiText.ItemTunnel )
|
||||
{
|
||||
@Override
|
||||
String getUnlocalizedName()
|
||||
String getTranslationKey()
|
||||
{
|
||||
return "p2p_tunnel";
|
||||
}
|
||||
@@ -277,7 +277,7 @@ public enum PartType
|
||||
.noneOf( IntegrationType.class ), PartP2PFluids.class, GuiText.FluidTunnel )
|
||||
{
|
||||
@Override
|
||||
String getUnlocalizedName()
|
||||
String getTranslationKey()
|
||||
{
|
||||
return "p2p_tunnel";
|
||||
}
|
||||
@@ -287,7 +287,7 @@ public enum PartType
|
||||
.of( IntegrationType.IC2 ), PartP2PIC2Power.class, GuiText.EUTunnel )
|
||||
{
|
||||
@Override
|
||||
String getUnlocalizedName()
|
||||
String getTranslationKey()
|
||||
{
|
||||
return "p2p_tunnel";
|
||||
}
|
||||
@@ -297,7 +297,7 @@ public enum PartType
|
||||
.noneOf( IntegrationType.class ), PartP2PLight.class, GuiText.LightTunnel )
|
||||
{
|
||||
@Override
|
||||
String getUnlocalizedName()
|
||||
String getTranslationKey()
|
||||
{
|
||||
return "p2p_tunnel";
|
||||
}
|
||||
@@ -307,7 +307,7 @@ public enum PartType
|
||||
.noneOf( IntegrationType.class ), PartP2PFEPower.class, GuiText.FETunnel )
|
||||
{
|
||||
@Override
|
||||
String getUnlocalizedName()
|
||||
String getTranslationKey()
|
||||
{
|
||||
return "p2p_tunnel";
|
||||
}
|
||||
@@ -326,7 +326,7 @@ public enum PartType
|
||||
private final Set<IntegrationType> integrations;
|
||||
private final Class<? extends IPart> myPart;
|
||||
private final GuiText extraName;
|
||||
@SideOnly( Side.CLIENT )
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
private List<ModelResourceLocation> itemModels;
|
||||
private final Set<ResourceLocation> models;
|
||||
private final boolean enabled;
|
||||
@@ -388,13 +388,13 @@ public enum PartType
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly( Side.CLIENT )
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
protected List<ModelResourceLocation> createItemModels( String baseName )
|
||||
{
|
||||
return ImmutableList.of( modelFromBaseName( baseName ) );
|
||||
}
|
||||
|
||||
@SideOnly( Side.CLIENT )
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
private static ModelResourceLocation modelFromBaseName( String baseName )
|
||||
{
|
||||
return new ModelResourceLocation( new ResourceLocation( AppEng.MOD_ID, "part/" + baseName ), "inventory" );
|
||||
@@ -430,7 +430,7 @@ public enum PartType
|
||||
return this.myPart;
|
||||
}
|
||||
|
||||
String getUnlocalizedName()
|
||||
String getTranslationKey()
|
||||
{
|
||||
return this.name().toLowerCase();
|
||||
}
|
||||
@@ -455,7 +455,7 @@ public enum PartType
|
||||
return this.oreName;
|
||||
}
|
||||
|
||||
@SideOnly( Side.CLIENT )
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public List<ModelResourceLocation> getItemModels()
|
||||
{
|
||||
return this.itemModels;
|
||||
|
||||
Reference in New Issue
Block a user