Forge Proofing

- Updated to Forge 28.0.45, Fixes #5
- Tidied up mods.toml and build.gradle
This commit is contained in:
simibubi 2019-08-06 19:00:51 +02:00
parent 488c1a1374
commit f67a61290f
17 changed files with 94 additions and 118 deletions

View file

@ -13,35 +13,20 @@ apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'eclipse'
apply plugin: 'maven-publish'
version = '0.0.4'
group = 'com.simibubi.create' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
version = '0.0.5'
group = 'com.simibubi.create'
archivesBaseName = 'create'
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8'
minecraft {
// The mappings can be changed at any time, and must be in the following format.
// snapshot_YYYYMMDD Snapshot are built nightly.
// stable_# Stables are built at the discretion of the MCP team.
// Use non-default mappings at your own risk. they may not always work.
// Simply re-run your setup task after changing the mappings to update your workspace.
mappings channel: 'snapshot', version: '20190725-1.14.3'
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
mappings channel: 'snapshot', version: '20190806-1.14.3'
// accessTransformer = file('build/resources/main/META-INF/accesstransformer.cfg')
// Default run configurations.
// These can be tweaked, removed, or duplicated as needed.
runs {
client {
createDev {
workingDirectory project.file('run')
// Recommended logging data for a userdev environment
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
// Recommended logging level for the console
property 'forge.logging.console.level', 'debug'
mods {
create {
source sourceSets.main
@ -49,15 +34,9 @@ minecraft {
}
}
server {
createSimi {
workingDirectory project.file('run')
// Recommended logging data for a userdev environment
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
// Recommended logging level for the console
property 'forge.logging.console.level', 'debug'
property 'forge.logging.console.level', 'info'
mods {
create {
source sourceSets.main
@ -65,17 +44,21 @@ minecraft {
}
}
data {
createServer {
workingDirectory project.file('run')
property 'forge.logging.console.level', 'info'
mods {
create {
source sourceSets.main
}
}
}
// Recommended logging data for a userdev environment
createData {
workingDirectory project.file('run')
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
// Recommended logging level for the console
property 'forge.logging.console.level', 'debug'
args '--mod', 'create', '--all', '--output', file('src/generated/resources/')
mods {
create {
source sourceSets.main
@ -86,32 +69,9 @@ minecraft {
}
dependencies {
// Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed
// that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied.
// The userdev artifact is a special name and will get all sorts of transformations applied to it.
minecraft 'net.minecraftforge:forge:1.14.4-28.0.14'
// You may put jars on which you depend on in ./libs or you may define them like so..
// compile "some.group:artifact:version:classifier"
// compile "some.group:artifact:version"
// Real examples
// compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env
// compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env
// The 'provided' configuration is for optional dependencies that exist at compile-time but might not at runtime.
// provided 'com.mod-buildcraft:buildcraft:6.0.8:dev'
// These dependencies get remapped to your current MCP mappings
// deobf 'com.mod-buildcraft:buildcraft:6.0.8:dev'
// For more info...
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
// http://www.gradle.org/docs/current/userguide/dependency_management.html
minecraft 'net.minecraftforge:forge:1.14.4-28.0.45'
}
// Example for how to get properties into the manifest for reading by the runtime..
jar {
manifest {
attributes([

View file

@ -12,7 +12,7 @@ public class AdvancementListener {
@SubscribeEvent
public static void onAdvancementGet(AdvancementEvent event) {
PlayerEntity player = event.getEntityPlayer();
PlayerEntity player = event.getPlayer();
if (player == null)
return;
if (player.getServer() == null)
@ -36,9 +36,9 @@ public class AdvancementListener {
}
private static void unlockWhen(String advancement, ResourceLocation recipe, AdvancementEvent event) {
AdvancementManager advancements = event.getEntityPlayer().getServer().getAdvancementManager();
AdvancementManager advancements = event.getPlayer().getServer().getAdvancementManager();
if (event.getAdvancement() == advancements.getAdvancement(new ResourceLocation(advancement)))
event.getEntityPlayer().unlockRecipes(new ResourceLocation[] { recipe });
event.getPlayer().unlockRecipes(new ResourceLocation[] { recipe });
}
private static ResourceLocation recipeOf(AllItems item) {

View file

@ -25,7 +25,9 @@ import net.minecraftforge.fml.network.IContainerFactory;
public enum AllContainers {
SchematicTable(SchematicTableContainer::new),
Schematicannon(SchematicannonContainer::new);
Schematicannon(SchematicannonContainer::new),
;
public ContainerType<? extends Container> type;
private IFactory<?> factory;

View file

@ -39,7 +39,9 @@ public enum AllItems {
TREE_FERTILIZER(new TreeFertilizerItem(standardProperties())),
EMPTY_BLUEPRINT(new Item(standardProperties().maxStackSize(1))),
BLUEPRINT_AND_QUILL(new BlueprintAndQuillItem(standardProperties().maxStackSize(1))),
BLUEPRINT(new BlueprintItem(standardProperties()));
BLUEPRINT(new BlueprintItem(standardProperties())),
;
public Item item;

View file

@ -10,7 +10,9 @@ import net.minecraftforge.event.RegistryEvent;
public enum AllRecipes {
Placement_Handgun_Upgrade(BuilderGunUpgradeRecipe.Serializer::new);
Placement_Handgun_Upgrade(BuilderGunUpgradeRecipe.Serializer::new),
;
public IRecipeSerializer<?> serializer;
public Supplier<IRecipeSerializer<?>> supplier;

View file

@ -5,7 +5,9 @@ import net.minecraft.util.ResourceLocation;
public enum AllSpecialTextures {
Selection("selection.png");
Selection("selection.png"),
;
public static final String ASSET_PATH = "textures/special/";
private ResourceLocation location;

View file

@ -17,6 +17,9 @@ import net.minecraft.item.crafting.IRecipeSerializer;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.event.TickEvent.ClientTickEvent;
import net.minecraftforge.event.TickEvent.Phase;
import net.minecraftforge.event.TickEvent.ServerTickEvent;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.DistExecutor;
@ -24,8 +27,6 @@ import net.minecraftforge.fml.client.registry.ClientRegistry;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus;
import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent.ServerTickEvent;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.event.server.FMLServerStoppingEvent;
@ -37,7 +38,7 @@ public class Create {
public static final String ID = "create";
public static final String NAME = "Create";
public static final String VERSION = "0.0.4";
public static final String VERSION = "0.0.5";
public static Logger logger = LogManager.getLogger();
@ -76,6 +77,8 @@ public class Create {
@SubscribeEvent
public static void onTick(ServerTickEvent event) {
if (event.phase == Phase.START)
return;
sSchematicLoader.tick();
}
@ -87,6 +90,11 @@ public class Create {
@OnlyIn(Dist.CLIENT)
@SubscribeEvent
public static void onClientTick(ClientTickEvent event) {
if (event.phase == Phase.START)
return;
if (cSchematicLoader == null)
return;
cSchematicLoader.tick();
}

View file

@ -4,9 +4,9 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screen.Screen;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.event.TickEvent.ClientTickEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent;
@OnlyIn(Dist.CLIENT)
@EventBusSubscriber(value = Dist.CLIENT)

View file

@ -44,7 +44,7 @@ public class FilesHelper {
}
public static String slug(String name) {
return name.toLowerCase().replace(' ', '_');
return name.toLowerCase().replace(' ', '_').replace('!', '_').replace('?', '_');
}
public static boolean saveTagCompoundAsJson(CompoundNBT compound, String path) {

View file

@ -35,11 +35,12 @@ import net.minecraft.util.math.Vec3d;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.client.event.RenderSpecificHandEvent;
import net.minecraftforge.client.event.RenderWorldLastEvent;
import net.minecraftforge.event.TickEvent.ClientTickEvent;
import net.minecraftforge.event.TickEvent.Phase;
import net.minecraftforge.event.world.BlockEvent.BreakEvent;
import net.minecraftforge.eventbus.api.EventPriority;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent;
@SuppressWarnings("deprecation")
@EventBusSubscriber(value = Dist.CLIENT)
@ -108,6 +109,8 @@ public class BuilderGunHandler {
@SubscribeEvent
public static void onClientTick(ClientTickEvent event) {
if (event.phase == Phase.START)
return;
if (cachedBeams == null)
cachedBeams = new LinkedList<>();
ClientWorld world = Minecraft.getInstance().world;

View file

@ -102,4 +102,9 @@ public class BuilderGunUpgradeRecipe implements ICraftingRecipe {
}
@Override
public boolean canFit(int width, int height) {
return recipe.canFit(width, height);
}
}

View file

@ -102,7 +102,8 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
public void tick() {
SchematicannonTileEntity te = container.getTileEntity();
for (int replaceMode = 0; replaceMode < replaceLevelButtons.size(); replaceMode++)
replaceLevelIndicators.get(0).state = te.replaceMode == 0 ? State.ON : State.OFF;
for (int replaceMode = 1; replaceMode < replaceLevelButtons.size(); replaceMode++)
replaceLevelIndicators.get(replaceMode).state = replaceMode <= te.replaceMode ? State.ON : State.OFF;
skipMissingIndicator.state = te.skipMissing ? State.ON : State.OFF;

View file

@ -17,8 +17,8 @@ import com.simibubi.create.foundation.gui.TextInputPromptScreen;
import com.simibubi.create.foundation.utility.FilesHelper;
import com.simibubi.create.foundation.utility.KeyboardHelper;
import com.simibubi.create.foundation.utility.RaycastHelper;
import com.simibubi.create.foundation.utility.TessellatorHelper;
import com.simibubi.create.foundation.utility.RaycastHelper.PredicateTraceResult;
import com.simibubi.create.foundation.utility.TessellatorHelper;
import net.minecraft.block.Blocks;
import net.minecraft.client.Minecraft;
@ -46,10 +46,11 @@ import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.client.event.GuiScreenEvent.MouseScrollEvent;
import net.minecraftforge.client.event.InputEvent.MouseInputEvent;
import net.minecraftforge.client.event.RenderWorldLastEvent;
import net.minecraftforge.event.TickEvent.ClientTickEvent;
import net.minecraftforge.event.TickEvent.Phase;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus;
import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent;
@EventBusSubscriber(value = Dist.CLIENT, bus = Bus.FORGE)
public class BlueprintAndQuillHandler {
@ -257,6 +258,8 @@ public class BlueprintAndQuillHandler {
@SubscribeEvent
public static void onClientTick(ClientTickEvent event) {
if (event.phase == Phase.START)
return;
if (!active())
return;
ClientPlayerEntity player = Minecraft.getInstance().player;

View file

@ -39,10 +39,11 @@ import net.minecraftforge.client.event.InputEvent.MouseInputEvent;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType;
import net.minecraftforge.client.event.RenderWorldLastEvent;
import net.minecraftforge.event.TickEvent.ClientTickEvent;
import net.minecraftforge.event.TickEvent.Phase;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus;
import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent;
@EventBusSubscriber(value = Dist.CLIENT, bus = Bus.FORGE)
public class BlueprintHandler {
@ -77,6 +78,8 @@ public class BlueprintHandler {
@SubscribeEvent
public static void onClientTick(ClientTickEvent event) {
if (event.phase == Phase.START)
return;
ClientPlayerEntity player = Minecraft.getInstance().player;
if (player == null)

View file

@ -36,10 +36,11 @@ import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.client.ForgeHooksClient;
import net.minecraftforge.client.event.RenderWorldLastEvent;
import net.minecraftforge.client.model.data.EmptyModelData;
import net.minecraftforge.event.TickEvent;
import net.minecraftforge.event.TickEvent.ClientTickEvent;
import net.minecraftforge.event.TickEvent.Phase;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
import net.minecraftforge.fml.common.gameevent.TickEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent;
@OnlyIn(Dist.CLIENT)
@EventBusSubscriber(Dist.CLIENT)
@ -91,6 +92,8 @@ public class SchematicHologram {
@SubscribeEvent
public static void onClientTickEvent(final ClientTickEvent event) {
if (event.phase == Phase.START)
return;
if (instance != null && instance.active) {
final Minecraft minecraft = Minecraft.getInstance();
if (event.phase != TickEvent.Phase.END)

View file

@ -27,13 +27,14 @@ import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.client.event.RenderWorldLastEvent;
import net.minecraftforge.client.model.data.EmptyModelData;
import net.minecraftforge.event.TickEvent.ClientTickEvent;
import net.minecraftforge.event.TickEvent.Phase;
import net.minecraftforge.event.world.BlockEvent.BreakEvent;
import net.minecraftforge.event.world.BlockEvent.EntityPlaceEvent;
import net.minecraftforge.eventbus.api.EventPriority;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus;
import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent;
@EventBusSubscriber(bus = Bus.FORGE)
public class SymmetryHandler {
@ -113,6 +114,8 @@ public class SymmetryHandler {
@OnlyIn(Dist.CLIENT)
@SubscribeEvent
public static void onClientTick(ClientTickEvent event) {
if (event.phase == Phase.START)
return;
Minecraft mc = Minecraft.getInstance();
ClientPlayerEntity player = mc.player;

View file

@ -1,47 +1,26 @@
# This is an example mods.toml file. It contains the data relating to the loading mods.
# There are several mandatory fields (#mandatory), and many more that are optional (#optional).
# The overall format is standard TOML format, v0.5.0.
# Note that there are a couple of TOML lists in this file.
# Find more information on toml format here: https://github.com/toml-lang/toml
# The name of the mod loader type to load - for regular FML @Mod mods it should be javafml
modLoader="javafml" #mandatory
# A version range to match for said mod loader - for regular FML @Mod it will be the forge version
loaderVersion="[26,)" #mandatory (26 is current forge version)
# A URL to refer people to when problems occur with this mod
#issueTrackerURL=""#optional
# A list of mods - how many allowed here is determined by the individual mod loader
[[mods]] #mandatory
# The modid of the mod
modId="create" #mandatory
# The version number of the mod - there's a few well known ${} variables useable here or just hardcode it
version="0.0.4" #mandatory
# A display name for the mod
displayName="Create" #mandatory
# A URL to query for updates for this mod. See the JSON update specification <here>
#updateJSONURL=""#optional
# A URL for the "homepage" for this mod, displayed in the mod UI
# A file name (in the root of the mod JAR) containing a logo for display
# A text field displayed in the mod UI
authors="simibubi" #optional
# The description text for the mod (multi line!) (#mandatory)
modLoader="javafml"
loaderVersion="[28,)"
#issueTrackerURL=""
[[mods]]
modId="create"
version="0.0.4"
displayName="Create"
#updateJSONURL=""
authors="simibubi"
description='''
A handful of additions to aid the creative survivalist.'''
# A dependency - use the . to indicate dependency for a specific modid. Dependencies are optional.
[[dependencies.examplemod]] #optional
# the modid of the dependency
modId="forge" #mandatory
# Does this dependency have to exist - if not, ordering below must be specified
mandatory=true #mandatory
# The version range of the dependency
versionRange="[27,)" #mandatory
# An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory
[[dependencies.create]]
modId="forge"
mandatory=true
versionRange="[28.0.45,)"
ordering="NONE"
# Side this dependency is applied on - BOTH, CLIENT or SERVER
side="BOTH"
# Here's another dependency
[[dependencies.examplemod]]
[[dependencies.create]]
modId="minecraft"
mandatory=true
versionRange="[1.14.3]"
versionRange="[1.14.4]"
ordering="NONE"
side="BOTH"