Merge branch 'dev' of https://github.com/TerraFirmaGreg-Team/Modpack-Modern into dev
This commit is contained in:
commit
35d667e50a
4 changed files with 110 additions and 95 deletions
|
|
@ -4357,4 +4357,4 @@
|
|||
"quests.tfg_tips.tools_tips.harvest_basket.subtitle": "For competitive pie bakers.",
|
||||
"quests.tfg_tips.tools_tips.harvest_basket.task": "Any #tfg:harvester",
|
||||
"quests.tfg_tips.tools_tips.harvest_basket.desc": "&l&2Harvest Baskets&r&r are a new tool made just for &5TFG&r! These baskets can be used to harvest whole trees and bushes of fruit in one right-click! A regular &6Harvest Basket&r has a base durability of &n128&r. But an &3Aluminium Harvest Basket&r takes no damage on use."
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,78 +1,75 @@
|
|||
//"use strict";
|
||||
// This is all debug code! Uncomment it if you want to test stuff related to the mars sandstorms
|
||||
|
||||
//const $Vec2 = Java.loadClass("net.minecraft.world.phys.Vec2")
|
||||
/*"use strict";
|
||||
|
||||
//ItemEvents.firstLeftClicked('gtceu:long_copper_rod', event => {
|
||||
// //if (event.getItem().getHoverName().getString() !== "zippity") return;
|
||||
const $Vec2 = Java.loadClass("net.minecraft.world.phys.Vec2")
|
||||
|
||||
// let player = event.player;
|
||||
// player.sendSystemMessage(event.getItem().getHoverName());
|
||||
// let biome = event.getLevel().getBiome(player.blockPosition());
|
||||
ItemEvents.firstLeftClicked('gtceu:long_copper_rod', event => {
|
||||
let player = event.player;
|
||||
player.sendSystemMessage(event.getItem().getHoverName());
|
||||
let biome = event.getLevel().getBiome(player.blockPosition());
|
||||
|
||||
// // player.sendSystemMessage("debug stick of dooooom!");
|
||||
// let currentWind = TFC.climate.getWindVector(player.level, player.blockPosition());
|
||||
let currentWind = TFC.climate.getWindVector(player.level, player.blockPosition());
|
||||
|
||||
// let tags = Array(
|
||||
// ResourceLocation.tryParse("tfg:has_light_sand_particles"),
|
||||
// ResourceLocation.tryParse("tfg:has_medium_sand_particles"),
|
||||
// ResourceLocation.tryParse("tfg:has_dark_sand_particles")
|
||||
// )
|
||||
// // player.sendSystemMessage(`current biome tags are ${biome.getTagKeys().toString()}`);
|
||||
// player.sendSystemMessage(biome.tags().map(tag => tag.location()).filter(element => tags.indexOf(element) > -1).toList());
|
||||
// let text = `current wind vector is x: ${currentWind.x.toPrecision(2)} z: ${currentWind.y.toPrecision(2)}`;
|
||||
// player.sendSystemMessage(text);
|
||||
//});
|
||||
let tags = Array(
|
||||
ResourceLocation.tryParse("tfg:has_light_sand_particles"),
|
||||
ResourceLocation.tryParse("tfg:has_medium_sand_particles"),
|
||||
ResourceLocation.tryParse("tfg:has_dark_sand_particles")
|
||||
)
|
||||
|
||||
//// scale wind up (down) on (crouch +) left click
|
||||
//ItemEvents.firstLeftClicked('gtceu:long_tin_rod', event => {
|
||||
// //if (event.getItem().getHoverName().getString() !== "zippity") return;
|
||||
// const player = event.getPlayer()
|
||||
player.sendSystemMessage(biome.tags().map(tag => tag.location()).filter(element => tags.indexOf(element) > -1).toList());
|
||||
let text = `current wind vector is x: ${currentWind.x.toPrecision(2)} z: ${currentWind.y.toPrecision(2)}`;
|
||||
player.sendSystemMessage(text);
|
||||
});
|
||||
|
||||
// const climateManager = global.getMarsClimateController();
|
||||
// const wind = climateManager.getWind();
|
||||
// const windVec = new $Vec2(wind.x, wind.z);
|
||||
// const increment = player.isCrouching() ? -0.1 : 0.1;
|
||||
// scale wind up (down) on (crouch +) left click
|
||||
ItemEvents.firstLeftClicked('gtceu:long_tin_rod', event => {
|
||||
const player = event.getPlayer();
|
||||
|
||||
const climateManager = global.getMarsClimateController();
|
||||
const wind = climateManager.getWind();
|
||||
const windVec = new $Vec2(wind.x, wind.z);
|
||||
const increment = player.isCrouching() ? -0.1 : 0.1;
|
||||
|
||||
// player.sendSystemMessage(`current x: ${windVec.x.toFixed(1)}, z: ${windVec.y.toFixed(1)}`);
|
||||
player.sendSystemMessage(`current x: ${windVec.x.toFixed(1)}, z: ${windVec.y.toFixed(1)}`);
|
||||
|
||||
// let scaledVec = windVec.add(increment);
|
||||
// let newX = 0.0;
|
||||
// let newY = 0.0;
|
||||
let scaledVec = windVec.add(increment);
|
||||
let newX = 0.0;
|
||||
let newY = 0.0;
|
||||
|
||||
// // i can't modify windVec's properties without rhino throwing a shitfit so here have some extra variables
|
||||
// newX = scaledVec.x
|
||||
// newY = scaledVec.y
|
||||
// i can't modify windVec's properties without rhino throwing a shitfit so here have some extra variables
|
||||
newX = scaledVec.x;
|
||||
newY = scaledVec.y;
|
||||
|
||||
// if (scaledVec.lengthSquared() >= 1.0) {
|
||||
// newX = scaledVec.normalized().scale(0.99).x;
|
||||
// newY = scaledVec.normalized().scale(0.99).y;
|
||||
// }
|
||||
// newX = newX <= 0.1 ? 0.1 : newX
|
||||
// newY = newY <= 0.1 ? 0.1 : newY
|
||||
if (scaledVec.lengthSquared() >= 1.0) {
|
||||
newX = scaledVec.normalized().scale(0.99).x;
|
||||
newY = scaledVec.normalized().scale(0.99).y;
|
||||
}
|
||||
newX = newX <= 0.1 ? 0.1 : newX;
|
||||
newY = newY <= 0.1 ? 0.1 : newY;
|
||||
|
||||
// climateManager.setWind({x: newX, z: newY})
|
||||
// player.sendSystemMessage(`new x: ${newX.toFixed(1)}, z: ${newY.toFixed(1)}`);
|
||||
//});
|
||||
climateManager.setWind({x: newX, z: newY});
|
||||
player.sendSystemMessage(`new x: ${newX.toFixed(1)}, z: ${newY.toFixed(1)}`);
|
||||
});
|
||||
|
||||
//ItemEvents.firstRightClicked('gtceu:long_tin_rod', event => {
|
||||
// //if (event.getItem().getHoverName().getString() !== "zippity") return;
|
||||
// const player = event.getPlayer();
|
||||
ItemEvents.firstRightClicked('gtceu:long_tin_rod', event => {
|
||||
const player = event.getPlayer();
|
||||
|
||||
// const climateManager = global.getMarsClimateController();
|
||||
// const wind = climateManager.getWind();
|
||||
// const windVec = new $Vec2(wind.x, wind.z);
|
||||
const climateManager = global.getMarsClimateController();
|
||||
const wind = climateManager.getWind();
|
||||
const windVec = new $Vec2(wind.x, wind.z);
|
||||
|
||||
// const initAngle = Math.atan2(windVec.y, windVec.x); // angle to x axis
|
||||
// let increment = player.isCrouching() ? 15 : -15;
|
||||
// increment = JavaMath.toRadians(increment)
|
||||
const initAngle = Math.atan2(windVec.y, windVec.x); // angle to x axis
|
||||
let increment = player.isCrouching() ? 15 : -15;
|
||||
increment = JavaMath.toRadians(increment)
|
||||
|
||||
// player.sendSystemMessage(`current angle: ${JavaMath.toDegrees(initAngle).toFixed(1)}`);
|
||||
player.sendSystemMessage(`current angle: ${JavaMath.toDegrees(initAngle).toFixed(1)}`);
|
||||
|
||||
// let newX = (windVec.x * JavaMath.cos(increment)) - (windVec.y * JavaMath.sin(increment))
|
||||
// let newY = (windVec.x * JavaMath.sin(increment)) + (windVec.y * JavaMath.cos(increment))
|
||||
let newX = (windVec.x * JavaMath.cos(increment)) - (windVec.y * JavaMath.sin(increment))
|
||||
let newY = (windVec.x * JavaMath.sin(increment)) + (windVec.y * JavaMath.cos(increment))
|
||||
|
||||
// player.sendSystemMessage(`new x: ${newX.toFixed(1)}, z: ${newY.toFixed(1)}`);
|
||||
player.sendSystemMessage(`new x: ${newX.toFixed(1)}, z: ${newY.toFixed(1)}`);
|
||||
|
||||
// climateManager.setWind({x: newX, z: newY});
|
||||
// player.sendSystemMessage(`new angle: ${JavaMath.toDegrees(Math.atan2(newY, newX)).toFixed(1)}`);
|
||||
//});
|
||||
climateManager.setWind({x: newX, z: newY});
|
||||
player.sendSystemMessage(`new angle: ${JavaMath.toDegrees(Math.atan2(newY, newX)).toFixed(1)}`);
|
||||
});*/
|
||||
|
|
@ -38,6 +38,12 @@ const registerTFGItemTags = (event) => {
|
|||
event.add('c:hidden_from_recipe_viewers', 'tfg:pile/hematitic_sand_covering')
|
||||
event.add('c:hidden_from_recipe_viewers', 'tfg:pile/mars_snow_covering')
|
||||
|
||||
// Actually "piles", the kind that can hide plants inside them
|
||||
event.add('c:hidden_from_recipe_viewers', 'tfg:pile/mars_sand_covering')
|
||||
event.add('c:hidden_from_recipe_viewers', 'tfg:pile/venus_sand_covering')
|
||||
event.add('c:hidden_from_recipe_viewers', 'tfg:pile/hematitic_sand_covering')
|
||||
event.add('c:hidden_from_recipe_viewers', 'tfg:pile/mars_snow_covering')
|
||||
|
||||
//Decorative Vases
|
||||
global.MINECRAFT_DYE_NAMES.forEach(color => {
|
||||
event.add('c:hidden_from_recipe_viewers', `tfg:decorative_vase/generated/${color}`)
|
||||
|
|
|
|||
|
|
@ -36,34 +36,49 @@ function invLerp(x, y, a) {
|
|||
* allows runtime control of wind vector; called every tick
|
||||
* @returns {Object} singleton manager object
|
||||
*/
|
||||
global.getMarsClimateController = function() {
|
||||
if (!global._MARS_CLIMATE_CONTROLLER) {
|
||||
console.info("Initializing MARS_CLIMATE_CONTROLLER...");
|
||||
global._MARS_CLIMATE_CONTROLLER = {
|
||||
windX: 0,
|
||||
windZ: 0,
|
||||
|
||||
getWind: function() {
|
||||
return {x: this.windX, z: this.windZ};
|
||||
},
|
||||
|
||||
setWind: function(vector) {
|
||||
const strength = Math.hypot(vector.x, vector.z);
|
||||
// if (strength > 1.0) throw new RangeError("Vector length > 1");
|
||||
this.windX = vector.x;
|
||||
this.windZ = vector.z;
|
||||
},
|
||||
|
||||
createCallbackForBuilder: function(builder) {
|
||||
var self = this;
|
||||
return function() {
|
||||
const wind = self.getWind();
|
||||
return builder.vector(wind.x, wind.z);
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
return global._MARS_CLIMATE_CONTROLLER;
|
||||
global.getMarsClimateController = function () {
|
||||
if (!global._MARS_CLIMATE_CONTROLLER) {
|
||||
console.info("Initializing MARS_CLIMATE_CONTROLLER...");
|
||||
global._MARS_CLIMATE_CONTROLLER = {
|
||||
windX: 0,
|
||||
windZ: 0,
|
||||
|
||||
getWind: function () {
|
||||
return { x: this.windX, z: this.windZ };
|
||||
},
|
||||
|
||||
setWind: function (vector) {
|
||||
this.windX = vector.x;
|
||||
this.windZ = vector.z;
|
||||
},
|
||||
|
||||
createWindCallback: function (builder) {
|
||||
var self = this;
|
||||
return function (level, pos, calendarTicks) {
|
||||
const strength = Max.max(0, (Math.sin(calendarTicks / 10000) -0.6) / 1.5);
|
||||
|
||||
const newX = Math.cos(calendarTicks / 2400) * strength;
|
||||
const newZ = Math.sin(calendarTicks / 2400) * strength;
|
||||
|
||||
self.setWind({x: newX, z: newZ});
|
||||
return builder.vector(newX, newZ);
|
||||
};
|
||||
},
|
||||
|
||||
createFogCallback: function (builder) {
|
||||
var self = this;
|
||||
return function (level, pos, calendarTicks) {
|
||||
const wind = self.getWind();
|
||||
const strength = Math.hypot(wind.x, wind.z);
|
||||
if (strength < 0.2)
|
||||
return 0;
|
||||
else
|
||||
return Math.max(0, strength);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
return global._MARS_CLIMATE_CONTROLLER;
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -98,7 +113,7 @@ function calcCurrentTemp(averageTemp, seaLevel, playerY, calendarTicks, tempRang
|
|||
let depthPercent = 1 - (playerY / 20);
|
||||
|
||||
let bedrockTemp = lerp(averageTemp, coreTemp, coreTempMult);
|
||||
|
||||
|
||||
return lerp(bedrockTemp, averageTemp, depthPercent);
|
||||
}
|
||||
}
|
||||
|
|
@ -150,7 +165,6 @@ TFCEvents.registerClimateModel(event => {
|
|||
})
|
||||
|
||||
event.register('tfg:orbit_climate', builder => {
|
||||
|
||||
builder.setCurrentTemperatureCalculation((level, pos, calendarTicks, daysInMonth) => {
|
||||
if (OxygenAPI.hasOxygen(level, pos.above())) {
|
||||
return OXYGENATED_TEMP;
|
||||
|
|
@ -194,22 +208,20 @@ TFCEvents.registerClimateModel(event => {
|
|||
})
|
||||
|
||||
builder.setAverageTemperatureCalculation((level, pos) => {
|
||||
|
||||
// Earth is 10k to each pole, and mars is about half as big as earth, so 5k to each pole sounds good
|
||||
return calcAverage(pos.z, global.MARS_PLANET_SIZE, -110, -15);
|
||||
})
|
||||
|
||||
builder.setAverageRainfallCalculation((level, pos) => {
|
||||
|
||||
// irl mars' poles have a snowfall of 0.13mm but that's barely noticeable here.
|
||||
// Use a negative rainfall to stop it snowing closer to the equator. TFC clamps negatives to zero so it's fine
|
||||
return calcAverage(pos.x, global.MARS_PLANET_SIZE, -25, 13)
|
||||
})
|
||||
|
||||
builder.setAirFog((level, pos, calendarTicks) => 0)
|
||||
builder.setWaterFog((level, pos, calendarTicks) => 0.1)
|
||||
builder.setWaterFog((level, pos, calendarTicks) => 0.02);
|
||||
|
||||
const controller = global.getMarsClimateController();
|
||||
builder.setWindVector(controller.createCallbackForBuilder(builder));
|
||||
builder.setAirFog(controller.createFogCallback(builder));
|
||||
builder.setWindVector(controller.createWindCallback(builder));
|
||||
})
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue