mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
ended endlessIDs
This commit is contained in:
parent
333c707a5a
commit
2584934e0b
10
build.gradle
10
build.gradle
@ -76,14 +76,6 @@ 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/"
|
||||
@ -103,8 +95,6 @@ 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 {
|
||||
|
||||
@ -1,20 +1,12 @@
|
||||
package com.hbm.crafting.handlers;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.hbm.blocks.generic.BlockStorageCrate;
|
||||
import com.hbm.blocks.machine.BlockMassStorage;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
|
||||
/**
|
||||
* Handles upgrading storage crates and mass storage blocks, preserving their contents.
|
||||
@ -24,35 +16,26 @@ import net.minecraft.nbt.NBTTagList;
|
||||
*/
|
||||
public class ContainerUpgradeCraftingHandler extends ShapedOreRecipe {
|
||||
|
||||
public ContainerUpgradeCraftingHandler(ItemStack result, Object... items){
|
||||
super(result, items);
|
||||
}
|
||||
public ContainerUpgradeCraftingHandler(ItemStack result, Object... items) {
|
||||
super(result, items);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getCraftingResult(InventoryCrafting inventoryCrafting) {
|
||||
|
||||
ItemStack source = getFirstContainer(inventoryCrafting);
|
||||
ItemStack result = super.getCraftingResult(inventoryCrafting);
|
||||
|
||||
result.setTagCompound(source.getTagCompound());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private static ItemStack getFirstContainer(InventoryCrafting inventoryCrafting) {
|
||||
for (int i = 0; i < 9; ++i) {
|
||||
ItemStack itemstack = inventoryCrafting.getStackInRowAndColumn(i % 3, i / 3);
|
||||
if (itemstack == null)
|
||||
continue;
|
||||
|
||||
Block block = Block.getBlockFromItem(itemstack.getItem());
|
||||
if (block == null)
|
||||
continue;
|
||||
|
||||
if (block instanceof BlockStorageCrate || block instanceof BlockMassStorage)
|
||||
return itemstack;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public ItemStack getCraftingResult(InventoryCrafting inventoryCrafting) {
|
||||
ItemStack source = getFirstContainer(inventoryCrafting);
|
||||
ItemStack result = super.getCraftingResult(inventoryCrafting);
|
||||
result.setTagCompound(source.getTagCompound());
|
||||
return result;
|
||||
}
|
||||
|
||||
private static ItemStack getFirstContainer(InventoryCrafting inventoryCrafting) {
|
||||
for(int i = 0; i < 9; ++i) {
|
||||
ItemStack itemstack = inventoryCrafting.getStackInRowAndColumn(i % 3, i / 3);
|
||||
if(itemstack == null) continue;
|
||||
Block block = Block.getBlockFromItem(itemstack.getItem());
|
||||
if(block == null) continue;
|
||||
if(block instanceof BlockStorageCrate || block instanceof BlockMassStorage) return itemstack;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -35,7 +35,7 @@ public class GunFactory {
|
||||
|
||||
/// GUNS ///
|
||||
ModItems.gun_debug = new ItemGunBaseNT(new GunConfig()
|
||||
.dura(600F).draw(15).inspect(23).crosshair(Crosshair.L_CLASSIC).hud(Lego.HUD_COMPONENT_DURABILITY, Lego.HUD_COMPONENT_AMMO).smoke(true).orchestra(Orchestras.DEBUG_ORCHESTRA)
|
||||
.dura(600F).draw(15).jam(23).inspect(23).crosshair(Crosshair.L_CLASSIC).hud(Lego.HUD_COMPONENT_DURABILITY, Lego.HUD_COMPONENT_AMMO).smoke(true).orchestra(Orchestras.DEBUG_ORCHESTRA)
|
||||
.rec(new Receiver(0)
|
||||
.dmg(10F).delay(14).reload(46).sound("hbm:weapon.44Shoot", 1.0F, 1.0F)
|
||||
.mag(new MagazineFullReload(0, 12).addConfigs(ammo_debug, ammo_debug_buckshot))
|
||||
|
||||
@ -149,6 +149,11 @@ public class ModEventHandlerClient {
|
||||
public static long flashTimestamp;
|
||||
public static final int shakeDuration = 1_500;
|
||||
public static long shakeTimestamp;
|
||||
|
||||
public static float recoilVertical = 0;
|
||||
public static float recoilHorizontal = 0;
|
||||
public static float offsetVertical = 0;
|
||||
public static float offsetHorizontal = 0;
|
||||
|
||||
@SubscribeEvent
|
||||
public void onOverlayRender(RenderGameOverlayEvent.Pre event) {
|
||||
@ -972,9 +977,10 @@ public class ModEventHandlerClient {
|
||||
} else {
|
||||
isRenderingItems = false;
|
||||
}
|
||||
|
||||
EntityPlayer player = mc.thePlayer;
|
||||
|
||||
if(event.phase == Phase.START) {
|
||||
EntityPlayer player = mc.thePlayer;
|
||||
|
||||
float discriminator = 0.003F;
|
||||
float defaultStepSize = 0.5F;
|
||||
@ -991,6 +997,25 @@ public class ModEventHandlerClient {
|
||||
for(int i = 1; i < 4; i++) if(player.stepHeight == i + discriminator) player.stepHeight = defaultStepSize;
|
||||
}
|
||||
}
|
||||
|
||||
if(event.phase == Phase.END) {
|
||||
|
||||
this.offsetVertical += this.recoilVertical;
|
||||
this.offsetHorizontal += this.recoilHorizontal;
|
||||
player.rotationPitch += this.recoilVertical;
|
||||
player.rotationYaw += this.recoilHorizontal;
|
||||
|
||||
float decay = 0.8F;
|
||||
this.recoilVertical *= decay;
|
||||
this.offsetHorizontal *= decay;
|
||||
float dV = this.offsetVertical * 0.2F;
|
||||
float dH = this.offsetHorizontal * 0.2F;
|
||||
|
||||
this.offsetVertical -= dV;
|
||||
this.offsetHorizontal -= dH;
|
||||
player.rotationPitch += dV;
|
||||
player.rotationYaw += dH;
|
||||
}
|
||||
}
|
||||
|
||||
public static ItemStack getMouseOverStack() {
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
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;
|
||||
@ -105,13 +104,13 @@ public class BiomeSyncPacket implements IMessage {
|
||||
|
||||
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;
|
||||
short[] array = Compat.getBiomeShortArray(chunk);
|
||||
if(array != null) array[(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];
|
||||
short[] array = Compat.getBiomeShortArray(chunk);
|
||||
if(array != null) array[i] = m.biomeArray[i];
|
||||
world.markBlockRangeForRenderUpdate(m.chunkX << 4, 0, m.chunkZ << 4, (m.chunkX << 4) + 15, 255, (m.chunkZ << 4) + 15);
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,6 +5,7 @@ import java.util.function.BiFunction;
|
||||
import com.hbm.items.weapon.ItemGunBase;
|
||||
import com.hbm.items.weapon.sedna.GunConfig;
|
||||
import com.hbm.items.weapon.sedna.ItemGunBaseNT;
|
||||
import com.hbm.main.ModEventHandlerClient;
|
||||
import com.hbm.render.anim.BusAnimation;
|
||||
import com.hbm.render.anim.HbmAnimations;
|
||||
import com.hbm.render.anim.HbmAnimations.AnimType;
|
||||
@ -97,6 +98,9 @@ public class GunAnimationPacket implements IMessage {
|
||||
if(type == AnimType.CYCLE) {
|
||||
gun.lastShot = System.currentTimeMillis();
|
||||
gun.shotRand = player.worldObj.rand.nextDouble();
|
||||
|
||||
ModEventHandlerClient.recoilVertical += 1;
|
||||
ModEventHandlerClient.recoilHorizontal += player.getRNG().nextGaussian();
|
||||
}
|
||||
|
||||
BiFunction<ItemStack, AnimType, BusAnimation> anims = config.getAnims(stack);
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.hbm.util;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
@ -200,6 +201,37 @@ public class Compat {
|
||||
MainRegistry.logger.info("#######################################################");
|
||||
}
|
||||
|
||||
public static Class getChunkBiomeHook() {
|
||||
try {
|
||||
return Class.forName("com.falsepattern.endlessids.mixin.helpers.ChunkBiomeHook");
|
||||
} catch(ClassNotFoundException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static Method getBiomeShortArray;
|
||||
|
||||
public static Method getBiomeShortArray() {
|
||||
if(getBiomeShortArray != null) return getBiomeShortArray;
|
||||
try {
|
||||
Method m = getChunkBiomeHook().getDeclaredMethod("getBiomeShortArray");
|
||||
getBiomeShortArray = m;
|
||||
return m;
|
||||
} catch(Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static short[] getBiomeShortArray(Object instance) {
|
||||
Method m = getBiomeShortArray();
|
||||
if(m != null) {
|
||||
try {
|
||||
return (short[]) m.invoke(instance);
|
||||
} catch(Exception e) { }
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/** A standard implementation of safely grabbing a tile entity without loading chunks, might have more fluff added to it later on. */
|
||||
public static TileEntity getTileStandard(World world, int x, int y, int z) {
|
||||
if(!world.getChunkProvider().chunkExists(x >> 4, z >> 4)) return null;
|
||||
|
||||
@ -3,7 +3,6 @@ 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;
|
||||
@ -24,8 +23,8 @@ public class WorldUtil {
|
||||
public static void setBiome(World world, int x, int z, BiomeGenBase biome) {
|
||||
Chunk chunk = world.getChunkFromBlockCoords(x, z);
|
||||
if(Loader.isModLoaded(Compat.MOD_EIDS)) {
|
||||
short[] array = ((ChunkBiomeHook) chunk).getBiomeShortArray();
|
||||
array[(z & 15) << 4 | x & 15] = (short) biome.biomeID;
|
||||
short[] array = Compat.getBiomeShortArray(chunk);
|
||||
if(array != null) array[(z & 15) << 4 | x & 15] = (short) biome.biomeID;
|
||||
} else {
|
||||
chunk.getBiomeArray()[(z & 15) << 4 | (x & 15)] = (byte)(biome.biomeID & 255);
|
||||
}
|
||||
@ -35,7 +34,8 @@ public class WorldUtil {
|
||||
public static void syncBiomeChange(World world, int x, int z) {
|
||||
Chunk chunk = world.getChunkFromBlockCoords(x, z);
|
||||
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));
|
||||
short[] array = Compat.getBiomeShortArray(chunk);
|
||||
if(array != null) PacketDispatcher.wrapper.sendToAllAround(new BiomeSyncPacket(x >> 4, z >> 4, array), 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));
|
||||
}
|
||||
@ -44,8 +44,8 @@ public class WorldUtil {
|
||||
public static void syncBiomeChangeBlock(World world, int x, int z) {
|
||||
Chunk chunk = world.getChunkFromBlockCoords(x, z);
|
||||
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));
|
||||
short[] array = Compat.getBiomeShortArray(chunk);
|
||||
if(array != null) PacketDispatcher.wrapper.sendToAllAround(new BiomeSyncPacket(x, z, array[(z & 15) << 4 | (x & 15)]), 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));
|
||||
@ -65,7 +65,8 @@ public class WorldUtil {
|
||||
/* this sucks ass */
|
||||
ChunkCoordIntPair coord = chunk.getChunkCoordIntPair();
|
||||
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));
|
||||
short[] array = Compat.getBiomeShortArray(chunk);
|
||||
if(array != null) PacketDispatcher.wrapper.sendToAllAround(new BiomeSyncPacket(coord.chunkXPos, coord.chunkZPos, array), 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));
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user