fix commit

This commit is contained in:
sainagh
2026-07-25 16:20:42 -05:00
parent 9396611ce0
commit c6df59caf7
3226 changed files with 209810 additions and 0 deletions
@@ -0,0 +1,265 @@
#loader contenttweaker
import native.net.minecraft.util.math.BlockPos;
import crafttweaker.block.IBlockState;
import crafttweaker.player.IPlayer;
import crafttweaker.text.ITextComponent;
import crafttweaker.world.IBlockPos;
import mods.contenttweaker.Commands;
import mods.contenttweaker.VanillaFactory;
import mods.zenutils.cotx.Block;
# Bee stargate portals
var sednaportal = VanillaFactory.createExpandBlock("sedna_portal_block", <blockmaterial:glass>);
setPortalProps(sednaportal);
setPortalLogic(sednaportal, 147, true);
sednaportal.register();
var rheniaportal = VanillaFactory.createExpandBlock("rhenia_portal_block", <blockmaterial:glass>);
setPortalProps(rheniaportal);
setPortalLogic(rheniaportal, 163, true);
rheniaportal.register();
var haumeaportal = VanillaFactory.createExpandBlock("haumea_portal_block", <blockmaterial:glass>);
setPortalProps(haumeaportal);
setPortalLogic(haumeaportal, 146, true);
haumeaportal.register();
var lunaportal = VanillaFactory.createExpandBlock("luna_portal_block", <blockmaterial:glass>);
setPortalProps(lunaportal);
setPortalLogic(lunaportal, 145, true);
lunaportal.register();
var osirisportal = VanillaFactory.createExpandBlock("osiris_portal_block", <blockmaterial:glass>);
setPortalProps(osirisportal);
setPortalLogic(osirisportal, 148, true);
osirisportal.register();
var ptahportal = VanillaFactory.createExpandBlock("ptah_portal_block", <blockmaterial:glass>);
setPortalProps(ptahportal);
setPortalLogic(ptahportal, 149, true);
ptahportal.register();
var hatorportal = VanillaFactory.createExpandBlock("hator_portal_block", <blockmaterial:glass>);
setPortalProps(hatorportal);
setPortalLogic(hatorportal, 150, true);
hatorportal.register();
var europaportal = VanillaFactory.createExpandBlock("europa_portal_block", <blockmaterial:glass>);
setPortalProps(europaportal);
setPortalLogic(europaportal, 151, true);
europaportal.register();
var oiportal = VanillaFactory.createExpandBlock("oi_portal_block", <blockmaterial:glass>);
setPortalProps(oiportal);
setPortalLogic(oiportal, 152, true);
oiportal.register();
var falacerportal = VanillaFactory.createExpandBlock("falacer_portal_block", <blockmaterial:glass>);
setPortalProps(falacerportal);
setPortalLogic(falacerportal, 160, true);
falacerportal.register();
var orcusportal = VanillaFactory.createExpandBlock("orcus_portal_block", <blockmaterial:glass>);
setPortalProps(orcusportal);
setPortalLogic(orcusportal, 161, true);
orcusportal.register();
var myrmexportal = VanillaFactory.createExpandBlock("myrmex_portal_block", <blockmaterial:glass>);
setPortalProps(myrmexportal);
setPortalLogic(myrmexportal, 164, true);
myrmexportal.register();
var pixoniaportal = VanillaFactory.createExpandBlock("pixonia_portal_block", <blockmaterial:glass>);
setPortalProps(pixoniaportal);
setPortalLogic(pixoniaportal, 165, true);
pixoniaportal.register();
var proximaportal = VanillaFactory.createExpandBlock("proxima_portal_block", <blockmaterial:glass>);
setPortalProps(proximaportal);
setPortalLogic(proximaportal, 166, true);
proximaportal.register();
var neroportal = VanillaFactory.createExpandBlock("nero_portal_block", <blockmaterial:glass>);
setPortalProps(neroportal);
setPortalLogic(neroportal, 170, true);
neroportal.register();
var zoiportal = VanillaFactory.createExpandBlock("zoi_portal_block", <blockmaterial:glass>);
setPortalProps(zoiportal);
setPortalLogic(zoiportal, 171, true);
zoiportal.register();
var akathartosportal = VanillaFactory.createExpandBlock("akathartos_portal_block", <blockmaterial:glass>);
setPortalProps(akathartosportal);
setPortalLogic(akathartosportal, 172, true);
akathartosportal.register();
var pauramportal = VanillaFactory.createExpandBlock("pauram_portal_block", <blockmaterial:glass>);
setPortalProps(pauramportal);
setPortalLogic(pauramportal, 173, true);
pauramportal.register();
var alkemiaportal = VanillaFactory.createExpandBlock("alkemia_portal_block", <blockmaterial:glass>);
setPortalProps(alkemiaportal);
setPortalLogic(alkemiaportal, 174, true);
alkemiaportal.register();
# Wormhole generator portals
var taerrapiattaportal = VanillaFactory.createExpandBlock("taerrapiatta_portal_block", <blockmaterial:glass>);
setPortalProps(taerrapiattaportal);
setPortalLogic(taerrapiattaportal, 180, false);
taerrapiattaportal.register();
var diamerismaportal = VanillaFactory.createExpandBlock("diamerisma_portal_block", <blockmaterial:glass>);
setPortalProps(diamerismaportal);
setPortalLogic(diamerismaportal, 181, false);
diamerismaportal.register();
var furattoportal = VanillaFactory.createExpandBlock("furatto_portal_block", <blockmaterial:glass>);
setPortalProps(furattoportal);
setPortalLogic(furattoportal, 182, false);
furattoportal.register();
var finemportal = VanillaFactory.createExpandBlock("finem_portal_block", <blockmaterial:glass>);
setPortalProps(finemportal);
setPortalLogic(finemportal, 185, false);
finemportal.register();
var apichisiportal = VanillaFactory.createExpandBlock("apichisi_portal_block", <blockmaterial:glass>);
setPortalProps(apichisiportal);
setPortalLogic(apichisiportal, 184, false);
apichisiportal.register();
var lyndenwyrmportal = VanillaFactory.createExpandBlock("lyndenwyrm_portal_block", <blockmaterial:glass>);
setPortalProps(lyndenwyrmportal);
setPortalLogic(lyndenwyrmportal, 162, false);
lyndenwyrmportal.register();
var gallifreyportal = VanillaFactory.createExpandBlock("gallifrey_portal_block", <blockmaterial:glass>);
setPortalProps(gallifreyportal);
setPortalLogic(gallifreyportal, 624, false);
gallifreyportal.register();
var homeseekerportal = VanillaFactory.createExpandBlock("homeseeker_portal_block", <blockmaterial:glass>);
setPortalProps(homeseekerportal);
setPortalHomeseeker(homeseekerportal);
homeseekerportal.register();
var homeboundportal = VanillaFactory.createExpandBlock("homebound_portal_block", <blockmaterial:glass>);
setPortalProps(homeboundportal);
setPortalHomebound(homeboundportal);
homeboundportal.register();
var crepuscularportal = VanillaFactory.createExpandBlock("crepuscular_portal_block", <blockmaterial:glass>);
setPortalProps(crepuscularportal);
setPortalTwilightforest(crepuscularportal);
crepuscularportal.register();
function setPortalProps(block as Block) as Block {
block.setBlockHardness(-1.0);
block.setToolClass("pickaxe");
block.setPassable(true);
block.setFullBlock(false);
block.setLightValue(0.5);
block.setBlockLayer("TRANSLUCENT");
block.setLightOpacity(0);
block.setTranslucent(true);
return block;
}
// Based off end portal logic.
function setPortalLogic(block as Block, dimId as int, inSpace as bool) as Block {
block.onEntityCollidedWithBlock = function(world, pos, state, entity) {
if (world.isRemote() || entity.world.time % 20 != 0 || !(entity instanceof IPlayer)) {
return;
}
var player as IPlayer = entity;
// CoT type -> native type
var blockPos as BlockPos = BlockPos(pos.x, pos.y, pos.z);
var entityBB = entity.native.getEntityBoundingBox();
// Ugly casting because of CoT types
var blockBB = (state as IBlockState).native.getBoundingBox(entity.world.native, blockPos);
if (!inSpace || world.getBiome(player.position as IBlockPos).name == "Space") {
if (!entity.isRiding && !entity.isBeingRidden && entityBB.intersects(blockBB.offset(blockPos))) {
Commands.call(`cofh tpx @s ${dimId}`, player, world, true, true);
Commands.call("summon astralsorcery:entitystarburst", player, world, true, true);
}
} else {
var text = ITextComponent.fromTranslation("chat.contenttweaker.stargate.NotInSpace");
text.style.color = "RED";
player.sendRichTextStatusMessage(text, true);
}
};
return block;
}
// construct special teleport
function setPortalHomeseeker(block as Block) as Block {
block.onEntityCollidedWithBlock = function(world, pos, state, entity) {
if (world.isRemote() || entity.world.time % 20 != 0 || !(entity instanceof IPlayer)) {
return;
}
var player as IPlayer = entity;
// CoT type -> native type
var blockPos as BlockPos = BlockPos(pos.x, pos.y, pos.z);
var entityBB = entity.native.getEntityBoundingBox();
// Ugly casting because of CoT types
var blockBB = (state as IBlockState).native.getBoundingBox(entity.world.native, blockPos);
if (!entity.isRiding && !entity.isBeingRidden && entityBB.intersects(blockBB.offset(blockPos))) {
Commands.call("tp @p ~5 ~50 ~5", player, world, true, true);
Commands.call("summon Item ~ ~ ~ {Item:{id:\"contenttweaker:shattered_mythic_matter\",Count:1b,Damage:0b}}", player, world, true, true);
}
};
return block;
}
// construct special teleport
function setPortalHomebound(block as Block) as Block {
block.onEntityCollidedWithBlock = function(world, pos, state, entity) {
if (world.isRemote() || entity.world.time % 20 != 0 || !(entity instanceof IPlayer)) {
return;
}
var player as IPlayer = entity;
// CoT type -> native type
var blockPos as BlockPos = BlockPos(pos.x, pos.y, pos.z);
var entityBB = entity.native.getEntityBoundingBox();
// Ugly casting because of CoT types
var blockBB = (state as IBlockState).native.getBoundingBox(entity.world.native, blockPos);
if (!entity.isRiding && !entity.isBeingRidden && entityBB.intersects(blockBB.offset(blockPos))) {
Commands.call("tp @p ~5 ~50 ~5", player, world, true, true);
Commands.call("summon twilightforest:knight_phantom ~ ~1 ~ {PersistenceRequired:1,HandItems:[{Count:1,id:\"aoa3:baron_sword\"},{Count:1,id:\"contenttweaker:recursive_mind_shield\"}],HandDropChances:[0.0f,1.0f],ArmorItems:[{},{},{Count:1,id:\"contenttweaker:sentient_meatball_chest\"},{Count:1,id:\"contenttweaker:sentient_meatball\"}],ActiveEffects:[{Id:14,Amplifier:0,Duration:999999,ShowParticles:0b},{Id:24,Amplifier:0,Duration:999999,ShowParticles:0b}],ForgeCaps:{\"twilightforest:cap_shield\":{tempshields:100,permshields:100}},Attributes:[{Name:generic.maxHealth, Base:50000.0},{Name:generic.attackDamage, Base:300.0}],Health:50000f,CustomName:\"Meatball Mind Shield\"}", player, world, true, true);
}
};
return block;
}
// construct special teleport
function setPortalTwilightforest(block as Block) as Block {
block.onEntityCollidedWithBlock = function(world, pos, state, entity) {
if (world.isRemote() || entity.world.time % 20 != 0 || !(entity instanceof IPlayer)) {
return;
}
var player as IPlayer = entity;
// CoT type -> native type
var blockPos as BlockPos = BlockPos(pos.x, pos.y, pos.z);
var entityBB = entity.native.getEntityBoundingBox();
// Ugly casting because of CoT types
var blockBB = (state as IBlockState).native.getBoundingBox(entity.world.native, blockPos);
if (!entity.isRiding && !entity.isBeingRidden && entityBB.intersects(blockBB.offset(blockPos))) {
Commands.call("tp @p ~ ~20 ~", player, world, true, true);
Commands.call("summon aoa3:realmshifter ~4 ~ ~4 {Invulnerable:1,PersistenceRequired:1,HandItems:[{Count:1,id:\"contenttweaker:unforgotten_summons\"},{}],HandDropChances:[0.0f,0.0f],CustomName:\"Heir of the Summoned Hero\"}", player, world, true, true);
}
};
return block;
}
@@ -0,0 +1,294 @@
import native.net.minecraft.item.Item;
import native.net.minecraft.item.ItemStack;
import crafttweaker.block.IBlockState;
import crafttweaker.command.ICommandSender;
import crafttweaker.world.IBlockPos;
import mods.modularmachinery.RecipeBuilder;
import mods.modularmachinery.MachineTickEvent;
import mods.modularmachinery.RecipeStartEvent;
import mods.modularmachinery.MMEvents;
import mods.modularmachinery.IMachineController;
// Shared code
import scripts.util.ModularEventUtils as Util;
static offset as Util.Offset = Util.Offset(5, -4);
var portal = <ore:blockCustomPortal>;
portal.addItems([
<contenttweaker:sedna_portal_block>,
<contenttweaker:rhenia_portal_block>,
<contenttweaker:haumea_portal_block>,
<contenttweaker:luna_portal_block>,
<contenttweaker:osiris_portal_block>,
<contenttweaker:ptah_portal_block>,
<contenttweaker:hator_portal_block>,
<contenttweaker:europa_portal_block>,
<contenttweaker:oi_portal_block>,
<contenttweaker:falacer_portal_block>,
<contenttweaker:orcus_portal_block>,
<contenttweaker:myrmex_portal_block>,
<contenttweaker:pixonia_portal_block>,
<contenttweaker:proxima_portal_block>,
<contenttweaker:nero_portal_block>,
<contenttweaker:zoi_portal_block>,
<contenttweaker:akathartos_portal_block>,
<contenttweaker:pauram_portal_block>,
<contenttweaker:alkemia_portal_block>
]);
var tooltip = [
"This recipe spawns a portal while active.",
"The multiblock needs to be placed in a Space Station.",
"To teleport, stand inside the portal."
] as string[];
var stargatesedna = RecipeBuilder.newBuilder("stargate_sedna", "bee_stargate", 100);
stargatesedna.addItemInput(<contenttweaker:sedna_warper>).setChance(0)
.addFluidInput(<fluid:for.honey> * 100)
.addStartHandler(function(event as RecipeStartEvent) {
beeStargateRecipeStart(event.controller, "contenttweaker:sedna_portal_block", "Sedna");
}
)
.addRecipeTooltip(tooltip)
.build();
var stargaterhenia = RecipeBuilder.newBuilder("stargate_rhenia", "bee_stargate", 100);
stargaterhenia.addItemInput(<contenttweaker:rhenia_warper>).setChance(0)
.addFluidInput(<fluid:for.honey> * 100)
.addStartHandler(function(event as RecipeStartEvent) {
beeStargateRecipeStart(event.controller, "contenttweaker:rhenia_portal_block", "Rhenia");
}
)
.addRecipeTooltip(tooltip)
.build();
var stargatehaumea = RecipeBuilder.newBuilder("stargate_haumea", "bee_stargate", 100);
stargatehaumea.addItemInput(<contenttweaker:haumea_warper>).setChance(0)
.addFluidInput(<fluid:for.honey> * 100)
.addStartHandler(function(event as RecipeStartEvent) {
beeStargateRecipeStart(event.controller, "contenttweaker:haumea_portal_block", "Haumea");
}
)
.addRecipeTooltip(tooltip)
.build();
var stargateluna = RecipeBuilder.newBuilder("stargate_luna", "bee_stargate", 100);
stargateluna.addItemInput(<contenttweaker:luna_warper>).setChance(0)
.addFluidInput(<fluid:for.honey> * 100)
.addStartHandler(function(event as RecipeStartEvent) {
beeStargateRecipeStart(event.controller, "contenttweaker:luna_portal_block", "Luna");
}
)
.addRecipeTooltip(tooltip)
.build();
var stargateosiris = RecipeBuilder.newBuilder("stargate_osiris", "bee_stargate", 100);
stargateosiris.addItemInput(<contenttweaker:osiris_warper>).setChance(0)
.addFluidInput(<fluid:for.honey> * 100)
.addStartHandler(function(event as RecipeStartEvent) {
beeStargateRecipeStart(event.controller, "contenttweaker:osiris_portal_block", "Osiris");
}
)
.addRecipeTooltip(tooltip)
.build();
var stargateptah = RecipeBuilder.newBuilder("stargate_ptah", "bee_stargate", 100);
stargateptah.addItemInput(<contenttweaker:ptah_warper>).setChance(0)
.addFluidInput(<fluid:for.honey> * 100)
.addStartHandler(function(event as RecipeStartEvent) {
beeStargateRecipeStart(event.controller, "contenttweaker:ptah_portal_block", "Ptah");
}
)
.addRecipeTooltip(tooltip)
.build();
var stargatehator = RecipeBuilder.newBuilder("stargate_hator", "bee_stargate", 100);
stargatehator.addItemInput(<contenttweaker:hator_warper>).setChance(0)
.addFluidInput(<fluid:for.honey> * 100)
.addStartHandler(function(event as RecipeStartEvent) {
beeStargateRecipeStart(event.controller, "contenttweaker:hator_portal_block", "Hator");
}
)
.addRecipeTooltip(tooltip)
.build();
var stargateeuropa = RecipeBuilder.newBuilder("stargate_europa", "bee_stargate", 100);
stargateeuropa.addItemInput(<contenttweaker:europa_warper>).setChance(0)
.addFluidInput(<fluid:for.honey> * 100)
.addStartHandler(function(event as RecipeStartEvent) {
beeStargateRecipeStart(event.controller, "contenttweaker:europa_portal_block", "Europa");
}
)
.addRecipeTooltip(tooltip)
.build();
var stargateoi = RecipeBuilder.newBuilder("stargate_oi", "bee_stargate", 100);
stargateoi.addItemInput(<contenttweaker:oi_warper>).setChance(0)
.addFluidInput(<fluid:for.honey> * 100)
.addStartHandler(function(event as RecipeStartEvent) {
beeStargateRecipeStart(event.controller, "contenttweaker:oi_portal_block", "Oi");
}
)
.addRecipeTooltip(tooltip)
.build();
var stargatefalacer = RecipeBuilder.newBuilder("stargate_falacer", "bee_stargate", 100);
stargatefalacer.addItemInput(<contenttweaker:falacer_warper>).setChance(0)
.addFluidInput(<fluid:for.honey> * 100)
.addStartHandler(function(event as RecipeStartEvent) {
beeStargateRecipeStart(event.controller, "contenttweaker:falacer_portal_block", "Falacer");
}
)
.addRecipeTooltip(tooltip)
.build();
var stargateorcus = RecipeBuilder.newBuilder("stargate_orcus", "bee_stargate", 100);
stargateorcus.addItemInput(<contenttweaker:orcus_warper>).setChance(0)
.addFluidInput(<fluid:for.honey> * 100)
.addStartHandler(function(event as RecipeStartEvent) {
beeStargateRecipeStart(event.controller, "contenttweaker:orcus_portal_block", "Orcus");
}
)
.addRecipeTooltip(tooltip)
.build();
var stargatemyrmex = RecipeBuilder.newBuilder("stargate_myrmex", "bee_stargate", 100);
stargatemyrmex.addItemInput(<contenttweaker:myrmex_warper>).setChance(0)
.addFluidInput(<fluid:for.honey> * 100)
.addStartHandler(function(event as RecipeStartEvent) {
beeStargateRecipeStart(event.controller, "contenttweaker:myrmex_portal_block", "Myrmex");
}
)
.addRecipeTooltip(tooltip)
.build();
var stargatepixonia = RecipeBuilder.newBuilder("stargate_pixonia", "bee_stargate", 100);
stargatepixonia.addItemInput(<contenttweaker:pixonia_warper>).setChance(0)
.addFluidInput(<fluid:for.honey> * 100)
.addStartHandler(function(event as RecipeStartEvent) {
beeStargateRecipeStart(event.controller, "contenttweaker:pixonia_portal_block", "Pixonia");
}
)
.addRecipeTooltip(tooltip)
.build();
var stargateproxima = RecipeBuilder.newBuilder("stargate_proxima", "bee_stargate", 100);
stargateproxima.addItemInput(<contenttweaker:proximabelt_warper>).setChance(0)
.addFluidInput(<fluid:for.honey> * 100)
.addStartHandler(function(event as RecipeStartEvent) {
beeStargateRecipeStart(event.controller, "contenttweaker:proxima_portal_block", "Proxima");
}
)
.addRecipeTooltip(tooltip)
.build();
var stargatenero = RecipeBuilder.newBuilder("stargate_nero", "bee_stargate", 100);
stargatenero.addItemInput(<contenttweaker:nero_warper>).setChance(0)
.addFluidInput(<fluid:for.honey> * 100)
.addStartHandler(function(event as RecipeStartEvent) {
beeStargateRecipeStart(event.controller, "contenttweaker:nero_portal_block", "Nero");
}
)
.addRecipeTooltip(tooltip)
.build();
var stargatezoi = RecipeBuilder.newBuilder("stargate_zoi", "bee_stargate", 100);
stargatezoi.addItemInput(<contenttweaker:zoi_warper>).setChance(0)
.addFluidInput(<fluid:for.honey> * 100)
.addStartHandler(function(event as RecipeStartEvent) {
beeStargateRecipeStart(event.controller, "contenttweaker:zoi_portal_block", "Zoi");
}
)
.addRecipeTooltip(tooltip)
.build();
var stargateakathartos = RecipeBuilder.newBuilder("stargate_akathartos", "bee_stargate", 100);
stargateakathartos.addItemInput(<contenttweaker:akathartos_warper>).setChance(0)
.addFluidInput(<fluid:for.honey> * 100)
.addStartHandler(function(event as RecipeStartEvent) {
beeStargateRecipeStart(event.controller, "contenttweaker:akathartos_portal_block", "Akathartos");
}
)
.addRecipeTooltip(tooltip)
.build();
var stargatepauram = RecipeBuilder.newBuilder("stargate_pauram", "bee_stargate", 100);
stargatepauram.addItemInput(<contenttweaker:pauram_warper>).setChance(0)
.addFluidInput(<fluid:for.honey> * 100)
.addStartHandler(function(event as RecipeStartEvent) {
beeStargateRecipeStart(event.controller, "contenttweaker:pauram_portal_block", "Pauram");
}
)
.addRecipeTooltip(tooltip)
.build();
var stargatealkemia = RecipeBuilder.newBuilder("stargate_alkemia", "bee_stargate", 100);
stargatealkemia.addItemInput(<contenttweaker:alkemia_warper>).setChance(0)
.addFluidInput(<fluid:for.honey> * 100)
.addStartHandler(function(event as RecipeStartEvent) {
beeStargateRecipeStart(event.controller, "contenttweaker:alkemia_portal_block", "Alkemia");
}
)
.addRecipeTooltip(tooltip)
.build();
// Do start up sound and message if no current portal, spawn portal if different recipe, or nothing if same portal:
function beeStargateRecipeStart(controller as IMachineController, portalBlock as string, destination as string) {
var pos = offset.getCenter(controller);
var sender = Util.getControllerSender(controller);
Util.scheduleTask(controller, function() as void {
var currentPortalBlock = controller.world.getBlockState(pos);
if (currentPortalBlock != IBlockState.getBlockState(portalBlock,"")) {
if (currentPortalBlock == IBlockState.getBlockState("minecraft:air","")) {
var onlineText = '{"translate":"chat.contenttweaker.stargate.online"}';
server.commandManager.executeCommand(sender, "playsound minecraft:entity.evocation_illager.prepare_summon ambient @a " + pos.x + " " + pos.y + " " + pos.z + " 1 1");
server.commandManager.executeCommand(sender, 'execute @a[x=' + pos.x + ',y=' + pos.y + ',z=' + pos.z + ',r=25] ~ ~ ~ tellraw @s ' + onlineText);
}
beeStargatePlacePortal(controller, portalBlock, pos, sender);
var destinationText = '{"translate":"chat.contenttweaker.portals.destination","with":["' + destination + '"]}';
server.commandManager.executeCommand(sender, "playsound minecraft:block.portal.trigger block @a " + pos.x + " " + pos.y + " " + pos.z + " 1 1");
server.commandManager.executeCommand(sender, "particle portal " + pos.x + " " + pos.y + " " + pos.z + " 1 1 1 0.1 1000");
server.commandManager.executeCommand(sender, 'execute @a[x=' + pos.x + ',y=' + pos.y + ',z=' + pos.z + ',r=25] ~ ~ ~ tellraw @s ' + destinationText);
}
});
}
// Destroy portal if the controller is not running.
MMEvents.onMachinePostTick("bee_stargate", function(event as MachineTickEvent) {
var ctrl = event.controller;
if (ctrl.world.time % 20 != 0 || ctrl.isWorking) {
return;
}
var pos = offset.getCenter(ctrl);
Util.scheduleTask(ctrl, function() as void {
var centerState = ctrl.world.getBlockState(pos);
var itemBlock = ItemStack(Item.getItemFromBlock(centerState.block.native));
// Only clear blocks that aren't unbreakable or are known portal blocks.
if(centerState != IBlockState.getBlockState("minecraft:air","") && !isNull(itemBlock)
&& (centerState.block.definition.hardness >= 0 || itemBlock.wrapper.definition.ores has portal)) {
beeStargateClear(ctrl, pos);
}
});
});
// Clear portal blocks.
function beeStargateClear(controller as IMachineController, pos as IBlockPos) {
var sender = Util.getControllerSender(controller);
beeStargatePlacePortal(controller, "minecraft:air", pos, sender);
var offlineText = '{"translate":"chat.contenttweaker.stargate.offline"}';
server.commandManager.executeCommand(sender, "playsound minecraft:entity.evocation_illager.cast_spell ambient @a " + pos.x + " " + pos.y + " " + pos.z + " 1 0.5");
server.commandManager.executeCommand(sender, "particle smoke " + pos.x + " " + pos.y + " " + pos.z + " 1 1 1 0.1 200");
server.commandManager.executeCommand(sender, 'execute @a[x=' + pos.x + ',y=' + pos.y + ',z=' + pos.z + ',r=25] ~ ~ ~ tellraw @s ' + offlineText);
}
// Places portal blocks inside the stargate frame:
function beeStargatePlacePortal(controller as IMachineController, portalBlock as string, pos as IBlockPos, sender as ICommandSender) {
var facing = controller.facing;
var dx = 0;
var dz = 0;
// The plane direction
if (facing == crafttweaker.world.IFacing.north() || facing == crafttweaker.world.IFacing.south()) { dx = 1; }
else { dz = 1; }
server.commandManager.executeCommand(sender, "fill " + (pos.x - dx) + " " + (pos.y - 1) + " " + (pos.z - dz) + " " + (pos.x + dx) + " " + (pos.y + 1) + " " + (pos.z + dz) + " " + portalBlock);
}
@@ -0,0 +1,178 @@
import native.net.minecraft.item.Item;
import native.net.minecraft.item.ItemStack;
import crafttweaker.block.IBlockState;
import crafttweaker.command.ICommandSender;
import crafttweaker.world.IBlockPos;
import mods.modularmachinery.RecipeBuilder;
import mods.modularmachinery.MachineTickEvent;
import mods.modularmachinery.RecipeStartEvent;
import mods.modularmachinery.MMEvents;
import mods.modularmachinery.IMachineController;
// Shared code
import scripts.util.ModularEventUtils as Util;
static offset as Util.Offset = Util.Offset(4, -3);
var portal = <ore:blockCustomPortal>;
portal.addItems([
<contenttweaker:taerrapiatta_portal_block>,
<contenttweaker:diamerisma_portal_block>,
<contenttweaker:furatto_portal_block>,
<contenttweaker:finem_portal_block>,
<contenttweaker:apichisi_portal_block>,
<contenttweaker:lyndenwyrm_portal_block>,
<contenttweaker:gallifrey_portal_block>
]);
var tooltip = [
"This recipe spawns a portal while active.",
"To teleport, stand inside the portal."
] as string[];
var wormholetaerrapiatta = RecipeBuilder.newBuilder("wormholetaerrapiatta","wormhole_field_generator",100);
wormholetaerrapiatta.addItemInput(<contenttweaker:taerrapiatta_warper>).setChance(0)
.addEnergyPerTickInput(10000)
.addStartHandler(function(event as RecipeStartEvent) {
wormholeGeneratorRecipeStart(event.controller, "contenttweaker:taerrapiatta_portal_block", "Taerrapiatta");
}
)
.addRecipeTooltip(tooltip)
.build();
var wormholediamerisma = RecipeBuilder.newBuilder("wormholediamerisma","wormhole_field_generator",100);
wormholediamerisma.addItemInput(<contenttweaker:diamerisma_warper>).setChance(0)
.addEnergyPerTickInput(10000)
.addStartHandler(function(event as RecipeStartEvent) {
wormholeGeneratorRecipeStart(event.controller, "contenttweaker:diamerisma_portal_block", "Diamerisma");
}
)
.addRecipeTooltip(tooltip)
.build();
var wormholefuratto = RecipeBuilder.newBuilder("wormholefuratto","wormhole_field_generator",100);
wormholefuratto.addItemInput(<contenttweaker:furatto_warper>).setChance(0)
.addEnergyPerTickInput(10000)
.addStartHandler(function(event as RecipeStartEvent) {
wormholeGeneratorRecipeStart(event.controller, "contenttweaker:furatto_portal_block", "Furatto");
}
)
.addRecipeTooltip(tooltip)
.build();
var wormholefinem = RecipeBuilder.newBuilder("wormholefinem","wormhole_field_generator",100);
wormholefinem.addItemInput(<contenttweaker:finem_warper>).setChance(0)
.addEnergyPerTickInput(10000)
.addStartHandler(function(event as RecipeStartEvent) {
wormholeGeneratorRecipeStart(event.controller, "contenttweaker:finem_portal_block", "Finem");
}
)
.addRecipeTooltip(tooltip)
.build();
var wormholeapichisi = RecipeBuilder.newBuilder("wormholeapichisi","wormhole_field_generator",100);
wormholeapichisi.addItemInput(<contenttweaker:apichisi_warper>).setChance(0)
.addEnergyPerTickInput(10000)
.addStartHandler(function(event as RecipeStartEvent) {
wormholeGeneratorRecipeStart(event.controller, "contenttweaker:apichisi_portal_block", "Apichisi");
}
)
.addRecipeTooltip(tooltip)
.build();
var wormholelyndenwyrm = RecipeBuilder.newBuilder("wormholelyndenwyrm","wormhole_field_generator",100);
wormholelyndenwyrm.addItemInput(<contenttweaker:lyndenwyrm_warper>).setChance(0)
.addEnergyPerTickInput(10000)
.addStartHandler(function(event as RecipeStartEvent) {
wormholeGeneratorRecipeStart(event.controller, "contenttweaker:lyndenwyrm_portal_block", "Lyndenwyrm");
}
)
.addRecipeTooltip(tooltip)
.build();
var wormholegallifrey = RecipeBuilder.newBuilder("wormholegallifrey","wormhole_field_generator",100);
wormholegallifrey.addItemInput(<contenttweaker:gallifrey_warper>).setChance(0)
.addEnergyPerTickInput(10000)
.addStartHandler(function(event as RecipeStartEvent) {
wormholeGeneratorRecipeStart(event.controller, "contenttweaker:gallifrey_portal_block", "Gallifrey");
}
)
.addRecipeTooltip(tooltip)
.build();
var wormholehomeseeker = RecipeBuilder.newBuilder("wormholehomeseeker","wormhole_field_generator",100);
wormholehomeseeker.addItemInput(<contenttweaker:homeseeker_warper>).setChance(0)
.addEnergyPerTickInput(10000)
.addStartHandler(function(event as RecipeStartEvent) {
wormholeGeneratorRecipeStart(event.controller, "contenttweaker:homeseeker_portal_block", "Home?");
}
)
.addRecipeTooltip(tooltip)
.build();
var wormholehomebound = RecipeBuilder.newBuilder("wormholehomebound","wormhole_field_generator",100);
wormholehomebound.addItemInput(<contenttweaker:homebound_warper>).setChance(0)
.addEnergyPerTickInput(10000)
.addStartHandler(function(event as RecipeStartEvent) {
wormholeGeneratorRecipeStart(event.controller, "contenttweaker:homebound_portal_block", "Home!");
}
)
.addRecipeTooltip(tooltip)
.build();
// Do start up sound and message if no current portal, spawn portal if different recipe, or nothing if same portal:
function wormholeGeneratorRecipeStart(controller as IMachineController, portalBlock as string, destination as string) {
var pos = offset.getCenter(controller);
var sender = Util.getControllerSender(controller);
Util.scheduleTask(controller, function() as void {
var currentPortalBlock = controller.world.getBlockState(pos);
if (currentPortalBlock != IBlockState.getBlockState(portalBlock,"")) {
if (currentPortalBlock == IBlockState.getBlockState("minecraft:air","")) {
var onlineText = '{"translate":"chat.contenttweaker.wormhole_generator.online"}';
server.commandManager.executeCommand(sender, "playsound minecraft:entity.evocation_illager.prepare_summon ambient @a " + pos.x + " " + pos.y + " " + pos.z + " 1 1");
server.commandManager.executeCommand(sender, 'execute @a[x=' + pos.x + ',y=' + pos.y + ',z=' + pos.z + ',r=25] ~ ~ ~ tellraw @s ' + onlineText);
}
wormholeGeneratorPlacePortal(controller, portalBlock, pos, sender);
var destinationText = '{"translate":"chat.contenttweaker.portals.destination","with":["' + destination + '"]}';
server.commandManager.executeCommand(sender, "playsound minecraft:block.portal.trigger block @a " + pos.x + " " + pos.y + " " + pos.z + " 1 1");
server.commandManager.executeCommand(sender, "particle portal " + pos.x + " " + pos.y + " " + pos.z + " 1 1 1 0.1 1000");
server.commandManager.executeCommand(sender, 'execute @a[x=' + pos.x + ',y=' + pos.y + ',z=' + pos.z + ',r=25] ~ ~ ~ tellraw @s ' + destinationText);
}
});
}
// Destroy portal if the controller is not running.
MMEvents.onMachinePostTick("wormhole_field_generator", function(event as MachineTickEvent) {
var ctrl = event.controller;
if (ctrl.world.time % 20 != 0 || ctrl.isWorking) {
return;
}
var pos = offset.getCenter(ctrl);
Util.scheduleTask(ctrl, function() as void {
var centerState = ctrl.world.getBlockState(pos);
var itemBlock = ItemStack(Item.getItemFromBlock(centerState.block.native));
// Only clear blocks that aren't unbreakable or are known portal blocks.
if(centerState != IBlockState.getBlockState("minecraft:air","") && !isNull(itemBlock)
&& (centerState.block.definition.hardness >= 0 || itemBlock.wrapper.definition.ores has portal)) {
wormholeGeneratorClear(ctrl, pos);
}
});
});
// Clear portal blocks.
function wormholeGeneratorClear(controller as IMachineController, pos as IBlockPos) {
var sender = Util.getControllerSender(controller);
wormholeGeneratorPlacePortal(controller, "minecraft:air", pos, sender);
var offlineText = '{"translate":"chat.contenttweaker.wormhole_generator.offline"}';
server.commandManager.executeCommand(sender, "playsound minecraft:entity.evocation_illager.cast_spell ambient @a " + pos.x + " " + pos.y + " " + pos.z + " 1 0.5");
server.commandManager.executeCommand(sender, "particle smoke " + pos.x + " " + pos.y + " " + pos.z + " 1 1 1 0.1 200");
server.commandManager.executeCommand(sender, 'execute @a[x=' + pos.x + ',y=' + pos.y + ',z=' + pos.z + ',r=25] ~ ~ ~ tellraw @s ' + offlineText);
}
// Places portal blocks inside the wormhole area:
function wormholeGeneratorPlacePortal(controller as IMachineController, portalBlock as string, pos as IBlockPos, sender as ICommandSender) {
var facing = controller.facing;
server.commandManager.executeCommand(sender, "fill " + (pos.x - 1) + " " + (pos.y - 1) + " " + (pos.z - 1) + " " + (pos.x + 1) + " " + (pos.y + 1) + " " + (pos.z + 1) + " " + portalBlock);
}