1.12 Release commit v1.0.12.
This commit is contained in:
parent
0ad6e542ba
commit
d0fe9788fd
14 changed files with 390 additions and 18 deletions
|
@ -388,6 +388,15 @@ public class ModContent
|
|||
Material.IRON, 0.6f, 10f, SoundType.METAL
|
||||
);
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
public static final BlockDecorTest TEST_BLOCK = new BlockDecorTest(
|
||||
"testblock",
|
||||
BlockDecor.CFG_LOOK_PLACEMENT|BlockDecor.CFG_FLIP_PLACEMENT_SHIFTCLICK,
|
||||
Material.IRON, 0.1f, 9000f, SoundType.METAL,
|
||||
ModAuxiliaries.getPixeledAABB(0,0,0, 16,16,16)
|
||||
);
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------
|
||||
//-- Tile entities
|
||||
//--------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -433,6 +442,10 @@ public class ModContent
|
|||
BlockDecorTreeCutter.BTileEntity.class, "te_small_tree_cutter"
|
||||
);
|
||||
|
||||
private static final TileEntityRegistrationData TEST_BLOCK_TEI = new TileEntityRegistrationData(
|
||||
BlockDecorTest.BTileEntity.class, "te_testblock"
|
||||
);
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------
|
||||
//-- Block registration list
|
||||
//--------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -495,9 +508,10 @@ public class ModContent
|
|||
private static final Object dev_content[] = {
|
||||
SIGN_MINDSTEP,
|
||||
PANZERGLASS_SLAB, // @todo: check if another class is needed due to is_side_visible
|
||||
SMALL_SOLAR_PANEL,SMALL_SOLAR_PANEL_TEI, // @todo: check power tuning <= Peltier generator
|
||||
TREATED_WOOD_FLOOR, // @todo: check if textures need improvement
|
||||
SMALL_TREE_CUTTER,SMALL_TREE_CUTTER_TEI, // @todo: test
|
||||
SMALL_SOLAR_PANEL,SMALL_SOLAR_PANEL_TEI,
|
||||
SMALL_TREE_CUTTER,SMALL_TREE_CUTTER_TEI,
|
||||
TEST_BLOCK,TEST_BLOCK_TEI
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -600,6 +614,9 @@ public class ModContent
|
|||
if(!ModConfig.isOptedOut(TREATED_WOOD_CRAFTING_TABLE)) {
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(BlockDecorCraftingTable.BTileEntity.class, new ModTesrs.TesrDecorCraftingTable());
|
||||
}
|
||||
if(!ModConfig.isOptedOut(TEST_BLOCK)) {
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(BlockDecorTest.BTileEntity.class, new ModTesrs.TesrDecorTest());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,93 @@
|
|||
/*
|
||||
* @file BlockDecorTest.java
|
||||
* @author Stefan Wilhelm (wile)
|
||||
* @copyright (C) 2019 Stefan Wilhelm
|
||||
* @license MIT (see https://opensource.org/licenses/MIT)
|
||||
*
|
||||
* Smaller (cutout) block with a defined facing.
|
||||
*/
|
||||
package wile.engineersdecor.blocks;
|
||||
|
||||
import wile.engineersdecor.detail.ModAuxiliaries;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.ITickable;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
|
||||
public class BlockDecorTest extends BlockDecorDirected implements ModAuxiliaries.IExperimentalFeature
|
||||
{
|
||||
public BlockDecorTest(@Nonnull String registryName, long config, @Nullable Material material, float hardness, float resistance, @Nullable SoundType sound, @Nonnull AxisAlignedBB unrotatedAABB)
|
||||
{ super(registryName, config, material, hardness, resistance, sound, unrotatedAABB); }
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(IBlockState state)
|
||||
{ return true; }
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity(World world, IBlockState state)
|
||||
{ return new BTileEntity(); }
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
|
||||
{ return clicked(world, pos, player, false); }
|
||||
|
||||
@Override
|
||||
public void onBlockClicked(World world, BlockPos pos, EntityPlayer player)
|
||||
{ clicked(world, pos, player, true); }
|
||||
|
||||
private boolean clicked(World world, BlockPos pos, EntityPlayer player, boolean lclick)
|
||||
{ TileEntity te = world.getTileEntity(pos); return (te instanceof BTileEntity) && ((BTileEntity)te).clicked(player, lclick); }
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------
|
||||
// Tile entity
|
||||
//--------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
public static class BTileEntity extends TileEntity implements ITickable
|
||||
{
|
||||
public static double increment = 0.008;
|
||||
private double progress_ = 0;
|
||||
private double incr_ = increment;
|
||||
|
||||
public BTileEntity()
|
||||
{}
|
||||
|
||||
@Override
|
||||
public boolean shouldRefresh(World world, BlockPos pos, IBlockState os, IBlockState ns)
|
||||
{ return (os.getBlock() != ns.getBlock()) || (!(ns.getBlock() instanceof BlockDecorTest)); }
|
||||
|
||||
|
||||
|
||||
public double progress()
|
||||
{ return progress_; }
|
||||
|
||||
public boolean clicked(EntityPlayer player, boolean lclicked)
|
||||
{
|
||||
progress_ = 0;
|
||||
incr_ = increment;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update()
|
||||
{
|
||||
progress_ += incr_;
|
||||
if(progress_ < 0) {
|
||||
incr_ = increment;
|
||||
progress_ = 0;
|
||||
} else if(progress_ > 1.0) {
|
||||
progress_ = 1.0;
|
||||
incr_ = -increment;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -11,16 +11,23 @@ package wile.engineersdecor.detail;
|
|||
|
||||
import wile.engineersdecor.ModEngineersDecor;
|
||||
import wile.engineersdecor.blocks.BlockDecorCraftingTable;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.*;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import wile.engineersdecor.blocks.BlockDecorTest;
|
||||
|
||||
public class ModTesrs
|
||||
{
|
||||
|
@ -82,4 +89,36 @@ public class ModTesrs
|
|||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static class TesrDecorTest extends TileEntitySpecialRenderer<BlockDecorTest.BTileEntity>
|
||||
{
|
||||
@Override
|
||||
public void render(final BlockDecorTest.BTileEntity te, double x, double y, double z, final float partialTicks, final int destroyStage, final float alpha)
|
||||
{
|
||||
renderBlockState(Blocks.SANDSTONE.getDefaultState(), te.getPos(), (new Vec3d(1,1,1)).scale(te.progress()), x,y,z);
|
||||
}
|
||||
|
||||
public void renderBlockState(IBlockState state, BlockPos pos, Vec3d offset, double basex, double basey, double basez)
|
||||
{
|
||||
if(state.getMaterial() == Material.AIR) return;
|
||||
BlockRendererDispatcher brd = Minecraft.getMinecraft().getBlockRendererDispatcher();
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
BufferBuilder bb = tessellator.getBuffer();
|
||||
bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.disableCull();
|
||||
GlStateManager.shadeModel(Minecraft.isAmbientOcclusionEnabled() ? 7425 : 7424);
|
||||
bb.begin(7, DefaultVertexFormats.BLOCK);
|
||||
bb.setTranslation(basex-(double)pos.getX()+offset.x, basey-(double)pos.getY()+offset.y,basez-(double)pos.getZ()+offset.z);
|
||||
final boolean checkSides=true;
|
||||
brd.getBlockModelRenderer().renderModel(getWorld(), brd.getModelForState(state), state, pos, bb, checkSides);
|
||||
bb.setTranslation(0.0, 0.0, 0.0);
|
||||
tessellator.draw();
|
||||
RenderHelper.enableStandardItemLighting();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue