Merge remote-tracking branch 'origin/master'

This commit is contained in:
BallOfEnergy 2023-03-30 16:52:57 -05:00
commit a754032841
11 changed files with 444 additions and 1 deletions

View File

@ -778,6 +778,7 @@ public class ModBlocks {
public static Block crane_router;
public static Block crane_boxer;
public static Block crane_unboxer;
public static Block crane_splitter;
public static Block fan;
@ -1902,6 +1903,7 @@ public class ModBlocks {
crane_router = new CraneRouter().setBlockName("crane_router").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
crane_boxer = new CraneBoxer().setBlockName("crane_boxer").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
crane_unboxer = new CraneUnboxer().setBlockName("crane_unboxer").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
crane_splitter = new CraneSplitter().setBlockName("crane_splitter").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
fan = new MachineFan().setBlockName("fan").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
chain = new BlockChain(Material.iron).setBlockName("dungeon_chain").setHardness(0.25F).setResistance(2.0F).setCreativeTab(MainRegistry.blockTab).setBlockTextureName(RefStrings.MODID + ":chain");
@ -3101,6 +3103,7 @@ public class ModBlocks {
GameRegistry.registerBlock(conveyor_triple, conveyor_triple.getUnlocalizedName());
GameRegistry.registerBlock(conveyor_chute, conveyor_chute.getUnlocalizedName());
GameRegistry.registerBlock(conveyor_lift, conveyor_lift.getUnlocalizedName());
GameRegistry.registerBlock(crane_splitter, crane_splitter.getUnlocalizedName());
GameRegistry.registerBlock(fan, fan.getUnlocalizedName());
GameRegistry.registerBlock(chain, chain.getUnlocalizedName());

View File

@ -0,0 +1,143 @@
package com.hbm.blocks.network;
import com.hbm.blocks.BlockDummyable;
import com.hbm.entity.item.EntityMovingItem;
import com.hbm.lib.RefStrings;
import com.hbm.tileentity.network.TileEntityCraneSplitter;
import api.hbm.conveyor.IConveyorBelt;
import api.hbm.conveyor.IConveyorItem;
import api.hbm.conveyor.IConveyorPackage;
import api.hbm.conveyor.IEnterableBlock;
import cpw.mods.fml.client.registry.RenderingRegistry;
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.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class CraneSplitter extends BlockDummyable implements IConveyorBelt, IEnterableBlock {
@SideOnly(Side.CLIENT) public IIcon iconTopLeft;
@SideOnly(Side.CLIENT) public IIcon iconTopRight;
@SideOnly(Side.CLIENT) public IIcon iconFrontLeft;
@SideOnly(Side.CLIENT) public IIcon iconFrontRight;
@SideOnly(Side.CLIENT) public IIcon iconBottom;
@SideOnly(Side.CLIENT) public IIcon iconBelt;
@SideOnly(Side.CLIENT) public IIcon iconInner;
public CraneSplitter() {
super(Material.iron);
}
@Override
public TileEntity createNewTileEntity(World world, int meta) {
return new TileEntityCraneSplitter();
}
@Override
public int[] getDimensions() {
return new int[] {0, 0, 0, 0, 0, 1};
}
@Override
public int getOffset() {
return 0;
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister) {
super.registerBlockIcons(iconRegister);
this.iconBelt = iconRegister.registerIcon(RefStrings.MODID + ":crane_splitter_belt");
}
public static int renderID = RenderingRegistry.getNextAvailableRenderId();
@Override
public int getRenderType() {
return renderID;
}
@Override public boolean canItemEnter(World world, int x, int y, int z, ForgeDirection dir, IConveyorItem entity) { return getTravelDirection(world, x, y, z, null) == dir; }
@Override public boolean canPackageEnter(World world, int x, int y, int z, ForgeDirection dir, IConveyorPackage entity) { return false; }
@Override public void onPackageEnter(World world, int x, int y, int z, ForgeDirection dir, IConveyorPackage entity) { }
@Override
public void onItemEnter(World world, int x, int y, int z, ForgeDirection dir, IConveyorItem entity) {
int[] core = this.findCore(world, x, y, z);
if(core == null) return;
x = core[0];
y = core[1];
z = core[2];
TileEntity tile = world.getTileEntity(x, y, z);
if(!(tile instanceof TileEntityCraneSplitter)) return;
TileEntityCraneSplitter splitter = (TileEntityCraneSplitter) tile;
boolean pos = splitter.getPosition();
ItemStack stack = entity.getItemStack();
ForgeDirection rot = ForgeDirection.getOrientation(splitter.getBlockMetadata() - offset).getRotation(ForgeDirection.DOWN);
if(stack.stackSize % 2 == 0) {
stack.stackSize /= 2;
spawnMovingItem(world, x, y, z, stack.copy());
spawnMovingItem(world, x + rot.offsetX, y, z + rot.offsetZ, stack.copy());
} else {
int baseSize = stack.stackSize /= 2;
stack.stackSize = baseSize + (pos ? 0 : 1);
spawnMovingItem(world, x, y, z, stack.copy());
stack.stackSize = baseSize + (pos ? 1 : 0);
spawnMovingItem(world, x + rot.offsetX, y, z + rot.offsetZ, stack.copy());
splitter.setPosition(!pos);
}
}
private void spawnMovingItem(World world, int x, int y, int z, ItemStack stack) {
if(stack.stackSize <= 0) return;
EntityMovingItem moving = new EntityMovingItem(world);
Vec3 pos = Vec3.createVectorHelper(x + 0.5, y + 0.5, z + 0.5);
Vec3 snap = this.getClosestSnappingPosition(world, x, y, z, pos);
moving.setPosition(snap.xCoord, snap.yCoord, snap.zCoord);
moving.setItemStack(stack);
world.spawnEntityInWorld(moving);
}
@Override
public boolean canItemStay(World world, int x, int y, int z, Vec3 itemPos) {
return true;
}
@Override
public Vec3 getTravelLocation(World world, int x, int y, int z, Vec3 itemPos, double speed) {
ForgeDirection dir = this.getTravelDirection(world, x, y, z, itemPos);
Vec3 snap = this.getClosestSnappingPosition(world, x, y, z, itemPos);
Vec3 dest = Vec3.createVectorHelper(snap.xCoord - dir.offsetX * speed, snap.yCoord - dir.offsetY * speed, snap.zCoord - dir.offsetZ * speed);
Vec3 motion = Vec3.createVectorHelper((dest.xCoord - itemPos.xCoord), (dest.yCoord - itemPos.yCoord), (dest.zCoord - itemPos.zCoord));
double len = motion.lengthVector();
Vec3 ret = Vec3.createVectorHelper(itemPos.xCoord + motion.xCoord / len * speed, itemPos.yCoord + motion.yCoord / len * speed, itemPos.zCoord + motion.zCoord / len * speed);
return ret;
}
@Override
public Vec3 getClosestSnappingPosition(World world, int x, int y, int z, Vec3 itemPos) {
ForgeDirection dir = this.getTravelDirection(world, x, y, z, itemPos);
itemPos.xCoord = MathHelper.clamp_double(itemPos.xCoord, x, x + 1);
itemPos.zCoord = MathHelper.clamp_double(itemPos.zCoord, z, z + 1);
double posX = x + 0.5;
double posZ = z + 0.5;
if(dir.offsetX != 0) posX = itemPos.xCoord;
if(dir.offsetZ != 0) posZ = itemPos.zCoord;
return Vec3.createVectorHelper(posX, y + 0.25, posZ);
}
public ForgeDirection getTravelDirection(World world, int x, int y, int z, Vec3 itemPos) {
int meta = world.getBlockMetadata(x, y, z);
if(meta >= 12) return ForgeDirection.getOrientation(meta - offset);
return ForgeDirection.getOrientation(meta).getRotation(ForgeDirection.UP);
}
}

View File

@ -145,7 +145,8 @@ public class ItemWatzPellet extends ItemEnumMulti {
}
public static double getEnrichment(ItemStack stack) {
return getYield(stack) / ((ItemRBMKRod) stack.getItem()).yield;
EnumWatzType num = EnumUtil.grabEnumSafely(EnumWatzType.class, stack.getItemDamage());
return getYield(stack) / num.yield;
}
public static double getYield(ItemStack stack) {

View File

@ -752,6 +752,7 @@ public class ClientProxy extends ServerProxy {
RenderingRegistry.registerBlockHandler(new RenderReeds());
RenderingRegistry.registerBlockHandler(new RenderRTTY());
RenderingRegistry.registerBlockHandler(new RenderDiFurnaceExtension());
RenderingRegistry.registerBlockHandler(new RenderSplitter());
RenderingRegistry.registerBlockHandler(new RenderFoundryBasin());
RenderingRegistry.registerBlockHandler(new RenderFoundryMold());

View File

@ -1306,6 +1306,7 @@ public class ResourceManager {
public static final IModelCustom cable_neo = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/blocks/cable_neo.obj"));
public static final IModelCustom pipe_neo = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/blocks/pipe_neo.obj"));
public static final IModelCustom difurnace_extension = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/blocks/difurnace_extension.obj"));
public static final IModelCustom splitter = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/blocks/splitter.obj"));
public static final IModelCustom charge_dynamite = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/blocks/charge_dynamite.obj"));
public static final IModelCustom charge_c4 = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/blocks/charge_c4.obj"));

View File

@ -0,0 +1,87 @@
package com.hbm.render.block;
import org.lwjgl.opengl.GL11;
import com.hbm.blocks.ModBlocks;
import com.hbm.blocks.network.CraneSplitter;
import com.hbm.main.ResourceManager;
import com.hbm.render.util.ObjUtil;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.client.model.obj.WavefrontObject;
public class RenderSplitter implements ISimpleBlockRenderingHandler {
@Override
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
GL11.glPushMatrix();
Tessellator tessellator = Tessellator.instance;
tessellator.setColorOpaque_F(1, 1, 1);
GL11.glScaled(0.625, 0.625, 0.625);
GL11.glRotated(-90, 0, 1, 0);
GL11.glTranslatef(0F, -0.5F, 0.5F);
tessellator.startDrawingQuads();
ObjUtil.renderWithIcon((WavefrontObject) ResourceManager.splitter, ModBlocks.block_steel.getIcon(0, 0), tessellator, 0, false);
tessellator.draw();
GL11.glTranslatef(0F, 0F, -1F);
tessellator.startDrawingQuads();
ObjUtil.renderWithIcon((WavefrontObject) ResourceManager.splitter, ModBlocks.block_steel.getIcon(0, 0), tessellator, 0, false);
tessellator.draw();
GL11.glPopMatrix();
}
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
Tessellator tessellator = Tessellator.instance;
tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z));
tessellator.setColorOpaque_F(1, 1, 1);
tessellator.addTranslation(x + 0.5F, y, z + 0.5F);
int meta = world.getBlockMetadata(x, y, z);
float rotation = 0;
if(meta == 12 || meta == 4) rotation = 90F / 180F * (float) Math.PI;
if(meta == 13 || meta == 5) rotation = 270F / 180F * (float) Math.PI;
if(meta == 14 || meta == 3) rotation = 180F / 180F * (float)Math.PI;
boolean isLeft = meta >= 12;
CraneSplitter splitter = (CraneSplitter) block;
IIcon conveyor = splitter.iconBelt;
ObjUtil.renderPartWithIcon((WavefrontObject) ResourceManager.splitter, "Top", ModBlocks.block_steel.getIcon(0, 0), tessellator, rotation, true);
ObjUtil.renderPartWithIcon((WavefrontObject) ResourceManager.splitter, "Bottom", ModBlocks.block_steel.getIcon(0, 0), tessellator, rotation, true);
if(isLeft) ObjUtil.renderPartWithIcon((WavefrontObject) ResourceManager.splitter, "Left", ModBlocks.block_steel.getIcon(0, 0), tessellator, rotation, true);
if(!isLeft) ObjUtil.renderPartWithIcon((WavefrontObject) ResourceManager.splitter, "Right", ModBlocks.block_steel.getIcon(0, 0), tessellator, rotation, true);
ObjUtil.renderPartWithIcon((WavefrontObject) ResourceManager.splitter, "Back", ModBlocks.block_steel.getIcon(0, 0), tessellator, rotation, true);
ObjUtil.renderPartWithIcon((WavefrontObject) ResourceManager.splitter, "Front", ModBlocks.block_steel.getIcon(0, 0), tessellator, rotation, true);
ObjUtil.renderPartWithIcon((WavefrontObject) ResourceManager.splitter, "Inner", ModBlocks.block_steel.getIcon(0, 0), tessellator, rotation, true);
ObjUtil.renderPartWithIcon((WavefrontObject) ResourceManager.splitter, "InnerLeft", ModBlocks.block_steel.getIcon(0, 0), tessellator, rotation, true);
ObjUtil.renderPartWithIcon((WavefrontObject) ResourceManager.splitter, "InnerRight", ModBlocks.block_steel.getIcon(0, 0), tessellator, rotation, true);
ObjUtil.renderPartWithIcon((WavefrontObject) ResourceManager.splitter, "InnerTop", ModBlocks.block_steel.getIcon(0, 0), tessellator, rotation, true);
ObjUtil.renderPartWithIcon((WavefrontObject) ResourceManager.splitter, "InnerBottom", conveyor, tessellator, rotation, true);
tessellator.addTranslation(-x - 0.5F, -y, -z - 0.5F);
return true;
}
@Override
public boolean shouldRender3DInInventory(int modelId) {
return true;
}
@Override
public int getRenderId() {
return CraneSplitter.renderID;
}
}

View File

@ -350,6 +350,7 @@ public class TileMappings {
put(TileEntityCraneBoxer.class, "tileentity_boxer");
put(TileEntityCraneUnboxer.class, "tileentity_unboxer");
put(TileEntityCraneRouter.class, "tileentity_router");
put(TileEntityCraneSplitter.class, "tileentity_splitter");
put(TileEntityFan.class, "tileentity_fan");
put(TileEntityRadioTorchSender.class, "tileentity_rtty_sender");

View File

@ -0,0 +1,31 @@
package com.hbm.tileentity.network;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
public class TileEntityCraneSplitter extends TileEntity {
/* false: left belt is preferred, true: right belt is preferred */
private boolean position;
public void setPosition(boolean pos) {
this.position = pos;
this.worldObj.markTileEntityChunkModified(this.xCoord, this.yCoord, this.zCoord, this);
}
public boolean getPosition() {
return this.position;
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
this.position = nbt.getBoolean("pos");
}
@Override
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
nbt.setBoolean("pos", this.position);
}
}

View File

@ -0,0 +1,172 @@
# Blender v2.79 (sub 0) OBJ File: 'splitter.blend'
# www.blender.org
o Inner
v 0.000000 0.250000 -0.375000
v 0.000000 0.250000 0.375000
v 0.000000 0.875000 -0.375000
v 0.000000 0.875000 0.375000
vt 0.875000 0.875000
vt 0.125000 0.250000
vt 0.875000 0.250000
vt 0.125000 0.875000
vn -1.0000 0.0000 0.0000
s off
f 4/1/1 1/2/1 2/3/1
f 4/1/1 3/4/1 1/2/1
o InnerBottom
v -0.500000 0.250000 0.375000
v -0.500000 0.250000 -0.375000
v 0.000000 0.250000 -0.375000
v 0.000000 0.250000 0.375000
vt 0.875000 0.000000
vt 0.125000 0.500000
vt 0.125000 0.000000
vt 0.875000 0.500000
vn 0.0000 1.0000 0.0000
s off
f 5/5/2 7/6/2 6/7/2
f 5/5/2 8/8/2 7/6/2
o InnerLeft
v -0.500000 0.250000 0.375000
v -0.500000 0.875000 0.375000
v 0.000000 0.250000 0.375000
v 0.000000 0.875000 0.375000
vt 1.000000 0.875000
vt 0.500000 0.250000
vt 1.000000 0.250000
vt 0.500000 0.875000
vn 0.0000 0.0000 -1.0000
s off
f 10/9/3 11/10/3 9/11/3
f 10/9/3 12/12/3 11/10/3
o InnerTop
v -0.500000 0.875000 0.375000
v -0.500000 0.875000 -0.375000
v 0.000000 0.875000 -0.375000
v 0.000000 0.875000 0.375000
vt 0.125000 1.000000
vt 0.875000 0.500000
vt 0.875000 1.000000
vt 0.125000 0.500000
vn 0.0000 -1.0000 0.0000
s off
f 14/13/4 16/14/4 13/15/4
f 14/13/4 15/16/4 16/14/4
o InnerRight
v -0.500000 0.250000 -0.375000
v -0.500000 0.875000 -0.375000
v 0.000000 0.250000 -0.375000
v 0.000000 0.875000 -0.375000
vt 0.000000 0.250000
vt 0.500000 0.875000
vt 0.000000 0.875000
vt 0.500000 0.250000
vn 0.0000 0.0000 1.0000
s off
f 17/17/5 20/18/5 18/19/5
f 17/17/5 19/20/5 20/18/5
o Top
v -0.500000 1.000000 -0.500000
v -0.500000 1.000000 0.500000
v 0.500000 0.875000 0.500000
v 0.500000 0.875000 -0.500000
v 0.000000 1.000000 0.500000
v 0.000000 1.000000 -0.500000
vt 0.000000 0.000000
vt 1.000000 0.500000
vt 0.000000 0.500000
vt 1.000000 1.000000
vt 0.000000 1.000000
vt 1.000000 0.000000
vn 0.2425 0.9701 0.0000
vn 0.0000 1.0000 0.0000
s off
f 23/21/6 26/22/6 25/23/6
f 25/23/7 21/24/7 22/25/7
f 23/21/6 24/26/6 26/22/6
f 25/23/7 26/22/7 21/24/7
o Right
v -0.500000 0.000000 -0.500000
v 0.500000 0.000000 -0.500000
v -0.500000 1.000000 -0.500000
v 0.500000 0.875000 -0.500000
v 0.000000 1.000000 -0.500000
vt 1.000000 0.000000
vt 1.000000 1.000000
vt 0.500000 1.000000
vt 0.000000 0.875000
vt 0.000000 0.000000
vn 0.0000 0.0000 -1.0000
s off
f 27/27/8 29/28/8 31/29/8
f 30/30/8 28/31/8 31/29/8
f 28/31/8 27/27/8 31/29/8
o Left
v -0.500000 0.000000 0.500000
v 0.500000 0.000000 0.500000
v -0.500000 1.000000 0.500000
v 0.500000 0.875000 0.500000
v 0.000000 1.000000 0.500000
vt 1.000000 0.000000
vt 1.000000 0.875000
vt 0.500000 1.000000
vt 0.000000 1.000000
vt 0.000000 0.000000
vn 0.0000 0.0000 1.0000
s off
f 33/32/9 35/33/9 36/34/9
f 34/35/9 32/36/9 36/34/9
f 32/36/9 33/32/9 36/34/9
o Back
v 0.500000 0.000000 0.500000
v 0.500000 0.000000 -0.500000
v 0.500000 0.875000 0.500000
v 0.500000 0.875000 -0.500000
vt 1.000000 0.000000
vt 0.000000 0.875000
vt 0.000000 0.000000
vt 1.000000 0.875000
vn 1.0000 0.0000 0.0000
s off
f 38/37/10 39/38/10 37/39/10
f 38/37/10 40/40/10 39/38/10
o Bottom
v -0.500000 0.000000 0.500000
v 0.500000 0.000000 0.500000
v -0.500000 0.000000 -0.500000
v 0.500000 0.000000 -0.500000
vt 1.000000 0.000000
vt 0.000000 1.000000
vt 0.000000 0.000000
vt 1.000000 1.000000
vn 0.0000 -1.0000 0.0000
s off
f 43/41/11 42/42/11 41/43/11
f 43/41/11 44/44/11 42/42/11
o Front
v -0.500000 0.000000 0.500000
v -0.500000 0.000000 -0.500000
v -0.500000 1.000000 -0.500000
v -0.500000 1.000000 0.500000
v -0.500000 0.250000 0.375000
v -0.500000 0.250000 -0.375000
v -0.500000 0.875000 0.375000
v -0.500000 0.875000 -0.375000
vt 0.000000 1.000000
vt 0.125000 0.250000
vt 0.125000 0.875000
vt 0.875000 0.250000
vt 0.000000 0.000000
vt 1.000000 0.000000
vt 1.000000 1.000000
vt 0.875000 0.875000
vn -1.0000 0.0000 0.0000
s off
f 47/45/12 50/46/12 52/47/12
f 49/48/12 46/49/12 45/50/12
f 48/51/12 49/48/12 45/50/12
f 47/45/12 51/52/12 48/51/12
f 47/45/12 46/49/12 50/46/12
f 49/48/12 50/46/12 46/49/12
f 48/51/12 51/52/12 49/48/12
f 47/45/12 52/47/12 51/52/12

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

@ -0,0 +1,3 @@
{
"animation": { }
}