Merge pull request #1698 from MellowArpeggiation/push-ups

Upstream Space Shit
This commit is contained in:
HbmMods 2024-09-26 08:28:50 +02:00 committed by GitHub
commit 333c707a5a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
23 changed files with 3677 additions and 3527 deletions

View File

@ -32,6 +32,7 @@ if(!mod_build_number.isEmpty()) {
group = "com.hbm" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "HBM-NTM"
compileJava.options.encoding = 'UTF-8'
compileJava.options.compilerArgs += '-proc:none'
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8'
@ -75,6 +76,14 @@ repositories {
name = "gt"
url = "https://gregtech.mechaenetia.com/"
}
maven {
name = 'FalsePattern'
url = "https://mvn.falsepattern.com/releases/"
}
maven {
name = "GitHub"
url = "https://jitpack.io"
}
//maven {
// name = "CurseForge"
// url = "https://minecraft.curseforge.com/api/maven/"
@ -94,6 +103,8 @@ dependencies {
compileOnly "inventorytweaks:InventoryTweaks:1.59-dev:deobf"
implementation "li.cil.oc:OpenComputers:MC1.7.10-1.5.+:api"
compileOnly 'com.falsepattern:endlessids-mc1.7.10:1.5.4:dev'
}
processResources {

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,6 @@
package com.hbm.blocks.generic;
import java.util.ArrayList;
import java.util.Locale;
import java.util.Random;
@ -7,15 +8,22 @@ import com.hbm.blocks.BlockEnumMulti;
import com.hbm.blocks.ModBlocks;
import com.hbm.items.ModItems;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class BlockOreBasalt extends BlockEnumMulti {
protected IIcon[] topIcons;
public BlockOreBasalt() {
super(Material.rock, EnumBasaltOreType.class, true, true);
@ -47,11 +55,6 @@ public class BlockOreBasalt extends BlockEnumMulti {
return super.getItemDropped(meta, rand, fortune);
}
@Override
public int damageDropped(int meta) {
return 0;
}
@Override
public void onEntityWalking(World world, int x, int y, int z, Entity entity) {
int meta = world.getBlockMetadata(x, y, z);
@ -76,4 +79,31 @@ public class BlockOreBasalt extends BlockEnumMulti {
if(meta == EnumBasaltOreType.ASBESTOS.ordinal()) world.setBlock(x, y, z, ModBlocks.gas_asbestos);
super.dropBlockAsItemWithChance(world, x, y, z, meta, chance, fortune);
}
@Override
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
return ModBlocks.getDropsWithoutDamage(world, this, metadata, fortune);
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister reg) {
super.registerBlockIcons(reg);
Enum[] enums = theEnum.getEnumConstants();
this.topIcons = new IIcon[enums.length];
for(int i = 0; i < topIcons.length; i++) {
Enum num = enums[i];
this.topIcons[i] = reg.registerIcon(this.getTextureMultiName(num) + "_top");
}
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int meta) {
if(side <= 1) return this.topIcons[meta % this.topIcons.length];
return super.getIcon(side, meta);
}
}

View File

@ -16,6 +16,7 @@ import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class BlockScaffold extends BlockMulti {
@ -59,22 +60,34 @@ public class BlockScaffold extends BlockMulti {
public IIcon getIcon(int side, int meta) {
return this.icons[this.damageDropped(meta)];
}
@Override
public int onBlockPlaced(World world, int x, int y, int z, int side, float fx, float fy, float fz, int meta) {
return side;
}
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack) {
int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
ForgeDirection placed = ForgeDirection.getOrientation(world.getBlockMetadata(x, y, z));
int meta = stack.getItemDamage();
if(i % 2 == 0) {
world.setBlockMetadataWithNotify(x, y, z, meta, 2);
if(placed == ForgeDirection.UP || placed == ForgeDirection.DOWN) {
int rot = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
if(rot % 2 == 0) {
world.setBlockMetadataWithNotify(x, y, z, meta, 2);
} else {
world.setBlockMetadataWithNotify(x, y, z, meta + 8, 2);
}
} else if(placed == ForgeDirection.NORTH || placed == ForgeDirection.SOUTH) {
world.setBlockMetadataWithNotify(x, y, z, meta + 4, 2);
} else {
world.setBlockMetadataWithNotify(x, y, z, meta + 8, 2);
world.setBlockMetadataWithNotify(x, y, z, meta + 12, 2);
}
}
@Override
public int damageDropped(int meta) {
return rectify(meta) & 7;
return rectify(meta);
}
@Override
@ -83,27 +96,24 @@ public class BlockScaffold extends BlockMulti {
}
@Override
public void setBlockBoundsBasedOnState(IBlockAccess p_149719_1_, int p_149719_2_, int p_149719_3_, int p_149719_4_) {
int te = p_149719_1_.getBlockMetadata(p_149719_2_, p_149719_3_, p_149719_4_);
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
int meta = world.getBlockMetadata(x, y, z);
float f = 0.0625F;
if((te & 8) != 0)
if(meta >= 12) {
this.setBlockBounds(0.0F, 2 * f, 0.0F, 1.0F, 14 * f, 1.0F);
} else if(meta >= 8) {
this.setBlockBounds(2 * f, 0.0F, 0.0F, 14 * f, 1.0F, 1.0F);
else
} else if(meta >= 4) {
this.setBlockBounds(0.0F, 2 * f, 0.0F, 1.0F, 14 * f, 1.0F);
} else {
this.setBlockBounds(0.0F, 0.0F, 2 * f, 1.0F, 1.0F, 14 * f);
}
}
@Override
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
int te = world.getBlockMetadata(x, y, z);
float f = 0.0625F;
if((te & 8) != 0)
this.setBlockBounds(2 * f, 0.0F, 0.0F, 14 * f, 1.0F, 1.0F);
else
this.setBlockBounds(0.0F, 0.0F, 2 * f, 1.0F, 1.0F, 14 * f);
setBlockBoundsBasedOnState(world, x, y, z);
return AxisAlignedBB.getBoundingBox(x + this.minX, y + this.minY, z + this.minZ, x + this.maxX, y + this.maxY, z + this.maxZ);
}
}

View File

@ -1,5 +1,6 @@
package com.hbm.blocks.generic;
import java.util.ArrayList;
import java.util.Random;
import com.hbm.blocks.BlockEnumMulti;
@ -10,6 +11,7 @@ import com.hbm.items.ModItems;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
@ -45,11 +47,6 @@ public class BlockStalagmite extends BlockEnumMulti {
return null;
}
@Override
public int damageDropped(int meta) {
return 0;
}
public static int getMetaFromResource(int meta) {
return meta;
@ -75,4 +72,10 @@ public class BlockStalagmite extends BlockEnumMulti {
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
return null;
}
@Override
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
return ModBlocks.getDropsWithoutDamage(world, this, metadata, fortune);
}
}

View File

@ -1,5 +1,9 @@
package com.hbm.packet.toclient;
import cpw.mods.fml.common.Loader;
import com.falsepattern.endlessids.mixin.helpers.ChunkBiomeHook;
import com.hbm.util.Compat;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
@ -16,18 +20,26 @@ public class BiomeSyncPacket implements IMessage {
int chunkZ;
byte blockX;
byte blockZ;
byte biome;
byte[] biomeArray;
short biome;
short[] biomeArray;
public BiomeSyncPacket() { }
public BiomeSyncPacket(int chunkX, int chunkZ, byte[] biomeArray) {
this(chunkX, chunkZ, bytesToShorts(biomeArray));
}
public BiomeSyncPacket(int blockX, int blockZ, byte biome) {
this(blockX, blockZ, (short) biome);
}
public BiomeSyncPacket(int chunkX, int chunkZ, short[] biomeArray) {
this.chunkX = chunkX;
this.chunkZ = chunkZ;
this.biomeArray = biomeArray;
}
public BiomeSyncPacket(int blockX, int blockZ, byte biome) {
public BiomeSyncPacket(int blockX, int blockZ, short biome) {
this.chunkX = blockX >> 4;
this.chunkZ = blockZ >> 4;
this.blockX = (byte) (blockX & 15);
@ -42,13 +54,13 @@ public class BiomeSyncPacket implements IMessage {
if(this.biomeArray == null) {
buf.writeBoolean(false);
buf.writeByte(this.biome);
buf.writeShort(this.biome);
buf.writeByte(this.blockX);
buf.writeByte(this.blockZ);
} else {
buf.writeBoolean(true);
for(int i = 0; i < 256; i++) {
buf.writeByte(this.biomeArray[i]);
buf.writeShort(this.biomeArray[i]);
}
}
}
@ -59,17 +71,27 @@ public class BiomeSyncPacket implements IMessage {
this.chunkZ = buf.readInt();
if(!buf.readBoolean()) {
this.biome = buf.readByte();
this.biome = buf.readShort();
this.blockX = buf.readByte();
this.blockZ = buf.readByte();
} else {
this.biomeArray = new byte[256];
this.biomeArray = new short[256];
for(int i = 0; i < 256; i++) {
this.biomeArray[i] = buf.readByte();
this.biomeArray[i] = buf.readShort();
}
}
}
private final static short[] bytesToShorts(byte[] byteArray) {
int size = byteArray.length;
short[] shortArray = new short[size];
for(int index = 0; index < size; index++)
shortArray[index] = (short) byteArray[index];
return shortArray;
}
public static class Handler implements IMessageHandler<BiomeSyncPacket, IMessage> {
@Override
@ -80,14 +102,28 @@ public class BiomeSyncPacket implements IMessage {
if(!world.getChunkProvider().chunkExists(m.chunkX, m.chunkZ)) return null;
Chunk chunk = world.getChunkFromChunkCoords(m.chunkX, m.chunkZ);
chunk.isModified = true;
if(m.biomeArray == null) {
chunk.getBiomeArray()[(m.blockZ & 15) << 4 | (m.blockX & 15)] = m.biome;
world.markBlockRangeForRenderUpdate(m.chunkX << 4, 0, m.chunkZ << 4, m.chunkX << 4, 255, m.chunkZ << 4);
if(Loader.isModLoaded(Compat.MOD_EIDS)) {
if (m.biomeArray == null) {
ChunkBiomeHook hook = (ChunkBiomeHook) chunk;
hook.getBiomeShortArray()[(m.blockZ & 15) << 4 | m.blockX & 15] = m.biome;
world.markBlockRangeForRenderUpdate(m.chunkX << 4, 0, m.chunkZ << 4, m.chunkX << 4, 255, m.chunkZ << 4);
} else {
for (int i = 0; i < 255; ++i) {
ChunkBiomeHook hook = (ChunkBiomeHook) chunk;
hook.getBiomeShortArray()[i] = m.biomeArray[i];
world.markBlockRangeForRenderUpdate(m.chunkX << 4, 0, m.chunkZ << 4, (m.chunkX << 4) + 15, 255, (m.chunkZ << 4) + 15);
}
}
} else {
for(int i = 0; i < 256; i++) {
chunk.getBiomeArray()[i] = m.biomeArray[i];
world.markBlockRangeForRenderUpdate(m.chunkX << 4, 0, m.chunkZ << 4, (m.chunkX << 4) + 15, 255, (m.chunkZ << 4) + 15);
if(m.biomeArray == null) {
chunk.getBiomeArray()[(m.blockZ & 15) << 4 | (m.blockX & 15)] = (byte) m.biome;
world.markBlockRangeForRenderUpdate(m.chunkX << 4, 0, m.chunkZ << 4, m.chunkX << 4, 255, m.chunkZ << 4);
} else {
for(int i = 0; i < 256; i++) {
chunk.getBiomeArray()[i] = (byte) m.biomeArray[i];
world.markBlockRangeForRenderUpdate(m.chunkX << 4, 0, m.chunkZ << 4, (m.chunkX << 4) + 15, 255, (m.chunkZ << 4) + 15);
}
}
}

View File

@ -49,14 +49,31 @@ public class RenderScaffoldBlock implements ISimpleBlockRenderingHandler {
iicon = renderer.overrideBlockTexture;
}
float rotation = (float) -Math.PI;
float ox = x + 0.5F;
float oy = y;
float oz = z + 0.5F;
if((world.getBlockMetadata(x, y, z) & 8) == 0)
rotation = -90F / 180F * (float) Math.PI;
float rotation = (float) Math.PI * -0.5F;
float pitch = 0;
tessellator.addTranslation(x + 0.5F, y, z + 0.5F);
ObjUtil.renderWithIcon((WavefrontObject) ResourceManager.scaffold, iicon, tessellator, rotation, true);
tessellator.addTranslation(-x - 0.5F, -y, -z - 0.5F);
int meta = world.getBlockMetadata(x, y, z);
if(meta >= 12) {
pitch = (float) Math.PI * 0.5F;
rotation = (float) -Math.PI;
ox = x + 1.0F;
oy = y + 0.5F;
} else if(meta >= 8) {
rotation = (float) -Math.PI;
} else if(meta >= 4) {
pitch = (float) Math.PI * 0.5F;
oy = y + 0.5F;
oz = z;
}
tessellator.addTranslation(ox, oy, oz);
ObjUtil.renderWithIcon((WavefrontObject) ResourceManager.scaffold, iicon, tessellator, rotation, pitch, true);
tessellator.addTranslation(-ox, -oy, -oz);
return true;
}

View File

@ -75,7 +75,8 @@ public class RenderFluidTank extends TileEntitySpecialRenderer implements IItemR
DiamondPronter.pront(type.poison, type.flammability, type.reactivity, type.symbol);
GL11.glPopMatrix();
}
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glPopMatrix();
RenderHelper.enableStandardItemLighting();
}

View File

@ -35,6 +35,7 @@ public class Compat {
public static final String MOD_TIC = "TConstruct";
public static final String MOD_RC = "Railcraft";
public static final String MOD_TC = "tc";
public static final String MOD_EIDS = "endlessids";
public static Item tryLoadItem(String domain, String name) {
return (Item) Item.itemRegistry.getObject(getReg(domain, name));

View File

@ -2,7 +2,9 @@ package com.hbm.world;
import com.hbm.packet.PacketDispatcher;
import com.hbm.packet.toclient.BiomeSyncPacket;
import com.hbm.util.Compat;
import com.falsepattern.endlessids.mixin.helpers.ChunkBiomeHook;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
import net.minecraft.entity.Entity;
import net.minecraft.util.MathHelper;
@ -21,19 +23,33 @@ public class WorldUtil {
public static void setBiome(World world, int x, int z, BiomeGenBase biome) {
Chunk chunk = world.getChunkFromBlockCoords(x, z);
chunk.getBiomeArray()[(z & 15) << 4 | (x & 15)] = (byte)(biome.biomeID & 255);
if(Loader.isModLoaded(Compat.MOD_EIDS)) {
short[] array = ((ChunkBiomeHook) chunk).getBiomeShortArray();
array[(z & 15) << 4 | x & 15] = (short) biome.biomeID;
} else {
chunk.getBiomeArray()[(z & 15) << 4 | (x & 15)] = (byte)(biome.biomeID & 255);
}
chunk.isModified = true;
}
public static void syncBiomeChange(World world, int x, int z) {
Chunk chunk = world.getChunkFromBlockCoords(x, z);
PacketDispatcher.wrapper.sendToAllAround(new BiomeSyncPacket(x >> 4, z >> 4, chunk.getBiomeArray()), new TargetPoint(world.provider.dimensionId, x, 128, z, 1024D));
if(Loader.isModLoaded(Compat.MOD_EIDS)) {
PacketDispatcher.wrapper.sendToAllAround(new BiomeSyncPacket(x >> 4, z >> 4, ((ChunkBiomeHook) chunk).getBiomeShortArray()), new TargetPoint(world.provider.dimensionId, x, 128, z, 1024D));
} else {
PacketDispatcher.wrapper.sendToAllAround(new BiomeSyncPacket(x >> 4, z >> 4, chunk.getBiomeArray()), new TargetPoint(world.provider.dimensionId, x, 128, z, 1024D));
}
}
public static void syncBiomeChangeBlock(World world, int x, int z) {
Chunk chunk = world.getChunkFromBlockCoords(x, z);
byte biome = chunk.getBiomeArray()[(z & 15) << 4 | (x & 15)];
PacketDispatcher.wrapper.sendToAllAround(new BiomeSyncPacket(x, z, biome), new TargetPoint(world.provider.dimensionId, x, 128, z, 1024D));
if(Loader.isModLoaded(Compat.MOD_EIDS)) {
short biome = ((ChunkBiomeHook) chunk).getBiomeShortArray()[(z & 15) << 4 | (x & 15)];
PacketDispatcher.wrapper.sendToAllAround(new BiomeSyncPacket(x, z, biome), new TargetPoint(world.provider.dimensionId, x, 128, z, 1024D));
} else {
byte biome = chunk.getBiomeArray()[(z & 15) << 4 | (x & 15)];
PacketDispatcher.wrapper.sendToAllAround(new BiomeSyncPacket(x, z, biome), new TargetPoint(world.provider.dimensionId, x, 128, z, 1024D));
}
}
public static void syncBiomeChange(World world, Chunk chunk) {
@ -48,7 +64,11 @@ public class WorldUtil {
/* this sucks ass */
ChunkCoordIntPair coord = chunk.getChunkCoordIntPair();
PacketDispatcher.wrapper.sendToAllAround(new BiomeSyncPacket(coord.chunkXPos, coord.chunkZPos, chunk.getBiomeArray()), new TargetPoint(world.provider.dimensionId, coord.getCenterXPos(), 128, coord.getCenterZPosition() /* who named you? */, 1024D));
if(Loader.isModLoaded(Compat.MOD_EIDS)) {
PacketDispatcher.wrapper.sendToAllAround(new BiomeSyncPacket(coord.chunkXPos, coord.chunkZPos, ((ChunkBiomeHook) chunk).getBiomeShortArray()), new TargetPoint(world.provider.dimensionId, coord.getCenterXPos(), 128, coord.getCenterZPosition() /* who named you? */, 1024D));
} else {
PacketDispatcher.wrapper.sendToAllAround(new BiomeSyncPacket(coord.chunkXPos, coord.chunkZPos, chunk.getBiomeArray()), new TargetPoint(world.provider.dimensionId, coord.getCenterXPos(), 128, coord.getCenterZPosition() /* who named you? */, 1024D));
}
}
/**Chunkloads the chunk the entity is going to spawn in and then spawns it

Binary file not shown.

Before

Width:  |  Height:  |  Size: 893 B

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 929 B

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 914 B

After

Width:  |  Height:  |  Size: 976 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 894 B

After

Width:  |  Height:  |  Size: 908 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 926 B

After

Width:  |  Height:  |  Size: 1017 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 947 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 924 B

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB