Skip to content

Commit

Permalink
Migrate Dyson from GalaxySpace to Intergalactic (#89)
Browse files Browse the repository at this point in the history
  • Loading branch information
serenibyss authored Dec 24, 2024
1 parent a16c8e9 commit 3b570fc
Show file tree
Hide file tree
Showing 55 changed files with 1,052 additions and 70 deletions.
2 changes: 1 addition & 1 deletion dependencies.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
dependencies {
api('com.github.GTNewHorizons:GT5-Unofficial:5.09.51.22:dev')
api('com.github.GTNewHorizons:Galaxy-Space-GTNH:1.1.100-GTNH:dev')
api('com.github.GTNewHorizons:Galacticraft:3.2.8-GTNH:dev')
api('com.github.GTNewHorizons:GTNHLib:0.6.0:dev')
compileOnly('com.github.GTNewHorizons:BlockRenderer6343:1.2.16:dev') {transitive = false}
compileOnly("com.github.GTNewHorizons:Hodgepodge:2.6.6:dev") {transitive = false}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
+ "required-after:gtnhlib@[0.5.21,);"
+ "required-after:tectech;"
+ "required-after:structurelib;"
+ "required-after:GalaxySpace;"
+ "after:GalaxySpace;"
+ "after:bartworks;"
+ "after:GoodGenerator;"
+ "after:miscutils;"
Expand Down Expand Up @@ -100,33 +100,26 @@ public void onMissingMapping(FMLMissingMappingsEvent event) {
for (FMLMissingMappingsEvent.MissingMapping mapping : event.getAll()) {
if (mapping.type == GameRegistry.Type.BLOCK) {
switch (mapping.name) {
case "GalaxySpace:spaceelevatorparts":
mapping.remap(IGBlocks.SpaceElevatorCasing);
break;
case "GalaxySpace:spaceelevatormotors":
mapping.remap(IGBlocks.SpaceElevatorMotor);
break;
case "GalaxySpace:spaceelevatorcable":
mapping.remap(IGBlocks.SpaceElevatorCable);
break;
case "GalaxySpace:spaceelevatorparts" -> mapping.remap(IGBlocks.SpaceElevatorCasing);
case "GalaxySpace:spaceelevatormotors" -> mapping.remap(IGBlocks.SpaceElevatorMotor);
case "GalaxySpace:spaceelevatorcable" -> mapping.remap(IGBlocks.SpaceElevatorCable);
case "GalaxySpace:dysonswarmparts" -> mapping.remap(IGBlocks.DysonSwarmCasing);
case "GalaxySpace:machineframes" -> mapping.remap(IGBlocks.GasSiphonCasing);
}
} else if (mapping.type == GameRegistry.Type.ITEM) {
switch (mapping.name) {
case "GalaxySpace:spaceelevatorparts":
mapping.remap(Item.getItemFromBlock(IGBlocks.SpaceElevatorCasing));
break;
case "GalaxySpace:spaceelevatormotors":
mapping.remap(Item.getItemFromBlock(IGBlocks.SpaceElevatorMotor));
break;
case "GalaxySpace:spaceelevatorcable":
mapping.remap(Item.getItemFromBlock(IGBlocks.SpaceElevatorCable));
break;
case "GalaxySpace:item.SpaceElevatorParts":
mapping.remap(IGItems.SpaceElevatorItems);
break;
case "GalaxySpace:item.MiningDrone":
mapping.remap(IGItems.MiningDrones);
break;
case "GalaxySpace:spaceelevatorparts" -> mapping
.remap(Item.getItemFromBlock(IGBlocks.SpaceElevatorCasing));
case "GalaxySpace:spaceelevatormotors" -> mapping
.remap(Item.getItemFromBlock(IGBlocks.SpaceElevatorMotor));
case "GalaxySpace:spaceelevatorcable" -> mapping
.remap(Item.getItemFromBlock(IGBlocks.SpaceElevatorCable));
case "GalaxySpace:dysonswarmparts" -> mapping
.remap(Item.getItemFromBlock(IGBlocks.DysonSwarmCasing));
case "GalaxySpace:machineframes" -> mapping.remap(Item.getItemFromBlock(IGBlocks.GasSiphonCasing));
case "GalaxySpace:item.SpaceElevatorParts" -> mapping.remap(IGItems.SpaceElevatorItems);
case "GalaxySpace:item.MiningDrone" -> mapping.remap(IGItems.MiningDrones);
case "GalaxySpace:item.DysonSwarmParts" -> mapping.remap(IGItems.DysonSwarmItems);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
package com.gtnewhorizons.gtnhintergalactic.block;

import java.util.List;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;

import com.gtnewhorizons.gtnhintergalactic.GTNHIntergalactic;

public class BlockCasingDysonSwarm extends Block {

private IIcon[][] textures;
public static final String[] names = { "ReceiverCasing", "ReceiverDish", "DeploymentUnitCasing",
"DeploymentUnitCore", "DeploymentUnitMagnet", "ControlCasing", "ControlPrimary", "ControlSecondary",
"ControlToroid", "Floor" };

public BlockCasingDysonSwarm() {
super(Material.iron);
setBlockName("DysonSwarmPart");
setCreativeTab(GTNHIntergalactic.tab);
setHarvestLevel("pickaxe", 2);
}

@Override
public void registerBlockIcons(IIconRegister register) {
textures = new IIcon[names.length][2];
for (int i = 0; i < names.length; i++) {
textures[i][0] = register
.registerIcon(GTNHIntergalactic.ASSET_PREFIX + ":dysonSwarm/" + names[i] + "_Side");
textures[i][1] = register.registerIcon(GTNHIntergalactic.ASSET_PREFIX + ":dysonSwarm/" + names[i]);
}
}

@Override
public IIcon getIcon(int side, int meta) {
return textures[meta % textures.length][side < 2 ? 1 : 0];
}

@Override
public void getSubBlocks(Item item, CreativeTabs tab, List variants) {
for (int i = 0; i < names.length; i++) {
variants.add(new ItemStack(item, 1, i));
}
}

@Override
public float getExplosionResistance(Entity entity, World world, int x, int y, int z, double explosionX,
double explosionY, double explosionZ) {
if (world.getBlockMetadata(x, y, z) == 9) {
return 1500.0f;
}
return 6.0f;
}

@Override
public float getExplosionResistance(Entity entity) {
return 6.0f;
}

@Override
public float getBlockHardness(World world, int x, int y, int z) {
if (world.getBlockMetadata(x, y, z) == 9) {
return 800.0f;
}
return 1.0f;
}

@Override
public int damageDropped(int meta) {
return meta;
}

@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack) {
world.setBlockMetadataWithNotify(x, y, z, stack.getItemDamage(), 3);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package com.gtnewhorizons.gtnhintergalactic.block;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.world.World;

import com.gtnewhorizons.gtnhintergalactic.GTNHIntergalactic;
import com.gtnewhorizons.gtnhintergalactic.Tags;

import gregtech.api.GregTechAPI;
import micdoodle8.mods.galacticraft.api.block.ITerraformableBlock;

public class BlockCasingGasSiphon extends Block implements ITerraformableBlock {

public BlockCasingGasSiphon() {
super(Material.rock);
this.setBlockName("GasSiphonCasing");
this.setHardness(2.0f);
this.setStepSound(soundTypeStone);
this.setHarvestLevel("pickaxe", 3);
this.setCreativeTab(GTNHIntergalactic.tab);
this.setBlockTextureName(Tags.MODID + ":gasSiphon/SiphonCasing");
GregTechAPI.registerMachineBlock(this, -1);
}

@Override
public boolean isTerraformable(final World world, final int x, final int y, final int z) {
return false;
}

@Override
public void onBlockAdded(World world, int x, int y, int z) {
if (GregTechAPI.isMachineBlock(this, world.getBlockMetadata(x, y, z))) {
GregTechAPI.causeMachineUpdate(world, x, y, z);
}
}

@Override
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
if (GregTechAPI.isMachineBlock(block, meta)) {
GregTechAPI.causeMachineUpdate(world, x, y, z);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import net.minecraft.block.Block;

import com.gtnewhorizons.gtnhintergalactic.item.ItemBlockSpaceElevatorCable;
import com.gtnewhorizons.gtnhintergalactic.item.ItemCasingDysonSwarm;

import cpw.mods.fml.common.registry.GameRegistry;

Expand All @@ -14,6 +15,8 @@ public class IGBlocks {
public static Block SpaceElevatorCable;
public static BlockCasingSpaceElevator SpaceElevatorCasing;
public static BlockCasingSpaceElevatorMotor SpaceElevatorMotor;
public static BlockCasingDysonSwarm DysonSwarmCasing;
public static BlockCasingGasSiphon GasSiphonCasing;

/**
* Initialize the blocks of this mod
Expand All @@ -23,5 +26,9 @@ public static void init() {
GameRegistry.registerBlock(SpaceElevatorCable, ItemBlockSpaceElevatorCable.class, "spaceelevatorcable");
SpaceElevatorCasing = new BlockCasingSpaceElevator();
SpaceElevatorMotor = new BlockCasingSpaceElevatorMotor();
DysonSwarmCasing = new BlockCasingDysonSwarm();
GameRegistry.registerBlock(DysonSwarmCasing, ItemCasingDysonSwarm.class, "dysonswarmparts");
GasSiphonCasing = new BlockCasingGasSiphon();
GameRegistry.registerBlock(GasSiphonCasing, "gassiphoncasing");
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.gtnewhorizons.gtnhintergalactic.client;

import galaxyspace.core.register.GSBlocks;
import gregtech.api.enums.Textures;
import com.gtnewhorizons.gtnhintergalactic.block.IGBlocks;

import gregtech.api.enums.Textures.BlockIcons;
import gregtech.api.enums.Textures.BlockIcons.CustomIcon;
import gregtech.api.interfaces.IIconContainer;
import gregtech.api.interfaces.ITexture;
import gregtech.api.render.TextureFactory;
Expand All @@ -13,22 +15,39 @@
*/
public class IGTextures implements Runnable {

public static int ADVANCED_MACHINE_FRAME_INDEX = 154;
public static IIconContainer SIPHON_OVERLAY_FRONT_GLOW;
public static IIconContainer SIPHON_OVERLAY_FRONT_ACTIVE_GLOW;
public static ITexture SIPHON_OVERLAY_FRONT;

public static IIconContainer DYSON_OVERLAY_FRONT_GLOW;
public static IIconContainer DYSON_OVERLAY_FRONT_ACTIVE_GLOW;
public static ITexture DYSON_OVERLAY_FRONT;
public static ITexture DYSON_OVERLAY_FRONT_ACTIVE;

public static final int CASING_INDEX_RECEIVER = 150;
public static final int CASING_INDEX_COMMAND = 151;
public static final int CASING_INDEX_LAUNCH = 152;
public static final int CASING_INDEX_FLOOR = 153;
public static final int CASING_INDEX_SIPHON = 154;

/**
* Register all used textures
*/
@Override
public void run() {
SIPHON_OVERLAY_FRONT = TextureFactory
.of(new Textures.BlockIcons.CustomIcon("iconsets/OVERLAY_FRONT_PLANETARYSIPHON"));
SIPHON_OVERLAY_FRONT_GLOW = new Textures.BlockIcons.CustomIcon("iconsets/OVERLAY_FRONT_PLANETARYSIPHON_GLOW");
SIPHON_OVERLAY_FRONT_ACTIVE_GLOW = new Textures.BlockIcons.CustomIcon(
"iconsets/OVERLAY_FRONT_PLANETARYSIPHON_ACTIVE_GLOW");
Textures.BlockIcons
.setCasingTextureForId(ADVANCED_MACHINE_FRAME_INDEX, TextureFactory.of(GSBlocks.MachineFrames));
SIPHON_OVERLAY_FRONT = TextureFactory.of(new CustomIcon("iconsets/OVERLAY_FRONT_PLANETARYSIPHON"));
SIPHON_OVERLAY_FRONT_GLOW = new CustomIcon("iconsets/OVERLAY_FRONT_PLANETARYSIPHON_GLOW");
SIPHON_OVERLAY_FRONT_ACTIVE_GLOW = new CustomIcon("iconsets/OVERLAY_FRONT_PLANETARYSIPHON_ACTIVE_GLOW");

DYSON_OVERLAY_FRONT = TextureFactory.of(new CustomIcon("iconsets/OVERLAY_FRONT_DYSONSPHERE"));
DYSON_OVERLAY_FRONT_ACTIVE = TextureFactory.of(new CustomIcon("iconsets/OVERLAY_FRONT_DYSONSPHERE_ACTIVE"));
DYSON_OVERLAY_FRONT_GLOW = new CustomIcon("iconsets/OVERLAY_FRONT_DYSONSPHERE_GLOW");
DYSON_OVERLAY_FRONT_ACTIVE_GLOW = new CustomIcon("iconsets/OVERLAY_FRONT_DYSONSPHERE_ACTIVE_GLOW");

BlockIcons.setCasingTextureForId(CASING_INDEX_RECEIVER, TextureFactory.of(IGBlocks.DysonSwarmCasing, 0));
BlockIcons.setCasingTextureForId(CASING_INDEX_LAUNCH, TextureFactory.of(IGBlocks.DysonSwarmCasing, 2));
BlockIcons.setCasingTextureForId(CASING_INDEX_COMMAND, TextureFactory.of(IGBlocks.DysonSwarmCasing, 5));
BlockIcons.setCasingTextureForId(CASING_INDEX_FLOOR, TextureFactory.of(IGBlocks.DysonSwarmCasing, 9));
BlockIcons.setCasingTextureForId(CASING_INDEX_SIPHON, TextureFactory.of(IGBlocks.GasSiphonCasing));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import com.gtnewhorizon.gtnhlib.client.tooltip.LoreHandler;
import com.gtnewhorizons.gtnhintergalactic.item.IGItems;
import com.gtnewhorizons.gtnhintergalactic.tile.multi.TileEntityDysonSwarm;
import com.gtnewhorizons.gtnhintergalactic.tile.multi.TileEntityPlanetaryGasSiphon;
import com.gtnewhorizons.gtnhintergalactic.tile.multi.elevator.TileEntitySpaceElevator;

Expand All @@ -21,6 +22,7 @@ public class TooltipUtil {
*/
public static void postInit() {
LoreHandler.registerLoreHolder(TileEntityPlanetaryGasSiphon.class);
LoreHandler.registerLoreHolder(TileEntityDysonSwarm.class);
LoreHandler.registerLoreHolder(TileEntitySpaceElevator.class);

Supplier<String> AUTHOR_GLOWREDMAN = chain(
Expand Down Expand Up @@ -52,5 +54,6 @@ public static void postInit() {
DARK_BLUE + OBFUSCATED));

addItemTooltip(IGItems.PlanetaryGasSiphon, AUTHOR_GLOWREDMAN);
addItemTooltip(IGItems.DysonSwarmController, AUTHOR_GLOWREDMAN);
}
}
Loading

0 comments on commit 3b570fc

Please sign in to comment.