forked from TheOriginalGolem/Hbm-s-Nuclear-Tech-GIT
-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Mixer Added UU Mixer Added RBMK Partial meltdowns Added JSON Bedrock Ore Dimension config Added more info to Fluid tooltips Added ethanol, fishoil, sunfloweroil, nitroglycering, colloid and their recipes Added logarithmic fluid display Added creative bedrock ore changing Added fluid rendering to crystallizer render Changed S.A.F.E reactor to have a button instead of a fuse Changed biofuel recipe to include ethanol Changed upgrade tooltips to have indentations Changed S.A.F.E reactor power output by x40 Changed DFC rendering scales and off look Changed name of coated red copper cable to red copper cable block as both are coated Changed Silex texture to reflect that it has a bottom port Fixed Crash when setting fluid types of fraction tower on a server Fixed RBMK redstone control not working on a server Fixed flashing when having [blinding] item and spider milks Fixed missing shift click of chemfactory Fixed barrel info render pos Fixed dickmask bug Fixed DFC negative power bug Fixed DFC injector not inputting fluids Removed unused interface
- Loading branch information
1 parent
eacccc0
commit 0f139dd
Showing
80 changed files
with
3,181 additions
and
429 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package com.hbm.blocks.machine; | ||
|
||
import com.hbm.blocks.BlockDummyable; | ||
import com.hbm.tileentity.machine.TileEntityMachineMixer; | ||
|
||
import net.minecraft.block.material.Material; | ||
import net.minecraft.block.state.IBlockState; | ||
import net.minecraft.entity.player.EntityPlayer; | ||
import net.minecraft.tileentity.TileEntity; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.util.EnumFacing; | ||
import net.minecraft.util.EnumHand; | ||
import net.minecraft.world.World; | ||
|
||
public class MachineMixer extends BlockDummyable { | ||
|
||
public MachineMixer(Material mat, String s) { | ||
super(mat, s); | ||
} | ||
|
||
@Override | ||
public TileEntity createNewTileEntity(World world, int meta) { | ||
|
||
if(meta >= 12) | ||
return new TileEntityMachineMixer(); | ||
|
||
return null; | ||
} | ||
|
||
@Override | ||
public int[] getDimensions() { | ||
return new int[] {2, 0, 0, 0, 0, 0}; | ||
} | ||
|
||
@Override | ||
public int getOffset() { | ||
return 0; | ||
} | ||
|
||
@Override | ||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { | ||
return standardOpenBehavior(world, pos.getX(), pos.getY(), pos.getZ(), player, 0); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
package com.hbm.config; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
import java.util.List; | ||
import java.util.HashMap; | ||
import java.util.HashSet; | ||
|
||
import com.google.gson.Gson; | ||
import com.google.gson.JsonElement; | ||
import com.google.gson.JsonArray; | ||
import com.google.gson.JsonObject; | ||
import com.google.gson.stream.JsonWriter; | ||
|
||
import com.hbm.main.MainRegistry; | ||
|
||
public class BedrockOreJsonConfig { | ||
|
||
public static final String bedrockOreJsonConfigFile = "hbm_bedrock_ores.json"; | ||
|
||
public static HashMap<Integer, HashSet<String>> dimOres = new HashMap(); | ||
public static HashMap<Integer, Boolean> dimWhiteList = new HashMap(); | ||
public static HashMap<Integer, Integer> dimOreRarity = new HashMap(); | ||
|
||
public static void init(){ | ||
if(!loadFromJson()){ | ||
clear(); | ||
setDefaults(); | ||
writeToJson(); | ||
} | ||
} | ||
|
||
public static void clear(){ | ||
dimOres.clear(); | ||
dimWhiteList.clear(); | ||
dimOreRarity.clear(); | ||
} | ||
|
||
public static boolean isOreAllowed(int dimID, String ore){ | ||
HashSet<String> ores = dimOres.get(dimID); | ||
boolean isInList = ores.contains(ore); | ||
if(!dimWhiteList.get(dimID)) isInList = !isInList; | ||
return isInList; | ||
} | ||
|
||
public static void setDefaults() { | ||
addEntry(0, 30, Arrays.asList("orePlutonium", "oreQuartz", "oreRedPhosphorus", "oreSchrabidium"), false); | ||
addEntry(-1, 60, Arrays.asList("orePlutonium", "oreQuartz", "oreRedPhosphorus", "oreSchrabidium"), true); | ||
} | ||
|
||
public static void addEntry(int dimID, int rarity, List<String> ores, Boolean isWhiteList){ | ||
HashSet<String> set = new HashSet(); | ||
for(String ore : ores) | ||
set.add(ore); | ||
dimOres.put(dimID, set); | ||
dimOreRarity.put(dimID, rarity); | ||
dimWhiteList.put(dimID, isWhiteList); | ||
} | ||
|
||
public static void writeToJson(){ | ||
try { | ||
JsonWriter writer = JsonConfig.startWriting(bedrockOreJsonConfigFile); | ||
writer.name("dimConfig").beginArray(); | ||
for(Integer dimID : dimOres.keySet()){ | ||
writer.beginObject(); | ||
writer.name("dimID").value(dimID); | ||
writer.name("oreRarity").value(dimOreRarity.get(dimID)); | ||
writer.name("isWhiteList").value(dimWhiteList.get(dimID)); | ||
writer.name("bedrockOres").beginArray(); | ||
for(String line : dimOres.get(dimID)) | ||
writer.value(line); | ||
writer.endArray(); | ||
writer.endObject(); | ||
} | ||
writer.endArray(); | ||
JsonConfig.stopWriting(writer); | ||
} catch(Exception ex) { | ||
ex.printStackTrace(); | ||
} | ||
} | ||
|
||
public static boolean loadFromJson() { | ||
try { | ||
JsonObject reader = JsonConfig.startReading(bedrockOreJsonConfigFile); | ||
|
||
if(reader == null || !reader.has("dimConfig")) return false; | ||
|
||
JsonArray entries = reader.getAsJsonArray("dimConfig"); | ||
for(JsonElement entry : entries){ | ||
|
||
if(entry == null || !entry.isJsonObject()) continue; | ||
JsonObject dimEntry = entry.getAsJsonObject(); | ||
|
||
if(!dimEntry.has("dimID")) return false; | ||
int dimID = dimEntry.get("dimID").getAsInt(); | ||
|
||
if(!dimEntry.has("oreRarity")) return false; | ||
int oreRarity = dimEntry.get("oreRarity").getAsInt(); | ||
|
||
if(!dimEntry.has("isWhiteList")) continue; | ||
boolean isWhiteList = dimEntry.get("isWhiteList").getAsBoolean(); | ||
|
||
if(!dimEntry.has("bedrockOres") || !dimEntry.get("bedrockOres").isJsonArray()) continue; | ||
JsonArray jbedrockOres = dimEntry.get("bedrockOres").getAsJsonArray(); | ||
List<String> bedrockOres = new ArrayList<String>(); | ||
for(JsonElement ore : jbedrockOres){ | ||
bedrockOres.add(ore.getAsString()); | ||
} | ||
|
||
addEntry(dimID, oreRarity, bedrockOres, isWhiteList); | ||
} | ||
|
||
return true; | ||
} catch(Exception ex) { | ||
MainRegistry.logger.error("Loading the bedrock ore config resulted in an error"); | ||
ex.printStackTrace(); | ||
return false; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package com.hbm.config; | ||
|
||
import java.io.File; | ||
import java.io.FileReader; | ||
import java.io.FileWriter; | ||
|
||
import com.google.gson.Gson; | ||
import com.google.gson.JsonObject; | ||
import com.google.gson.stream.JsonWriter; | ||
|
||
import com.hbm.main.MainRegistry; | ||
|
||
public class JsonConfig { | ||
|
||
public static final Gson gson = new Gson(); | ||
|
||
private static File getFile(String filename){ | ||
return new File(MainRegistry.proxy.getDataDir().getPath() + "/config/hbm" + File.separatorChar + filename); | ||
} | ||
|
||
public static JsonWriter startWriting(String filename){ | ||
try{ | ||
JsonWriter writer = new JsonWriter(new FileWriter(getFile(filename))); | ||
writer.setIndent(" "); | ||
writer.beginObject(); | ||
return writer; | ||
} catch(Exception ex) { } | ||
return null; | ||
} | ||
|
||
public static void stopWriting(JsonWriter writer){ | ||
try{ | ||
writer.endObject(); | ||
writer.close(); | ||
} catch(Exception ex) { } | ||
} | ||
|
||
public static JsonObject startReading(String filename){ | ||
try{ | ||
File file = getFile(filename); | ||
if(file.exists()) | ||
return gson.fromJson(new FileReader(file), JsonObject.class); | ||
return null; | ||
} catch(Exception ex) { } | ||
return null; | ||
} | ||
} |
Oops, something went wrong.