crane keybinds, fixed debris not saving, a surprise

This commit is contained in:
Boblet 2021-10-13 16:45:41 +02:00
parent c4eee6990d
commit 83bb0fd16f
11 changed files with 181 additions and 10 deletions

View File

@ -1077,6 +1077,7 @@ public class ModBlocks {
public static Block gas_coal;
public static Block gas_flammable;
public static Block gas_explosive;
public static Block vacuum;
public static Block absorber;
public static Block absorber_red;
@ -2062,6 +2063,7 @@ public class ModBlocks {
gas_coal = new BlockGasCoal().setBlockName("gas_coal").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":gas_coal");
gas_flammable = new BlockGasFlammable().setBlockName("gas_flammable").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":gas_flammable");
gas_explosive = new BlockGasExplosive().setBlockName("gas_explosive").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":gas_explosive");
vacuum = new BlockVacuum().setBlockName("vacuum").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":vacuum");
absorber = new BlockAbsorber(Material.iron, 2.5F).setBlockName("absorber").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":absorber");
absorber_red = new BlockAbsorber(Material.iron, 10F).setBlockName("absorber_red").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":absorber_red");
@ -3103,6 +3105,7 @@ public class ModBlocks {
GameRegistry.registerBlock(gas_coal, gas_coal.getUnlocalizedName());
GameRegistry.registerBlock(gas_flammable, gas_flammable.getUnlocalizedName());
GameRegistry.registerBlock(gas_explosive, gas_explosive.getUnlocalizedName());
GameRegistry.registerBlock(vacuum, vacuum.getUnlocalizedName());
//???
GameRegistry.registerBlock(crystal_virus, crystal_virus.getUnlocalizedName());

View File

@ -0,0 +1,105 @@
package com.hbm.blocks.gas;
import java.util.Random;
import com.hbm.blocks.ModBlocks;
import com.hbm.lib.ModDamageSource;
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.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.Item;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class BlockVacuum extends Block {
public BlockVacuum() {
super(ModBlocks.materialGas);
this.setHardness(0.0F);
this.setResistance(0.0F);
}
@Override
public boolean isOpaqueCube() {
return false;
}
@Override
public int getRenderType() {
return -1;
}
@Override
public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_) {
return null;
}
@Override
public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) {
return null;
}
@Override
public boolean renderAsNormalBlock() {
return false;
}
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) {
return false;
}
@Override
public boolean canCollideCheck(int p_149678_1_, boolean p_149678_2_) {
return false;
}
@Override
public boolean isReplaceable(IBlockAccess world, int x, int y, int z) {
return true;
}
@Override
public void onBlockAdded(World world, int x, int y, int z) {
if(!world.isRemote) world.scheduleBlockUpdate(x, y, z, this, 1);
}
@Override
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
if(!world.isRemote) world.scheduleBlockUpdate(x, y, z, this, 1);
}
@Override
public void updateTick(World world, int x, int y, int z, Random rand) {
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
Block b = world.getBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ);
if(b == this)
continue;
if(b.getBlockBoundsMinX() > 0 || b.getBlockBoundsMinY() > 0 || b.getBlockBoundsMinZ() > 0 ||
b.getBlockBoundsMaxX() < 1 || b.getBlockBoundsMaxY() < 1 || b.getBlockBoundsMaxZ() < 1) {
world.setBlockToAir(x, y, z);
return;
}
}
}
@Override
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) {
if(!(entity instanceof EntityLivingBase))
return;
entity.attackEntityFrom(ModDamageSource.vacuum, 1F);
}
}

View File

@ -8,6 +8,7 @@ import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
import net.minecraft.block.Block;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.projectile.EntityThrowable;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
@ -60,4 +61,18 @@ public class EntityRubble extends EntityThrowable {
this.dataWatcher.updateObject(16, Block.getIdFromBlock(b));
this.dataWatcher.updateObject(17, i);
}
@Override
public void readEntityFromNBT(NBTTagCompound nbt) {
super.readEntityFromNBT(nbt);
this.dataWatcher.updateObject(16, nbt.getInteger("block"));
this.dataWatcher.updateObject(17, nbt.getInteger("meta"));
}
@Override
public void writeEntityToNBT(NBTTagCompound nbt) {
super.writeEntityToNBT(nbt);
nbt.setInteger("block", this.dataWatcher.getWatchableObjectInt(16));
nbt.setInteger("meta", this.dataWatcher.getWatchableObjectInt(17));
}
}

