Skip to content

Commit

Permalink
Merge branch 'master' into Grave_Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
DrParadox7 committed Nov 21, 2023
2 parents ac84add + cf2c1c1 commit ba75fe6
Show file tree
Hide file tree
Showing 11 changed files with 175 additions and 51 deletions.
33 changes: 0 additions & 33 deletions .github/scripts/test-no-error-reports.sh

This file was deleted.

4 changes: 2 additions & 2 deletions dependencies.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// Add your dependencies here

dependencies {
compile('com.github.GTNewHorizons:OpenModsLib:0.10.4:dev')
api('com.github.GTNewHorizons:OpenModsLib:0.10.6:dev')

compile('openperipheral:OpenPeripheralCore-API:3.4.1')

compileOnly('openperipheral:OpenPeripheralCore-API:3.4.1')
compileOnly('com.github.GTNewHorizons:NotEnoughItems:2.4.12-GTNH:dev')
compileOnly('curse.maven:computercraft-67504:2269339')
}
14 changes: 0 additions & 14 deletions repositories.gradle
Original file line number Diff line number Diff line change
@@ -1,21 +1,7 @@
// Add any additional repositories for your dependencies here

repositories {
maven {
name 'GTNH Maven'
url 'http://jenkins.usrv.eu:8081/nexus/content/groups/public/'
allowInsecureProtocol
}
maven {
url 'https://repo.openmods.info/artifactory/openmods/'
}
maven {
url 'https://cursemaven.com'
content {
includeGroup 'curse.maven'
}
}
maven {
url = 'https://jitpack.io'
}
}
10 changes: 10 additions & 0 deletions src/main/java/openblocks/NEIOpenBlocksConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import com.google.common.base.Throwables;

import codechicken.nei.api.IConfigureNEI;
import openblocks.common.item.MetasGeneric;
import openblocks.common.item.MetasGenericUnstackable;
import openmods.Log;

public class NEIOpenBlocksConfig implements IConfigureNEI {
Expand All @@ -27,6 +29,14 @@ public void loadConfig() {
API$hideItem(new ItemStack(OpenBlocks.Items.heightMap, 1, OreDictionary.WILDCARD_VALUE));
}

if (!MetasGeneric.subItemEnabled()) {
API$hideItem(new ItemStack(OpenBlocks.Items.generic, 1, OreDictionary.WILDCARD_VALUE));
}

if (!MetasGenericUnstackable.subItemEnabled()) {
API$hideItem(new ItemStack(OpenBlocks.Items.genericUnstackable, 1, OreDictionary.WILDCARD_VALUE));
}

Log.info("OpenBlocks NEI Integration loaded successfully");
}

Expand Down
2 changes: 2 additions & 0 deletions src/main/java/openblocks/OpenBlocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,8 @@ public void preInit(FMLPreInitializationEvent evt) {
// needed first, to properly initialize delegates
FluidRegistry.registerFluid(Fluids.xpJuice);

ItemHangGlider.loadConfig(evt);

startupHelper.registerBlocksHolder(OpenBlocks.Blocks.class);
startupHelper.registerItemsHolder(OpenBlocks.Items.class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ private void renderCubes(float time) {
}

GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_LIGHTING);
}

protected void drawCube(float theta, float phi) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public BlockScaffolding() {
super(Material.cloth);
setTickRandomly(true);
setHardness(0.1F);
setStepSound(Block.soundTypeWood);
}

@Override
Expand Down
89 changes: 88 additions & 1 deletion src/main/java/openblocks/common/item/ItemHangGlider.java
Original file line number Diff line number Diff line change
@@ -1,28 +1,106 @@
package openblocks.common.item;

import java.util.HashSet;
import java.util.Map;

import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ChatComponentText;
import net.minecraft.world.World;
import net.minecraftforge.common.config.Configuration;

import com.google.common.collect.MapMaker;

import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import openblocks.OpenBlocks;
import openblocks.common.entity.EntityHangGlider;
import openmods.infobook.BookDocumentation;

