This commit is contained in:
Prospector 2016-03-16 10:01:28 -07:00
commit a9eb7e6b42
13 changed files with 336 additions and 14 deletions

View file

@ -1,39 +1,48 @@
package techreborn.blocks; package techreborn.blocks;
import me.modmuss50.jsonDestroyer.api.ITexturedBlock; 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.BlockState;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityArrow;
import net.minecraft.util.BlockPos; import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.world.Explosion; import net.minecraft.world.Explosion;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import reborncore.RebornCore; import reborncore.RebornCore;
import reborncore.common.BaseBlock;
import techreborn.client.TechRebornCreativeTabMisc; import techreborn.client.TechRebornCreativeTabMisc;
import techreborn.entitys.EntityNukePrimed; import techreborn.entitys.EntityNukePrimed;
/** /**
* Created by Mark on 13/03/2016. * 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() { public BlockNuke() {
super(Material.tnt);
setUnlocalizedName("techreborn.nuke"); setUnlocalizedName("techreborn.nuke");
setCreativeTab(TechRebornCreativeTabMisc.instance); setCreativeTab(TechRebornCreativeTabMisc.instance);
RebornCore.jsonDestroyer.registerObject(this); RebornCore.jsonDestroyer.registerObject(this);
this.setDefaultState(this.blockState.getBaseState().withProperty(OVERLAY, false));
} }
@Override
public void explode(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase igniter) { public void explode(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase igniter) {
if (!worldIn.isRemote) { 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); EntityNukePrimed entitynukeprimed = new EntityNukePrimed(worldIn, (double) ((float) pos.getX() + 0.5F), (double) pos.getY(), (double) ((float) pos.getZ() + 0.5F), igniter);
worldIn.spawnEntityInWorld(entitynukeprimed); worldIn.spawnEntityInWorld(entitynukeprimed);
worldIn.playSoundAtEntity(entitynukeprimed, "game.tnt.primed", 1.0F, 1.0F); worldIn.playSoundAtEntity(entitynukeprimed, "game.tnt.primed", 1.0F, 1.0F);
} }
} }
}
@Override @Override
public void onBlockDestroyedByExplosion(World worldIn, BlockPos pos, Explosion explosionIn) { public void onBlockDestroyedByExplosion(World worldIn, BlockPos pos, Explosion explosionIn) {
@ -44,6 +53,35 @@ 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.explode(worldIn, pos, state, null);
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.explode(worldIn, pos, state, null);
worldIn.setBlockToAir(pos);
}
}
@Override @Override
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) { public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) {
return false; //No flint and steel return false; //No flint and steel
@ -51,11 +89,28 @@ public class BlockNuke extends BlockTNT implements ITexturedBlock {
@Override @Override
public String getTextureNameFromState(IBlockState iBlockState, EnumFacing enumFacing) { 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 @Override
public int amountOfStates() { 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 BlockState createBlockState() {
return new BlockState(this, OVERLAY);
}
} }

View file

@ -0,0 +1,51 @@
package techreborn.blocks.transformers;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import techreborn.blocks.storage.BlockBatBox;
import techreborn.client.TechRebornCreativeTab;
import techreborn.tiles.storage.TileMFE;
import techreborn.tiles.transformers.TileHVTransformer;
/**
* Created by modmuss50 on 16/03/2016.
*/
public class BlockHVTransformer extends BlockLVTransformer {
public BlockHVTransformer() {
super();
setUnlocalizedName("techreborn.hvt");
setCreativeTab(TechRebornCreativeTab.instance);
}
@Override
public TileEntity createNewTileEntity(World world, int p_149915_2_) {
return new TileHVTransformer();
}
@Override
public String getFrontOff() {
return prefix + "hvt_front";
}
@Override
public String getFrontOn() {
return prefix + "hvt_front";
}
@Override
public String getSide() {
return prefix + "hvt_side";
}
@Override
public String getTop() {
return prefix + "hvt_top";
}
@Override
public String getBottom() {
return prefix + "hvt_bottom";
}
}

View file

@ -0,0 +1,50 @@
package techreborn.blocks.transformers;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import techreborn.blocks.storage.BlockBatBox;
import techreborn.client.TechRebornCreativeTab;
import techreborn.tiles.storage.TileMFE;
import techreborn.tiles.transformers.TileLVTransformer;
/**
* Created by modmuss50 on 16/03/2016.
*/
public class BlockLVTransformer extends BlockBatBox {
public BlockLVTransformer() {
super();
setUnlocalizedName("techreborn.lvt");
setCreativeTab(TechRebornCreativeTab.instance);
}
@Override
public TileEntity createNewTileEntity(World world, int p_149915_2_) {
return new TileLVTransformer();
}
@Override
public String getFrontOff() {
return prefix + "lvt_front";
}
@Override
public String getFrontOn() {
return prefix + "lvt_front";
}
@Override
public String getSide() {
return prefix + "lvt_side";
}
@Override
public String getTop() {
return prefix + "lvt_top";
}
@Override
public String getBottom() {
return prefix + "lvt_bottom";
}
}

View file

@ -0,0 +1,50 @@
package techreborn.blocks.transformers;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import techreborn.blocks.storage.BlockBatBox;
import techreborn.client.TechRebornCreativeTab;
import techreborn.tiles.storage.TileMFE;
import techreborn.tiles.transformers.TileMVTransformer;
/**
* Created by modmuss50 on 16/03/2016.
*/
public class BlockMVTransformer extends BlockLVTransformer {
public BlockMVTransformer() {
super();
setUnlocalizedName("techreborn.mvt");
setCreativeTab(TechRebornCreativeTab.instance);
}
@Override
public TileEntity createNewTileEntity(World world, int p_149915_2_) {
return new TileMVTransformer();
}
@Override
public String getFrontOff() {
return prefix + "mvt_front";
}
@Override
public String getFrontOn() {
return prefix + "mvt_front";
}
@Override
public String getSide() {
return prefix + "mvt_side";
}
@Override
public String getTop() {
return prefix + "mvt_top";
}
@Override
public String getBottom() {
return prefix + "mvt_bottom";
}
}

