This commit is contained in:
tterrag1098 committed 2014-08-21 21:32:59 -04:00
commit 0b1fedcc9a
20 files changed
+243 -68

No files matched your search

@@ -69,6 +69,8 @@ import crazypants.enderio.machine.light.BlockElectricLight;
import crazypants.enderio.machine.light.ElectricLightRenderer;
import crazypants.enderio.machine.painter.BlockPaintedFenceGate;
import crazypants.enderio.machine.painter.BlockPaintedFenceGateRenderer;
import crazypants.enderio.machine.painter.BlockPaintedGlowstone;
import crazypants.enderio.machine.painter.BlockPaintedGlowstoneRenderer;
import crazypants.enderio.machine.painter.PaintedItemRenderer;
import crazypants.enderio.machine.power.BlockCapacitorBank;
import crazypants.enderio.machine.power.CapBankRenderer2;
@@ -255,6 +257,9 @@ public class ClientProxy extends CommonProxy {
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockPaintedGlowstone), pir);
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockPaintedCarpet), pir);
BlockPaintedGlowstone.renderId = RenderingRegistry.getNextAvailableRenderId();
RenderingRegistry.registerBlockHandler(new BlockPaintedGlowstoneRenderer());
MinecraftForgeClient.registerItemRenderer(EnderIO.itemMachinePart, new MachinePartRenderer());
MinecraftForgeClient.registerItemRenderer(EnderIO.itemConduitFacade, new FacadeRenderer());
@@ -25,6 +25,7 @@ import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.registry.EntityRegistry;
import cpw.mods.fml.relauncher.Side;
import crazypants.enderio.block.BlockDarkSteelPressurePlate;
import crazypants.enderio.block.BlockReinforcedObsidian;
import crazypants.enderio.conduit.BlockConduitBundle;
import crazypants.enderio.conduit.ConduitRecipes;
import crazypants.enderio.conduit.facade.BlockConduitFacade;
@@ -198,6 +199,7 @@ public class EnderIO {
//Blocks
public static BlockDarkSteelPressurePlate blockDarkSteelPressurePlate;
public static BlockEndermanSkull blockEndermanSkull;
public static BlockReinforcedObsidian blockReinforcedObsidian;
//Fluids
public static Fluid fluidNutrientDistillation;
@@ -286,6 +288,7 @@ public class EnderIO {
blockKillerJoe = BlockKillerJoe.create();
blockDarkSteelPressurePlate = BlockDarkSteelPressurePlate.create();
blockReinforcedObsidian = BlockReinforcedObsidian.create();
blockFusedQuartz = BlockFusedQuartz.create();
itemFusedQuartzFrame = ItemFusedQuartzFrame.create();
@@ -63,6 +63,7 @@ public enum ModObject {
//Blocks
blockDarkSteelPressurePlate,
blockReinforcedObsidian,
// Painter
blockPainter,
@@ -0,0 +1,48 @@
package crazypants.enderio.block;
import net.minecraft.block.Block;
import net.minecraft.block.material.MapColor;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import crazypants.enderio.BlockEio;
import crazypants.enderio.ModObject;
import crazypants.enderio.config.Config;
import crazypants.enderio.gui.IResourceTooltipProvider;
import crazypants.enderio.machine.painter.TileEntityPaintedBlock;
import crazypants.enderio.material.BlockFusedQuartz;
public class BlockReinforcedObsidian extends BlockEio implements IResourceTooltipProvider {
public static BlockReinforcedObsidian create() {
BlockReinforcedObsidian result = new BlockReinforcedObsidian();
result.init();
return result;
}
private BlockReinforcedObsidian() {
super(ModObject.blockReinforcedObsidian.unlocalisedName, null, Material.rock);
setHardness(50.0F);
setResistance(2000.0F);
setStepSound(soundTypePiston);
if(!Config.reinforcedObsidianEnabled) {
setCreativeTab(null);
}
}
public boolean canEntityDestroy(IBlockAccess world, int x, int y, int z, Entity entity) {
return false;
}
public MapColor getMapColor(int p_149728_1_) {
return MapColor.obsidianColor;
}
@Override
public String getUnlocalizedNameForTooltip(ItemStack itemStack) {
return getUnlocalizedName();
}
}
@@ -303,7 +303,14 @@ public class InsulatedRedstoneConduit extends RedstoneConduit implements IInsula
if(getConectionMode(toDirection.getOpposite()) != ConnectionMode.IN_OUT) {
return 0;
}
return super.isProvidingWeakPower(toDirection);
return super.isProvidingWeakPower(toDirection);
}
@Override
public int isProvidingStrongPower(ForgeDirection toDirection) {
return isProvidingWeakPower(toDirection);
}
@Override
@@ -186,7 +186,7 @@ public class RedstoneConduit extends AbstractConduit implements IRedstoneConduit
@Override
public int isProvidingStrongPower(ForgeDirection toDirection) {
return 0;
return isProvidingWeakPower(toDirection);
}
@Override
@@ -9,6 +9,7 @@ import java.util.Set;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import crazypants.enderio.EnderIO;
import crazypants.enderio.conduit.AbstractConduitNetwork;
import crazypants.enderio.conduit.IConduitBundle;
@@ -182,18 +183,28 @@ public class RedstoneConduitNetwork extends AbstractConduitNetwork<IRedstoneCond
TileEntity te = con.getBundle().getEntity();
World worldObj = te.getWorldObj();
worldObj.notifyBlocksOfNeighborChange(te.xCoord, te.yCoord, te.zCoord, worldObj.getBlock(te.xCoord, te.yCoord, te.zCoord));
// Need to notify neighbours neighbours for changes to string signals
if(signal != null && signal.strength >= 15 && signal.x == te.xCoord && signal.y == te.yCoord && signal.z == te.zCoord) {
worldObj.notifyBlocksOfNeighborChange(te.xCoord + 1, te.yCoord, te.zCoord, worldObj.getBlock(te.xCoord + 1, te.yCoord, te.zCoord));
worldObj.notifyBlocksOfNeighborChange(te.xCoord - 1, te.yCoord, te.zCoord, worldObj.getBlock(te.xCoord - 1, te.yCoord, te.zCoord));
worldObj.notifyBlocksOfNeighborChange(te.xCoord, te.yCoord + 1, te.zCoord, worldObj.getBlock(te.xCoord, te.yCoord + 1, te.zCoord));
worldObj.notifyBlocksOfNeighborChange(te.xCoord, te.yCoord - 1, te.zCoord, worldObj.getBlock(te.xCoord, te.yCoord - 1, te.zCoord));
worldObj.notifyBlocksOfNeighborChange(te.xCoord, te.yCoord, te.zCoord + 1, worldObj.getBlock(te.xCoord, te.yCoord, te.zCoord + 1));
worldObj.notifyBlocksOfNeighborChange(te.xCoord, te.yCoord, te.zCoord - 1, worldObj.getBlock(te.xCoord, te.yCoord, te.zCoord - 1));
worldObj.notifyBlocksOfNeighborChange(te.xCoord, te.yCoord, te.zCoord, EnderIO.blockConduitBundle);
// Need to notify neighbours neighbours for changes to signals
if(signal != null /*&& signal.strength >= 15 && signal.x == te.xCoord && signal.y == te.yCoord && signal.z == te.zCoord*/) {
if(worldObj.getBlock(te.xCoord + 1, te.yCoord, te.zCoord).isNormalCube()) {
worldObj.notifyBlocksOfNeighborChange(te.xCoord + 1, te.yCoord, te.zCoord, EnderIO.blockConduitBundle);
}
if(worldObj.getBlock(te.xCoord - 1, te.yCoord, te.zCoord).isNormalCube()) {
worldObj.notifyBlocksOfNeighborChange(te.xCoord - 1, te.yCoord, te.zCoord, EnderIO.blockConduitBundle);
}
if(worldObj.getBlock(te.xCoord, te.yCoord + 1, te.zCoord).isNormalCube()) {
worldObj.notifyBlocksOfNeighborChange(te.xCoord, te.yCoord + 1, te.zCoord, EnderIO.blockConduitBundle);
}
if(worldObj.getBlock(te.xCoord, te.yCoord - 1, te.zCoord).isNormalCube()) {
worldObj.notifyBlocksOfNeighborChange(te.xCoord, te.yCoord - 1, te.zCoord, EnderIO.blockConduitBundle);
}
if(worldObj.getBlock(te.xCoord, te.yCoord, te.zCoord + 1).isNormalCube()) {
worldObj.notifyBlocksOfNeighborChange(te.xCoord, te.yCoord, te.zCoord + 1, EnderIO.blockConduitBundle);
}
if(worldObj.getBlock(te.xCoord, te.yCoord, te.zCoord - 1).isNormalCube()) {
worldObj.notifyBlocksOfNeighborChange(te.xCoord, te.yCoord, te.zCoord - 1, EnderIO.blockConduitBundle);
}
}
}
@@ -142,20 +142,8 @@ public class ConduitBundleRenderer extends TileEntitySpecialRenderer implements
IBlockAccess origBa = rb.blockAccess;
rb.blockAccess = new FacadeAccessWrapper(origBa);
// BlockConduitFacade facb = EnderIO.blockConduitFacade;
// facb.setBlockOverride(bundle);
// facb.setBlockBounds(0, 0, 0, 1, 1, 1);
// rb.setRenderBoundsFromBlock(facb);
// rb.renderStandardBlock(facb, x, y, z);
// facb.setBlockOverride(null);
//rb.renderStandardBlock(facadeId, x, y, z);
rb.renderBlockByRenderType(facadeId, x, y, z);
rb.blockAccess = origBa;
rb.renderBlockByRenderType(facadeId, x, y, z);
rb.blockAccess = origBa;
}
@@ -60,6 +60,8 @@ public final class Config {
public static final double DEFAULT_CONDUIT_SCALE = 0.5;
public static boolean reinforcedObsidianEnabled = true;
public static boolean useAlternateBinderRecipe;
public static boolean useAlternateTesseractModel;
@@ -212,7 +214,7 @@ public final class Config {
public static int crafterMjPerCraft = 250;
public static int capacitorBankMaxIoMJ = 100;
public static int capacitorBankMaxIoMJ = 500;
public static int capacitorBankMaxStorageMJ = 500000;
public static int poweredSpawnerMinDelayTicks = 200;
@@ -386,6 +388,9 @@ public final class Config {
useSneakMouseWheelYetaWrench = true;
}
reinforcedObsidianEnabled = config.get(sectionItems.name, "reinforcedObsidianEnabled", reinforcedObsidianEnabled,
"When set to false reinforced obsidian is not craftable.").getBoolean(reinforcedObsidianEnabled);
travelAnchorEnabled = config.get(sectionItems.name, "travelAnchorEnabled", travelAnchorEnabled,
"When set to false: the travel anchor will not be craftable.").getBoolean(travelAnchorEnabled);
@@ -20,21 +20,19 @@ public final class IconEIO {
public static final IconEIO BUTTON_DOWN = new IconEIO(48, 116);
public static final IconEIO BUTTON_DOWN_HIGHLIGHT = new IconEIO(64, 116);
public static final IconEIO WRENCH_OVERLAY_ALL_ON = new IconEIO(0, 148, 96, 64);
public static final IconEIO WRENCH_OVERLAY_ALL_OFF = new IconEIO(96, 148, 96, 64);
public static final IconEIO WRENCH_OVERLAY_ALL_ON = new IconEIO(0, 148, 64, 64);
public static final IconEIO WRENCH_OVERLAY_ALL_OFF = new IconEIO(96, 148, 64, 64);
public static final IconEIO WRENCH_OVERLAY_POWER = new IconEIO(0, 148, 32, 32);
public static final IconEIO WRENCH_OVERLAY_POWER_OFF = new IconEIO(96, 148, 32, 32);
public static final IconEIO WRENCH_OVERLAY_REDSTONE = new IconEIO(32, 148, 32, 32);
public static final IconEIO WRENCH_OVERLAY_ITEM = new IconEIO(64, 148, 32, 32);
public static final IconEIO WRENCH_OVERLAY_ITEM_OFF = new IconEIO(64 + 96, 148, 32, 32);
public static final IconEIO WRENCH_OVERLAY_ITEM = new IconEIO(32, 180, 32, 32);
public static final IconEIO WRENCH_OVERLAY_ITEM_OFF = new IconEIO(32 + 96, 180, 32, 32);
public static final IconEIO WRENCH_OVERLAY_FLUID = new IconEIO(16, 180, 32, 32);
public static final IconEIO WRENCH_OVERLAY_FLUID_OFF = new IconEIO(112, 180, 32, 32);
public static final IconEIO WRENCH_OVERLAY_ME = new IconEIO(48, 180, 32, 32);
public static final IconEIO WRENCH_OVERLAY_FLUID = new IconEIO(0, 180, 32, 32);
public static final IconEIO WRENCH_OVERLAY_FLUID_OFF = new IconEIO(96, 180, 32, 32);
public static final IconEIO ACTIVE_TAB = new IconEIO(237, 0, 19, 24);
public static final IconEIO INACTIVE_TAB = new IconEIO(237, 25, 19, 24);
@@ -47,20 +47,20 @@ public class YetaWrenchOverlayRenderer {
if(mode == ConduitDisplayMode.ALL) {
GL11.glColor4f(1, 1, 1, 0.75f);
IconEIO.WRENCH_OVERLAY_ALL_ON.renderIcon(offsetX, offsetY - 32, 48, 32, 0, true);
IconEIO.WRENCH_OVERLAY_ALL_ON.renderIcon(offsetX, offsetY - 32, 32, 32, 0, true);
return;
}
float c = 0.6f;
GL11.glColor4f(c, c, c, 0.33f);
IconEIO.WRENCH_OVERLAY_ALL_OFF.renderIcon(offsetX, offsetY - 32, 48, 32, 0, true);
IconEIO.WRENCH_OVERLAY_ALL_OFF.renderIcon(offsetX, offsetY - 32, 32, 32, 0, true);
GL11.glColor4f(1, 1, 1, 0.75f);
if(mode == ConduitDisplayMode.POWER) {
IconEIO.WRENCH_OVERLAY_POWER.renderIcon(offsetX, offsetY - 32, 16, 16, 0, true);
} else if(mode == ConduitDisplayMode.FLUID) {
IconEIO.WRENCH_OVERLAY_FLUID.renderIcon(offsetX + 8, offsetY - 16, 16, 16, 0, true);
IconEIO.WRENCH_OVERLAY_FLUID.renderIcon(offsetX , offsetY - 16, 16, 16, 0, true);
} else if(mode == ConduitDisplayMode.ITEM) {
IconEIO.WRENCH_OVERLAY_ITEM.renderIcon(offsetX + 32, offsetY - 32, 16, 16, 0, true);
IconEIO.WRENCH_OVERLAY_ITEM.renderIcon(offsetX + 16, offsetY - 16, 16, 16, 0, true);
} else if(mode == ConduitDisplayMode.REDSTONE) {
IconEIO.WRENCH_OVERLAY_REDSTONE.renderIcon(offsetX + 16, offsetY - 32, 16, 16, 0, true);
}
@@ -36,8 +36,9 @@ import crazypants.enderio.machine.MachineRecipeInput;
import crazypants.enderio.machine.MachineRecipeRegistry;
public class BlockPaintedGlowstone extends Block implements ITileEntityProvider {
public static int renderId = -1;
public static BlockPaintedGlowstone create() {
BlockPaintedGlowstone result = new BlockPaintedGlowstone();
result.init();
@@ -207,7 +208,6 @@ public class BlockPaintedGlowstone extends Block implements ITileEntityProvider
*/
@Override
public void breakBlock(World world, int x, int y, int z, Block par5, int par6) {
if(!world.isRemote && world.getGameRules().getGameRuleBooleanValue("doTileDrops")) {
TileEntity te = world.getTileEntity(x, y, z);
@@ -223,11 +223,8 @@ public class BlockPaintedGlowstone extends Block implements ITileEntityProvider
EntityItem entityitem = new EntityItem(world, x + d0, y + d1, z + d2, itemStack);
entityitem.delayBeforeCanPickup = 10;
world.spawnEntityInWorld(entityitem);
}
}
world.removeTileEntity(x, y, z);
}
@@ -236,6 +233,11 @@ public class BlockPaintedGlowstone extends Block implements ITileEntityProvider
return 0; // need to do custom dropping to maintain source metadata
}
@Override
public int getRenderType() {
return renderId;
}
public static final class PainterTemplate extends BasicPainterTemplate {
public PainterTemplate(Block paintedGlowstone) {
@@ -0,0 +1,94 @@
package crazypants.enderio.machine.painter;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockAccess;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import crazypants.enderio.EnderIO;
import crazypants.util.IBlockAccessWrapper;
public class BlockPaintedGlowstoneRenderer implements ISimpleBlockRenderingHandler {
@Override
public int getRenderId() {
return BlockPaintedGlowstone.renderId;
}
@Override
public void renderInventoryBlock(Block arg0, int arg1, int arg2, RenderBlocks arg3) {
}
@Override
public boolean renderWorldBlock(IBlockAccess ba, int x, int y, int z, Block block, int arg5, RenderBlocks rb) {
BlockPaintedGlowstone paintedGlowstone = (BlockPaintedGlowstone) block;
TileEntity tile = ba.getTileEntity(x, y, z);
if(!(tile instanceof TileEntityPaintedBlock)) {
return false;
}
TileEntityPaintedBlock te = (TileEntityPaintedBlock) tile;
Block srcBlk = te.getSourceBlock();
IBlockAccess origBa = rb.blockAccess;
rb.blockAccess = new PaintedAccessWrapper(origBa);
rb.renderBlockByRenderType(srcBlk, x, y, z);
rb.blockAccess = origBa;
return true;
}
@Override
public boolean shouldRender3DInInventory(int arg0) {
return true;
}
private class PaintedAccessWrapper extends IBlockAccessWrapper {
public PaintedAccessWrapper(IBlockAccess ba) {
super(ba);
}
@Override
public Block getBlock(int x, int y, int z) {
Block res = super.getBlock(x, y, z);
if(res == EnderIO.blockPaintedGlowstone) {
TileEntity te = getTileEntity(x, y, z);
if(te instanceof TileEntityPaintedBlock) {
TileEntityPaintedBlock tcb = (TileEntityPaintedBlock) te;
Block fac = tcb.getSourceBlock();
if(fac != null) {
res = fac;
}
}
}
return res;
}
@Override
@SideOnly(Side.CLIENT)
public int getLightBrightnessForSkyBlocks(int var1, int var2, int var3, int var4) {
return wrapped.getLightBrightnessForSkyBlocks(var1, var2, var3, var4);
}
@Override
public int getBlockMetadata(int x, int y, int z) {
Block block = super.getBlock(x, y, z);
if(block == EnderIO.blockPaintedGlowstone) {
TileEntity te = getTileEntity(x, y, z);
if(te instanceof TileEntityPaintedBlock) {
TileEntityPaintedBlock tcb = (TileEntityPaintedBlock) te;
Block fac = tcb.getSourceBlock();
if(fac != null) {
return tcb.getSourceBlockMetadata();
}
}
}
return super.getBlockMetadata(x, y, z);
}
}
}
@@ -9,6 +9,9 @@ import net.minecraftforge.client.IItemRenderer;
import org.lwjgl.opengl.GL11;
import crazypants.enderio.EnderIO;
import crazypants.render.RenderUtil;
public class PaintedItemRenderer implements IItemRenderer {
@Override
@@ -35,37 +38,35 @@ public class PaintedItemRenderer implements IItemRenderer {
}
public void renderEquipped(ItemStack item, RenderBlocks renderBlocks) {
Block block = PainterUtil.getSourceBlock(item);
if(block != null) {
int meta = PainterUtil.getSourceBlockMetadata(item);
renderBlocks.setOverrideBlockTexture(renderBlocks.getBlockIconFromSideAndMetadata(block, 2, meta));
}
GL11.glPushMatrix();
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
Item i = item.getItem();
if(i instanceof ItemBlock) {
renderBlocks.renderBlockAsItem(((ItemBlock) i).field_150939_a, item.getItemDamage(), 1.0f);
}
renderToInventory(item, renderBlocks);
GL11.glPopMatrix();
renderBlocks.clearOverrideBlockTexture();
}
public void renderToInventory(ItemStack item, RenderBlocks renderBlocks) {
Block block = PainterUtil.getSourceBlock(item);
if(block != null) {
int meta = PainterUtil.getSourceBlockMetadata(item);
renderBlocks.setOverrideBlockTexture(renderBlocks.getBlockIconFromSideAndMetadata(block, 2, meta));
}
Item i = item.getItem();
if(i instanceof ItemBlock) {
renderBlocks.renderBlockAsItem(((ItemBlock) i).field_150939_a, item.getItemDamage(), 1.0f);
if(item.getItem() == Item.getItemFromBlock(EnderIO.blockPaintedGlowstone)) {
Block block = PainterUtil.getSourceBlock(item);
if(block != null) {
RenderUtil.bindBlockTexture();
renderBlocks.renderBlockAsItem(block, PainterUtil.getSourceBlockMetadata(item), 1.0F);
}
} else {
Block block = PainterUtil.getSourceBlock(item);
if(block != null) {
int meta = PainterUtil.getSourceBlockMetadata(item);
renderBlocks.setOverrideBlockTexture(renderBlocks.getBlockIconFromSideAndMetadata(block, 2, meta));
}
Item i = item.getItem();
if(i instanceof ItemBlock) {
renderBlocks.renderBlockAsItem(((ItemBlock) i).field_150939_a, item.getItemDamage(), 1.0f);
}
renderBlocks.clearOverrideBlockTexture();
}
renderBlocks.clearOverrideBlockTexture();
}
}
@@ -147,6 +147,11 @@ public class MaterialRecipes {
} else {
GameRegistry.addShapedRecipe(enderCapacitor, " e ", "cgc", " e ", 'e', phasedGold, 'c', activatedCapacitor, 'g', Blocks.glowstone);
}
if(Config.reinforcedObsidianEnabled) {
ItemStack reinfObs = new ItemStack(EnderIO.blockReinforcedObsidian);
GameRegistry.addShapedRecipe(reinfObs , "dbd", "bob", "dbd", 'd', darkSteel, 'b', EnderIO.blockDarkIronBars, 'o', Blocks.obsidian);
}
}
@@ -30,6 +30,9 @@ public class NEIEnderIOConfig implements IConfigureNEI {
if(!Config.travelAnchorEnabled) {
API.hideItem(new ItemStack(EnderIO.itemTravelStaff));
}
if(!Config.reinforcedObsidianEnabled) {
API.hideItem(new ItemStack(EnderIO.blockReinforcedObsidian));
}
}
@Override