Skip to content

Commit

Permalink
Merge pull request #803 from ByThePowerOfScience/dev/1.12.2
Browse files Browse the repository at this point in the history
Roots 3.1.8 Patches
  • Loading branch information
ByThePowerOfScience authored Oct 27, 2023
2 parents ff7af25 + fe79284 commit 67ae488
Show file tree
Hide file tree
Showing 15 changed files with 139 additions and 58 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,3 @@ eiostore.jks
build\.sh

spells/
python/
119 changes: 79 additions & 40 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@ buildscript {
}
}
dependencies {
classpath("net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT") {
classpath("net.minecraftforge.gradle:ForgeGradle:3.+") {
changing = true
}
}
}

apply plugin: "net.minecraftforge.gradle.forge"
apply plugin: "net.minecraftforge.gradle"
apply plugin: 'idea'

version = "${minecraft_version}-${mod_version}"
group = "epicsquid.roots"
Expand All @@ -25,49 +26,82 @@ compileJava {
sourceCompatibility = targetCompatibility = '1.8'
}

runClient {
args "--username=Dev"
}

minecraft {
version = "1.12.2-14.23.5.2847"
runDir = "run"

mappings = "stable_39"
mappings channel: 'stable', version: '39-1.12'

replace "@VERSION@", project.version
replaceIn "Roots.java"
replace "after:maindependencies", project.depends


// Scala: not even once
replace 'scala.actors.threadpool.Arrays', 'java.util.Arrays'
accessTransformer = file('src/main/resources/META-INF/roots_at.cfg')
runs {
client {
workingDirectory project.file('run')

args '--username=Dev'

property 'forge.logging.markers', 'REGISTRIES'

property 'forge.logging.console.level', 'debug'


mods {
roots {
source sourceSets.main
}
}
}

server {
workingDirectory project.file('run')

property 'forge.logging.markers', 'REGISTRIES'

property 'forge.logging.console.level', 'debug'

mods {
roots {
source sourceSets.main
}
}
}
}
}


