and all that

This commit is contained in:
Bob 2022-04-10 10:39:55 +02:00
parent 5a5078f4e2
commit 8ac0544727
25 changed files with 304 additions and 56 deletions

View File

@ -1,14 +1,9 @@
package com.hbm.blocks;
import java.util.List;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
public class BlockEnumMulti extends BlockMulti {

View File

@ -9,7 +9,7 @@ import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
public abstract class BlockMulti extends BlockBase {
public abstract class BlockMulti extends BlockBase implements IBlockMulti {
public BlockMulti() {
super();
@ -35,6 +35,4 @@ public abstract class BlockMulti extends BlockBase {
list.add(new ItemStack(item, 1, i));
}
}
public abstract int getSubCount();
}

View File

@ -0,0 +1,6 @@
package com.hbm.blocks;
public interface IBlockMulti {
public int getSubCount();
}

View File

@ -448,6 +448,8 @@ public class ModBlocks {
public static Block mush_block;
public static Block mush_block_stem;
public static Block plant_flower;
public static Block waste_earth;
public static Block waste_mycelium;
public static Block waste_trinitite;
@ -742,6 +744,7 @@ public class ModBlocks {
public static Block gas_duct;
public static Block fluid_duct;
public static Block fluid_duct_solid;
public static Block fluid_duct_neo;
public static Block conveyor;
@ -1666,6 +1669,8 @@ public class ModBlocks {
mush_block = new BlockMushHuge(Material.plants).setBlockName("mush_block").setLightLevel(1.0F).setStepSound(Block.soundTypeGrass).setHardness(0.2F).setBlockTextureName(RefStrings.MODID + ":mush_block_skin");
mush_block_stem = new BlockMushHuge(Material.plants).setBlockName("mush_block_stem").setLightLevel(1.0F).setStepSound(Block.soundTypeGrass).setHardness(0.2F).setBlockTextureName(RefStrings.MODID + ":mush_block_stem");
plant_flower = new BlockNTMFlower().setBlockName("plant_flower").setStepSound(Block.soundTypeGrass).setHardness(0.0F);
waste_earth = new WasteEarth(Material.ground, true).setBlockName("waste_earth").setStepSound(Block.soundTypeGrass).setCreativeTab(MainRegistry.blockTab).setHardness(0.6F).setBlockTextureName(RefStrings.MODID + ":waste_earth");
waste_mycelium = new WasteEarth(Material.ground, true).setBlockName("waste_mycelium").setStepSound(Block.soundTypeGrass).setLightLevel(1F).setCreativeTab(MainRegistry.blockTab).setHardness(0.6F).setBlockTextureName(RefStrings.MODID + ":waste_mycelium_side");
waste_trinitite = new BlockOre(Material.sand).noFortune().setBlockName("waste_trinitite").setStepSound(Block.soundTypeSand).setCreativeTab(MainRegistry.blockTab).setHardness(0.5F).setResistance(2.5F).setBlockTextureName(RefStrings.MODID + ":waste_trinitite");
@ -1875,6 +1880,7 @@ public class ModBlocks {
fluid_duct = new BlockFluidDuct(Material.iron).setBlockName("fluid_duct").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":fluid_duct_icon");
fluid_duct_solid = new BlockFluidDuctSolid(Material.iron).setBlockName("fluid_duct_solid").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":fluid_duct_solid");
conveyor = new BlockConveyor(Material.iron).setBlockName("conveyor").setHardness(0.0F).setResistance(2.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":conveyor");
fluid_duct_neo = new FluidDuctStandard(Material.iron).setBlockName("fluid_duct_neo").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":pipe_neo");
chain = new BlockChain(Material.iron).setBlockName("dungeon_chain").setHardness(0.25F).setResistance(2.0F).setCreativeTab(MainRegistry.blockTab).setBlockTextureName(RefStrings.MODID + ":chain");
@ -2688,6 +2694,7 @@ public class ModBlocks {
GameRegistry.registerBlock(deco_pipe_quad_green_rusted, ItemBlockBase.class, deco_pipe_quad_green_rusted.getUnlocalizedName());
GameRegistry.registerBlock(deco_pipe_quad_red, ItemBlockBase.class, deco_pipe_quad_red.getUnlocalizedName());
GameRegistry.registerBlock(deco_pipe_quad_marked, ItemBlockBase.class, deco_pipe_quad_marked.getUnlocalizedName());
GameRegistry.registerBlock(plant_flower, ItemBlockBase.class, plant_flower.getUnlocalizedName());
GameRegistry.registerBlock(mush, mush.getUnlocalizedName());
GameRegistry.registerBlock(mush_block, mush_block.getUnlocalizedName());
GameRegistry.registerBlock(mush_block_stem, mush_block_stem.getUnlocalizedName());
@ -2996,6 +3003,7 @@ public class ModBlocks {
GameRegistry.registerBlock(gas_duct, gas_duct.getUnlocalizedName());
GameRegistry.registerBlock(gas_duct_solid, gas_duct_solid.getUnlocalizedName());
GameRegistry.registerBlock(fluid_duct, fluid_duct.getUnlocalizedName());
GameRegistry.registerBlock(fluid_duct_neo, ItemBlockBase.class, fluid_duct_neo.getUnlocalizedName());
GameRegistry.registerBlock(fluid_duct_solid, fluid_duct_solid.getUnlocalizedName());
GameRegistry.registerBlock(conveyor, conveyor.getUnlocalizedName());
GameRegistry.registerBlock(chain, chain.getUnlocalizedName());

View File

@ -0,0 +1,93 @@
package com.hbm.blocks.generic;
import com.hbm.blocks.BlockEnumMulti;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.init.Blocks;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.EnumPlantType;
import net.minecraftforge.common.IPlantable;
import net.minecraftforge.common.util.ForgeDirection;
public class BlockNTMFlower extends BlockEnumMulti implements IPlantable {
public BlockNTMFlower() {
super(Material.plants, EnumFlowerType.class, true, true);
}
public static enum EnumFlowerType {
FOXGLOVE,
TOBACCO,
NIGHTSHADE
}
@Override
public EnumPlantType getPlantType(IBlockAccess world, int x, int y, int z) {
return EnumPlantType.Plains;
}
@Override
public Block getPlant(IBlockAccess world, int x, int y, int z) {
return this;
}
@Override
public int getPlantMetadata(IBlockAccess world, int x, int y, int z) {
return world.getBlockMetadata(x, y, z);
}
@Override
public boolean canPlaceBlockAt(World world, int x, int y, int z) {
return super.canPlaceBlockAt(world, x, y, z) && this.canBlockStay(world, x, y, z);
}
protected boolean canPlaceBlockOn(Block block) {
return block == Blocks.grass || block == Blocks.dirt || block == Blocks.farmland;
}
@Override
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
super.onNeighborBlockChange(world, x, y, z, block);
this.checkAndDropBlock(world, x, y, z);
}
protected void checkAndDropBlock(World world, int x, int y, int z) {
if(!this.canBlockStay(world, x, y, z)) {
this.dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
world.setBlock(x, y, z, getBlockById(0), 0, 2);
}
}
@Override
public boolean canBlockStay(World world, int x, int y, int z) {
return world.getBlock(x, y - 1, z).canSustainPlant(world, x, y - 1, z, ForgeDirection.UP, this);
}
@Override
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
return null;
}
@Override
public boolean isOpaqueCube() {
return false;
}
@Override
public boolean renderAsNormalBlock() {
return false;
}
@Override
public int getRenderType() {
return 1;
}
@Override
public int damageDropped(int meta) {
return meta;
}
}

View File

@ -1,21 +1,28 @@
package com.hbm.blocks.network;
import java.util.List;
import com.hbm.blocks.IBlockMulti;
import com.hbm.blocks.test.TestPipe;
import com.hbm.lib.RefStrings;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
public class FluidDuctStandard extends FluidDuctBase {
public class FluidDuctStandard extends FluidDuctBase implements IBlockMulti {
@SideOnly(Side.CLIENT)
protected IIcon[] icon;
@SideOnly(Side.CLIENT)
protected IIcon[] overlay;
protected FluidDuctStandard(Material mat) {
public FluidDuctStandard(Material mat) {
super(mat);
}
@ -40,6 +47,13 @@ public class FluidDuctStandard extends FluidDuctBase {
return side == 0 ? this.icon[rectify(metadata)] : this.overlay[rectify(metadata)];
}
@SideOnly(Side.CLIENT)
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
for(int i = 0; i < 3; ++i) {
list.add(new ItemStack(item, 1, i));
}
}
public int damageDropped(int meta) {
return rectify(meta);
}
@ -47,4 +61,24 @@ public class FluidDuctStandard extends FluidDuctBase {
private int rectify(int meta) {
return Math.abs(meta % 3);
}
@Override
public int getRenderType() {
return TestPipe.renderID;
}
@Override
public boolean isOpaqueCube() {
return false;
}
@Override
public boolean renderAsNormalBlock() {
return false;
}
@Override
public int getSubCount() {
return 3;
}
}

View File

@ -206,6 +206,7 @@ public abstract class ToolAbility {
EnchantmentUtil.removeEnchantment(stack, Enchantment.silkTouch);
world.setBlockToAir(x, y, z);
player.getHeldItem().damageItem(1, player);
}
@Override
@ -252,6 +253,7 @@ public abstract class ToolAbility {
EnchantmentUtil.removeEnchantment(stack, Enchantment.fortune);
world.setBlockToAir(x, y, z);
player.getHeldItem().damageItem(1, player);
}
@Override
@ -294,6 +296,7 @@ public abstract class ToolAbility {
}
world.setBlockToAir(x, y, z);
player.getHeldItem().damageItem(1, player);
for(ItemStack stack : drops)
world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, stack.copy()));
@ -335,6 +338,7 @@ public abstract class ToolAbility {
if(result != null && result.getItem() != ModItems.scrap) {
world.setBlockToAir(x, y, z);
world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, result.copy()));
player.getHeldItem().damageItem(1, player);
}
}
@ -373,6 +377,7 @@ public abstract class ToolAbility {
if(result != null) {
world.setBlockToAir(x, y, z);
player.getHeldItem().damageItem(1, player);
for(ItemStack st : result) {
if(st != null)
@ -417,6 +422,7 @@ public abstract class ToolAbility {
if(result != null) {
world.setBlockToAir(x, y, z);
world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, result.copy()));
player.getHeldItem().damageItem(1, player);
}
}
@ -460,6 +466,7 @@ public abstract class ToolAbility {
if(mercury > 0) {
world.setBlockToAir(x, y, z);
world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, new ItemStack(ModItems.ingot_mercury, mercury)));
player.getHeldItem().damageItem(1, player);
}
}

