Skip to content

Commit

Permalink
Refactoring GT++ 2025-02-12 (#3937)
Browse files Browse the repository at this point in the history
Co-authored-by: Martin Robertz <[email protected]>
  • Loading branch information
serenibyss and Dream-Master authored Feb 14, 2025
1 parent 2d8f485 commit 197c082
Show file tree
Hide file tree
Showing 21 changed files with 560 additions and 491 deletions.
18 changes: 5 additions & 13 deletions src/main/java/gregtech/api/recipe/RecipeMaps.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import java.util.Optional;

import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;

Expand Down Expand Up @@ -87,8 +86,7 @@
import gregtech.nei.formatter.FusionSpecialValueFormatter;
import gregtech.nei.formatter.HeatingCoilSpecialValueFormatter;
import gregtech.nei.formatter.SimpleSpecialValueFormatter;
import gtPlusPlus.core.block.ModBlocks;
import gtPlusPlus.core.item.ModItems;
import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList;
import mods.railcraft.common.blocks.aesthetics.cube.EnumCube;
import mods.railcraft.common.items.RailcraftToolItems;
import tectech.thing.CustomItemList;
Expand Down Expand Up @@ -649,8 +647,8 @@ public final class RecipeMaps {
.setOutputs(aOutput1, aOutput2, Materials.Ash.getDustTiny(aCoalAmount / 2))
.setDuration(aDuration * 2 / 3);
}
ItemStack cactusCoke = new ItemStack(ModItems.itemCactusCoke, aCoalAmount * 2);
ItemStack sugarCoke = new ItemStack(ModItems.itemSugarCoke, aCoalAmount * 2);
ItemStack cactusCoke = GregtechItemList.CactusCoke.get(aCoalAmount * 2L);
ItemStack sugarCoke = GregtechItemList.SugarCoke.get(aCoalAmount * 2L);
coll.derive()
.setInputs(aInput1, aInput2, cactusCoke)
.setOutputs(aOutput1, aOutput2, Materials.Ash.getDustTiny(aCoalAmount * 2))
Expand Down Expand Up @@ -679,14 +677,8 @@ public final class RecipeMaps {
.setOutputs(aOutput1, aOutput2, Materials.Ash.getDust(aCoalAmount / 2))
.setDuration(aDuration * 20 / 3);
}
ItemStack cactusCokeBlock = new ItemStack(
Item.getItemFromBlock(ModBlocks.blockCactusCoke),
aCoalAmount * 2,
0);
ItemStack sugarCokeBlock = new ItemStack(
Item.getItemFromBlock(ModBlocks.blockSugarCoke),
aCoalAmount * 2,
0);
ItemStack cactusCokeBlock = GregtechItemList.BlockCactusCoke.get(aCoalAmount * 2L);
ItemStack sugarCokeBlock = GregtechItemList.BlockSugarCoke.get(aCoalAmount * 2L);
coll.derive()
.setInputs(aInput1, aInput2, cactusCokeBlock)
.setOutputs(aOutput1, aOutput2, Materials.Ash.getDust(aCoalAmount * 2))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import static gregtech.api.util.GTRecipeConstants.NANO_FORGE_TIER;
import static gregtech.api.util.GTRecipeConstants.RESEARCH_ITEM;
import static gregtech.api.util.GTRecipeConstants.SCANNING;
import static gtPlusPlus.core.block.ModBlocks.blockCompressedObsidian;

import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.Fluid;
Expand Down Expand Up @@ -129,8 +128,7 @@ public static void run() {
GTValues.RA.stdBuilder()
.itemInputs(
aUEVTierLens,
new ItemStack(blockCompressedObsidian, 8, 7), // Double compressed glowstone blocks (yes,
// it's not obsidian)
GregtechItemList.DoubleCompressedGlowstone.get(8),
ItemList.Circuit_Chip_SoC2.get(64))
.itemOutputs(Materials.Glowstone.getNanite(64))
.fluidInputs(Materials.UUMatter.getFluid(50_000))
Expand Down
82 changes: 53 additions & 29 deletions src/main/java/gtPlusPlus/core/block/ModBlocks.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package gtPlusPlus.core.block;

import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.Fluid;

import gtPlusPlus.api.objects.Logger;
Expand All @@ -23,13 +24,13 @@
import gtPlusPlus.core.block.machine.BlockProjectTable;
import gtPlusPlus.core.block.machine.BlockSuperJukebox;
import gtPlusPlus.core.fluids.FluidRegistryHandler;
import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList;

public final class ModBlocks {

public static Block blockCircuitProgrammer;
public static Block blockVolumetricFlaskSetter;

public static Block blockFishTrap;
public static Block blockDecayablesChest;

public static Block blockCasingsMisc;
Expand All @@ -49,25 +50,14 @@ public final class ModBlocks {
public static Fluid fluidSludge = new Fluid("fluid.sludge");
public static Block blockFluidSludge;

public static Block blockMiningExplosive;

public static Block blockHellfire;
public static Block blockInfiniteFLuidTank;
public static Block blockProjectTable;
public static Block blockWitherGuard;
public static Block blockCompressedObsidian;

public static Block blockCactusCharcoal;
public static Block blockCactusCoke;
public static Block blockSugarCharcoal;
public static Block blockSugarCoke;

public static Block blockCustomJukebox;

public static Block blockPooCollector;

public static Block blockPestKiller;

public static void init() {
Logger.INFO("Initializing Blocks.");

Expand All @@ -82,31 +72,65 @@ public static void registerBlocks() {
// Fluids
FluidRegistryHandler.registerFluids();

// Workbench
blockFishTrap = new BlockFishTrap();
GregtechItemList.FishTrap.set(new ItemStack(new BlockFishTrap()));
blockInfiniteFLuidTank = new BlockFluidTankInfinite();
blockMiningExplosive = new BlockMiningExplosives();
GregtechItemList.MiningExplosives.set(new ItemStack(new BlockMiningExplosives()));
blockHellfire = new BlockHellFire();
blockProjectTable = new BlockProjectTable();
blockWitherGuard = new BlockWitherProof();
blockCompressedObsidian = new BlockCompressedObsidian();

blockCactusCharcoal = new BlockCactusCharcoal();
blockCactusCoke = new BlockCactusCoke();
blockSugarCharcoal = new BlockSugarCharcoal();
blockSugarCoke = new BlockSugarCoke();

GregtechItemList.WitherGuard.set(new ItemStack(new BlockWitherProof()));
blockCircuitProgrammer = new BlockCircuitProgrammer();

blockDecayablesChest = new BlockDecayablesChest();

blockCustomJukebox = new BlockSuperJukebox();

blockPooCollector = new BlockPooCollector();

blockPestKiller = new BlockPestKiller();

GregtechItemList.PestKiller.set(new ItemStack(new BlockPestKiller()));
blockVolumetricFlaskSetter = new BlockFlaskSetter();

// Compressed Blocks
Block cactusCharcoal = new BlockCactusCharcoal();
GregtechItemList.BlockCactusCharcoal.set(new ItemStack(cactusCharcoal));
GregtechItemList.CompressedCactusCharcoal.set(new ItemStack(cactusCharcoal, 1, 1));
GregtechItemList.DoubleCompressedCactusCharcoal.set(new ItemStack(cactusCharcoal, 1, 2));
GregtechItemList.TripleCompressedCactusCharcoal.set(new ItemStack(cactusCharcoal, 1, 3));
GregtechItemList.QuadrupleCompressedCactusCharcoal.set(new ItemStack(cactusCharcoal, 1, 4));
GregtechItemList.QuintupleCompressedCactusCharcoal.set(new ItemStack(cactusCharcoal, 1, 5));

Block cactusCoke = new BlockCactusCoke();
GregtechItemList.BlockCactusCoke.set(new ItemStack(cactusCoke));
GregtechItemList.CompressedCactusCoke.set(new ItemStack(cactusCoke, 1, 1));
GregtechItemList.DoubleCompressedCactusCoke.set(new ItemStack(cactusCoke, 1, 2));
GregtechItemList.TripleCompressedCactusCoke.set(new ItemStack(cactusCoke, 1, 3));
GregtechItemList.QuadrupleCompressedCactusCoke.set(new ItemStack(cactusCoke, 1, 4));
GregtechItemList.QuintupleCompressedCactusCoke.set(new ItemStack(cactusCoke, 1, 5));

Block sugarCharcoal = new BlockSugarCharcoal();
GregtechItemList.BlockSugarCharcoal.set(new ItemStack(sugarCharcoal));
GregtechItemList.CompressedSugarCharcoal.set(new ItemStack(sugarCharcoal, 1, 1));
GregtechItemList.DoubleCompressedSugarCharcoal.set(new ItemStack(sugarCharcoal, 1, 2));
GregtechItemList.TripleCompressedSugarCharcoal.set(new ItemStack(sugarCharcoal, 1, 3));
GregtechItemList.QuadrupleCompressedSugarCharcoal.set(new ItemStack(sugarCharcoal, 1, 4));
GregtechItemList.QuintupleCompressedSugarCharcoal.set(new ItemStack(sugarCharcoal, 1, 5));

Block sugarCoke = new BlockSugarCoke();
GregtechItemList.BlockSugarCoke.set(new ItemStack(sugarCoke));
GregtechItemList.CompressedSugarCoke.set(new ItemStack(sugarCoke, 1, 1));
GregtechItemList.DoubleCompressedSugarCoke.set(new ItemStack(sugarCoke, 1, 2));
GregtechItemList.TripleCompressedSugarCoke.set(new ItemStack(sugarCoke, 1, 3));
GregtechItemList.QuadrupleCompressedSugarCoke.set(new ItemStack(sugarCoke, 1, 4));
GregtechItemList.QuintupleCompressedSugarCoke.set(new ItemStack(sugarCoke, 1, 5));

Block compressedObsidian = new BlockCompressedObsidian();
GregtechItemList.CompressedObsidian.set(new ItemStack(compressedObsidian));
GregtechItemList.DoubleCompressedObsidian.set(new ItemStack(compressedObsidian, 1, 1));
GregtechItemList.TripleCompressedObsidian.set(new ItemStack(compressedObsidian, 1, 2));
GregtechItemList.QuadrupleCompressedObsidian.set(new ItemStack(compressedObsidian, 1, 3));
GregtechItemList.QuintupleCompressedObsidian.set(new ItemStack(compressedObsidian, 1, 4));
GregtechItemList.InvertedObsidian.set(new ItemStack(compressedObsidian, 1, 5));

// Compressed Glowstone shares the block with Compressed Obsidian
GregtechItemList.CompressedGlowstone.set(new ItemStack(compressedObsidian, 1, 6));
GregtechItemList.DoubleCompressedGlowstone.set(new ItemStack(compressedObsidian, 1, 7));
GregtechItemList.TripleCompressedGlowstone.set(new ItemStack(compressedObsidian, 1, 8));
GregtechItemList.QuadrupleCompressedGlowstone.set(new ItemStack(compressedObsidian, 1, 9));
GregtechItemList.QuintupleCompressedGlowstone.set(new ItemStack(compressedObsidian, 1, 10));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.block.ModBlocks;
import gtPlusPlus.core.entity.EntityPrimedMiningExplosive;
import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList;

@SideOnly(Side.CLIENT)
public class RenderMiningExplosivesPrimed extends RenderTNTPrimed {
Expand Down Expand Up @@ -56,15 +56,16 @@ public void doRender(final EntityPrimedMiningExplosive entity, final double p_76

f2 = (1.0F - (((entity.fuse - p_76986_9_) + 1.0F) / 100.0F)) * 0.8F;
this.bindEntityTexture(entity);
this.blockRenderer.renderBlockAsItem(ModBlocks.blockMiningExplosive, 0, entity.getBrightness(p_76986_9_));
this.blockRenderer
.renderBlockAsItem(GregtechItemList.MiningExplosives.getBlock(), 0, entity.getBrightness(p_76986_9_));

if (((entity.fuse / 5) % 2) == 0) {
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_DST_ALPHA);
GL11.glColor4f(1.0F, 1.0F, 1.0F, f2);
this.blockRenderer.renderBlockAsItem(ModBlocks.blockMiningExplosive, 0, 1.0F);
this.blockRenderer.renderBlockAsItem(GregtechItemList.MiningExplosives.getBlock(), 0, 1.0F);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_LIGHTING);
Expand Down
7 changes: 1 addition & 6 deletions src/main/java/gtPlusPlus/core/common/CommonProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

import baubles.common.container.InventoryBaubles;
import baubles.common.lib.PlayerHandler;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.IFuelHandler;
import cpw.mods.fml.common.Optional;
import cpw.mods.fml.common.event.FMLInitializationEvent;
Expand Down Expand Up @@ -88,11 +87,7 @@ public void init(final FMLInitializationEvent e) {
}
// Handles Sleep Benefits
PlayerSleepEventHandler.init();
// Handles Magic Feather
MinecraftForge.EVENT_BUS.register(ModItems.itemMagicFeather);
FMLCommonHandler.instance()
.bus()
.register(ModItems.itemMagicFeather);

MinecraftForge.EVENT_BUS.register(new EnderDragonDeathHandler());
MinecraftForge.EVENT_BUS.register(new EntityDeathHandler());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;

import gtPlusPlus.core.block.ModBlocks;
import gtPlusPlus.core.inventories.InventoryFishTrap;
import gtPlusPlus.core.slots.SlotNoInput;
import gtPlusPlus.core.tileentities.general.TileEntityFishTrap;
import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList;

public class ContainerFishTrap extends Container {

Expand Down Expand Up @@ -85,7 +85,7 @@ public void onContainerClosed(final EntityPlayer par1EntityPlayer) {

@Override
public boolean canInteractWith(final EntityPlayer par1EntityPlayer) {
if (this.worldObj.getBlock(this.posX, this.posY, this.posZ) != ModBlocks.blockFishTrap) {
if (this.worldObj.getBlock(this.posX, this.posY, this.posZ) != GregtechItemList.FishTrap.getBlock()) {
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import gtPlusPlus.core.block.ModBlocks;
import gtPlusPlus.core.inventories.InventoryPestKiller;
import gtPlusPlus.core.slots.SlotGeneric;
import gtPlusPlus.core.slots.SlotNoInput;
import gtPlusPlus.core.tileentities.machines.TileEntityPestKiller;
import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList;

public class ContainerPestKiller extends Container {

Expand Down Expand Up @@ -99,7 +99,7 @@ public void onContainerClosed(final EntityPlayer par1EntityPlayer) {

@Override
public boolean canInteractWith(final EntityPlayer par1EntityPlayer) {
if (this.worldObj.getBlock(this.posX, this.posY, this.posZ) != ModBlocks.blockPestKiller) {
if (this.worldObj.getBlock(this.posX, this.posY, this.posZ) != GregtechItemList.PestKiller.getBlock()) {
return false;
}
return par1EntityPlayer.getDistanceSq(this.posX + 0.5D, this.posY + 0.5D, this.posZ + 0.5D) <= 64D;
Expand Down
17 changes: 2 additions & 15 deletions src/main/java/gtPlusPlus/core/handler/AchievementHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import gregtech.api.enums.Materials;
import gregtech.api.util.GTLog;
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.block.ModBlocks;
import gtPlusPlus.core.item.ModItems;
import gtPlusPlus.core.lib.GTPPCore;
import gtPlusPlus.core.material.MaterialsAlloy;
Expand Down Expand Up @@ -87,20 +86,8 @@ public AchievementHandler() {
true);

// Blocks
this.registerAchievement(
"block.fishtrap",
-2,
2,
ItemUtils.getSimpleStack(ModBlocks.blockFishTrap),
"dust.potin",
false);
this.registerAchievement(
"block.withercage",
-2,
4,
ItemUtils.getSimpleStack(ModBlocks.blockWitherGuard),
"dust.eglin",
false);
this.registerAchievement("block.fishtrap", -2, 2, GregtechItemList.FishTrap.get(1), "dust.potin", false);
this.registerAchievement("block.withercage", -2, 4, GregtechItemList.WitherGuard.get(1), "dust.eglin", false);

// Machines (-10/-8/-6)
this.registerAchievement("rtg", -16, -10, GregtechItemList.RTG.get(1), aBaseAchievementName, false);
Expand Down
Loading

0 comments on commit 197c082

Please sign in to comment.