main content changes pre 0.18.3
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
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(2, 0);
|
||||
|
||||
|
||||
var megeliumboomdraconium = RecipeBuilder.newBuilder("megeliumboomdraconium","megelium_detonator",200);
|
||||
megeliumboomdraconium.addBiomeInput("minecraft:sky")
|
||||
.addEnergyPerTickInput(2000000000)
|
||||
.addStartHandler(function(event as RecipeStartEvent) {
|
||||
megeliumDetonatorRecipeStart(event.controller, "aoa3:ancient_rock", "bnkrblks:megelium_stone");
|
||||
}
|
||||
)
|
||||
.addRecipeTooltip(["Ancient Rock blocks placed around the Reactor Core will be converted to megelium through an reactor explosion","The explosion will be toggled if the correct block is placed on top of the core"])
|
||||
.build();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function megeliumDetonatorRecipeStart(controller as IMachineController, initialBlock as string, finalBlock as string) {
|
||||
var pos = offset.getCenter(controller);
|
||||
var sender = Util.getControllerSender(controller);
|
||||
Util.scheduleTask(controller, function() as void {
|
||||
var currentBoomBlock = controller.world.getBlockState(pos);
|
||||
|
||||
if (currentBoomBlock == IBlockState.getBlockState(initialBlock,"")) {
|
||||
replaceBoomBlock(controller, initialBlock, finalBlock, pos, sender);
|
||||
server.commandManager.executeCommand(sender, "playsound minecraft:block.end_portal.spawn block @a " + pos.x + " " + pos.y + " " + pos.z + " 1 1");
|
||||
server.commandManager.executeCommand(sender, "particle hugeexplosion " + pos.x + " " + pos.y + " " + pos.z + " 1 1 1 0.1 1000");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
// replace blocks around reactor
|
||||
function replaceBoomBlock(controller as IMachineController, initialBlock as string, finalBlock 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) + " " + (pos.z + 1) + " " + finalBlock + " 0 replace " + initialBlock);
|
||||
}
|
||||
@@ -142,6 +142,18 @@ 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();
|
||||
|
||||
|
||||
function setPortalProps(block as Block) as Block {
|
||||
block.setBlockHardness(-1.0);
|
||||
block.setToolClass("pickaxe");
|
||||
@@ -178,4 +190,51 @@ function setPortalLogic(block as Block, dimId as int, inSpace as bool) as Block
|
||||
}
|
||||
};
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -99,6 +99,27 @@ wormholegallifrey.addItemInput(<contenttweaker:gallifrey_warper>).setChance(0)
|
||||
.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);
|
||||
|
||||
Reference in New Issue
Block a user