Fast breaking in Normal+ mode in addition to fast building.
Fixed issue #36: Having issues with some features with a Sponge Forge Server. Messed with shader to try and fix some issues.
This commit is contained in:
@@ -11,7 +11,7 @@ apply plugin: 'net.minecraftforge.gradle.forge'
|
||||
//Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.
|
||||
|
||||
|
||||
version = "1.12.2-2.9"
|
||||
version = "1.12.2-2.10"
|
||||
group = "nl.requios.effortlessbuilding" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||
archivesBaseName = "effortlessbuilding"
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ public class BuildConfig {
|
||||
|
||||
@Comment({"Determines what blocks can be replaced in survival.",
|
||||
"-1: only blocks that can be harvested by hand (default)",
|
||||
"0: blocks that can be harvested with wooden or gold tools",
|
||||
"0: blocks that can be harvested with wooden oref gold tools",
|
||||
"1: blocks that can be harvested with stone tools",
|
||||
"2: blocks that can be harvested with iron tools",
|
||||
"3: blocks that can be harvested with diamond tools",
|
||||
@@ -65,7 +65,7 @@ public class BuildConfig {
|
||||
|
||||
@Comment({"How many placements are remembered for the undo functionality."})
|
||||
@RequiresMcRestart
|
||||
public int undoStackSize = 5;
|
||||
public int undoStackSize = 10;
|
||||
}
|
||||
|
||||
public static class Visuals {
|
||||
|
||||
@@ -39,7 +39,7 @@ public class EffortlessBuilding
|
||||
{
|
||||
public static final String MODID = "effortlessbuilding";
|
||||
public static final String NAME = "Effortless Building";
|
||||
public static final String VERSION = "1.12.2-2.9";
|
||||
public static final String VERSION = "1.12.2-2.10";
|
||||
|
||||
@Mod.Instance(EffortlessBuilding.MODID)
|
||||
public static EffortlessBuilding instance;
|
||||
|
||||
@@ -1,16 +1,11 @@
|
||||
package nl.requios.effortlessbuilding.buildmode;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import nl.requios.effortlessbuilding.EffortlessBuilding;
|
||||
import nl.requios.effortlessbuilding.buildmodifier.ModifierSettingsManager;
|
||||
import nl.requios.effortlessbuilding.buildmodifier.UndoRedo;
|
||||
import nl.requios.effortlessbuilding.gui.buildmode.RadialMenu;
|
||||
import nl.requios.effortlessbuilding.gui.buildmodifier.ModifierSettingsGui;
|
||||
import nl.requios.effortlessbuilding.proxy.ClientProxy;
|
||||
|
||||
public class ModeOptions {
|
||||
|
||||
@@ -73,7 +68,6 @@ public class ModeOptions {
|
||||
//Called on both client and server
|
||||
public static void performAction(EntityPlayer player, ActionEnum action) {
|
||||
if (action == null) return;
|
||||
BuildModes.BuildModeEnum currentBuildMode = ModeSettingsManager.getModeSettings(Minecraft.getMinecraft().player).getBuildMode();
|
||||
|
||||
switch (action) {
|
||||
case UNDO:
|
||||
@@ -90,7 +84,7 @@ public class ModeOptions {
|
||||
break;
|
||||
case OPEN_MODIFIER_SETTINGS:
|
||||
if (player.world.isRemote)
|
||||
openModifierSettings();
|
||||
ClientProxy.openModifierSettings();
|
||||
break;
|
||||
|
||||
case NORMAL_SPEED:
|
||||
@@ -132,19 +126,7 @@ public class ModeOptions {
|
||||
}
|
||||
|
||||
if (player.world.isRemote && action != ActionEnum.REPLACE && action != ActionEnum.OPEN_MODIFIER_SETTINGS) {
|
||||
logAction(action);
|
||||
ClientProxy.logTranslate(action.name);
|
||||
}
|
||||
}
|
||||
|
||||
//TODO fix client class import giving error on server (nothing happens, it's just ugly)
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static void openModifierSettings() {
|
||||
Minecraft.getMinecraft().displayGuiScreen(new ModifierSettingsGui());
|
||||
RadialMenu.instance.setVisibility(0f);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static void logAction(ActionEnum action) {
|
||||
EffortlessBuilding.log(Minecraft.getMinecraft().player, I18n.format(action.name), true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,6 @@ package nl.requios.effortlessbuilding.buildmode;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.gameevent.PlayerEvent;
|
||||
import nl.requios.effortlessbuilding.EffortlessBuilding;
|
||||
import nl.requios.effortlessbuilding.capability.ModeCapabilityManager;
|
||||
import nl.requios.effortlessbuilding.helper.ReachHelper;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package nl.requios.effortlessbuilding.buildmodifier;
|
||||
|
||||
import mod.chiselsandbits.api.IBitLocation;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
@@ -3,8 +3,6 @@ package nl.requios.effortlessbuilding.buildmodifier;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.gameevent.PlayerEvent;
|
||||
import nl.requios.effortlessbuilding.BuildConfig;
|
||||
import nl.requios.effortlessbuilding.EffortlessBuilding;
|
||||
import nl.requios.effortlessbuilding.capability.ModifierCapabilityManager;
|
||||
|
||||
@@ -9,6 +9,7 @@ import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.client.settings.KeyBinding;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
@@ -80,7 +81,7 @@ public class ClientProxy implements IProxy {
|
||||
@Override
|
||||
public void init(FMLInitializationEvent event) {
|
||||
// register key bindings
|
||||
keyBindings = new KeyBinding[6];
|
||||
keyBindings = new KeyBinding[7];
|
||||
|
||||
// instantiate the key bindings
|
||||
keyBindings[0] = new KeyBinding("key.effortlessbuilding.hud.desc", KeyConflictContext.UNIVERSAL, Keyboard.KEY_ADD, "key.effortlessbuilding.category");
|
||||
@@ -96,7 +97,7 @@ public class ClientProxy implements IProxy {
|
||||
};
|
||||
keyBindings[4] = new KeyBinding("key.effortlessbuilding.undo.desc", KeyConflictContext.IN_GAME, KeyModifier.CONTROL, Keyboard.KEY_Z, "key.effortlessbuilding.category");
|
||||
keyBindings[5] = new KeyBinding("key.effortlessbuilding.redo.desc", KeyConflictContext.IN_GAME, KeyModifier.CONTROL, Keyboard.KEY_Y, "key.effortlessbuilding.category");
|
||||
// keyBindings[6] = new KeyBinding("Reload shaders", Keyboard.KEY_TAB, "key.effortlessbuilding.category");
|
||||
keyBindings[6] = new KeyBinding("Reload shaders", Keyboard.KEY_TAB, "key.effortlessbuilding.category");
|
||||
|
||||
// register all the key bindings
|
||||
for (int i = 0; i < keyBindings.length; ++i) {
|
||||
@@ -278,6 +279,7 @@ public class ClientProxy implements IProxy {
|
||||
}
|
||||
} else if (buildMode == BuildModes.BuildModeEnum.NORMAL_PLUS) {
|
||||
breakCooldown--;
|
||||
if (ModeOptions.getBuildSpeed() == ModeOptions.ActionEnum.FAST_SPEED) breakCooldown = 0;
|
||||
}
|
||||
|
||||
//EffortlessBuilding.packetHandler.sendToServer(new CancelModeMessage());
|
||||
@@ -301,16 +303,7 @@ public class ClientProxy implements IProxy {
|
||||
//Remember to send packet to server if necessary
|
||||
//Show Modifier Settings GUI
|
||||
if (keyBindings[0].isPressed()) {
|
||||
//Disabled if max reach is 0, might be set in the config that way.
|
||||
if (ReachHelper.getMaxReach(player) == 0) {
|
||||
EffortlessBuilding.log(player, "Build modifiers are disabled until your reach has increased. Increase your reach with craftable reach upgrades.");
|
||||
} else {
|
||||
if (Minecraft.getMinecraft().currentScreen == null) {
|
||||
Minecraft.getMinecraft().displayGuiScreen(new ModifierSettingsGui());
|
||||
} else {
|
||||
player.closeScreen();
|
||||
}
|
||||
}
|
||||
openModifierSettings();
|
||||
}
|
||||
|
||||
//QuickReplace toggle
|
||||
@@ -353,6 +346,23 @@ public class ClientProxy implements IProxy {
|
||||
|
||||
}
|
||||
|
||||
public static void openModifierSettings() {
|
||||
EntityPlayerSP player = Minecraft.getMinecraft().player;
|
||||
|
||||
RadialMenu.instance.setVisibility(0f);
|
||||
|
||||
//Disabled if max reach is 0, might be set in the config that way.
|
||||
if (ReachHelper.getMaxReach(player) == 0) {
|
||||
EffortlessBuilding.log(player, "Build modifiers are disabled until your reach has increased. Increase your reach with craftable reach upgrades.");
|
||||
} else {
|
||||
if (Minecraft.getMinecraft().currentScreen == null) {
|
||||
Minecraft.getMinecraft().displayGuiScreen(new ModifierSettingsGui());
|
||||
} else {
|
||||
player.closeScreen();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onGuiOpen(GuiOpenEvent event) {
|
||||
EntityPlayer player = Minecraft.getMinecraft().player;
|
||||
@@ -374,4 +384,8 @@ public class ClientProxy implements IProxy {
|
||||
return player.rayTrace(raytraceRange, 1f);
|
||||
// return world.rayTraceBlocks(start, end, false, false, false);
|
||||
}
|
||||
|
||||
public static void logTranslate(String key) {
|
||||
EffortlessBuilding.log(Minecraft.getMinecraft().player, I18n.format(key), true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,7 +72,8 @@ public class BlockPreviewRenderer {
|
||||
|
||||
private static List<PlacedData> placedDataList = new ArrayList<>();
|
||||
|
||||
private static final int secondaryTextureUnit = 7;
|
||||
private static final int primaryTextureUnit = 0;
|
||||
private static final int secondaryTextureUnit = 1;
|
||||
|
||||
public static void render(EntityPlayer player, ModifierSettings modifierSettings, ModeSettings modeSettings) {
|
||||
|
||||
@@ -382,19 +383,17 @@ public class BlockPreviewRenderer {
|
||||
int maskUniform = ARBShaderObjects.glGetUniformLocationARB(shader, "mask");
|
||||
|
||||
//image
|
||||
OpenGlHelper.setActiveTexture(ARBMultitexture.GL_TEXTURE0_ARB);
|
||||
ARBShaderObjects.glUniform1iARB(imageUniform, primaryTextureUnit);
|
||||
OpenGlHelper.setActiveTexture(ARBMultitexture.GL_TEXTURE0_ARB + primaryTextureUnit);
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, mc.renderEngine.getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).getGlTextureId());
|
||||
ARBShaderObjects.glUniform1iARB(imageUniform, 0);
|
||||
|
||||
OpenGlHelper.setActiveTexture(ARBMultitexture.GL_TEXTURE0_ARB + secondaryTextureUnit);
|
||||
|
||||
GlStateManager.enableTexture2D();
|
||||
GL11.glGetInteger(GL11.GL_TEXTURE_BINDING_2D);
|
||||
|
||||
//mask
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D,
|
||||
mc.renderEngine.getTexture(new ResourceLocation(EffortlessBuilding.MODID, "textures/shader_mask.png")).getGlTextureId());
|
||||
ARBShaderObjects.glUniform1iARB(maskUniform, secondaryTextureUnit);
|
||||
OpenGlHelper.setActiveTexture(ARBMultitexture.GL_TEXTURE0_ARB + secondaryTextureUnit);
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, mc.renderEngine.getTexture(ShaderHandler.shaderMaskTextureLocation).getGlTextureId());
|
||||
|
||||
//blockpos
|
||||
ARBShaderObjects.glUniform3fARB(blockposUniform, (float) blockpos.x, (float) blockpos.y, (float) blockpos.z);
|
||||
|
||||
@@ -185,8 +185,8 @@ public class RenderHandler implements IWorldEventListener {
|
||||
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation(EffortlessBuilding.MODID, "textures/shader_mask.png"));
|
||||
// Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(ShaderHandler.shaderMaskTextureLocation);
|
||||
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
@@ -196,6 +196,7 @@ public class RenderHandler implements IWorldEventListener {
|
||||
protected static void endBlockPreviews() {
|
||||
ShaderHandler.releaseShader();
|
||||
GlStateManager.disableBlend();
|
||||
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
package nl.requios.effortlessbuilding.render;
|
||||
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import nl.requios.effortlessbuilding.BuildConfig;
|
||||
import nl.requios.effortlessbuilding.EffortlessBuilding;
|
||||
import nl.requios.effortlessbuilding.proxy.ClientProxy;
|
||||
@@ -39,6 +40,8 @@ public final class ShaderHandler {
|
||||
public static int rawColor;
|
||||
public static int dissolve;
|
||||
|
||||
public static ResourceLocation shaderMaskTextureLocation = new ResourceLocation(EffortlessBuilding.MODID, "textures/shader_mask.png");
|
||||
|
||||
public static void init() {
|
||||
if(!doUseShaders())
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user