View File

@ -146,7 +146,7 @@ public class SILEXRecipeHandler extends TemplateRecipeHandler {
if(recipe.getKey() instanceof ItemStack) {
if (NEIServerUtils.areStacksSameType(ingredient, (ItemStack)recipe.getKey()))
if (NEIServerUtils.areStacksSameTypeCrafting(ingredient, (ItemStack)recipe.getKey()))
this.arecipes.add(new RecipeSet(recipe.getKey(), recipe.getValue()));
} else if (recipe.getKey() instanceof ArrayList) {
@ -154,7 +154,7 @@ public class SILEXRecipeHandler extends TemplateRecipeHandler {
for(Object o : (ArrayList)recipe.getKey()) {
ItemStack stack = (ItemStack)o;
if (NEIServerUtils.areStacksSameType(ingredient, stack))
if (NEIServerUtils.areStacksSameTypeCrafting(ingredient, stack))
this.arecipes.add(new RecipeSet(stack, recipe.getValue()));
}
}

View File

@ -22,7 +22,7 @@ public class HazardTransformerRadiationME extends HazardTransformerBase {
float radiation = 0;
for(ItemStack held : stacks) {
radiation += HazardSystem.getHazardLevelFromStack(held, HazardRegistry.RADIATION);
radiation += HazardSystem.getHazardLevelFromStack(held, HazardRegistry.RADIATION) * held.stackSize;
}
if(radiation > 0) {

View File

@ -61,16 +61,7 @@ public class ItemModGasmask extends ItemArmorMod implements IGasMask {
@Override
public void addDesc(List list, ItemStack stack, ItemStack armor) {
int i = 0;
ItemStack filter = ArmorUtil.getGasMaskFilter(stack);
if(filter != null) {
i = filter.getItemDamage() / filter.getMaxDamage();
}
list.add(EnumChatFormatting.GREEN + " " + stack.getDisplayName() + " (gas protection)");
ArmorUtil.addGasMaskTooltip(stack, MainRegistry.proxy.me(), list, false);
}
@ -87,6 +78,7 @@ public class ItemModGasmask extends ItemArmorMod implements IGasMask {
EntityPlayer player = event.entityPlayer;
modelM65.isSneak = model.isSneak;
modelM65.isChild = renderer.modelBipedMain.isChild;
float interp = event.partialRenderTick;
float yawHead = player.prevRotationYawHead + (player.rotationYawHead - player.prevRotationYawHead) * interp;

View File

@ -3,22 +3,25 @@ package com.hbm.items.block;
import java.util.List;
import com.hbm.blocks.BlockEnumMulti;
import com.hbm.blocks.BlockMulti;
import com.hbm.blocks.IBlockMulti;
import com.hbm.blocks.ITooltipProvider;
import com.hbm.util.EnumUtil;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
public class ItemBlockBase extends ItemBlock {
public ItemBlockBase(Block block) {
super(block);
if(block instanceof BlockMulti) {
if(block instanceof IBlockMulti) {
this.setMaxDamage(0);
this.setHasSubtypes(true);
}
@ -26,7 +29,7 @@ public class ItemBlockBase extends ItemBlock {
@Override
public int getMetadata(int meta) {
if(field_150939_a instanceof BlockMulti)
if(field_150939_a instanceof IBlockMulti)
return meta;
else
return super.getMetadata(meta);
@ -52,6 +55,11 @@ public class ItemBlockBase extends ItemBlock {
}
}
@SideOnly(Side.CLIENT)
public IIcon getIconFromDamage(int meta) {
return this.field_150939_a.getIcon(1, meta); //fuck you mojang
}
@Override
public EnumRarity getRarity(ItemStack stack) {

View File

@ -102,7 +102,7 @@ public class ItemFluidIdentifier extends Item implements IItemFluidIdentifier {
}
}
//world.markBlockForUpdate(x, y, z);
world.markBlockForUpdate(x, y, z);
player.swingItem();
}

View File

@ -213,6 +213,8 @@ public class ItemToolAbility extends ItemTool implements IItemAbility, IDepthRoc
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
System.out.println("PRE " + world.isRemote + " " + stack.getItemDamage());
if(world.isRemote || this.breakAbility.size() < 2 || !canOperate(stack))
return super.onItemRightClick(stack, world, player);
@ -242,6 +244,8 @@ public class ItemToolAbility extends ItemTool implements IItemAbility, IDepthRoc
world.playSoundAtEntity(player, "random.orb", 0.25F, getCurrentAbility(stack) == null ? 0.75F : 1.25F);
System.out.println("POST " + world.isRemote + " " + stack.getItemDamage());
return stack;
}

View File

@ -4,6 +4,7 @@ import java.util.Random;
import com.hbm.blocks.ModBlocks;
import com.hbm.blocks.generic.BlockMotherOfAllOres;
import com.hbm.blocks.generic.BlockNTMFlower.EnumFlowerType;
import com.hbm.config.GeneralConfig;
import com.hbm.config.WorldConfig;
import com.hbm.items.ModItems;
@ -44,7 +45,10 @@ import net.minecraft.tileentity.TileEntitySkull;
import net.minecraft.util.WeightedRandomChestContent;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.biome.BiomeGenForest;
import net.minecraft.world.biome.BiomeGenJungle;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.feature.WorldGenFlowers;
import net.minecraft.world.gen.feature.WorldGenMinable;
import cpw.mods.fml.common.IWorldGenerator;
@ -67,6 +71,18 @@ public class HbmWorldGen implements IWorldGenerator {
private void generateSurface(World world, Random rand, int i, int j) {
BiomeGenBase biome = world.getWorldChunkManager().getBiomeGenAt(i, j);
if(biome instanceof BiomeGenForest && rand.nextInt(16) == 0) {
DungeonToolbox.generateFlowers(world, rand, i, j, ModBlocks.plant_flower, EnumFlowerType.FOXGLOVE.ordinal());
}
if(biome == BiomeGenBase.roofedForest && rand.nextInt(8) == 0) {
DungeonToolbox.generateFlowers(world, rand, i, j, ModBlocks.plant_flower, EnumFlowerType.NIGHTSHADE.ordinal());
}
if(biome instanceof BiomeGenJungle && rand.nextInt(8) == 0) {
DungeonToolbox.generateFlowers(world, rand, i, j, ModBlocks.plant_flower, EnumFlowerType.TOBACCO.ordinal());
}
if(WorldConfig.oilcoalSpawn > 0 && rand.nextInt(WorldConfig.oilcoalSpawn) == 0)
DungeonToolbox.generateOre(world, rand, i, j, 1, 64, 32, 32, ModBlocks.ore_coal_oil);
@ -176,8 +192,6 @@ public class HbmWorldGen implements IWorldGenerator {
if (GeneralConfig.enableDungeons && world.provider.isSurfaceWorld()) {
BiomeGenBase biome = world.getWorldChunkManager().getBiomeGenAt(i, j);
if (biome == BiomeGenBase.plains || biome == BiomeGenBase.desert) {
if (WorldConfig.radioStructure > 0 && rand.nextInt(WorldConfig.radioStructure) == 0) {
for (int a = 0; a < 1; a++) {

View File

@ -28,6 +28,8 @@ import com.hbm.tileentity.machine.TileEntityDummy;
import api.hbm.energy.IBatteryItem;
import api.hbm.energy.IEnergyConnector;
import api.hbm.energy.IEnergyConnectorBlock;
import api.hbm.fluid.IFluidConnector;
import api.hbm.fluid.IFluidConnectorBlock;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
@ -129,6 +131,31 @@ public class Library {
return false;
}
public static boolean canConnectFluid(IBlockAccess world, int x, int y, int z, ForgeDirection dir, FluidType type) {
if(y > 255 || y < 0)
return false;
Block b = world.getBlock(x, y, z);
TileEntity te = world.getTileEntity(x, y, z);
if(b instanceof IFluidConnectorBlock) {
IFluidConnectorBlock con = (IFluidConnectorBlock) b;
if(con.canConnect(type, world, x, y, z, dir))
return true;
}
if(te instanceof IFluidConnector) {
IFluidConnector con = (IFluidConnector) te;
if(con.canConnect(type, dir))
return true;
}
return false;
}
public static boolean checkFluidConnectables(World world, int x, int y, int z, FluidType type)
{
TileEntity tileentity = world.getTileEntity(x, y, z);

View File

@ -14,6 +14,7 @@ import net.minecraft.stats.Achievement;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.WeightedRandomChestContent;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.common.AchievementPage;
import net.minecraftforge.common.ChestGenHooks;
import net.minecraftforge.common.ForgeChunkManager;
@ -39,6 +40,7 @@ import org.apache.logging.log4j.Logger;
import com.google.common.collect.ImmutableList;
import com.hbm.blocks.ModBlocks;
import com.hbm.blocks.generic.BlockMotherOfAllOres;
import com.hbm.blocks.generic.BlockNTMFlower.EnumFlowerType;
import com.hbm.config.*;
import com.hbm.creativetabs.*;
import com.hbm.entity.effect.*;
@ -981,6 +983,12 @@ public class MainRegistry {
new OreCave(ModBlocks.stone_resource, 0).setThreshold(1.5D).setRangeMult(20).setYLevel(30).setMaxRange(20).withFluid(ModBlocks.sulfuric_acid_block); //sulfur
new OreCave(ModBlocks.stone_resource, 1).setThreshold(1.75D).setRangeMult(20).setYLevel(25).setMaxRange(20); //asbestos
//new OreLayer(Blocks.coal_ore, 0.2F).setThreshold(4).setRangeMult(3).setYLevel(70);
//imagine adding flower entries but they don't actually do shit with the world generator
//"well but at least they work with bone meal, as advertised" except they fucking don't
/*BiomeGenBase.plains.addFlower(ModBlocks.plant_flower, EnumFlowerType.FOXGLOVE.ordinal(), 10);
BiomeGenBase.roofedForest.addFlower(ModBlocks.plant_flower, EnumFlowerType.NIGHTSHADE.ordinal(), 10);
BiomeGenBase.jungle.addFlower(ModBlocks.plant_flower, EnumFlowerType.TOBACCO.ordinal(), 10);*/
}
@EventHandler

View File

@ -3,6 +3,9 @@ package com.hbm.render.block;
import org.lwjgl.opengl.GL11;
import com.hbm.blocks.test.TestPipe;
import com.hbm.inventory.fluid.FluidType;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.lib.Library;
import com.hbm.main.ResourceManager;
import com.hbm.render.util.ObjUtil;
import com.hbm.tileentity.network.TileEntityPipeBaseNT;
@ -24,7 +27,8 @@ public class RenderTestPipe implements ISimpleBlockRenderingHandler {
GL11.glPushMatrix();
Tessellator tessellator = Tessellator.instance;
IIcon iicon = block.getIcon(0, 0);
IIcon iicon = block.getIcon(0, metadata);
IIcon overlay = block.getIcon(1, metadata);
tessellator.setColorOpaque_F(1, 1, 1);
if(renderer.hasOverrideBlockTexture()) {
@ -39,6 +43,14 @@ public class RenderTestPipe implements ISimpleBlockRenderingHandler {
ObjUtil.renderPartWithIcon((WavefrontObject) ResourceManager.pipe_neo, "pZ", iicon, tessellator, 0, false);
ObjUtil.renderPartWithIcon((WavefrontObject) ResourceManager.pipe_neo, "nZ", iicon, tessellator, 0, false);
tessellator.draw();
tessellator.startDrawingQuads();
ObjUtil.setColor(Fluids.NONE.getColor());
ObjUtil.renderPartWithIcon((WavefrontObject) ResourceManager.pipe_neo, "pX", overlay, tessellator, 0, false);
ObjUtil.renderPartWithIcon((WavefrontObject) ResourceManager.pipe_neo, "nX", overlay, tessellator, 0, false);
ObjUtil.renderPartWithIcon((WavefrontObject) ResourceManager.pipe_neo, "pZ", overlay, tessellator, 0, false);
ObjUtil.renderPartWithIcon((WavefrontObject) ResourceManager.pipe_neo, "nZ", overlay, tessellator, 0, false);
ObjUtil.clearColor();
tessellator.draw();
GL11.glPopMatrix();
}
@ -47,36 +59,40 @@ public class RenderTestPipe implements ISimpleBlockRenderingHandler {
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
Tessellator tessellator = Tessellator.instance;
IIcon iicon = block.getIcon(0, 0);
IIcon overlay = block.getIcon(1, 0);
int meta = world.getBlockMetadata(x, y, z);
IIcon iicon = block.getIcon(0, meta);
IIcon overlay = block.getIcon(1, meta);
tessellator.setColorOpaque_F(1, 1, 1);
if(renderer.hasOverrideBlockTexture()) {
iicon = renderer.overrideBlockTexture;
}
TileEntity te = world.getTileEntity(x, y, z);
int color = 0xff00ff;
FluidType type = Fluids.NONE;
if(te instanceof TileEntityPipeBaseNT) {
TileEntityPipeBaseNT pipe = (TileEntityPipeBaseNT) te;
color = pipe.getType().getColor();
type = pipe.getType();
}
tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z));
tessellator.setColorOpaque_F(1, 1, 1);
boolean pX = world.getTileEntity(x + 1, y, z) instanceof IFluidConnector;
boolean nX = world.getTileEntity(x - 1, y, z) instanceof IFluidConnector;
boolean pY = world.getTileEntity(x, y + 1, z) instanceof IFluidConnector;
boolean nY = world.getTileEntity(x, y - 1, z) instanceof IFluidConnector;
boolean pZ = world.getTileEntity(x, y, z + 1) instanceof IFluidConnector;
boolean nZ = world.getTileEntity(x, y, z - 1) instanceof IFluidConnector;
boolean pX = Library.canConnectFluid(world, x + 1, y, z, Library.NEG_X, type);
boolean nX = Library.canConnectFluid(world, x - 1, y, z, Library.POS_X, type);
boolean pY = Library.canConnectFluid(world, x, y + 1, z, Library.NEG_Y, type);
boolean nY = Library.canConnectFluid(world, x, y - 1, z, Library.POS_Y, type);
boolean pZ = Library.canConnectFluid(world, x, y, z + 1, Library.NEG_Z, type);
boolean nZ = Library.canConnectFluid(world, x, y, z - 1, Library.POS_Z, type);
int mask = 0 + (pX ? 32 : 0) + (nX ? 16 : 0) + (pY ? 8 : 0) + (nY ? 4 : 0) + (pZ ? 2 : 0) + (nZ ? 1 : 0);
tessellator.addTranslation(x + 0.5F, y + 0.5F, z + 0.5F);
TileEntity te = world.getTileEntity(x, y, z);
int color = 0xff00ff;
if(te instanceof TileEntityPipeBaseNT) {
color = ((TileEntityPipeBaseNT) te).getType().getColor();
}
if(mask == 0) {
renderDuct(iicon, overlay, color, tessellator, "pX");
renderDuct(iicon, overlay, color, tessellator, "nX");

View File

@ -85,11 +85,16 @@ public class ObjUtil {
normal.rotateAroundY(rot);
tes.setNormal((float)normal.xCoord, (float)normal.yCoord, (float)normal.zCoord);
if(shadow || hasColor) {
float brightness = 1.0F;
if(shadow) {
float brightness = ((float)normal.yCoord + 0.7F) * 0.9F - (float)Math.abs(normal.xCoord) * 0.1F + (float)Math.abs(normal.zCoord) * 0.1F;
brightness = ((float)normal.yCoord + 0.7F) * 0.9F - (float)Math.abs(normal.xCoord) * 0.1F + (float)Math.abs(normal.zCoord) * 0.1F;
if(brightness < 0.45F)
brightness = 0.45F;
}
if(hasColor) {
tes.setColorOpaque((int)(red * brightness), (int)(green * brightness), (int)(blue * brightness));

View File

@ -7,18 +7,26 @@ import api.hbm.fluid.IFluidConductor;
import api.hbm.fluid.IPipeNet;
import api.hbm.fluid.PipeNet;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.WorldServer;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityPipeBaseNT extends TileEntity implements IFluidConductor {
private IPipeNet network;
protected FluidType type = Fluids.NONE;
protected FluidType lastType = Fluids.NONE;
@Override
public void updateEntity() {
if(worldObj.isRemote && lastType != type) {
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
lastType = type;
}
if(!worldObj.isRemote && canUpdate()) {
//we got here either because the net doesn't exist or because it's not valid, so that's safe to assume
@ -40,10 +48,13 @@ public class TileEntityPipeBaseNT extends TileEntity implements IFluidConductor
this.type = type;
this.markDirty();
if(worldObj instanceof WorldServer) {
WorldServer world = (WorldServer) worldObj;
world.getPlayerManager().markBlockForUpdate(xCoord, yCoord, zCoord);
if(this.network != null)
this.network.destroy();
}
@Override
public boolean canConnect(FluidType type, ForgeDirection dir) {
return dir != ForgeDirection.UNKNOWN && type == this.type;
}
protected void connect() {
@ -113,6 +124,18 @@ public class TileEntityPipeBaseNT extends TileEntity implements IFluidConductor
this.network = network;
}
@Override
public Packet getDescriptionPacket() {
NBTTagCompound nbt = new NBTTagCompound();
this.writeToNBT(nbt);
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 0, nbt);
}
@Override
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
this.readFromNBT(pkt.func_148857_g());
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);

View File

@ -9,6 +9,7 @@ import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenFlowers;
import net.minecraft.world.gen.feature.WorldGenMinable;
public class DungeonToolbox {
@ -87,4 +88,13 @@ public class DungeonToolbox {
(new WorldGenMinable(ore, meta, amount, target)).generate(world, rand, x, y, z);
}
}
private static WorldGenFlowers genFlowers = new WorldGenFlowers(null);
public static void generateFlowers(World world, Random rand, int chunkX, int chunkZ, Block flower, int meta) {
int x = chunkX + rand.nextInt(16);
int z = chunkZ + rand.nextInt(16);
int y = world.getHeightValue(x, z);
genFlowers.func_150550_a(flower, meta);
genFlowers.generate(world, rand, x, y, z);
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 168 B

After

Width:  |  Height:  |  Size: 128 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 193 B

After

Width:  |  Height:  |  Size: 221 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 575 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 468 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 451 B