View file

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

View file

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

View file

@ -16,6 +16,9 @@ import techreborn.blocks.iron_machines.BlockIronFurnace;
import techreborn.blocks.machine.*; import techreborn.blocks.machine.*;
import techreborn.blocks.storage.*; import techreborn.blocks.storage.*;
import techreborn.blocks.tier1.*; import techreborn.blocks.tier1.*;
import techreborn.blocks.transformers.BlockHVTransformer;
import techreborn.blocks.transformers.BlockLVTransformer;
import techreborn.blocks.transformers.BlockMVTransformer;
import techreborn.itemblocks.*; import techreborn.itemblocks.*;
import techreborn.tiles.*; import techreborn.tiles.*;
import techreborn.tiles.fusionReactor.TileEntityFusionController; import techreborn.tiles.fusionReactor.TileEntityFusionController;
@ -27,6 +30,9 @@ import techreborn.tiles.storage.TileBatBox;
import techreborn.tiles.storage.TileMFE; import techreborn.tiles.storage.TileMFE;
import techreborn.tiles.storage.TileMFSU; import techreborn.tiles.storage.TileMFSU;
import techreborn.tiles.teir1.*; import techreborn.tiles.teir1.*;
import techreborn.tiles.transformers.TileHVTransformer;
import techreborn.tiles.transformers.TileLVTransformer;
import techreborn.tiles.transformers.TileMVTransformer;
public class ModBlocks { public class ModBlocks {
@ -84,6 +90,9 @@ public class ModBlocks {
public static Block mfe; public static Block mfe;
public static Block mfsu; public static Block mfsu;
public static Block scrapboxinator; public static Block scrapboxinator;
public static Block lvt;
public static Block mvt;
public static Block hvt;
public static BlockOre ore; public static BlockOre ore;
public static BlockOre2 ore2; public static BlockOre2 ore2;
@ -339,6 +348,18 @@ public class ModBlocks {
GameRegistry.registerBlock(mfsu, "mfsu"); GameRegistry.registerBlock(mfsu, "mfsu");
GameRegistry.registerTileEntity(TileMFSU.class, "TileMFSU"); GameRegistry.registerTileEntity(TileMFSU.class, "TileMFSU");
lvt = new BlockLVTransformer();
GameRegistry.registerBlock(lvt, "lvt");
GameRegistry.registerTileEntity(TileLVTransformer.class, "TileLVTransformer");
mvt = new BlockMVTransformer();
GameRegistry.registerBlock(mvt, "mvt");
GameRegistry.registerTileEntity(TileMVTransformer.class, "TileMVTransformer");
hvt = new BlockHVTransformer();
GameRegistry.registerBlock(hvt, "hvt");
GameRegistry.registerTileEntity(TileHVTransformer.class, "TileHVTransformer");
ironFurnace = new BlockIronFurnace(); ironFurnace = new BlockIronFurnace();
GameRegistry.registerBlock(ironFurnace, "ironfurnace"); GameRegistry.registerBlock(ironFurnace, "ironfurnace");
GameRegistry.registerTileEntity(TileIronFurnace.class, "TileIronFurnaceTR"); GameRegistry.registerTileEntity(TileIronFurnace.class, "TileIronFurnaceTR");

View file

@ -134,6 +134,12 @@ public abstract class CableMultipart extends Multipart implements IOccludingPart
public void onRemoved() { public void onRemoved() {
super.onRemoved(); super.onRemoved();
removeFromNetwork(); removeFromNetwork();
for(EnumFacing dir : EnumFacing.VALUES){
CableMultipart multipart = getPartFromWorld(getWorld(), getPos().offset(dir), dir);
if(multipart != null){
multipart.nearByChange();
}
}
} }
@Override @Override

View file

@ -0,0 +1,24 @@
package techreborn.tiles.transformers;
import reborncore.api.power.EnumPowerTier;
/**
* Created by modmuss50 on 16/03/2016.
*/
public class TileHVTransformer extends TileLVTransformer {
@Override
public double getMaxOutput() {
return 512;
}
@Override
public double getMaxInput() {
return 2048;
}
@Override
public EnumPowerTier getTier() {
return EnumPowerTier.EXTREME;
}
}

View file

@ -0,0 +1,40 @@
package techreborn.tiles.transformers;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import reborncore.api.power.EnumPowerTier;
import techreborn.init.ModBlocks;
import techreborn.tiles.storage.TileBatBox;
/**
* Created by modmuss50 on 16/03/2016.
*/
public class TileLVTransformer extends TileBatBox {
@Override
public double getMaxOutput() {
return 32;
}
@Override
public double getMaxInput() {
return 128;
}
@Override
//Can take medium power in
public EnumPowerTier getTier() {
return EnumPowerTier.MEDIUM;
}
@Override
public double getMaxPower() {
return getMaxInput() * 2;
}
@Override
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
return new ItemStack(worldObj.getBlockState(pos).getBlock());
}
}

View file

@ -0,0 +1,24 @@
package techreborn.tiles.transformers;
import reborncore.api.power.EnumPowerTier;
/**
* Created by modmuss50 on 16/03/2016.
*/
public class TileMVTransformer extends TileLVTransformer {
@Override
public double getMaxOutput() {
return 128;
}
@Override
public double getMaxInput() {
return 512;
}
@Override
public EnumPowerTier getTier() {
return EnumPowerTier.HIGH;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB