This commit is contained in:
Pyritie 2025-10-21 12:23:09 +01:00
commit 35d667e50a
4 changed files with 110 additions and 95 deletions

View file

@ -4357,4 +4357,4 @@
"quests.tfg_tips.tools_tips.harvest_basket.subtitle": "For competitive pie bakers.", "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.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." "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."
} }

View file

@ -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 => { const $Vec2 = Java.loadClass("net.minecraft.world.phys.Vec2")
// //if (event.getItem().getHoverName().getString() !== "zippity") return;
// let player = event.player; ItemEvents.firstLeftClicked('gtceu:long_copper_rod', event => {
// player.sendSystemMessage(event.getItem().getHoverName()); let player = event.player;
// let biome = event.getLevel().getBiome(player.blockPosition()); 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( let tags = Array(
// ResourceLocation.tryParse("tfg:has_light_sand_particles"), ResourceLocation.tryParse("tfg:has_light_sand_particles"),
// ResourceLocation.tryParse("tfg:has_medium_sand_particles"), ResourceLocation.tryParse("tfg:has_medium_sand_particles"),
// ResourceLocation.tryParse("tfg:has_dark_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);
//});
//// scale wind up (down) on (crouch +) left click player.sendSystemMessage(biome.tags().map(tag => tag.location()).filter(element => tags.indexOf(element) > -1).toList());
//ItemEvents.firstLeftClicked('gtceu:long_tin_rod', event => { let text = `current wind vector is x: ${currentWind.x.toPrecision(2)} z: ${currentWind.y.toPrecision(2)}`;
// //if (event.getItem().getHoverName().getString() !== "zippity") return; player.sendSystemMessage(text);
// const player = event.getPlayer() });
// const climateManager = global.getMarsClimateController(); // scale wind up (down) on (crouch +) left click
// const wind = climateManager.getWind(); ItemEvents.firstLeftClicked('gtceu:long_tin_rod', event => {
// const windVec = new $Vec2(wind.x, wind.z); const player = event.getPlayer();
// const increment = player.isCrouching() ? -0.1 : 0.1;
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 scaledVec = windVec.add(increment);
// let newX = 0.0; let newX = 0.0;
// let newY = 0.0; let newY = 0.0;
// // i can't modify windVec's properties without rhino throwing a shitfit so here have some extra variables // i can't modify windVec's properties without rhino throwing a shitfit so here have some extra variables
// newX = scaledVec.x newX = scaledVec.x;
// newY = scaledVec.y newY = scaledVec.y;
// if (scaledVec.lengthSquared() >= 1.0) { if (scaledVec.lengthSquared() >= 1.0) {
// newX = scaledVec.normalized().scale(0.99).x; newX = scaledVec.normalized().scale(0.99).x;
// newY = scaledVec.normalized().scale(0.99).y; newY = scaledVec.normalized().scale(0.99).y;
// } }
// newX = newX <= 0.1 ? 0.1 : newX newX = newX <= 0.1 ? 0.1 : newX;
// newY = newY <= 0.1 ? 0.1 : newY newY = newY <= 0.1 ? 0.1 : newY;
// climateManager.setWind({x: newX, z: newY}) climateManager.setWind({x: newX, z: newY});
// player.sendSystemMessage(`new x: ${newX.toFixed(1)}, z: ${newY.toFixed(1)}`); player.sendSystemMessage(`new x: ${newX.toFixed(1)}, z: ${newY.toFixed(1)}`);
//}); });
//ItemEvents.firstRightClicked('gtceu:long_tin_rod', event => { ItemEvents.firstRightClicked('gtceu:long_tin_rod', event => {
// //if (event.getItem().getHoverName().getString() !== "zippity") return; const player = event.getPlayer();
// const player = event.getPlayer();
// const climateManager = global.getMarsClimateController(); const climateManager = global.getMarsClimateController();
// const wind = climateManager.getWind(); const wind = climateManager.getWind();
// const windVec = new $Vec2(wind.x, wind.z); const windVec = new $Vec2(wind.x, wind.z);
// const initAngle = Math.atan2(windVec.y, windVec.x); // angle to x axis const initAngle = Math.atan2(windVec.y, windVec.x); // angle to x axis
// let increment = player.isCrouching() ? 15 : -15; let increment = player.isCrouching() ? 15 : -15;
// increment = JavaMath.toRadians(increment) 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 newX = (windVec.x * JavaMath.cos(increment)) - (windVec.y * JavaMath.sin(increment))
// let newY = (windVec.x * JavaMath.sin(increment)) + (windVec.y * JavaMath.cos(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}); climateManager.setWind({x: newX, z: newY});
// player.sendSystemMessage(`new angle: ${JavaMath.toDegrees(Math.atan2(newY, newX)).toFixed(1)}`); player.sendSystemMessage(`new angle: ${JavaMath.toDegrees(Math.atan2(newY, newX)).toFixed(1)}`);
//}); });*/

View file

@ -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/hematitic_sand_covering')
event.add('c:hidden_from_recipe_viewers', 'tfg:pile/mars_snow_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 //Decorative Vases
global.MINECRAFT_DYE_NAMES.forEach(color => { global.MINECRAFT_DYE_NAMES.forEach(color => {
event.add('c:hidden_from_recipe_viewers', `tfg:decorative_vase/generated/${color}`) event.add('c:hidden_from_recipe_viewers', `tfg:decorative_vase/generated/${color}`)

View file

@ -36,34 +36,49 @@ function invLerp(x, y, a) {
* allows runtime control of wind vector; called every tick * allows runtime control of wind vector; called every tick
* @returns {Object} singleton manager object * @returns {Object} singleton manager object
*/ */
global.getMarsClimateController = function() { global.getMarsClimateController = function () {
if (!global._MARS_CLIMATE_CONTROLLER) { if (!global._MARS_CLIMATE_CONTROLLER) {
console.info("Initializing MARS_CLIMATE_CONTROLLER..."); console.info("Initializing MARS_CLIMATE_CONTROLLER...");
global._MARS_CLIMATE_CONTROLLER = { global._MARS_CLIMATE_CONTROLLER = {
windX: 0, windX: 0,
windZ: 0, windZ: 0,
getWind: function() { getWind: function () {
return {x: this.windX, z: this.windZ}; return { x: this.windX, z: this.windZ };
}, },
setWind: function(vector) { setWind: function (vector) {
const strength = Math.hypot(vector.x, vector.z); this.windX = vector.x;
// if (strength > 1.0) throw new RangeError("Vector length > 1"); this.windZ = vector.z;
this.windX = vector.x; },
this.windZ = vector.z;
}, createWindCallback: function (builder) {
var self = this;
createCallbackForBuilder: function(builder) { return function (level, pos, calendarTicks) {
var self = this; const strength = Max.max(0, (Math.sin(calendarTicks / 10000) -0.6) / 1.5);
return function() {
const wind = self.getWind(); const newX = Math.cos(calendarTicks / 2400) * strength;
return builder.vector(wind.x, wind.z); const newZ = Math.sin(calendarTicks / 2400) * strength;
};
} self.setWind({x: newX, z: newZ});
}; return builder.vector(newX, newZ);
} };
return global._MARS_CLIMATE_CONTROLLER; },
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 depthPercent = 1 - (playerY / 20);
let bedrockTemp = lerp(averageTemp, coreTemp, coreTempMult); let bedrockTemp = lerp(averageTemp, coreTemp, coreTempMult);
return lerp(bedrockTemp, averageTemp, depthPercent); return lerp(bedrockTemp, averageTemp, depthPercent);
} }
} }
@ -150,7 +165,6 @@ TFCEvents.registerClimateModel(event => {
}) })
event.register('tfg:orbit_climate', builder => { event.register('tfg:orbit_climate', builder => {
builder.setCurrentTemperatureCalculation((level, pos, calendarTicks, daysInMonth) => { builder.setCurrentTemperatureCalculation((level, pos, calendarTicks, daysInMonth) => {
if (OxygenAPI.hasOxygen(level, pos.above())) { if (OxygenAPI.hasOxygen(level, pos.above())) {
return OXYGENATED_TEMP; return OXYGENATED_TEMP;
@ -194,22 +208,20 @@ TFCEvents.registerClimateModel(event => {
}) })
builder.setAverageTemperatureCalculation((level, pos) => { 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 // 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); return calcAverage(pos.z, global.MARS_PLANET_SIZE, -110, -15);
}) })
builder.setAverageRainfallCalculation((level, pos) => { builder.setAverageRainfallCalculation((level, pos) => {
// irl mars' poles have a snowfall of 0.13mm but that's barely noticeable here. // 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 // 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) return calcAverage(pos.x, global.MARS_PLANET_SIZE, -25, 13)
}) })
builder.setAirFog((level, pos, calendarTicks) => 0) builder.setWaterFog((level, pos, calendarTicks) => 0.02);
builder.setWaterFog((level, pos, calendarTicks) => 0.1)
const controller = global.getMarsClimateController(); const controller = global.getMarsClimateController();
builder.setWindVector(controller.createCallbackForBuilder(builder)); builder.setAirFog(controller.createFogCallback(builder));
builder.setWindVector(controller.createWindCallback(builder));
}) })
}) })