Skip to content

Commit

Permalink
Fix /dev/null darkening screen (#23)
Browse files Browse the repository at this point in the history
* update bs+deps & enable modern+generic

* fix errors from generic inject

* fix dev/null darkening screen when displaying via holo-glasses (at night)
  • Loading branch information
Lyfts authored Oct 2, 2024
1 parent b05c92f commit 60325ae
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 32 deletions.
5 changes: 2 additions & 3 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
dependencies {
api('com.github.GTNewHorizons:OpenModsLib:0.11.1:dev')


devOnlyNonPublishable('com.github.GTNewHorizons:NotEnoughItems:2.6.39-GTNH:dev')
compileOnly('openperipheral:OpenPeripheralCore-API:3.4.1')
compileOnly('com.github.GTNewHorizons:NotEnoughItems:2.6.33-GTNH:dev')
compileOnly('curse.maven:computercraft-67504:2269339')
compileOnly('com.github.GTNewHorizons:Mobs-Info:0.4.5-GTNH:dev')
compileOnly('com.github.GTNewHorizons:Mobs-Info:0.4.6-GTNH:dev')
}
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,19 @@ developmentEnvironmentUserName = "Developer"

# Enables using modern Java syntax (up to version 17) via Jabel, while still targeting JVM 8.
# See https://github.com/bsideup/jabel for details on how this works.
enableModernJavaSyntax = false
enableModernJavaSyntax = true

# Enables injecting missing generics into the decompiled source code for a better coding experience.
# Turns most publicly visible List, Map, etc. into proper List<E>, Map<K, V> types.
enableGenericInjection = false
enableGenericInjection = true

# Generate a class with a String field for the mod version named as defined below.
# If generateGradleTokenClass is empty or not missing, no such class will be generated.
# If gradleTokenVersion is empty or missing, the field will not be present in the class.
generateGradleTokenClass =
generateGradleTokenClass = openblocks.Tags

# Name of the token containing the project's current version to generate/replace.
gradleTokenVersion = GRADLETOKEN_VERSION
gradleTokenVersion = VERSION

# [DEPRECATED] Mod ID replacement token.
gradleTokenModId =
Expand All @@ -70,7 +70,7 @@ gradleTokenGroupName =
# The string's content will be replaced with your mod's version when compiled. You should use this to specify your mod's
# version in @Mod([...], version = VERSION, [...]).
# Leave these properties empty to skip individual token replacements.
replaceGradleTokenInFile = OpenBlocks.java
replaceGradleTokenInFile =

# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise, you can
# leave this property empty.
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pluginManagement {
}

plugins {
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.26'
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.27'
}


2 changes: 1 addition & 1 deletion src/main/java/openblocks/OpenBlocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ public class OpenBlocks {

public static final String MODID = "OpenBlocks";
public static final String NAME = "OpenBlocks";
public static final String VERSION = "GRADLETOKEN_VERSION";
public static final String VERSION = Tags.VERSION;
public static final String PROXY_SERVER = "openblocks.common.ServerProxy";
public static final String PROXY_CLIENT = "openblocks.client.ClientProxy";
public static final String DEPENDENCIES = "required-after:OpenMods@[0.10.1,)";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public ItemRendererDevNull() {
}

@SubscribeEvent
public void onTextuteChange(TextureStitchEvent evt) {
public void onTextureChange(TextureStitchEvent evt) {
if (evt.map.getTextureType() == TextureUtils.TEXTURE_MAP_ITEMS) cube.reset();
}

Expand Down Expand Up @@ -156,16 +156,11 @@ protected void renderInHandStack(ItemRenderType type, ItemStack containerStack,
if (type == ItemRenderType.ENTITY) {
GL11.glTranslated(-0.25, -0.25, -0.25);
GL11.glScaled(0.5, 0.5, 0.5);
RenderUtils.disableLightmap();
}

TextureUtils.bindDefaultItemsTexture();
cube.render();

if (type == ItemRenderType.ENTITY) {
RenderUtils.enableLightmap();
}

if (containedStack != null && (containedStack.getItem() instanceof ItemBlock)) {
GL11.glTranslated(0.5, 0.5, 0.5);
GL11.glScalef(0.8f, 0.8f, 0.8f);
Expand Down
14 changes: 4 additions & 10 deletions src/main/java/openblocks/common/EntityEventHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,24 @@

public class EntityEventHandler {

public static final String OPENBLOCKS_PERSIST_TAG = "OpenBlocks";
public static final String GIVEN_MANUAL_TAG = "givenManual";
public static final String LATEST_CHANGELOG_TAG = "latestChangelog";

private Set<Class<?>> entityBlacklist;

@SuppressWarnings("unchecked")
private Set<Class<?>> getBlacklist() {
if (entityBlacklist == null) {
entityBlacklist = Sets.newIdentityHashSet();

Set<String> unknownNames = Sets.newHashSet();
for (String name : Config.disableMobNames) {

Class<?> cls = (Class<?>) EntityList.stringToClassMapping.get(name);
Class<?> cls = EntityList.stringToClassMapping.get(name);
if (cls != null) entityBlacklist.add(cls);
else unknownNames.add(name);
}

// using Class.forName is unsafe
for (Class<?> cls : (Set<Class<?>>) EntityList.classToStringMapping.keySet()) {
for (Class<?> cls : EntityList.classToStringMapping.keySet()) {
if (unknownNames.isEmpty()) break;
if (unknownNames.remove(cls.getName())) entityBlacklist.add(cls);
}
Expand Down Expand Up @@ -70,11 +67,8 @@ public void onEntityJoinWorld(EntityJoinWorldEvent event) {
}
}

/**
* If the player hasn't been given a manual, we'll give him one! (or throw it on the floor..)
*/
if (Config.spamInfoBook && !event.world.isRemote && entity instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) entity;
// If the player hasn't been given a manual, we'll give him one! (or throw it on the floor..)
if (Config.spamInfoBook && !event.world.isRemote && entity instanceof EntityPlayer player) {
NBTTagCompound persistTag = PlayerUtils.getModPlayerPersistTag(player, "OpenBlocks");

boolean shouldGiveManual = OpenBlocks.Items.infoBook != null && !persistTag.getBoolean(GIVEN_MANUAL_TAG);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import java.util.List;

import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.monster.EntitySkeleton;
Expand Down Expand Up @@ -45,7 +44,7 @@ public class TileEntityGrave extends SyncedTileEntity

private IChatComponent deathMessage;

private GenericInventory inventory = registerInventoryCallback(new GenericInventory("grave", false, 1));
private final GenericInventory inventory = registerInventoryCallback(new GenericInventory("grave", false, 1));

public TileEntityGrave() {}

Expand All @@ -56,14 +55,13 @@ protected void createSyncedFields() {
}

@Override
@SuppressWarnings("unchecked")
public void updateEntity() {
super.updateEntity();

if (!worldObj.isRemote) {
if (Config.spawnSkeletons && worldObj.difficultySetting != EnumDifficulty.PEACEFUL
&& worldObj.rand.nextDouble() < Config.skeletonSpawnRate) {
List<Entity> mobs = worldObj.getEntitiesWithinAABB(IMob.class, getBB().expand(7, 7, 7));
List<IMob> mobs = worldObj.getEntitiesWithinAABB(IMob.class, getBB().expand(7, 7, 7));
if (mobs.size() < 5) {
double chance = worldObj.rand.nextDouble();
EntityLiving living = chance < 0.5 ? new EntitySkeleton(worldObj) : new EntityBat(worldObj);
Expand Down Expand Up @@ -105,8 +103,7 @@ public boolean isOnSoil() {
@Override
public void onBlockPlacedBy(EntityLivingBase placer, ItemStack stack) {
if (!worldObj.isRemote) {
if ((placer instanceof EntityPlayer) && !(placer instanceof FakePlayer)) {
EntityPlayer player = (EntityPlayer) placer;
if ((placer instanceof EntityPlayer player) && !(placer instanceof FakePlayer)) {

if (stack.hasDisplayName()) setUsername(stack.getDisplayName());
else setUsername(player.getGameProfile().getName());
Expand Down

0 comments on commit 60325ae

Please sign in to comment.