Merge remote-tracking branch 'remotes/origin/1.8.9' into 1.9

This commit is contained in:
modmuss50 2016-03-16 16:26:44 +00:00
commit 00fc80b071
10 changed files with 75 additions and 22 deletions

View file

@ -1,42 +1,47 @@
package techreborn.blocks;
import me.modmuss50.jsonDestroyer.api.ITexturedBlock;
import net.minecraft.block.BlockTNT;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyBool;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.entity.projectile.EntityArrow;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.Explosion;
import net.minecraft.world.World;
import reborncore.RebornCore;
import reborncore.common.BaseBlock;
import techreborn.client.TechRebornCreativeTabMisc;
import techreborn.entitys.EntityNukePrimed;
/**
* Created by Mark on 13/03/2016.
*/
public class BlockNuke extends BlockTNT implements ITexturedBlock {
public class BlockNuke extends BaseBlock implements ITexturedBlock {
public static final PropertyBool OVERLAY = PropertyBool.create("overlay");
public BlockNuke() {
super(Material.tnt);
setUnlocalizedName("techreborn.nuke");
setCreativeTab(TechRebornCreativeTabMisc.instance);
RebornCore.jsonDestroyer.registerObject(this);
this.setDefaultState(this.blockState.getBaseState().withProperty(OVERLAY, false));
}
@Override
public void explode(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase igniter) {
if (!worldIn.isRemote) {
if (state.getValue(EXPLODE).booleanValue()) {
EntityNukePrimed entitynukeprimed = new EntityNukePrimed(worldIn, (double) ((float) pos.getX() + 0.5F), (double) pos.getY(), (double) ((float) pos.getZ() + 0.5F), igniter);
worldIn.spawnEntityInWorld(entitynukeprimed);
//TODO 1.9 sounds
// worldIn.playSoundAtEntity(entitynukeprimed, "game.tnt.primed", 1.0F, 1.0F);
}
}
}
@Override
public void onBlockDestroyedByExplosion(World worldIn, BlockPos pos, Explosion explosionIn) {
@ -47,6 +52,40 @@ public class BlockNuke extends BlockTNT implements ITexturedBlock {
}
}
public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn) {
if (!worldIn.isRemote && entityIn instanceof EntityArrow) {
EntityArrow entityarrow = (EntityArrow) entityIn;
if (entityarrow.isBurning()) {
this.explode(worldIn, pos, state, entityarrow.shootingEntity instanceof EntityLivingBase ? (EntityLivingBase) entityarrow.shootingEntity : null);
worldIn.setBlockToAir(pos);
}
}
}
public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) {
super.onBlockAdded(worldIn, pos, state);
if (worldIn.isBlockPowered(pos)) {
this.onBlockDestroyedByPlayer(worldIn, pos, state);
worldIn.setBlockToAir(pos);
}
}
/**
* Called when a neighboring block changes.
*/
public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) {
if (worldIn.isBlockPowered(pos)) {
this.onBlockDestroyedByPlayer(worldIn, pos, state);
worldIn.setBlockToAir(pos);
}
}
public void onBlockDestroyedByPlayer(World worldIn, BlockPos pos, IBlockState state)
{
this.explode(worldIn, pos, state, (EntityLivingBase)null);
}
@Override
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
return false;
@ -54,11 +93,28 @@ public class BlockNuke extends BlockTNT implements ITexturedBlock {
@Override
public String getTextureNameFromState(IBlockState iBlockState, EnumFacing enumFacing) {
return "techreborn:blocks/machine/greg_machine/nuke";
if (iBlockState.getValue(OVERLAY)) {
return "techreborn:blocks/nuke_overlay";
}
return "techreborn:blocks/nuke";
}
@Override
public int amountOfStates() {
return 1;
return 2;
}
public int getMetaFromState(IBlockState state) {
return state.getValue(OVERLAY) ? 1 : 0;
}
public IBlockState getStateFromMeta(int meta)
{
return this.getDefaultState().withProperty(OVERLAY, Boolean.valueOf((meta & 1) > 0));
}
protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, OVERLAY);
}
}

View file

@ -28,22 +28,18 @@ public class ContainerAesu extends RebornContainer {
tile = tileaesu;
this.player = player;
// input
//this.addSlotToContainer(new Slot(tileaesu.inventory, 0, 116, 23));
// this.addSlotToContainer(new Slot(tileaesu.inventory, 1, 116, 59));
int i;
for (i = 0; i < 3; ++i) {
for (int j = 0; j < 9; ++j) {
this.addSlotToContainer(new Slot(player.inventory, j + i * 9
+ 9, 8 + j * 18, 84 + i * 18));
+ 9, 8 + j * 18, 115 + i * 18));
}
}
for (i = 0; i < 9; ++i) {
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18,
142));
173));
}
}

View file

@ -28,7 +28,7 @@ public class GuiAesu extends GuiContainer {
TileAesu tileaesu) {
super(new ContainerAesu(tileaesu, player));
this.xSize = 176;
this.ySize = 165;
this.ySize = 197;
aesu = tileaesu;
this.containerAesu = (ContainerAesu) this.inventorySlots;
}

View file

@ -9,6 +9,8 @@ import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.init.Blocks;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;
import org.lwjgl.opengl.GL11;
import techreborn.blocks.BlockNuke;
import techreborn.entitys.EntityNukePrimed;
import techreborn.init.ModBlocks;
@ -41,20 +43,18 @@ public class RenderNukePrimed extends Render<EntityNukePrimed> {
blockrendererdispatcher.renderBlockBrightness(ModBlocks.nuke.getDefaultState(), entity.getBrightness(partialTicks));
GlStateManager.translate(0.0F, 0.0F, 1.0F);
if (entity.fuse / 5 % 2 == 0) {
GlStateManager.disableTexture2D();
GlStateManager.disableLighting();
GlStateManager.enableBlend();
GlStateManager.blendFunc(770, 772);
GlStateManager.color(1.0F, 1.0F, 1.0F, f2);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1F);
GlStateManager.doPolygonOffset(-3.0F, -3.0F);
GlStateManager.enablePolygonOffset();
blockrendererdispatcher.renderBlockBrightness(Blocks.tnt.getDefaultState(), 1.0F);
blockrendererdispatcher.renderBlockBrightness(ModBlocks.nuke.getDefaultState().withProperty(BlockNuke.OVERLAY, true), 1.0F);
GlStateManager.doPolygonOffset(0.0F, 0.0F);
GlStateManager.disablePolygonOffset();
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.disableBlend();
GlStateManager.enableLighting();
GlStateManager.enableTexture2D();
}
GlStateManager.popMatrix();
super.doRender(entity, x, y, z, entityYaw, partialTicks);

View file

@ -51,6 +51,7 @@ public class EntityNukePrimed extends EntityTNTPrimed {
public void explodeNuke() {
RebornExplosion nukeExplosion = new RebornExplosion(new BlockPos(this.posX, this.posY, this.posZ), worldObj, 40);
nukeExplosion.setLivingBase(getTntPlacedBy());
nukeExplosion.explode();
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 833 B

After

Width:  |  Height:  |  Size: 738 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 919 B

After

Width:  |  Height:  |  Size: 838 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 803 B

After

Width:  |  Height:  |  Size: 719 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB