Compare commits

...

14 commits

Author SHA1 Message Date
e3d6f161a2 more tiny fixes 2020-08-03 19:52:53 +02:00
2df50e381d Fixed tooltip not showing angel mode 2020-08-03 19:30:55 +02:00
c141eddd2d tiny fix 2020-08-03 19:06:24 +02:00
fc8bb4b6ef
Merge pull request #12 from Theta-Dev/1.15_update1.1
1.15 update1.1
2020-08-03 19:02:03 +02:00
6149dc4114
Merge branch '1.14' into 1.15_update1.1 2020-08-03 19:01:50 +02:00
dfbdb10a80 Fixed key events 2020-08-03 00:57:48 +02:00
bab43266a6
Merge pull request #6 from Theta-Dev/upd1.1
Mod update to 1.1
2020-08-03 00:13:15 +02:00
ce9673ee87
Merge branch '1.14' into upd1.1 2020-08-03 00:12:05 +02:00
37dd871056
Merge pull request #5 from Theta-Dev/1.15
1.15
2020-08-03 00:06:08 +02:00
493861f8c9 Improved Preview Renderer 2020-08-02 18:09:42 +02:00
d3eaa22505 Ported to 1.14 2020-08-02 17:41:30 +02:00
36fa9efb32 Changed version to 1.14 2020-08-02 16:59:41 +02:00
c96feedb91 Changed version to 1.14 2020-08-02 16:56:49 +02:00
3f067cec30
Merge pull request #4 from Theta-Dev/1.15
Update mods.toml
2020-08-02 16:50:43 +02:00
9 changed files with 74 additions and 84 deletions

View file

