Skip to content

Commit

Permalink
Merge branch 'master' into refactor/packets
Browse files Browse the repository at this point in the history
  • Loading branch information
boubou19 committed Sep 28, 2024
2 parents f4d818b + 86f1765 commit 55be6a1
Show file tree
Hide file tree
Showing 116 changed files with 412 additions and 1,528 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import net.minecraft.command.ICommandSender;
import net.minecraft.util.ChatComponentText;

import bartworks.hooks.BWCoreStaticReplacementMethodes;
import gregtech.mixin.hooks.BWCoreStaticReplacementMethodes;

public class ClearCraftingCache extends CommandBase {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
Expand Down Expand Up @@ -435,7 +434,7 @@ public boolean supportsVoidProtection() {

@SideOnly(Side.CLIENT)
@Override
protected ResourceLocation getActivitySoundLoop() {
return SoundResource.GT_MACHINES_MEGA_BLAST_FURNACE_LOOP.resourceLocation;
protected SoundResource getActivitySoundLoop() {
return SoundResource.GT_MACHINES_MEGA_BLAST_FURNACE_LOOP;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
Expand Down Expand Up @@ -537,7 +536,7 @@ public boolean supportsVoidProtection() {

@SideOnly(Side.CLIENT)
@Override
protected ResourceLocation getActivitySoundLoop() {
return SoundResource.GT_MACHINES_MULTI_MEGA_VACUUM_FREEZER_LOOP.resourceLocation;
protected SoundResource getActivitySoundLoop() {
return SoundResource.GT_MACHINES_MULTI_MEGA_VACUUM_FREEZER_LOOP;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@

import bartworks.API.recipe.BWNBTDependantCraftingRecipe;
import bartworks.API.recipe.BartWorksRecipeMaps;
import bartworks.hooks.BWCoreStaticReplacementMethodes;
import bartworks.system.material.WerkstoffLoader;
import bartworks.util.BWUtil;
import bartworks.util.Pair;
Expand All @@ -48,6 +47,7 @@
import gregtech.api.util.GTOreDictUnificator;
import gregtech.api.util.GTRecipe;
import gregtech.api.util.GTUtility;
import gregtech.mixin.hooks.BWCoreStaticReplacementMethodes;

public class CircuitImprintLoader {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@
import gregtech.api.enums.Materials;
import gregtech.api.enums.OrePrefixes;
import gregtech.api.enums.TierEU;
import gregtech.api.interfaces.IRecipeMutableAccess;
import gregtech.api.interfaces.ISubTagContainer;
import gregtech.api.items.GTGenericBlock;
import gregtech.api.items.GTGenericItem;
Expand All @@ -123,6 +122,7 @@
import gregtech.api.util.GTRecipe;
import gregtech.api.util.GTUtility;
import gregtech.common.blocks.BlockOresAbstract;
import gregtech.mixin.interfaces.accessors.IRecipeMutableAccess;
import gtPlusPlus.core.block.base.BlockBaseModular;
import gtPlusPlus.core.item.base.BaseItemComponent;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import gregtech.api.recipe.check.SimpleCheckRecipeResult;
import gregtech.api.render.TextureFactory;
import gregtech.api.util.MultiblockTooltipBuilder;
import gregtech.api.util.OverclockCalculator;
import tectech.thing.metaTileEntity.hatch.MTEHatchEnergyMulti;
import tectech.thing.metaTileEntity.multi.base.TTMultiblockBase;
import thaumcraft.api.aspects.Aspect;
Expand Down Expand Up @@ -363,14 +364,18 @@ protected void runMachine(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
this.drainNodePower(WORLD, x, y, z);
this.nodePower -= expectedPower();

calculatePerfectOverclockedNessMulti(
RECIPE_EUT,
(int) Math.ceil(this.mOutputAspects.visSize() * RECIPE_DURATION * (1 - this.nodeIncrease * 0.005)),
1,
Math.min(Integer.MAX_VALUE, getMaxInputEnergy_EM()));
OverclockCalculator calculator = new OverclockCalculator().setRecipeEUt(RECIPE_EUT)
.setEUt(getMaxInputEu())
.setDuration(
(int) Math.ceil(this.mOutputAspects.visSize() * RECIPE_DURATION * (1 - this.nodeIncrease * 0.005)))
.setDurationDecreasePerOC(4)
.calculate();

useLongPower = true;
lEUt = -calculator.getConsumption();
mMaxProgresstime = calculator.getDuration();

this.updateSlots();
if (this.mEUt > 0) this.mEUt = -this.mEUt;
return CheckRecipeResultRegistry.SUCCESSFUL;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
Expand Down Expand Up @@ -534,8 +533,8 @@ public void getWailaBody(ItemStack itemStack, List<String> currentTip, IWailaDat

@SideOnly(Side.CLIENT)
@Override
protected ResourceLocation getActivitySoundLoop() {
return SoundResource.GT_MACHINES_MULTI_PRECISE_LOOP.resourceLocation;
protected SoundResource getActivitySoundLoop() {
return SoundResource.GT_MACHINES_MULTI_PRECISE_LOOP;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import net.minecraft.world.ChunkCoordIntPair;
import net.minecraftforge.common.util.ForgeDirection;
Expand Down Expand Up @@ -358,7 +357,7 @@ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
.setErrorDisplayID((aBaseMetaTileEntity.getErrorDisplayID() & ~127) | (mMachine ? 0 : 64));
aBaseMetaTileEntity.setActive(mMaxProgresstime > 0);
} else {
soundMagic(getActivitySoundLoop());
doActivitySound(getActivitySoundLoop());
}
}

Expand Down Expand Up @@ -570,8 +569,8 @@ public boolean explodesOnComponentBreak(ItemStack aStack) {

@SideOnly(Side.CLIENT)
@Override
protected ResourceLocation getActivitySoundLoop() {
return SoundResource.GT_MACHINES_FUSION_LOOP.resourceLocation;
protected SoundResource getActivitySoundLoop() {
return SoundResource.GT_MACHINES_FUSION_LOOP;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,14 @@
import gregtech.api.enums.Mods;
import gregtech.api.enums.OrePrefixes;
import gregtech.api.enums.TierEU;
import gregtech.api.interfaces.IRecipeMutableAccess;
import gregtech.api.recipe.RecipeMaps;
import gregtech.api.util.GTLog;
import gregtech.api.util.GTOreDictUnificator;
import gregtech.api.util.GTRecipe;
import gregtech.api.util.GTUtility;
import gregtech.common.items.CombType;
import gregtech.loaders.misc.GTBees;
import gregtech.mixin.interfaces.accessors.IRecipeMutableAccess;
import gtPlusPlus.api.recipe.GTPPRecipeMaps;
import gtPlusPlus.core.item.chemistry.GenericChem;

Expand Down
16 changes: 15 additions & 1 deletion src/main/java/gregtech/api/enums/SoundResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import static gregtech.api.enums.Mods.GregTech;
import static gregtech.api.enums.Mods.IndustrialCraft2;
import static gregtech.api.enums.Mods.TecTech;

import java.util.EnumSet;
import java.util.Locale;
Expand Down Expand Up @@ -100,6 +101,10 @@ public enum SoundResource {
GT_MACHINES_QUANTUM_FORCE_TRANSFORMER_LOOP(264, GregTech.ID, "machines.MTEQuantumForceTransformer"),
GT_MACHINES_ADV_EBF_LOOP(265, GregTech.ID, "machines.MTEAdvEBF"),
GT_MACHINES_LARGE_TURBINES_LOOP(266, GregTech.ID, "machines.MTELargeTurbine"),
TECTECH_MACHINES_FX_LOW_FREQ(267, TecTech.ID, "fx_lo_freq"),
TECTECH_MACHINES_FX_HIGH_FREQ(268, TecTech.ID, "fx_hi_freq"),
TECTECH_MACHINES_NOISE(269, TecTech.ID, "fx_noise"),
TECTECH_MACHINES_FX_WHOOUM(270, TecTech.ID, "fx_whooum"),

GUI_BUTTON_DOWN(-1, GregTech.ID, "gui.buttonDown"),
GUI_BUTTON_UP(-1, GregTech.ID, "gui.buttonUp"),
Expand Down Expand Up @@ -346,7 +351,16 @@ public enum SoundResource {

static {
EnumSet.allOf(SoundResource.class)
.forEach(sound -> { if (sound.id >= 0) ID_SOUND_MAP.put(sound.id, sound); });
.forEach(sound -> {
if (sound.id < 0) {
return;
}

if (ID_SOUND_MAP.containsKey(sound.id)) {
throw new IllegalStateException(String.format("Sound ID %s is already occupied!", sound.id));
}
ID_SOUND_MAP.put(sound.id, sound);
});
EnumSet.allOf(SoundResource.class)
.forEach(sound -> RESOURCE_STR_SOUND_MAP.put(sound.resourceLocation.toString(), sound));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import net.minecraftforge.common.util.Constants;
Expand Down Expand Up @@ -677,10 +676,14 @@ public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) {
}

@SideOnly(Side.CLIENT)
protected void doActivitySound(ResourceLocation activitySound) {
protected void doActivitySound(SoundResource activitySound) {
if (getBaseMetaTileEntity().isActive() && activitySound != null) {
if (activitySoundLoop == null) {
activitySoundLoop = new GTSoundLoop(activitySound, getBaseMetaTileEntity(), false, true);
activitySoundLoop = new GTSoundLoop(
activitySound.resourceLocation,
getBaseMetaTileEntity(),
false,
true);
Minecraft.getMinecraft()
.getSoundHandler()
.playSound(activitySoundLoop);
Expand Down Expand Up @@ -710,7 +713,7 @@ protected SoundResource getProcessStartSound() {
* @return Sound that will be looped for as long as the machine is doing a recipe
*/
@SideOnly(Side.CLIENT)
protected ResourceLocation getActivitySoundLoop() {
protected SoundResource getActivitySoundLoop() {
return null;
}

Expand Down
17 changes: 3 additions & 14 deletions src/main/java/gregtech/api/util/GTRecipeRegistrator.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import static gregtech.api.util.GTUtility.calculateRecipeEU;
import static gregtech.api.util.GTUtility.getTier;

import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.IdentityHashMap;
Expand All @@ -53,7 +52,6 @@
import com.google.common.collect.ImmutableList;
import com.google.common.collect.SetMultimap;

import cpw.mods.fml.relauncher.ReflectionHelper;
import gregtech.api.GregTechAPI;
import gregtech.api.enums.GTValues;
import gregtech.api.enums.Materials;
Expand All @@ -63,6 +61,7 @@
import gregtech.api.objects.ItemData;
import gregtech.api.objects.MaterialStack;
import gregtech.api.recipe.RecipeCategories;
import gregtech.mixin.interfaces.accessors.ShapedOreRecipeAccessor;
import ic2.api.reactor.IReactorComponent;

/**
Expand Down Expand Up @@ -123,8 +122,6 @@ public class GTRecipeRegistrator {
new RecipeShape(null, sMt1, null, sMt1, null, null, null, null, null),
new RecipeShape(sMt1, sMt1, null, sMt2, null, sMt1, sMt2, null, null),
new RecipeShape(null, sMt1, sMt1, sMt1, null, sMt2, null, null, sMt2) };
public static final Field SHAPED_ORE_RECIPE_WIDTH = ReflectionHelper.findField(ShapedOreRecipe.class, "width");
public static final Field SHAPED_ORE_RECIPE_HEIGHT = ReflectionHelper.findField(ShapedOreRecipe.class, "height");
private static volatile Map<RecipeShape, List<IRecipe>> indexedRecipeListCache;
private static final String[][] sShapesA = new String[][] { null, null, null,
{ "Helmet", s_P + s_P + s_P, s_P + s_H + s_P },
Expand Down Expand Up @@ -791,19 +788,11 @@ public static boolean hasVanillaRecipes(Materials materials) {
}

private static int getRecipeWidth(ShapedOreRecipe r) {
try {
return (int) SHAPED_ORE_RECIPE_WIDTH.get(r);
} catch (ReflectiveOperationException e) {
throw new RuntimeException(e);
}
return ((ShapedOreRecipeAccessor) r).gt5u$getWidth();
}

private static int getRecipeHeight(ShapedOreRecipe r) {
try {
return (int) SHAPED_ORE_RECIPE_HEIGHT.get(r);
} catch (ReflectiveOperationException e) {
throw new RuntimeException(e);
}
return ((ShapedOreRecipeAccessor) r).gt5u$getHeight();
}

private static int getRecipeHeight(ShapedRecipes r) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
Expand Down Expand Up @@ -402,7 +401,7 @@ public boolean supportsBatchMode() {

@SideOnly(Side.CLIENT)
@Override
protected ResourceLocation getActivitySoundLoop() {
return SoundResource.GT_MACHINES_EBF_LOOP.resourceLocation;
protected SoundResource getActivitySoundLoop() {
return SoundResource.GT_MACHINES_EBF_LOOP;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
Expand Down Expand Up @@ -546,8 +545,8 @@ public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBu

@SideOnly(Side.CLIENT)
@Override
protected ResourceLocation getActivitySoundLoop() {
return SoundResource.GT_MACHINES_FUSION_LOOP.resourceLocation;
protected SoundResource getActivitySoundLoop() {
return SoundResource.GT_MACHINES_FUSION_LOOP;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.common.util.ForgeDirection;
Expand Down Expand Up @@ -479,7 +478,7 @@ public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBu

@SideOnly(Side.CLIENT)
@Override
protected ResourceLocation getActivitySoundLoop() {
return SoundResource.GT_MACHINES_LARGE_TURBINES_LOOP.resourceLocation;
protected SoundResource getActivitySoundLoop() {
return SoundResource.GT_MACHINES_LARGE_TURBINES_LOOP;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
Expand Down Expand Up @@ -301,8 +300,8 @@ public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBu

@SideOnly(Side.CLIENT)
@Override
protected ResourceLocation getActivitySoundLoop() {
return SoundResource.GT_MACHINES_MULTI_AUTOCLAVE_LOOP.resourceLocation;
protected SoundResource getActivitySoundLoop() {
return SoundResource.GT_MACHINES_MULTI_AUTOCLAVE_LOOP;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
Expand Down Expand Up @@ -287,8 +286,8 @@ public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBu

@SideOnly(Side.CLIENT)
@Override
protected ResourceLocation getActivitySoundLoop() {
return SoundResource.GT_MACHINES_MULTI_LATHE_LOOP.resourceLocation;
protected SoundResource getActivitySoundLoop() {
return SoundResource.GT_MACHINES_MULTI_LATHE_LOOP;
}

private int mCasingAmount;
Expand Down
Loading

0 comments on commit 55be6a1

Please sign in to comment.