this doesn't compile yet, but have something to peek at

This commit is contained in:
Nicholas Ignoffo 2017-08-14 20:53:42 -07:00
parent 973f1019a5
commit 5fcdd978d7
329 changed files with 3247 additions and 2953 deletions

View file

@ -3,15 +3,12 @@ package WayofTime.bloodmagic.meteor;
import java.util.List;
import java.util.Random;
import lombok.Getter;
import lombok.Setter;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import WayofTime.bloodmagic.util.Utils;
@Getter
public class Meteor
{
private static final Random RAND = new Random();
@ -21,8 +18,6 @@ public class Meteor
private final float explosionStrength;
private final int radius;
private final int maxWeight;
@Setter
public int version;
public Meteor(ItemStack catalystStack, List<MeteorComponent> components, float explosionStrength, int radius)
@ -94,4 +89,32 @@ public class Meteor
return RAND.nextDouble() > fillerChance ? fillerBlock : null;
}
public ItemStack getCatalystStack() {
return catalystStack;
}
public List<MeteorComponent> getComponents() {
return components;
}
public float getExplosionStrength() {
return explosionStrength;
}
public int getRadius() {
return radius;
}
public int getMaxWeight() {
return maxWeight;
}
public int getVersion() {
return version;
}
public void setVersion(int version) {
this.version = version;
}
}

View file

@ -2,9 +2,6 @@ package WayofTime.bloodmagic.meteor;
import java.util.List;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
@ -15,14 +12,16 @@ import net.minecraftforge.fml.common.registry.ForgeRegistries;
import net.minecraftforge.oredict.OreDictionary;
import WayofTime.bloodmagic.util.Utils;
@Getter
@Setter
@AllArgsConstructor
public class MeteorComponent
{
public int weight;
public String oreName;
public MeteorComponent(int weight, String oreName) {
this.weight = weight;
this.oreName = oreName;
}
public IBlockState getStateFromOre()
{
if (oreName.contains(":"))
@ -60,4 +59,20 @@ public class MeteorComponent
return null;
}
public int getWeight() {
return weight;
}
public void setWeight(int weight) {
this.weight = weight;
}
public String getOreName() {
return oreName;
}
public void setOreName(String oreName) {
this.oreName = oreName;
}
}

View file

@ -32,7 +32,7 @@ public class MeteorConfigHandler
public static void handleMeteors(boolean checkNewVersion)
{
if (meteorDir == null) {
BloodMagic.instance.getLogger().error("Attempted to handle meteor config but the folder has not been initialized. Was this run too early?");
BloodMagic.instance.logger.error("Attempted to handle meteor config but the folder has not been initialized. Was this run too early?");
return;
}
@ -64,11 +64,13 @@ public class MeteorConfigHandler
// Filter names so we can compare to defaults
for (File meteorFile : meteorFiles)
{
Meteor meteor = Serializers.GSON.fromJson(new FileReader(meteorFile), Meteor.class);
FileReader reader = new FileReader(meteorFile);
Meteor meteor = Serializers.GSON.fromJson(reader, Meteor.class);
meteors.add(Pair.of(FilenameUtils.removeExtension(meteorFile.getName()), meteor));
reader.close();
}
if (checkNewVersion && ConfigHandler.getConfig().getBoolean("resyncOnVersionChange", "Meteors", true, "Should the default meteors be regenerated if the mod has updated them"))
if (checkNewVersion && ConfigHandler.config.getBoolean("resyncOnVersionChange", "Meteors", true, "Should the default meteors be regenerated if the mod has updated them"))
{
Set<String> discoveredDefaults = Sets.newHashSet();
@ -103,7 +105,7 @@ public class MeteorConfigHandler
e.printStackTrace();
}
ConfigHandler.getConfig().save();
ConfigHandler.config.save();
}
private static List<Pair<String, Meteor>> getDefaultMeteors()