pylon connector rotation, crafting recipe

This commit is contained in:
Boblet 2021-11-30 16:18:59 +01:00
parent 5d8b186c29
commit 18d4d091e5
8 changed files with 61 additions and 6 deletions

View File

@ -4,8 +4,11 @@ import com.hbm.lib.RefStrings;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.world.IBlockAccess;
public class BlockBase extends Block {
private boolean beaconable = false;
public BlockBase() {
super(Material.rock);
@ -21,4 +24,14 @@ public class BlockBase extends Block {
this.setBlockTextureName(RefStrings.MODID + ":" + name);
return this;
}
public BlockBase setBeaconable() {
this.beaconable = true;
return this;
}
@Override
public boolean isBeaconBase(IBlockAccess worldObj, int x, int y, int z, int beaconX, int beaconY, int beaconZ) {
return this.beaconable;
}
}

View File

@ -1,12 +1,13 @@
package com.hbm.blocks.generic;
import com.hbm.blocks.BlockBase;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
public class BlockGeneric extends Block {
public class BlockGeneric extends BlockBase {
public BlockGeneric(Material material) {
super(material);
}
}

View File

@ -17,4 +17,8 @@ public class ConnectorRedWire extends PylonBase {
return new TileEntityConnector();
}
@Override
public int onBlockPlaced(World world, int x, int y, int z, int side, float fX, float fY, float fZ, int meta) {
return side;
}
}

View File

@ -1475,7 +1475,7 @@ public class MachineRecipes {
list.add(new ItemStack(ModItems.nugget_bismuth, 4));
break;
case ETHANOL:
list.add(new ItemStack(ModItems.biomass, 6));
list.add(new ItemStack(Items.sugar, 6));
break;
case METH:
list.add(new ItemStack(Items.wheat, 1));

View File

@ -231,7 +231,8 @@ public class CraftingManager {
addRecipeAuto(new ItemStack(ModBlocks.cable_switch, 1), new Object[] { "S", "W", 'S', Blocks.lever, 'W', ModBlocks.red_wire_coated });
addRecipeAuto(new ItemStack(ModBlocks.machine_detector, 1), new Object[] { "IRI", "CTC", "IRI", 'I', ModItems.plate_polymer, 'R', REDSTONE.dust(), 'C', ModItems.wire_red_copper, 'T', ModItems.coil_tungsten });
addRecipeAuto(new ItemStack(Item.getItemFromBlock(ModBlocks.red_cable), 16), new Object[] { " W ", "RRR", " W ", 'W', ModItems.plate_polymer, 'R', ModItems.wire_red_copper });
addRecipeAuto(new ItemStack(Item.getItemFromBlock(ModBlocks.red_pylon), 4), new Object[] { "CWC", "PWP", " T ", 'C', ModItems.coil_copper_torus, 'W', KEY_PLANKS, 'P', ModItems.plate_polymer, 'T', ModBlocks.red_wire_coated });
addRecipeAuto(new ItemStack(ModBlocks.red_connector, 4), new Object[] { "C", "I", "S", 'C', ModItems.coil_copper, 'I', ModItems.plate_polymer, 'S', STEEL.ingot() });
addRecipeAuto(new ItemStack(ModBlocks.red_pylon, 4), new Object[] { "CWC", "PWP", " T ", 'C', ModItems.coil_copper, 'W', KEY_PLANKS, 'P', ModItems.plate_polymer, 'T', ModBlocks.red_wire_coated });
addRecipeAuto(new ItemStack(Item.getItemFromBlock(ModBlocks.oil_duct_solid), 16), new Object[] { "SPS", "P P", "SPS", 'S', STEEL.ingot(), 'P', IRON.plate() });
addRecipeAuto(new ItemStack(Item.getItemFromBlock(ModBlocks.oil_duct), 16), new Object[] { "SIS", " ", "SIS", 'S', STEEL.plate(), 'I', IRON.plate() });
addRecipeAuto(new ItemStack(Item.getItemFromBlock(ModBlocks.gas_duct_solid), 16), new Object[] { "SPS", "P P", "SPS", 'S', STEEL.ingot(), 'P', CU.plate() });

View File

@ -14,7 +14,20 @@ public class RenderConnector extends RenderPylonBase {
TileEntityConnector con = (TileEntityConnector) te;
GL11.glPushMatrix();
GL11.glTranslated(x + 0.5, y, z + 0.5);
GL11.glTranslated(x + 0.5D, y + 0.5D, z + 0.5D);
switch(te.getBlockMetadata()) {
case 0: GL11.glRotated(180, 1, 0, 0); break;
case 1: break;
case 2: GL11.glRotated(90, 1, 0, 0); GL11.glRotated(180, 0, 0, 1); break;
case 3: GL11.glRotated(90, 1, 0, 0); break;
case 4: GL11.glRotated(90, 1, 0, 0); GL11.glRotated(90, 0, 0, 1); break;
case 5: GL11.glRotated(90, 1, 0, 0); GL11.glRotated(270, 0, 0, 1); break;
}
GL11.glTranslated(0, -0.5F, 0);
double s = 0.5;
GL11.glScaled(s, s, s);
bindTexture(ResourceManager.universal);

View File

@ -69,7 +69,7 @@ public class RenderDemonLamp extends TileEntitySpecialRenderer {
tess.setColorRGBA_F(0F, 0.75F, 1F, 0F);
tess.addVertex(vec.xCoord * far, 0.5D + j * 0.125D + height, vec.zCoord * far);
vec.rotateAroundY((float)Math.PI * 2F / 16F);
vec.rotateAroundY((float)(Math.PI * 2D / 16D));
tess.addVertex(vec.xCoord * far, 0.5D + j * 0.125D + height, vec.zCoord * far);
tess.setColorRGBA_F(0F, 0.75F, 1F, 0.25F);

View File

@ -1,6 +1,9 @@
package com.hbm.tileentity.network;
import api.hbm.energy.IEnergyConductor;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Vec3;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityConnector extends TileEntityPylonBase {
@ -19,4 +22,24 @@ public class TileEntityConnector extends TileEntityPylonBase {
return 10;
}
@Override
protected void connect() {
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata());
TileEntity te = worldObj.getTileEntity(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ);
if(te instanceof IEnergyConductor) {
IEnergyConductor conductor = (IEnergyConductor) te;
if(this.getPowerNet() == null && conductor.getPowerNet() != null) {
conductor.getPowerNet().joinLink(this);
}
if(this.getPowerNet() != null && conductor.getPowerNet() != null && this.getPowerNet() != conductor.getPowerNet()) {
conductor.getPowerNet().joinNetworks(this.getPowerNet());
}
}
}
}