View File

@ -19,11 +19,23 @@ public class HbmKeybinds {
public static KeyBinding jetpackKey = new KeyBinding(category + ".toggleBack", Keyboard.KEY_C, category);
public static KeyBinding hudKey = new KeyBinding(category + ".toggleHUD", Keyboard.KEY_V, category);
public static KeyBinding reloadKey = new KeyBinding(category + ".reload", Keyboard.KEY_R, category);
public static KeyBinding craneUpKey = new KeyBinding(category + ".craneMoveUp", Keyboard.KEY_UP, category);
public static KeyBinding craneDownKey = new KeyBinding(category + ".craneMoveDown", Keyboard.KEY_DOWN, category);
public static KeyBinding craneLeftKey = new KeyBinding(category + ".craneMoveLeft", Keyboard.KEY_LEFT, category);
public static KeyBinding craneRightKey = new KeyBinding(category + ".craneMoveRight", Keyboard.KEY_RIGHT, category);
public static KeyBinding craneLoadKey = new KeyBinding(category + ".craneLoad", Keyboard.KEY_RETURN, category);
public static void register() {
ClientRegistry.registerKeyBinding(jetpackKey);
ClientRegistry.registerKeyBinding(hudKey);
ClientRegistry.registerKeyBinding(reloadKey);
ClientRegistry.registerKeyBinding(craneUpKey);
ClientRegistry.registerKeyBinding(craneDownKey);
ClientRegistry.registerKeyBinding(craneLeftKey);
ClientRegistry.registerKeyBinding(craneRightKey);
ClientRegistry.registerKeyBinding(craneLoadKey);
}
@SubscribeEvent
@ -46,6 +58,11 @@ public class HbmKeybinds {
JETPACK,
TOGGLE_JETPACK,
TOGGLE_HEAD,
RELOAD
RELOAD,
CRANE_UP,
CRANE_DOWN,
CRANE_LEFT,
CRANE_RIGHT,
CRANE_LOAD
}
}

View File

