1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-01-15 19:55:42 +00:00

Fix several deprecation warnings

This commit is contained in:
SquidDev 2019-04-09 16:30:44 +01:00
parent fcaa777c95
commit 23ddd4feb5
5 changed files with 20 additions and 13 deletions

View File

@ -75,8 +75,9 @@ public final class ComputerCraftProxyClient
ModLoadingContext.get().registerExtensionPoint( ExtensionPoint.GUIFACTORY, () -> packet -> { ModLoadingContext.get().registerExtensionPoint( ExtensionPoint.GUIFACTORY, () -> packet -> {
ContainerType<?> type = ContainerType.factories.get( packet.getId() ).get(); ContainerType<?> type = ContainerType.factories.get( packet.getId() ).get();
if( packet.getAdditionalData() != null ) type.fromBytes( packet.getAdditionalData() ); if( packet.getAdditionalData() != null ) type.fromBytes( packet.getAdditionalData() );
return ((BiFunction<ContainerType<?>, EntityPlayer, GuiContainer>) ContainerType.guiFactories.get( packet.getId() )) @SuppressWarnings( "unchecked" )
.apply( type, Minecraft.getInstance().player ); BiFunction<ContainerType<?>, EntityPlayer, GuiContainer> factory = (BiFunction<ContainerType<?>, EntityPlayer, GuiContainer>) ContainerType.guiFactories.get( packet.getId() );
return factory.apply( type, Minecraft.getInstance().player );
} ); } );
} }

View File

@ -18,7 +18,6 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.ItemRenderer; import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.model.IBakedModel; import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -89,9 +88,7 @@ public final class ItemPocketRenderer extends ItemMapLikeRenderer
GlStateManager.blendFunc( GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA ); GlStateManager.blendFunc( GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA );
GlStateManager.color4f( 1.0F, 1.0F, 1.0F, 1.0F ); GlStateManager.color4f( 1.0F, 1.0F, 1.0F, 1.0F );
IBakedModel baked = renderItem.getItemModelWithOverrides( stack, null, null ); renderItem.renderItem( stack, transform( renderItem.getItemModelWithOverrides( stack, null, null ) ) );
baked = ForgeHooksClient.handleCameraTransforms( baked, TransformType.GUI, false );
renderItem.renderItem( stack, baked );
GlStateManager.disableAlphaTest(); GlStateManager.disableAlphaTest();
GlStateManager.disableRescaleNormal(); GlStateManager.disableRescaleNormal();
@ -168,4 +165,10 @@ public final class ItemPocketRenderer extends ItemMapLikeRenderer
GlStateManager.enableLighting(); GlStateManager.enableLighting();
} }
@SuppressWarnings( { "deprecation" } )
private static IBakedModel transform( IBakedModel model )
{
return ForgeHooksClient.handleCameraTransforms( model, net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType.GUI, false );
}
} }

View File

@ -9,7 +9,6 @@ package dan200.computercraft.client.render;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.model.BakedQuad; import net.minecraft.client.renderer.model.BakedQuad;
import net.minecraft.client.renderer.model.IBakedModel; import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.model.ItemCameraTransforms;
import net.minecraft.client.renderer.model.ItemOverrideList; import net.minecraft.client.renderer.model.ItemOverrideList;
import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
@ -122,7 +121,7 @@ public class TurtleMultiModel implements IBakedModel
@Nonnull @Nonnull
@Override @Override
@Deprecated @Deprecated
public ItemCameraTransforms getItemCameraTransforms() public net.minecraft.client.renderer.model.ItemCameraTransforms getItemCameraTransforms()
{ {
return m_baseModel.getItemCameraTransforms(); return m_baseModel.getItemCameraTransforms();
} }

View File

@ -14,7 +14,6 @@ import dan200.computercraft.core.apis.handles.ArrayByteChannel;
import net.minecraft.resources.IReloadableResourceManager; import net.minecraft.resources.IReloadableResourceManager;
import net.minecraft.resources.IResource; import net.minecraft.resources.IResource;
import net.minecraft.resources.IResourceManager; import net.minecraft.resources.IResourceManager;
import net.minecraft.resources.IResourceManagerReloadListener;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.resource.IResourceType; import net.minecraftforge.resource.IResourceType;
import net.minecraftforge.resource.ISelectiveResourceReloadListener; import net.minecraftforge.resource.ISelectiveResourceReloadListener;
@ -241,7 +240,7 @@ public class ResourceMount implements IMount
} }
/** /**
* A {@link IResourceManagerReloadListener} which reloads any associated mounts. * A {@link ISelectiveResourceReloadListener} which reloads any associated mounts.
* *
* While people should really be keeping a permanent reference to this, some people construct it every * While people should really be keeping a permanent reference to this, some people construct it every
* method call, so let's make this as small as possible. * method call, so let's make this as small as possible.

View File

@ -7,7 +7,6 @@
package dan200.computercraft.shared.common; package dan200.computercraft.shared.common;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
@ -23,7 +22,7 @@ import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.Random; import java.util.Random;
public abstract class BlockGeneric extends Block implements ITileEntityProvider public abstract class BlockGeneric extends Block
{ {
private final TileEntityType<? extends TileGeneric> type; private final TileEntityType<? extends TileGeneric> type;
@ -77,9 +76,15 @@ public abstract class BlockGeneric extends Block implements ITileEntityProvider
if( te instanceof TileGeneric ) ((TileGeneric) te).blockTick(); if( te instanceof TileGeneric ) ((TileGeneric) te).blockTick();
} }
@Override
public boolean hasTileEntity( IBlockState state )
{
return true;
}
@Nullable @Nullable
@Override @Override
public TileEntity createNewTileEntity( @Nonnull IBlockReader world ) public TileEntity createTileEntity( @Nonnull IBlockState state, @Nonnull IBlockReader world )
{ {
return type.create(); return type.create();
} }