mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
Merge branch 'master' into push-ups
This commit is contained in:
commit
d21f23287b
@ -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() {
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -7,7 +7,6 @@ import com.hbm.util.Compat;
|
||||
import java.lang.invoke.MethodHandle;
|
||||
import java.lang.invoke.MethodHandles;
|
||||
import java.lang.invoke.MethodType;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user