yeah so what

This commit is contained in:
Bob 2025-04-01 22:32:49 +02:00
parent 6aad688485
commit b9047ac593
2 changed files with 65 additions and 3 deletions

View File

@ -3,12 +3,22 @@ package com.hbm.blocks.generic;
import java.util.function.Consumer;
import java.util.function.Function;
import com.hbm.blocks.ModBlocks;
import com.hbm.blocks.generic.BlockSkeletonHolder.TileEntitySkeletonHolder;
import com.hbm.entity.mob.EntityUndeadSoldier;
import com.hbm.items.ItemEnums.EnumSecretType;
import com.hbm.items.ModItems;
import com.hbm.util.EnumUtil;
import com.hbm.util.Vec3NT;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
public class DungeonSpawner extends BlockContainer {
@ -25,6 +35,7 @@ public class DungeonSpawner extends BlockContainer {
public static class TileEntityDungeonSpawner extends TileEntity {
public int phase = 0;
public int timer = 0;
public EnumSpawnerType type = EnumSpawnerType.NONE;
@Override
@ -32,7 +43,12 @@ public class DungeonSpawner extends BlockContainer {
if(!worldObj.isRemote) {
type.phase.accept(this);
if(type.phaseCondition.apply(this)) phase++;
if(type.phaseCondition.apply(this)) {
phase++;
timer = 0;
} else {
timer++;
}
}
}
@ -53,7 +69,7 @@ public class DungeonSpawner extends BlockContainer {
public static enum EnumSpawnerType {
NONE((te) -> { return false; }, (te) -> {});
NONE(CON_TEST, PHASE_TEST);
public Function<TileEntityDungeonSpawner, Boolean> phaseCondition;
public Consumer<TileEntityDungeonSpawner> phase;
@ -63,4 +79,50 @@ public class DungeonSpawner extends BlockContainer {
this.phase = ph;
}
}
public static Function<TileEntityDungeonSpawner, Boolean> CON_TEST = (tile) -> {
World world = tile.getWorldObj();
int x = tile.xCoord;
int y = tile.yCoord;
int z = tile.zCoord;
if(tile.phase == 0) {
if(world.getTotalWorldTime() % 20 != 0) return false;
return !world.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 1, z + 1).expand(20, 10, 20)).isEmpty();
}
if(tile.phase < 3) {
if(world.getTotalWorldTime() % 20 != 0 || tile.timer < 60) return false;
return world.getEntitiesWithinAABB(EntityUndeadSoldier.class, AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 1, z + 1).expand(50, 20, 50)).isEmpty();
}
return true;
};
public static Consumer<TileEntityDungeonSpawner> PHASE_TEST = (tile) -> {
World world = tile.getWorldObj();
int x = tile.xCoord;
int y = tile.yCoord;
int z = tile.zCoord;
if(tile.phase == 1 || tile.phase == 2) {
if(tile.timer == 0) {
Vec3NT vec = new Vec3NT(10, 0, 0);
for(int i = 0; i < 10; i++) {
EntityUndeadSoldier mob = new EntityUndeadSoldier(world);
mob.setPositionAndRotation(x + 0.5 + vec.xCoord, y, z + 0.5 + vec.zCoord, i * 36F, 0);
vec.rotateAroundYDeg(36D);
mob.onSpawnWithEgg(null);
world.spawnEntityInWorld(mob);
}
}
}
if(tile.phase > 2) {
world.setBlock(x, y + 1, z, ModBlocks.skeleton_holder, 2 + world.rand.nextInt(4), 3);
TileEntity te = world.getTileEntity(x, y + 1, z);
if(te instanceof TileEntitySkeletonHolder) {
TileEntitySkeletonHolder skeleton = (TileEntitySkeletonHolder) te;
skeleton.item = new ItemStack(ModItems.item_secret, 1, EnumSecretType.ABERRATOR.ordinal());
skeleton.markDirty();
world.markBlockForUpdate(x, y, z);
}
world.setBlock(x, y, z, Blocks.obsidian);
}
};
}

View File

@ -89,7 +89,7 @@ public class WeaponRecipes {
CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_stg77, 1), new Object[] { " D ", "BRS", "GGM", 'D', DictFrame.fromOne(ModItems.weapon_mod_special, EnumModSpecial.SCOPE), 'B', BIGMT.lightBarrel(), 'R', BIGMT.lightReceiver(), 'S', ANY_HARDPLASTIC.stock(), 'G', ANY_HARDPLASTIC.grip(), 'M', BIGMT.mechanism() });
CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_fatman, 1), new Object[] { "PPP", "BSR", "G M", 'P', BIGMT.plate(), 'B', BIGMT.heavyBarrel(), 'S', BIGMT.shell(), 'R', BIGMT.heavyReceiver(), 'G', ANY_HARDPLASTIC.grip(), 'M', BIGMT.mechanism() });
CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_tau, 1), new Object[] { " RD", "CTT", "GMS", 'D', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.BISMOID), 'C', CU.pipe(), 'T', ModItems.coil_advanced_torus, 'G', ANY_HARDPLASTIC.grip(), 'R', BIGMT.lightReceiver(), 'M', BIGMT.mechanism(), 'S', ANY_HARDPLASTIC.stock() });
CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_lasrifle, 1), new Object[] { "LC ", "BRS", "MG ", 'L', DictFrame.fromOne(ModItems.weapon_mod_special, EnumModSpecial.SCOPE), 'C', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.BISMOID), 'B', ANY_BISMOIDBRONZE.lightBarrel(), 'R', ANY_BISMOIDBRONZE.lightReceiver(), 'S', ANY_HARDPLASTIC.stock(), 'M', BIGMT.mechanism(), 'G', ANY_HARDPLASTIC.grip() });
CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_lasrifle, 1), new Object[] { " LC", "BRS", "MG ", 'L', DictFrame.fromOne(ModItems.weapon_mod_special, EnumModSpecial.SCOPE), 'C', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.BISMOID), 'B', ANY_BISMOIDBRONZE.lightBarrel(), 'R', ANY_BISMOIDBRONZE.lightReceiver(), 'S', ANY_HARDPLASTIC.stock(), 'M', BIGMT.mechanism(), 'G', ANY_HARDPLASTIC.grip() });
CraftingManager.addShapelessAuto(new ItemStack(ModItems.gun_double_barrel_sacred_dragon, 1), new Object[] { ModItems.gun_double_barrel, DictFrame.fromOne(ModItems.item_secret, EnumSecretType.SELENIUM_STEEL) });
//SEDNA Ammo