@ -37,7 +37,6 @@ public class CrystallizerRecipes {
recipes.put("orePlutonium", new ItemStack(ModItems.crystal_plutonium));
recipes.put("oreTitanium", new ItemStack(ModItems.crystal_titanium));
recipes.put("oreSulfur", new ItemStack(ModItems.crystal_sulfur));
recipes.put("oreNiter", new ItemStack(ModItems.crystal_niter));
recipes.put("oreSaltpeter", new ItemStack(ModItems.crystal_niter));
recipes.put("oreCopper", new ItemStack(ModItems.crystal_copper));
recipes.put("oreTungsten", new ItemStack(ModItems.crystal_tungsten));

View File

@ -50,6 +50,7 @@ public class ModDamageSource extends DamageSource {
public static DamageSource asbestos = (new DamageSource("asbestos")).setDamageIsAbsolute().setDamageBypassesArmor();
public static DamageSource blacklung = (new DamageSource("blacklung")).setDamageIsAbsolute().setDamageBypassesArmor();
public static DamageSource mku = (new DamageSource("mku")).setDamageIsAbsolute().setDamageBypassesArmor();
public static DamageSource vacuum = (new DamageSource("vacuum")).setDamageIsAbsolute().setDamageBypassesArmor();
public static final String s_bullet = "revolverBullet";
public static final String s_emplacer = "chopperBullet";

View File

@ -1515,12 +1515,17 @@ public class ClientProxy extends ServerProxy {
@Override
public boolean getIsKeyPressed(EnumKeybind key) {
if(key == EnumKeybind.JETPACK)
return Minecraft.getMinecraft().gameSettings.keyBindJump.getIsKeyPressed();
if(key == EnumKeybind.TOGGLE_JETPACK)
return HbmKeybinds.jetpackKey.getIsKeyPressed();
if(key == EnumKeybind.TOGGLE_HEAD)
return HbmKeybinds.hudKey.getIsKeyPressed();
switch(key){
case JETPACK: return Minecraft.getMinecraft().gameSettings.keyBindJump.getIsKeyPressed();
case TOGGLE_JETPACK: return HbmKeybinds.jetpackKey.getIsKeyPressed();
case TOGGLE_HEAD: return HbmKeybinds.hudKey.getIsKeyPressed();
case RELOAD: return HbmKeybinds.reloadKey.getIsKeyPressed();
case CRANE_UP: return HbmKeybinds.craneUpKey.getIsKeyPressed();
case CRANE_DOWN: return HbmKeybinds.craneDownKey.getIsKeyPressed();
case CRANE_LEFT: return HbmKeybinds.craneLeftKey.getIsKeyPressed();
case CRANE_RIGHT: return HbmKeybinds.craneRightKey.getIsKeyPressed();
case CRANE_LOAD: return HbmKeybinds.craneLoadKey.getIsKeyPressed();
}
return false;
}

View File

@ -6,6 +6,7 @@ import java.util.Random;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;
import com.hbm.blocks.ModBlocks;
import com.hbm.blocks.generic.BlockAshes;
import com.hbm.entity.mob.EntityHunterChopper;
import com.hbm.entity.projectile.EntityChopperMine;
@ -67,6 +68,7 @@ import cpw.mods.fml.common.gameevent.TickEvent.ClientTickEvent;
import cpw.mods.fml.common.gameevent.TickEvent.Phase;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.AbstractClientPlayer;
import net.minecraft.client.gui.ScaledResolution;
@ -83,6 +85,7 @@ import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
@ -401,9 +404,22 @@ public class ModEventHandlerClient {
@Spaghetti("please get this shit out of my face")
@SubscribeEvent
public void onPlaySound(PlaySoundEvent17 e) {
EntityPlayer player = MainRegistry.proxy.me();
Minecraft mc = Minecraft.getMinecraft();
int i = MathHelper.floor_double(mc.thePlayer.posX);
int j = MathHelper.floor_double(mc.thePlayer.posY);
int k = MathHelper.floor_double(mc.thePlayer.posZ);
Block block = mc.theWorld.getBlock(i, j, k);
if(block == ModBlocks.vacuum) {
e.result = null;
return;
}
ResourceLocation r = e.sound.getPositionedSoundLocation();
WorldClient wc = Minecraft.getMinecraft().theWorld;
WorldClient wc = mc.theWorld;
//Alright, alright, I give the fuck up, you've wasted my time enough with this bullshit. You win.
//A winner is you.
@ -458,7 +474,7 @@ public class ModEventHandlerClient {
if(!sounds.init || sounds.isDonePlaying()) {
sounds.init = true;
sounds.setDone(false);
Minecraft.getMinecraft().getSoundHandler().playSound(sounds);
mc.getSoundHandler().playSound(sounds);
}
}
}

View File

@ -410,6 +410,11 @@ hazard.particleFine=Feinstaub
hazard.sand=Augenreizstoffe
hbm.key=NTM Hotkeys
hbm.key.craneLoad=Kran laden/entladen
hbm.key.craneMoveDown=Kran rückwärts
hbm.key.craneMoveLeft=Kran nach links
hbm.key.craneMoveRight=Kran nach rechts
hbm.key.craneMoveUp=Kran vorwärts
hbm.key.toggleBack=Rucksack umschalten
hbm.key.toggleHUD=HUD umschalten
hbm.key.reload=Nachladen

View File

@ -478,6 +478,11 @@ hazard.particleFine=Particulates
hazard.sand=Eye Irritants
hbm.key=NTM Hotkeys
hbm.key.craneLoad=Load/Unload Crane
hbm.key.craneMoveDown=Move Crane Backward
hbm.key.craneMoveLeft=Move Crane Left
hbm.key.craneMoveRight=Move Crane Right
hbm.key.craneMoveUp=Move Crane Forward
hbm.key.toggleBack=Toggle Backpack
hbm.key.toggleHUD=Toggle HUD
hbm.key.reload=Reload

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 B