@BookDocumentation(hasVideo = true)
public class ItemHangGlider extends Item {

private static Map<EntityPlayer, EntityHangGlider> spawnedGlidersMap = new MapMaker().weakKeys().weakValues()
private static final Map<EntityPlayer, EntityHangGlider> spawnedGlidersMap = new MapMaker().weakKeys().weakValues()
.makeMap();

private static HashSet<Integer> blacklistedDimensions = new HashSet<>();

public ItemHangGlider() {
setCreativeTab(OpenBlocks.tabOpenBlocks);
}

// Configuration loading
// Outer Lands - 173
// The Last Millenium - 112
// Underdark - 100
// Mehen Belt - 95
// Seth - 94
// Horus - 93
// Anubis - 92
// Maahes - 91
// Neper - 90
// Miranda - 86
// T Ceti E - 85
// Vega B - 84
// Haumea - 83
// Barnarda F - 82
// Barnarda E - 81
// Saturn - 77
// Neptune - 74
// Jupiter - 71
// Mirror - 70
// Pocket Plane - 69
// Ross128b - 64
// Ross128ba - 63
// Bedrock - 60
// Torment - 56
// Spirit World - 55
// Space Station 54 - 54
// Storage Cell - 52
// Uranus - 51
// The Outer Lands - 50
// Pluto - 49
// Triton - 48
// Proteus - 47
// Oberon - 46
// Callisto - 45
// Titan - 44
// Ganymede - 43
// Ceres - 42
// Enceladus - 41
// Deimos - 40
// Venus - 39
// Phobos - 38
// Mercury - 37
// Io - 36
// Europa - 35
// Kuiper Belt - 33
// Barnarda C - 32
// α Centauri Bb - 31
// Asteroids - 30
// Mars - 29
// Moon - 28
// Makemake - 25
// dimensionDarkWorld - 227

public static void loadConfig(FMLPreInitializationEvent event) {
Configuration config = new Configuration(event.getSuggestedConfigurationFile());
config.load();

int[] dimensionIDs = config.get(
"general",
"BlacklistedDimensions",
new int[] { 95, 94, 93, 92, 86, 85, 84, 83, 82, 81, 77, 74, 71, 69, 63, 54, 51, 49, 48, 47, 46, 45, 44,
43, 42, 41, 40, 39, 38, 37, 36, 35, 33, 32, 31, 30, 29, 28, 25 },
"List of dimension IDs where the glider doesn't work").getIntList();
for (int id : dimensionIDs) {
blacklistedDimensions.add(id);
}

config.save();
}

@Override
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) {
if (!world.isRemote && player != null) {
Expand All @@ -39,9 +117,18 @@ private static void despawnGlider(EntityPlayer player, EntityHangGlider glider)
}

private static void spawnGlider(EntityPlayer player) {
if (isInvalidDimension(player)) {
player.addChatMessage(new ChatComponentText(I18n.format("item.openblocks.hangglider.invalid_dimension")));
return;
}

EntityHangGlider glider = new EntityHangGlider(player.worldObj, player);
glider.setPositionAndRotation(player.posX, player.posY, player.posZ, player.rotationPitch, player.rotationYaw);
player.worldObj.spawnEntityInWorld(glider);
spawnedGlidersMap.put(player, glider);
}

private static boolean isInvalidDimension(EntityPlayer player) {
return blacklistedDimensions.contains(player.dimension);
}
}
58 changes: 58 additions & 0 deletions src/main/java/openblocks/common/item/MetasGeneric.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ public IMetaItem createMetaItem() {
new ShapedOreRecipe(result, " sl", "sll", "lll", 's', "stickWood", 'l', Items.leather),
new ShapedOreRecipe(result, "ls ", "lls", "lll", 's', "stickWood", 'l', Items.leather));
}

@Override
public boolean isEnabled() {
return OpenBlocks.Items.hangGlider != null;
}
},
beam {

Expand Down Expand Up @@ -56,6 +61,11 @@ public IMetaItem createMetaItem() {
'y',
"dyeYellow"));
}

@Override
public boolean isEnabled() {
return OpenBlocks.Items.craneBackpack != null;
}
},
craneEngine {

Expand All @@ -76,6 +86,11 @@ public IMetaItem createMetaItem() {
'r',
"dustRedstone"));
}

@Override
public boolean isEnabled() {
return OpenBlocks.Items.craneBackpack != null;
}
},
craneMagnet {

Expand Down Expand Up @@ -109,6 +124,12 @@ public IMetaItem createMetaItem() {
'y',
"dyeYellow"));
}

@Override
public boolean isEnabled() {
return OpenBlocks.Items.craneBackpack != null
|| (Loader.isModLoaded(openmods.Mods.OPENPERIPHERALCORE) && Config.enableCraneTurtles);
}
},
miracleMagnet {

Expand Down Expand Up @@ -156,6 +177,11 @@ public IMetaItem createMetaItem() {
"line",
new ShapedOreRecipe(result, "sss", "bbb", "sss", 's', Items.string, 'b', "slimeball"));
}

@Override
public boolean isEnabled() {
return OpenBlocks.Items.craneBackpack != null;
}
},
mapController {

Expand All @@ -166,6 +192,11 @@ public IMetaItem createMetaItem() {
"map_controller",
new ShapedOreRecipe(result, " r ", "rgr", " r ", 'r', "dustRedstone", 'g', "ingotGold"));
}

@Override
public boolean isEnabled() {
return OpenBlocks.Items.emptyMap != null;
}
},
mapMemory {

Expand All @@ -176,6 +207,11 @@ public IMetaItem createMetaItem() {
"map_memory",
new ShapedOreRecipe(result, "rg", "rg", "rg", 'g', "nuggetGold", 'r', "dustRedstone"));
}

@Override
public boolean isEnabled() {
return OpenBlocks.Items.emptyMap != null;
}
},
/**
* Deprecated. Moved to ItemCursor Can't remove it from here because it'll re-index everyones items.. I guess the
Expand Down Expand Up @@ -211,6 +247,11 @@ public IMetaItem createMetaItem() {
'r',
"dustRedstone"));
}

@Override
public boolean isEnabled() {
return OpenBlocks.Items.cartographer != null;
}
},
unpreparedStencil {

Expand All @@ -221,6 +262,11 @@ public IMetaItem createMetaItem() {
"unprepared_stencil",
new ShapedOreRecipe(result, " p ", "pip", " p ", 'p', Items.paper, 'i', "ingotIron"));
}

@Override
public boolean isEnabled() {
return OpenBlocks.Blocks.drawingTable != null;
}
},
sketchingPencil {

Expand All @@ -239,6 +285,11 @@ public IMetaItem createMetaItem() {
's',
"stickWood"));
}

@Override
public boolean isEnabled() {
return OpenBlocks.Blocks.drawingTable != null;
}
};

public ItemStack newItemStack(int size) {
Expand Down Expand Up @@ -275,4 +326,11 @@ public Iterable<Entry> getBookEntries() {
}

}

public static boolean subItemEnabled() {
for (MetasGeneric m : values()) if (m.isEnabled()) {
return true;
}
return false;
}
}
Loading

0 comments on commit ba75fe6

Please sign in to comment.