Lightning fix, black blocks on break attempt fix
This commit is contained in:
parent
235b6310f8
commit
7f1791abbf
4 changed files with 43 additions and 45 deletions
|
@ -1,37 +1,26 @@
|
||||||
package gregtech.api.items;
|
package gregtech.api.items;
|
||||||
|
|
||||||
import gregtech.common.blocks.GT_Block_Ores;
|
import gregtech.api.util.GT_LanguageManager;
|
||||||
import gregtech.common.blocks.UnlistedBlockPosProperty;
|
import gregtech.common.blocks.UnlistedBlockPosProperty;
|
||||||
import gregtech.common.render.IIconRegister;
|
import net.minecraft.block.Block;
|
||||||
import gregtech.common.render.newblocks.IBlockIconProvider;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.BlockGlass;
|
|
||||||
import net.minecraft.block.properties.IProperty;
|
import net.minecraft.block.properties.IProperty;
|
||||||
import net.minecraft.block.properties.PropertyInteger;
|
import net.minecraft.block.properties.PropertyInteger;
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
import net.minecraft.block.state.BlockStateContainer;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.client.multiplayer.WorldClient;
|
|
||||||
import net.minecraft.client.renderer.texture.TextureMap;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.item.ItemBlock;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.BlockRenderLayer;
|
||||||
|
import net.minecraft.util.EnumBlockRenderType;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.RayTraceResult;
|
import net.minecraft.util.math.RayTraceResult;
|
||||||
import net.minecraft.world.ChunkCache;
|
|
||||||
import net.minecraft.world.EnumSkyBlock;
|
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.property.ExtendedBlockState;
|
import net.minecraftforge.common.property.ExtendedBlockState;
|
||||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||||
import net.minecraftforge.common.property.IUnlistedProperty;
|
import net.minecraftforge.common.property.IUnlistedProperty;
|
||||||
import net.minecraftforge.fml.client.FMLClientHandler;
|
|
||||||
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
|
|
||||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||||
import gregtech.api.util.GT_LanguageManager;
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.item.ItemBlock;
|
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
import static gregtech.api.enums.GT_Values.W;
|
import static gregtech.api.enums.GT_Values.W;
|
||||||
|
|
||||||
|
@ -47,6 +36,13 @@ public abstract class GT_Generic_Block extends Block {
|
||||||
setUnlocalizedName(mUnlocalizedName = aName);
|
setUnlocalizedName(mUnlocalizedName = aName);
|
||||||
GameRegistry.registerBlock(this, aItemClass, getUnlocalizedName());
|
GameRegistry.registerBlock(this, aItemClass, getUnlocalizedName());
|
||||||
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + W + ".name", "Any Sub Block of this one");
|
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + W + ".name", "Any Sub Block of this one");
|
||||||
|
setLightLevel(2);
|
||||||
|
translucent = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isOpaqueCube(IBlockState state) {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -70,29 +66,27 @@ public abstract class GT_Generic_Block extends Block {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) {
|
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) {
|
||||||
return getExtendedState(state, worldIn, pos);
|
return getExtendedState(state, worldIn, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean getUseNeighborBrightness(IBlockState state) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public int getPackedLightmapCoords(IBlockState state, IBlockAccess source, BlockPos pos) {
|
|
||||||
World world = FMLClientHandler.instance().getWorldClient();
|
|
||||||
int i = world.getLightFromNeighborsFor(EnumSkyBlock.SKY, pos);
|
|
||||||
int j = world.getLightFromNeighborsFor(EnumSkyBlock.BLOCK, pos);
|
|
||||||
if(i < 2) i = 8;
|
|
||||||
return i << 20 | j << 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) {
|
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) {
|
||||||
return new ItemStack(this, 1, state.getValue(METADATA));
|
return new ItemStack(this, 1, state.getValue(METADATA));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BlockRenderLayer getBlockLayer() {
|
||||||
|
return BlockRenderLayer.CUTOUT;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EnumBlockRenderType getRenderType(IBlockState state) {
|
||||||
|
StackTraceElement[] trace = Thread.currentThread().getStackTrace();
|
||||||
|
if(trace[3].getMethodName().equals("renderBlockDamage")) {
|
||||||
|
return EnumBlockRenderType.INVISIBLE;
|
||||||
|
//TODO FIX ME PLEASE
|
||||||
|
}
|
||||||
|
return EnumBlockRenderType.MODEL;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -65,10 +65,10 @@ public class GT_RenderedTexture implements ITexture {
|
||||||
TextureAtlasSprite sprite = mIconContainer.getIcon();
|
TextureAtlasSprite sprite = mIconContainer.getIcon();
|
||||||
TextureAtlasSprite overlay = mIconContainer.getOverlayIcon();
|
TextureAtlasSprite overlay = mIconContainer.getOverlayIcon();
|
||||||
if(sprite != null) {
|
if(sprite != null) {
|
||||||
quads.add(RenderUtil.renderSide(DefaultVertexFormats.BLOCK, sprite, side, tintOff, 0.0F, mRGBa, blockPos == null));
|
quads.add(RenderUtil.renderSide(DefaultVertexFormats.BLOCK, sprite, side, -1, 0.001F, mRGBa, blockPos == null));
|
||||||
}
|
}
|
||||||
if(overlay != null) {
|
if(overlay != null) {
|
||||||
quads.add(RenderUtil.renderSide(DefaultVertexFormats.BLOCK, overlay, side, tintOff + 1000, 0.001F, mRGBa, blockPos == null));
|
quads.add(RenderUtil.renderSide(DefaultVertexFormats.BLOCK, overlay, side, -1, 0.001F, mRGBa, blockPos == null));
|
||||||
}
|
}
|
||||||
return quads;
|
return quads;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,13 +10,27 @@ import gregtech.api.objects.GT_RenderedTexture;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.RayTraceResult;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class GT_Block_Ores extends GT_Block_Ores_Abstract {
|
public class GT_Block_Ores extends GT_Block_Ores_Abstract {
|
||||||
public GT_Block_Ores() {
|
public GT_Block_Ores() {
|
||||||
super("gt.blockores", false, Material.ROCK);
|
super("gt.blockores", false, Material.ROCK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) {
|
||||||
|
GT_TileEntity_Ores tileEntity_ores = (GT_TileEntity_Ores) world.getTileEntity(pos);
|
||||||
|
if(tileEntity_ores != null && tileEntity_ores.mMetaData != 0) {
|
||||||
|
return new ItemStack(this, 1, tileEntity_ores.mMetaData);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getUnlocalizedName() {
|
public String getUnlocalizedName() {
|
||||||
return "gt.blockores";
|
return "gt.blockores";
|
||||||
|
|
|
@ -60,16 +60,6 @@ public class GT_Block_Storage extends GT_Generic_Block {
|
||||||
return GT_LanguageManager.getTranslation(this.mUnlocalizedName + ".name");
|
return GT_LanguageManager.getTranslation(this.mUnlocalizedName + ".name");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isNormalCube(IBlockState state) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isVisuallyOpaque() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||||
return Lists.newArrayList(new ItemStack(this, 1, state.getValue(METADATA)));
|
return Lists.newArrayList(new ItemStack(this, 1, state.getValue(METADATA)));
|
||||||
|
|
Loading…
Reference in a new issue