use of micdoodle8.mods.galacticraft.api.vector.Vector3 in project Galacticraft by micdoodle8.
the class RoomBoss method addComponentParts.
@Override
public boolean addComponentParts(World worldIn, Random random, StructureBoundingBox chunkBox) {
for (int i = 0; i <= this.sizeX; i++) {
for (int j = 0; j <= this.sizeY; j++) {
for (int k = 0; k <= this.sizeZ; k++) {
if (i == 0 || i == this.sizeX || j == 0 || j == this.sizeY || k == 0 || k == this.sizeZ) {
boolean placeBlock = true;
if (getDirection().getAxis() == EnumFacing.Axis.Z) {
int start = (this.boundingBox.maxX - this.boundingBox.minX) / 2 - 1;
int end = (this.boundingBox.maxX - this.boundingBox.minX) / 2 + 1;
if (i > start && i <= end && j < 3 && j > 0) {
if (getDirection() == EnumFacing.SOUTH && k == 0) {
placeBlock = false;
} else if (getDirection() == EnumFacing.NORTH && k == this.sizeZ) {
placeBlock = false;
}
}
} else {
int start = (this.boundingBox.maxZ - this.boundingBox.minZ) / 2 - 1;
int end = (this.boundingBox.maxZ - this.boundingBox.minZ) / 2 + 1;
if (k > start && k <= end && j < 3 && j > 0) {
if (getDirection() == EnumFacing.EAST && i == 0) {
placeBlock = false;
} else if (getDirection() == EnumFacing.WEST && i == this.sizeX) {
placeBlock = false;
}
}
}
if (placeBlock) {
this.setBlockState(worldIn, this.configuration.getBrickBlock(), i, j, k, chunkBox);
} else {
this.setBlockState(worldIn, Blocks.air.getDefaultState(), i, j, k, chunkBox);
}
} else if ((i == 1 && k == 1) || (i == 1 && k == this.sizeZ - 1) || (i == this.sizeX - 1 && k == 1) || (i == this.sizeX - 1 && k == this.sizeZ - 1)) {
this.setBlockState(worldIn, Blocks.flowing_lava.getDefaultState(), i, j, k, chunkBox);
} else if (j % 3 == 0 && j >= 2 && ((i == 1 || i == this.sizeX - 1 || k == 1 || k == this.sizeZ - 1) || (i == 2 && k == 2) || (i == 2 && k == this.sizeZ - 2) || (i == this.sizeX - 2 && k == 2) || (i == this.sizeX - 2 && k == this.sizeZ - 2))) {
// Horizontal bars
this.setBlockState(worldIn, Blocks.iron_bars.getDefaultState(), i, j, k, chunkBox);
} else if ((i == 1 && k == 2) || (i == 2 && k == 1) || (i == 1 && k == this.sizeZ - 2) || (i == 2 && k == this.sizeZ - 1) || (i == this.sizeX - 1 && k == 2) || (i == this.sizeX - 2 && k == 1) || (i == this.sizeX - 1 && k == this.sizeZ - 2) || (i == this.sizeX - 2 && k == this.sizeZ - 1)) {
// Vertical bars
this.setBlockState(worldIn, Blocks.iron_bars.getDefaultState(), i, j, k, chunkBox);
} else {
this.setBlockState(worldIn, Blocks.air.getDefaultState(), i, j, k, chunkBox);
}
}
}
}
int spawnerX = this.sizeX / 2;
int spawnerY = 1;
int spawnerZ = this.sizeZ / 2;
BlockPos blockpos = new BlockPos(this.getXWithOffset(spawnerX, spawnerZ), this.getYWithOffset(spawnerY), this.getZWithOffset(spawnerX, spawnerZ));
// Is this position inside the chunk currently being generated?
if (chunkBox.isVecInside(blockpos)) {
worldIn.setBlockState(blockpos, GCBlocks.bossSpawner.getDefaultState(), 2);
TileEntityDungeonSpawner spawner = (TileEntityDungeonSpawner) worldIn.getTileEntity(blockpos);
if (spawner != null) {
spawner.setRoom(new Vector3(this.boundingBox.minX + 1, this.boundingBox.minY + 1, this.boundingBox.minZ + 1), new Vector3(this.sizeX - 1, this.sizeY - 1, this.sizeZ - 1));
spawner.setChestPos(this.chestPos);
}
}
return true;
}
use of micdoodle8.mods.galacticraft.api.vector.Vector3 in project Galacticraft by micdoodle8.
the class RenderTier3Rocket method doRender.
@Override
public void doRender(EntityTier3Rocket entity, double par2, double par4, double par6, float par8, float par9) {
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glPushMatrix();
final float var24 = entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * par9 + 180;
final float var25 = entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * par9 + 45;
GL11.glTranslatef((float) par2, (float) par4 + entity.getRenderOffsetY(), (float) par6);
GL11.glRotatef(180.0F - par8, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(-var24, 0.0F, 0.0F, 1.0F);
final float var28 = entity.rollAmplitude / 3 - par9;
if (var28 > 0.0F) {
final float i = entity.getLaunched() ? (5 - MathHelper.floor_double(entity.timeUntilLaunch / 85)) / 10F : 0.3F;
GL11.glRotatef(MathHelper.sin(var28) * var28 * i * par9, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(MathHelper.sin(var28) * var28 * i * par9, 1.0F, 0.0F, 1.0F);
}
updateModel();
RenderHelper.disableStandardItemLighting();
this.bindTexture(TextureMap.locationBlocksTexture);
if (Minecraft.isAmbientOcclusionEnabled()) {
GlStateManager.shadeModel(GL11.GL_SMOOTH);
} else {
GlStateManager.shadeModel(GL11.GL_FLAT);
}
GL11.glScalef(-1.0F, -1.0F, 1.0F);
GL11.glScalef(0.8F, 0.8F, 0.8F);
ClientUtil.drawBakedModel(rocketModel);
Vector3 teamColor = ClientUtil.updateTeamColor(FMLClientHandler.instance().getClient().thePlayer.getName(), true);
if (teamColor != null) {
GL11.glColor3f(teamColor.floatX(), teamColor.floatY(), teamColor.floatZ());
}
if (FMLClientHandler.instance().getClient().thePlayer.ticksExisted / 10 % 2 < 1) {
GL11.glColor3f(1, 0, 0);
} else {
GL11.glColor3f(0, 1, 0);
}
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glColor3f(1, 1, 1);
GL11.glPopMatrix();
RenderHelper.enableStandardItemLighting();
}
use of micdoodle8.mods.galacticraft.api.vector.Vector3 in project Galacticraft by micdoodle8.
the class SpaceRace method loadFromNBT.
public void loadFromNBT(NBTTagCompound nbt) {
this.teamName = nbt.getString("TeamName");
if (ConfigManagerCore.enableDebug) {
GCLog.info("Loading spacerace data for team " + this.teamName);
}
this.spaceRaceID = nbt.getInteger("SpaceRaceID");
// Deal with legacy error
this.ticksSpent = (int) nbt.getLong("TicksSpent");
this.flagData = FlagData.readFlagData(nbt);
this.teamColor = new Vector3(nbt.getDouble("teamColorR"), nbt.getDouble("teamColorG"), nbt.getDouble("teamColorB"));
NBTTagList tagList = nbt.getTagList("PlayerList", 10);
for (int i = 0; i < tagList.tagCount(); i++) {
NBTTagCompound tagAt = tagList.getCompoundTagAt(i);
this.playerNames.add(tagAt.getString("PlayerName"));
}
tagList = nbt.getTagList("CelestialBodyList", 10);
for (int i = 0; i < tagList.tagCount(); i++) {
NBTTagCompound tagAt = tagList.getCompoundTagAt(i);
CelestialBody body = GalaxyRegistry.getCelestialBodyFromUnlocalizedName(tagAt.getString("CelestialBodyName"));
if (body != null) {
this.celestialBodyStatusList.put(body, tagAt.getInteger("TimeTaken"));
}
}
tagList = nbt.getTagList("SchList", 10);
for (int i = 0; i < tagList.tagCount(); i++) {
NBTTagCompound tagAt = tagList.getCompoundTagAt(i);
String name = tagAt.getString("Mem");
if (name != null && this.playerNames.contains(name)) {
final NBTTagList itemList = tagAt.getTagList("Sch", 10);
for (int j = 0; j < itemList.tagCount(); ++j) {
addNewSchematic(name, ItemStack.loadItemStackFromNBT(itemList.getCompoundTagAt(j)));
}
}
}
if (ConfigManagerCore.enableDebug) {
GCLog.info("Loaded spacerace team data OK.");
}
}
use of micdoodle8.mods.galacticraft.api.vector.Vector3 in project Galacticraft by micdoodle8.
the class SpaceRaceManager method onPlayerRemoval.
public static void onPlayerRemoval(MinecraftServer server, String player, SpaceRace race) {
for (String member : race.getPlayerNames()) {
EntityPlayerMP memberObj = PlayerUtil.getPlayerForUsernameVanilla(server, member);
if (memberObj != null) {
memberObj.addChatMessage(new ChatComponentText(EnumColor.DARK_AQUA + GCCoreUtil.translateWithFormat("gui.space_race.chat.remove_success", EnumColor.RED + player + EnumColor.DARK_AQUA)).setChatStyle(new ChatStyle().setColor(EnumChatFormatting.DARK_AQUA)));
}
}
List<String> playerList = new ArrayList<String>();
playerList.add(player);
SpaceRace newRace = SpaceRaceManager.addSpaceRace(new SpaceRace(playerList, SpaceRace.DEFAULT_NAME, new FlagData(48, 32), new Vector3(1, 1, 1)));
EntityPlayerMP playerToRemove = PlayerUtil.getPlayerBaseServerFromPlayerUsername(server, player, true);
if (playerToRemove != null) {
SpaceRaceManager.sendSpaceRaceData(server, playerToRemove, newRace);
SpaceRaceManager.sendSpaceRaceData(server, playerToRemove, race);
}
}
use of micdoodle8.mods.galacticraft.api.vector.Vector3 in project Galacticraft by micdoodle8.
the class EntityLander method getParticleMap.
@Override
public Map<Vector3, Vector3> getParticleMap() {
double sinPitch = Math.sin(this.rotationPitch / Constants.RADIANS_TO_DEGREES_D);
final double x1 = 4 * Math.cos(this.rotationYaw / Constants.RADIANS_TO_DEGREES_D) * sinPitch;
final double z1 = 4 * Math.sin(this.rotationYaw / Constants.RADIANS_TO_DEGREES_D) * sinPitch;
final double y1 = -4 * Math.abs(Math.cos(this.rotationPitch / Constants.RADIANS_TO_DEGREES_D));
new Vector3(this);
final Map<Vector3, Vector3> particleMap = new HashMap<Vector3, Vector3>();
particleMap.put(new Vector3(this.posX, this.posY + 1D + this.motionY / 2, this.posZ), new Vector3(x1, y1 + this.motionY / 2, z1));
return particleMap;
}
Aggregations