dependencies {
deobfCompile 'curse.maven:MysticalWorld-282940:3460961'
deobfCompile 'curse.maven:MysticalLib-277064:3483816'
deobfCompile 'curse.maven:SimpleHarvest-240783:2897811'
deobfCompile "vazkii.patchouli:Patchouli:${patchouli_version}"
minecraft 'net.minecraftforge:forge:1.12.2-14.23.5.2860'

compile("CraftTweaker2:CraftTweaker2-MC1120-Main:1.12-${ct_version}") {
exclude group: 'mezz.jei'
implementation fg.deobf('curse.maven:MysticalWorld-282940:3460961')
implementation fg.deobf('curse.maven:MysticalLib-277064:3483816')
compileOnly fg.deobf('curse.maven:JustEnoughResources-240630:2728585') {
exclude group: "mezz.jei"
}
implementation fg.deobf('curse.maven:SimpleHarvest-240783:2897811')

implementation "vazkii.patchouli:Patchouli:${patchouli_version}"
compileOnly fg.deobf("curse.maven:Baubles-227083:2518667")

compileOnly fg.deobf("mezz.jei:jei_${minecraft_version}:${jei_version}")

compileOnly fg.deobf("CraftTweaker2:CraftTweaker2-MC1120-Main:1.12-${ct_version}")
compileOnly fg.deobf("CraftTweaker2:CraftTweaker2-API:4.+")
compileOnly "CraftTweaker2:ZenScript:4.0.+"

deobfProvided('curse.maven:JustEnoughResources-240630:2728585') {
exclude group: 'mezz.jei'

compileOnly(fg.deobf("vazkii.botania:Botania:${botania_version}")) {
exclude group: "mezz.jei"
}
deobfProvided "curse.maven:Baubles-227083:2518667"
deobfProvided "mezz.jei:jei_${minecraft_version}:${jei_version}"
deobfProvided("vazkii.botania:Botania:${botania_version}") {
exclude group: 'mezz.jei'

compileOnly fg.deobf("curse.maven:Thaumcraft6-223628:2629023")

compileOnly(fg.deobf("curse.maven:Hwyla-253449:2568751")) {
exclude group: "mezz.jei"
}
deobfProvided "curse.maven:Thaumcraft6-223628:2629023"
deobfProvided "curse.maven:Hwyla-253449:2568751"
deobfProvided "mcjty.theoneprobe:TheOneProbe-${top_version}"
compileOnly fg.deobf("mcjty.theoneprobe:TheOneProbe-${top_version}")
}

project.configurations.all {
exclude(group: 'net.minecraftforge', module: 'mergetool')
}


repositories {
mavenLocal()
maven {
Expand Down Expand Up @@ -105,42 +139,47 @@ repositories {

jar {
manifest {
attributes 'FMLAT': 'roots_at.cfg'
attributes(
'FMLAT': 'roots_at.cfg',
)
}
exclude("net/**")
}


processResources {
// this will ensure that this task is redone when the versions change.
inputs.property "version", project.version
inputs.property "mcversion", project.minecraft.version
inputs.property "mcversion", project.minecraft_version

duplicatesStrategy = DuplicatesStrategy.EXCLUDE

// replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'

// replace version and mcversion
expand 'version':project.version, 'mcversion':project.minecraft.version
expand 'version':project.version, 'mcversion':project.minecraft_version
}

// copy everything else except the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}

rename '(.+_at.cfg)', 'META-INF/$1'
rename '(.+_at.cfg)', '../$1' // it keeps putting it in /META-INF/META-INF/roots_at.cfg fsr?????
}


idea {
module {
inheritOutputDirs = true
downloadSources = false
downloadJavadoc = true
}
}
/*
sourceSets {
main.output.resourcesDir = main.java.outputDir
}*/
}

task generateModpackZip(type: Exec, group: 'buildruns') {
commandLine("python3", "./python/CustomRunClient.py")
Expand All @@ -158,4 +197,4 @@ task updateCFModpack(type: Exec, group: 'buildruns') {

task copyTestZS(type: Copy) {
from "./" include "Test.zs" into "./run/scripts"
}
}
Empty file removed gradle/wrapper/gradle-wrapper.jar
Empty file.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
18 changes: 15 additions & 3 deletions src/main/java/epicsquid/roots/EventManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.GameType;
import net.minecraft.world.Teleporter;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ITeleporter;
import net.minecraftforge.event.AttachCapabilitiesEvent;
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
import net.minecraftforge.event.entity.living.LivingFallEvent;
Expand Down Expand Up @@ -231,20 +233,29 @@ public static void onEntityTick(LivingUpdateEvent event) {
entity.removePotionEffect(ModPotions.time_stop);
event.setCanceled(true);
}
if (entity instanceof EntityPlayer && event.getEntity().getEntityData().hasKey(Constants.LIGHT_DRIFTER_TAG) && !event.getEntity().getEntityWorld().isRemote) {
if (entity instanceof EntityPlayer
&& event.getEntity().getEntityData().hasKey(Constants.LIGHT_DRIFTER_TAG)
&& !event.getEntity().getEntityWorld().isRemote)
{
event.getEntity().getEntityData().setInteger(Constants.LIGHT_DRIFTER_TAG, event.getEntity().getEntityData().getInteger(Constants.LIGHT_DRIFTER_TAG) - 1);
// When spell ends:
if (event.getEntity().getEntityData().getInteger(Constants.LIGHT_DRIFTER_TAG) <= 0) {
EntityPlayer player = ((EntityPlayer) event.getEntity());
player.addPotionEffect(new PotionEffect(MobEffects.RESISTANCE, 40, 10, false, false));
player.posX = event.getEntity().getEntityData().getDouble(Constants.LIGHT_DRIFTER_X);
player.posY = event.getEntity().getEntityData().getDouble(Constants.LIGHT_DRIFTER_Y);
player.posZ = event.getEntity().getEntityData().getDouble(Constants.LIGHT_DRIFTER_Z);
PacketHandler.sendToAllTracking(new MessageLightDrifterSync(event.getEntity().getUniqueID(), player.posX, player.posY, player.posZ, false, event.getEntity().getEntityData().getInteger(Constants.LIGHT_DRIFTER_MODE)), player);
int currentDim = player.dimension; // Save dimension the player is currently in to check against
player.dimension = event.getEntity().getEntityData().getInteger(Constants.LIGHT_DRIFTER_DIMENSION_ID);
PacketHandler.sendToAllTracking(new MessageLightDrifterSync(event.getEntity().getUniqueID(), player.posX, player.posY, player.posZ, false, event.getEntity().getEntityData().getInteger(Constants.LIGHT_DRIFTER_MODE), player.dimension), player);
player.capabilities.allowFlying = false;
player.capabilities.disableDamage = false;
player.noClip = false;
player.capabilities.isFlying = false;
player.setPositionAndUpdate(player.posX, player.posY, player.posZ);
if (currentDim != player.dimension) // Change dimension only if it's different than where we left
player.changeDimension(player.dimension, (world, entity1, yaw) -> {});
else
player.setPositionAndUpdate(player.posX, player.posY, player.posZ); // Handled by changeDimension
player.setGameType(GameType.getByID(event.getEntity().getEntityData().getInteger(Constants.LIGHT_DRIFTER_MODE)));
player.extinguish();
//PacketHandler.sendToAllTracking(new MessageLightDrifterFX(event.getEntity().posX, event.getEntity().posY + 1.0f, event.getEntity().posZ), event.getEntity());
Expand All @@ -253,6 +264,7 @@ public static void onEntityTick(LivingUpdateEvent event) {
event.getEntity().getEntityData().removeTag(Constants.LIGHT_DRIFTER_Y);
event.getEntity().getEntityData().removeTag(Constants.LIGHT_DRIFTER_Z);
event.getEntity().getEntityData().removeTag(Constants.LIGHT_DRIFTER_MODE);
event.getEntity().getEntityData().removeTag(Constants.LIGHT_DRIFTER_DIMENSION_ID);
if (SpellAugment.instance.shouldPlaySound()) {
player.world.playSound(null, player.getPosition(), ModSounds.Spells.LIGHT_DRIFTER_EFFECT_END, SoundCategory.PLAYERS, SpellAugment.instance.getSoundVolume(), 1);
}
Expand Down
1 change: 1 addition & 0 deletions src/main/java/epicsquid/roots/ExportDocumentation.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import epicsquid.roots.util.zen.ZenDocExporter;

import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
Expand Down
10 changes: 6 additions & 4 deletions src/main/java/epicsquid/roots/GuiHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.network.IGuiHandler;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

import javax.annotation.Nullable;
import java.util.function.Supplier;
Expand Down Expand Up @@ -75,15 +77,15 @@ public Object getServerGuiElement(int id, EntityPlayer player, World world, int
if (te instanceof TileEntityFeyCrafter) {
return new ContainerFeyCrafter(player, (TileEntityFeyCrafter) te);
} else {
return new FakeContainer();
return null;
}
case IMPOSER_ID:
te = world.getTileEntity(new BlockPos(x, y, z));
if (te instanceof TileEntityImposer) {
((TileEntityImposer) te).updateInSlot(player);
return new ContainerImposer(player, (TileEntityImposer) te);
} else {
return new FakeContainer();
return null;
}
case LIBRARY_ID:
Supplier<ItemStack> staff = getStaff(player);
Expand All @@ -93,7 +95,7 @@ public Object getServerGuiElement(int id, EntityPlayer player, World world, int
return new ContainerLibrary(player, staff, SpellLibraryRegistry.getData(player));
} else {
player.sendStatusMessage(new TextComponentTranslation("roots.message.hold_staff").setStyle(new Style().setColor(TextFormatting.LIGHT_PURPLE).setBold(true)), true);
return new FakeContainer();
return null;
}
}
return null;
Expand Down Expand Up @@ -122,7 +124,7 @@ public Object getClientGuiElement(int id, EntityPlayer player, World world, int
case LIBRARY_ID:
Supplier<ItemStack> staff = getStaff(player);
if (staff != null) {
return new GuiLibrary(new ContainerLibrary(player, staff, null));
return new GuiLibrary(new ContainerLibrary(player, staff, SpellLibraryRegistry.getData(player)));
}
break;
}
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/epicsquid/roots/Roots.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class Roots {
public static final String NAME = "Roots";
public static final String VERSION = "@VERSION@";

public static final String DEPENDENCIES = "after:maindependencies";
public static final String DEPENDENCIES = "required-before:mysticallib@[1.12.2-1.13,);required-before:mysticalworld@[1.12.2-1.11,);before:harvest;before:chisel;before:endercore;required:patchouli";

public static final GuiHandler GUI_HANDLER = new GuiHandler();

Expand Down Expand Up @@ -64,13 +64,14 @@ public ItemStack createIcon() {

@EventHandler
public void preInit(FMLPreInitializationEvent event) {
logger = event.getModLog();
CONTAINER = Loader.instance().activeModContainer();
// We load before MysticalLib so we can't use an annotation or it will crash
MinecraftForge.EVENT_BUS.register(RegistryManager.class);
CapabilityManager.INSTANCE.register(RunicShearsCapability.class, new RunicShearsCapabilityStorage(), RunicShearsCapability::new);
CapabilityManager.INSTANCE.register(LifeEssenceCapability.class, new LifeEssenceCapabilityStorage(), LifeEssenceCapability::new);
NetworkRegistry.INSTANCE.registerGuiHandler(instance, GUI_HANDLER);
logger = event.getModLog();

ModDamage.init();
proxy.preInit(event);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ protected void writeEntityToNBT(NBTTagCompound compound) {

@Override
public void onUpdate() {
getDataManager().set(lifetime, getDataManager().get(lifetime) - 1);
getDataManager().set(lifetime, Integer.valueOf(getDataManager().get(lifetime) - 1));
getDataManager().setDirty(lifetime);
if (getDataManager().get(lifetime) < 0) {
setDead();
Expand Down
Loading

0 comments on commit 67ae488

Please sign in to comment.