@ -13,7 +13,7 @@ apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'eclipse'
apply plugin: 'maven-publish'
version = '1.15-1.1'
version = '1.14-1.1'
group = 'thetadev.constructionwand' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = 'constructionwand'
@ -25,7 +25,7 @@ minecraft {
// stable_# Stables are built at the discretion of the MCP team.
// Use non-default mappings at your own risk. they may not always work.
// Simply re-run your setup task after changing the mappings to update your workspace.
mappings channel: 'snapshot', version: '20200514-1.15.1'
mappings channel: 'snapshot', version: '20190719-1.14.3'
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
// accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
@ -98,14 +98,13 @@ dependencies {
// Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed
// that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied.
// The userdev artifact is a special name and will get all sorts of transformations applied to it.
minecraft 'net.minecraftforge:forge:1.15.2-31.2.31'
minecraft 'net.minecraftforge:forge:1.14.4-28.2.23'
runtimeOnly fg.deobf("vazkii.patchouli:Patchouli:1.15.2-1.2-32.160")
runtimeOnly fg.deobf("top.theillusivec4.curios:curios:FORGE-1.15.2-2.0.2.4")
runtimeOnly fg.deobf("vazkii.patchouli:Patchouli:1.14.4-1.1-25.135")
runtimeOnly fg.deobf("top.theillusivec4.curios:curios:FORGE-1.14.4-1.0.6.1")
compileOnly fg.deobf("vazkii.botania:Botania:r1.15-387.455:api")
runtimeOnly fg.deobf("vazkii.botania:Botania:r1.15-387.455")
compileOnly fg.deobf("vazkii.botania:Botania:r1.11-379.354:api")
runtimeOnly fg.deobf("vazkii.botania:Botania:r1.11-379.354")
// You may put jars on which you depend on in ./libs or you may define them like so..
// compile "some.group:artifact:version:classifier"

View file

@ -29,9 +29,11 @@ public class KeyEvents
private final String langPrefix = ConstructionWand.MODID + ".key.";
private final String langCategory = langPrefix + "category";
public final KeyBinding[] keys = {
new KeyBinding(langPrefix+"direction", KeyConflictContext.IN_GAME, InputMappings.getInputByCode(GLFW.GLFW_KEY_N, 0), langCategory),
new KeyBinding(langPrefix+"replace", KeyConflictContext.IN_GAME, KeyModifier.SHIFT, InputMappings.getInputByCode(GLFW.GLFW_KEY_N, 0), langCategory)
public final KeyBinding WAND_KEY = new KeyBinding(langPrefix+"wand", KeyConflictContext.IN_GAME, InputMappings.getInputByCode(GLFW.GLFW_KEY_N, 0), langCategory);
public static final KeyModifier[] keyModifiers = {
KeyModifier.NONE,
KeyModifier.SHIFT
};
public static final IEnumOption[] keyOptions = {
@ -42,8 +44,8 @@ public class KeyEvents
private boolean ctrlPressed;
public KeyEvents() {
for(KeyBinding key : keys) ClientRegistry.registerKeyBinding(key);
ctrlPressed = false;
ClientRegistry.registerKeyBinding(WAND_KEY);
ctrlPressed = false;
}
@SubscribeEvent
@ -52,10 +54,12 @@ public class KeyEvents
if(player == null) return;
if(WandUtil.holdingWand(player) == null) return;
for(int i=0; i<keyOptions.length; i++) {
if(keys[i].isPressed()) {
PacketWandOption packet = new PacketWandOption(keyOptions[i], true);
ConstructionWand.instance.HANDLER.sendToServer(packet);
if(WAND_KEY.isPressed()) {
for(int i=0; i<keyOptions.length; i++) {
if(keyModifiers[i].isActive(null)) {
PacketWandOption packet = new PacketWandOption(keyOptions[i], true);
ConstructionWand.instance.HANDLER.sendToServer(packet);
}
}
}
@ -86,7 +90,7 @@ public class KeyEvents
/*
@SubscribeEvent
public void sneak(InputUpdateEvent e) {
if(e.getMovementInput().sneaking) {
if(e.getMovementInput().sneak) {
PlayerEntity player = e.getPlayer();
if(WandUtil.holdingWand(player) == null) return;

View file

@ -1,11 +1,9 @@
package thetadev.constructionwand.client;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.vertex.IVertexBuilder;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.WorldRenderer;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
@ -13,7 +11,7 @@ import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.RayTraceResult;
import net.minecraftforge.client.event.DrawHighlightEvent;
import net.minecraftforge.client.event.DrawBlockHighlightEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import thetadev.constructionwand.basics.WandUtil;
import thetadev.constructionwand.job.WandJob;
@ -26,7 +24,7 @@ public class RenderBlockPreview
public LinkedList<BlockPos> undoBlocks;
@SubscribeEvent
public void renderBlockHighlight(DrawHighlightEvent event)
public void renderBlockHighlight(DrawBlockHighlightEvent event)
{
if(event.getTarget().getType() != RayTraceResult.Type.BLOCK) return;
@ -54,24 +52,48 @@ public class RenderBlockPreview
if(blocks == null || blocks.isEmpty()) return;
renderBlockList(blocks, event.getMatrix(), event.getBuffers(), colorR, colorG, colorB);
for(BlockPos block : blocks) {
double partialTicks = event.getPartialTicks();
double d0 = player.lastTickPosX + (player.posX - player.lastTickPosX) * partialTicks;
double d1 = player.lastTickPosY + player.getEyeHeight() + (player.posY - player.lastTickPosY) * partialTicks;
double d2 = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * partialTicks;
AxisAlignedBB aabb = new AxisAlignedBB(block).offset(-d0, -d1, -d2);
//WorldRenderer.drawSelectionBoundingBox(aabb, colorR, colorG, colorB, 0.4F);
drawBoundingBox(aabb, colorR, colorG, colorB, 0.4F);
}
event.setCanceled(true);
}
private void renderBlockList(LinkedList<BlockPos> blocks, MatrixStack ms, IRenderTypeBuffer buffer, float red, float green, float blue) {
double renderPosX = Minecraft.getInstance().getRenderManager().info.getProjectedView().getX();
double renderPosY = Minecraft.getInstance().getRenderManager().info.getProjectedView().getY();
double renderPosZ = Minecraft.getInstance().getRenderManager().info.getProjectedView().getZ();
private static void drawBoundingBox(AxisAlignedBB box, float red, float green, float blue, float alpha) {
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder buffer = tessellator.getBuffer();
buffer.begin(3, DefaultVertexFormats.POSITION_COLOR);
ms.push();
ms.translate(-renderPosX, -renderPosY, -renderPosZ);
//Base
buffer.pos(box.minX, box.minY, box.minZ).color(red, green, blue, alpha).endVertex();
buffer.pos(box.maxX, box.minY, box.minZ).color(red, green, blue, alpha).endVertex();
buffer.pos(box.maxX, box.minY, box.maxZ).color(red, green, blue, alpha).endVertex();
buffer.pos(box.minX, box.minY, box.maxZ).color(red, green, blue, alpha).endVertex();
buffer.pos(box.minX, box.minY, box.minZ).color(red, green, blue, alpha).endVertex();
//Side1
buffer.pos(box.minX, box.maxY, box.minZ).color(red, green, blue, alpha).endVertex();
buffer.pos(box.minX, box.maxY, box.maxZ).color(red, green, blue, alpha).endVertex();
buffer.pos(box.minX, box.minY, box.maxZ).color(red, green, blue, alpha).endVertex();
//Side2
buffer.pos(box.minX, box.maxY, box.maxZ).color(red, green, blue, alpha).endVertex();
buffer.pos(box.maxX, box.maxY, box.maxZ).color(red, green, blue, alpha).endVertex();
buffer.pos(box.maxX, box.minY, box.maxZ).color(red, green, blue, alpha).endVertex();
//Side3
buffer.pos(box.maxX, box.maxY, box.maxZ).color(red, green, blue, alpha).endVertex();
buffer.pos(box.maxX, box.maxY, box.minZ).color(red, green, blue, alpha).endVertex();
buffer.pos(box.maxX, box.minY, box.minZ).color(red, green, blue, alpha).endVertex();
//Side4
buffer.pos(box.maxX, box.maxY, box.minZ).color(red, green, blue, alpha).endVertex();
buffer.pos(box.minX, box.maxY, box.minZ).color(red, green, blue, alpha).endVertex();
for(BlockPos block : blocks) {
AxisAlignedBB aabb = new AxisAlignedBB(block);
IVertexBuilder lineBuilder = buffer.getBuffer(RenderTypes.TRANSLUCENT_LINES);
WorldRenderer.drawBoundingBox(ms, lineBuilder, aabb, red, green, blue, 0.4F);
}
ms.pop();
tessellator.draw();
}
}

View file

@ -1,37 +0,0 @@
package thetadev.constructionwand.client;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.renderer.RenderState;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import org.lwjgl.opengl.GL11;
import thetadev.constructionwand.ConstructionWand;
import java.util.OptionalDouble;
public class RenderTypes
{
public static final RenderType TRANSLUCENT_LINES;
protected static final RenderState.TransparencyState TRANSLUCENT_TRANSPARENCY = new RenderState.TransparencyState("translucent_transparency", () -> {
RenderSystem.enableBlend();
RenderSystem.defaultBlendFunc();
}, RenderSystem::disableBlend);
protected static final RenderState.DepthTestState DEPTH_ALWAYS = new RenderState.DepthTestState(GL11.GL_ALWAYS);
static {
RenderType.State translucentNoDepthState = RenderType.State.getBuilder().transparency(TRANSLUCENT_TRANSPARENCY)
.line(new RenderState.LineState(OptionalDouble.of(2)))
.texture(new RenderState.TextureState())
.depthTest(DEPTH_ALWAYS)
.build(false);
TRANSLUCENT_LINES = RenderType.makeType(
ConstructionWand.MODID+":translucent_lines",
DefaultVertexFormats.POSITION_COLOR,
GL11.GL_LINES,
256,
translucentNoDepthState
);
}
}

View file

@ -54,7 +54,7 @@ public abstract class ItemWand extends Item
Hand hand = context.getHand();
World world = context.getWorld();
if(world.isRemote) return ActionResultType.FAIL;
if(world.isRemote || player == null) return ActionResultType.FAIL;
ItemStack stack = player.getHeldItem(hand);
@ -74,7 +74,7 @@ public abstract class ItemWand extends Item
public ActionResult<ItemStack> onItemRightClick(World world, PlayerEntity player, Hand hand) {
ItemStack stack = player.getHeldItem(hand);
if(world.isRemote) return ActionResult.resultFail(stack);
if(world.isRemote) return new ActionResult<>(ActionResultType.FAIL, stack);
if(player.isSneaking()) {
// SHIFT + Right click: Change wand mode
@ -87,13 +87,13 @@ public abstract class ItemWand extends Item
optionMessage(player, opt);
player.inventory.markDirty();
return ActionResult.resultSuccess(stack);
return new ActionResult<>(ActionResultType.SUCCESS, stack);
}
else {
// Right click: Place angel block
//ConstructionWand.LOGGER.debug("Place angel block");
WandJob job = new AngelJob(player, world, stack);
return job.doIt() ? ActionResult.resultSuccess(stack) : ActionResult.resultFail(stack);
return new ActionResult<>(job.doIt() ? ActionResultType.SUCCESS : ActionResultType.FAIL, stack);
}
}
@ -136,7 +136,7 @@ public abstract class ItemWand extends Item
IEnumOption opt = WandOptions.options[0];
lines.add(new TranslationTextComponent(langTooltip + "blocks", wand.maxBlocks).applyTextStyle(TextFormatting.GRAY));
lines.add(new TranslationTextComponent(langPrefix+opt.getOptionKey()).applyTextStyle(TextFormatting.AQUA)
.appendSibling(new TranslationTextComponent(langPrefix+opt.getTranslationKey()).applyTextStyle(TextFormatting.WHITE)));
.appendSibling(new TranslationTextComponent(langPrefix+options.getOption(opt).getTranslationKey()).applyTextStyle(TextFormatting.WHITE)));
lines.add(new TranslationTextComponent(langTooltip + "shift").applyTextStyle(TextFormatting.AQUA));
}
}

View file

@ -22,7 +22,7 @@ public class AngelJob extends WandJob
@Override
protected void getBlockPositionList() {
if(options.getOption(EnumMode.DEFAULT) != EnumMode.ANGEL) return;
if(options.getOption(EnumMode.DEFAULT) != EnumMode.ANGEL || wandItem.angelDistance == 0) return;
if(!player.isCreative() && !ConfigHandler.ANGEL_FALLING.get() && player.fallDistance > 10) return;

View file

@ -6,7 +6,7 @@
# The name of the mod loader type to load - for regular FML @Mod mods it should be javafml
modLoader="javafml" #mandatory
# A version range to match for said mod loader - for regular FML @Mod it will be the forge version
loaderVersion="[31,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions.
loaderVersion="[28,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions.
# A URL to refer people to when problems occur with this mod
#issueTrackerURL="https://github.com/Theta-Dev/ConstructionWand" #optional
# A list of mods - how many allowed here is determined by the individual mod loader
@ -44,7 +44,7 @@ This is my first minecraft mod. May the odds be ever in your favor.
# Does this dependency have to exist - if not, ordering below must be specified
mandatory=true #mandatory
# The version range of the dependency
versionRange="[31,)" #mandatory
versionRange="[28,)" #mandatory
# An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory
ordering="NONE"
# Side this dependency is applied on - BOTH, CLIENT or SERVER
@ -53,6 +53,6 @@ This is my first minecraft mod. May the odds be ever in your favor.
[[dependencies.constructionwand]]
modId="minecraft"
mandatory=true
versionRange="[1.15.2]"
versionRange="[1.14.4]"
ordering="NONE"
side="BOTH"

View file

@ -5,6 +5,7 @@
"item.constructionwand.infinity_wand": "Stab der Unendlichkeit",
"constructionwand.key.category": "Construction Wand",
"constructionwand.key.wand": "Ausrichtung (+SHIFT: Ersetzungsmodus)",
"constructionwand.key.direction": "Ausrichtung",
"constructionwand.key.replace": "Ersetzungsmodus",

View file

@ -5,6 +5,7 @@
"item.constructionwand.infinity_wand": "Infinity Wand",
"constructionwand.key.category": "Construction Wand",
"constructionwand.key.wand": "Place direction (+SHIFT: Replacement mode)",
"constructionwand.key.direction": "Place direction",
"constructionwand.key.replace": "Replacement mode",