Compare commits

...

38 commits

Author SHA1 Message Date
31f549a0a0 Merge branch 'update_2.1' into 1.15 2021-04-01 07:32:45 +02:00
28db271630 2.0 Update fixes for 1.15 (2) 2021-03-14 23:10:13 +01:00
e5d393bce4 Merge branch 'update_1.8' into 1.15
# Conflicts:
#	src/main/java/thetadev/constructionwand/basics/WandUtil.java
2021-03-14 22:56:36 +01:00
ccad062fd5 Update 2.0 fixes for 1.15 2021-03-14 21:48:58 +01:00
a59db99c4f Merge branch 'update_1.8' into 1.15
# Conflicts:
#	README.md
#	gradle.properties
#	src/main/java/thetadev/constructionwand/ConstructionWand.java
#	src/main/java/thetadev/constructionwand/basics/ConfigClient.java
#	src/main/java/thetadev/constructionwand/basics/ConfigServer.java
#	src/main/java/thetadev/constructionwand/basics/WandUtil.java
#	src/main/java/thetadev/constructionwand/client/RenderTypes.java
#	src/main/java/thetadev/constructionwand/client/ScreenWand.java
#	src/main/java/thetadev/constructionwand/data/Inp.java
#	src/main/java/thetadev/constructionwand/data/RecipeGenerator.java
#	src/main/java/thetadev/constructionwand/items/ItemWand.java
#	src/main/java/thetadev/constructionwand/items/ItemWandBasic.java
#	src/main/java/thetadev/constructionwand/items/ItemWandInfinity.java
#	src/main/java/thetadev/constructionwand/items/ModItems.java
#	src/main/java/thetadev/constructionwand/job/AngelJob.java
#	src/main/java/thetadev/constructionwand/job/UndoHistory.java
#	src/main/java/thetadev/constructionwand/job/WandItemUseContext.java
#	src/main/java/thetadev/constructionwand/job/WandJob.java
#	src/main/resources/META-INF/mods.toml
2021-03-14 21:16:06 +01:00
c6f39b5378 Added TE White/Blacklist
Now triggers onBlockPlacedBy()
Fixed SecurityCraft bug
2020-12-06 19:28:41 +01:00
ba5e35de04 Updated mod to V1.6
Added MC 1.16.4 support
Better direction lock descriptions
Removed stray English words in German translation
2020-11-06 16:08:22 +01:00
17fd5d5fee 1.15 update fixes 2020-09-29 23:33:51 +02:00
3c5fdf5847
Merge pull request #26 from Theta-Dev/update_1.5
Update 1.5 -> 1.5
2020-09-29 22:53:14 +02:00
2abea82c76
Merge branch '1.15' into update_1.5 2020-09-29 22:53:02 +02:00
b848742f90
Merge branch '1.16' into update_1.5 2020-09-29 22:47:29 +02:00
3aee9629df Fixed stack overflow when placing many connecting blocks (1.16) 2020-09-18 22:29:53 +02:00
a966a47209 Merge remote-tracking branch 'origin/1.15' into 1.15
# Conflicts:
#	src/main/java/thetadev/constructionwand/job/WandJob.java
2020-09-18 22:02:53 +02:00
cb01f789cb Fixed stack overflow when placing many connecting blocks 2020-09-18 22:01:40 +02:00
a29ce8cc22 Fixed stack overflow when placing many connecting blocks 2020-09-18 21:32:42 +02:00
a0be0884f6 Changed readme 2020-09-18 13:08:19 +02:00
40a4df7a20 Changed readme 2020-09-18 13:06:12 +02:00
7b291d514f Changed botania version 2020-09-18 00:20:09 +02:00
e6e282427b
Merge pull request #22 from Theta-Dev/update1.3
Update1.3 -> 1.15
2020-09-18 00:16:41 +02:00
0ea9cfaf46 Changed version to 1.15 2020-09-18 00:16:15 +02:00
3003cdcf18 Merge branch '1.15' into update1.3 2020-09-18 00:15:17 +02:00
0d90de89cf
Removed duplicate forge declaration 2020-09-17 23:26:40 +02:00
fe89f27aaa Set direction default to TARGET 2020-09-17 23:19:19 +02:00
9aec266dd2 Set mc/forge version 2020-09-17 23:17:02 +02:00
0ca8f23b69
Merge pull request #21 from Theta-Dev/update1.3
Update1.3 -> 1.16
2020-09-17 23:03:50 +02:00
e4ca89680d
Merge branch '1.16' into update1.3 2020-09-17 23:03:42 +02:00
d87c7f7d1b fix exception with no-collision blocks 2020-08-27 00:10:38 +02:00
87ab64675f
Merge pull request #18 from Theta-Dev/fix_collision
Fix collision
2020-08-26 23:56:00 +02:00
b9353126eb
Merge branch '1.15' into fix_collision 2020-08-26 23:55:52 +02:00
20b016dd57
Merge pull request #17 from Theta-Dev/fix_collision
Fix collision
2020-08-26 23:51:57 +02:00
95d3c504ba
Merge branch '1.16' into fix_collision 2020-08-26 23:51:47 +02:00
4876683b07 placement dir improvements 2020-08-26 17:39:21 +02:00
64f947e535 Revert "Merge branch '1.16' into 1.15"
This reverts commit cd99733803, reversing
changes made to fa1587f269.
2020-08-26 17:24:31 +02:00
cd99733803 Merge branch '1.16' into 1.15 2020-08-26 17:20:13 +02:00
1186043bf3 placement dir improvements 2020-08-26 17:18:54 +02:00
fa1587f269
Merge pull request #13 from Theta-Dev/1.15_1.2
Update 1.2
2020-08-26 01:06:37 +02:00
e3918bc9bb
Update README.md 2020-08-15 21:10:51 +02:00
89fbd5313b
Update README.md 2020-08-03 21:56:39 +02:00
20 changed files with 84 additions and 94 deletions

View file

@ -104,6 +104,10 @@ dependencies {
version: "${project.botania}",
classifier: "api"
])
//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.botania:Botania:r1.15-387.455")
}
jar {
@ -137,4 +141,4 @@ publishing {
url "file:///${project.projectDir}/mcmodsrepo"
}
}
}
}

View file

@ -4,11 +4,11 @@ org.gradle.daemon=false
author=thetadev
modid=constructionwand
mcversion=1.16.5
forgeversion=36.0.46
mcp_mappings=20200723-1.16.1
mcversion=1.15.2
forgeversion=31.2.31
mcp_mappings=20200514-1.15.1
botania=1.16.2-405
botania=r1.15-387.455
version_major=2
version_minor=1

View file

@ -11,7 +11,7 @@
"conditions": {
"items": [
{
"tag": "minecraft:stone_tool_materials"
"tag": "forge:cobblestone"
}
]
}

View file

@ -7,7 +7,7 @@
],
"key": {
"X": {
"tag": "minecraft:stone_tool_materials"
"tag": "forge:cobblestone"
},
"#": {
"tag": "forge:rods/wooden"

View file

@ -82,7 +82,6 @@ public class ConstructionWand
renderBlockPreview = new RenderBlockPreview();
MinecraftForge.EVENT_BUS.register(renderBlockPreview);
MinecraftForge.EVENT_BUS.register(new ClientEvents());
ModItems.registerModelProperties();
ModItems.registerItemColors();
}

View file

@ -7,12 +7,8 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.BlockItem;
import net.minecraft.item.BlockItemUseContext;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.state.Property;
import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.state.properties.SlabType;
import net.minecraft.stats.Stats;
import net.minecraft.util.Direction;
import net.minecraft.util.EntityPredicates;
@ -20,9 +16,8 @@ import net.minecraft.util.Hand;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.BlockSnapshot;
@ -31,7 +26,6 @@ import thetadev.constructionwand.ConstructionWand;
import thetadev.constructionwand.basics.option.WandOptions;
import thetadev.constructionwand.containers.ContainerManager;
import thetadev.constructionwand.items.wand.ItemWand;
import thetadev.constructionwand.wand.WandItemUseContext;
import javax.annotation.Nullable;
import java.util.ArrayList;
@ -62,12 +56,12 @@ public class WandUtil
return new BlockPos(player.getPositionVec());
}
public static Vector3d entityPositionVec(Entity entity) {
return new Vector3d(entity.getPosX(), entity.getPosY() - entity.getYOffset() + entity.getHeight() / 2, entity.getPosZ());
public static Vec3d entityPositionVec(Entity entity) {
return new Vec3d(entity.getPosX(), entity.getPosY() - entity.getYOffset() + entity.getHeight() / 2, entity.getPosZ());
}
public static Vector3d blockPosVec(BlockPos pos) {
return new Vector3d(pos.getX(), pos.getY(), pos.getZ());
public static Vec3d blockPosVec(BlockPos pos) {
return new Vec3d(pos.getX(), pos.getY(), pos.getZ());
}
public static List<ItemStack> getHotbar(PlayerEntity player) {
@ -110,17 +104,15 @@ public class WandUtil
}
public static boolean placeBlock(World world, PlayerEntity player, BlockState block, BlockPos pos, @Nullable BlockItem item) {
if(!world.setBlockState(pos, block)) {
ConstructionWand.LOGGER.info("Block could not be placed");
return false;
}
// Remove block if placeEvent is canceled
BlockSnapshot snapshot = BlockSnapshot.create(world.func_234923_W_(), world, pos);
// Abort if placeEvent is canceled
BlockSnapshot snapshot = new BlockSnapshot(world, pos, block);
BlockEvent.EntityPlaceEvent placeEvent = new BlockEvent.EntityPlaceEvent(snapshot, block, player);
MinecraftForge.EVENT_BUS.post(placeEvent);
if(placeEvent.isCanceled()) {
world.removeBlock(pos, false);
if(placeEvent.isCanceled()) return false;
// Place the block
if(!world.setBlockState(pos, block)) {
ConstructionWand.LOGGER.info("Block could not be placed");
return false;
}
@ -211,14 +203,14 @@ public class WandUtil
* This check is independent from the used block.
*/
public static boolean isPositionPlaceable(World world, PlayerEntity player, BlockPos pos, boolean replace) {
if(!isPositionModifiable(world,player, pos)) return false;
if(!isPositionModifiable(world, player, pos)) return false;
// If replace mode is off, target has to be air
return replace || world.isAirBlock(pos);
}
public static boolean isBlockRemovable(World world, PlayerEntity player, BlockPos pos) {
if(!isPositionModifiable(world,player, pos)) return false;
if(!isPositionModifiable(world, player, pos)) return false;
if(!player.isCreative()) {
return !(world.getBlockState(pos).getBlockHardness(world, pos) <= -1) && world.getTileEntity(pos) == null;
@ -235,7 +227,7 @@ public class WandUtil
return false;
}
public static Direction fromVector(Vector3d vector) {
public static Direction fromVector(Vec3d vector) {
return Direction.getFacingFromVector(vector.x, vector.y, vector.z);
}
}

View file

@ -17,7 +17,7 @@ public class RenderTypes
RenderSystem.enableBlend();
RenderSystem.defaultBlendFunc();
}, RenderSystem::disableBlend);
protected static final RenderState.DepthTestState DEPTH_ALWAYS = new RenderState.DepthTestState("always", GL11.GL_ALWAYS);
protected static final RenderState.DepthTestState DEPTH_ALWAYS = new RenderState.DepthTestState(GL11.GL_ALWAYS);
static {
RenderType.State translucentNoDepthState = RenderType.State.getBuilder().transparency(TRANSLUCENT_TRANSPARENCY)

View file

@ -1,6 +1,5 @@
package thetadev.constructionwand.client;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.widget.button.Button;
@ -13,12 +12,13 @@ import thetadev.constructionwand.basics.option.IOption;
import thetadev.constructionwand.basics.option.WandOptions;
import thetadev.constructionwand.network.PacketWandOption;
import javax.annotation.Nonnull;
import java.util.HashMap;
public class ScreenWand extends Screen
{
private final ItemStack wand;
private final WandOptions wandOptions;
private final HashMap<IOption<?>, Button> optionButtons;
private static final int BUTTON_WIDTH = 160;
private static final int BUTTON_HEIGHT = 20;
@ -34,11 +34,13 @@ public class ScreenWand extends Screen
super(new StringTextComponent("ScreenWand"));
this.wand = wand;
wandOptions = new WandOptions(wand);
optionButtons = new HashMap<>();
}
@Override
public void init(@Nonnull Minecraft minecraft, int width, int height) {
public void init(Minecraft minecraft, int width, int height) {
super.init(minecraft, width, height);
optionButtons.clear();
createButton(0, 0, wandOptions.cores);
createButton(0, 1, wandOptions.lock);
@ -49,33 +51,35 @@ public class ScreenWand extends Screen
}
@Override
public void render(@Nonnull MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
renderBackground(matrixStack);
super.render(matrixStack, mouseX, mouseY, partialTicks);
drawCenteredString(matrixStack, font, wand.getDisplayName(), width / 2, height / 2 - FIELD_HEIGHT / 2 - SPACING_HEIGHT, 16777215);
public void render(int mouseX, int mouseY, float partialTicks) {
renderBackground();
super.render(mouseX, mouseY, partialTicks);
drawCenteredString(font, wand.getDisplayName().getFormattedText(), width / 2, height / 2 - FIELD_HEIGHT / 2 - SPACING_HEIGHT, 16777215);
optionButtons.forEach((opt, but) -> drawTooltip(mouseX, mouseY, opt, but));
}
@Override
public boolean charTyped(char character, int code) {
if(character == 'e') closeScreen();
if(character == 'e') onClose();
return super.charTyped(character, code);
}
private void createButton(int cx, int cy, IOption<?> option) {
Button button = new Button(getX(cx), getY(cy), BUTTON_WIDTH, BUTTON_HEIGHT, getButtonLabel(option), bt -> clickButton(bt, option), (bt, ms, x, y) -> drawTooltip(ms, x, y, option));
Button button = new Button(getX(cx), getY(cy), BUTTON_WIDTH, BUTTON_HEIGHT, getButtonLabel(option).getFormattedText(), bt -> clickButton(bt, option));
button.active = option.isEnabled();
addButton(button);
optionButtons.put(option, button);
}
private void clickButton(Button button, IOption<?> option) {
option.next();
ConstructionWand.instance.HANDLER.sendToServer(new PacketWandOption(option, false));
button.setMessage(getButtonLabel(option));
button.setMessage(getButtonLabel(option).getFormattedText());
}
private void drawTooltip(MatrixStack matrixStack, int mouseX, int mouseY, IOption<?> option) {
if(isMouseOver(mouseX, mouseY)) {
renderTooltip(matrixStack, new TranslationTextComponent(option.getDescTranslation()), mouseX, mouseY);
private void drawTooltip(int mouseX, int mouseY, IOption<?> option, Button button) {
if(button.isHovered()) {
renderTooltip(new TranslationTextComponent(option.getDescTranslation()).getFormattedText(), mouseX, mouseY);
}
}
@ -88,6 +92,6 @@ public class ScreenWand extends Screen
}
private ITextComponent getButtonLabel(IOption<?> option) {
return new TranslationTextComponent(option.getKeyTranslation()).append(new TranslationTextComponent(option.getValueTranslation()));
return new TranslationTextComponent(option.getKeyTranslation()).appendSibling(new TranslationTextComponent(option.getValueTranslation()));
}
}

View file

@ -3,7 +3,7 @@ package thetadev.constructionwand.data;
import net.minecraft.advancements.criterion.ItemPredicate;
import net.minecraft.item.Item;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.tags.ITag;
import net.minecraft.tags.Tag;
import net.minecraft.util.IItemProvider;
public class Inp
@ -22,7 +22,7 @@ public class Inp
return new Inp(in.asItem().getRegistryName().getPath(), Ingredient.fromItems(in), ItemPredicate.Builder.create().item(in).build());
}
public static Inp fromTag(ITag.INamedTag<Item> in) {
return new Inp(in.getName().getPath(), Ingredient.fromTag(in), ItemPredicate.Builder.create().tag(in).build());
public static Inp fromTag(Tag<Item> in) {
return new Inp(in.getId().getPath(), Ingredient.fromTag(in), ItemPredicate.Builder.create().tag(in).build());
}
}

View file

@ -3,8 +3,8 @@ package thetadev.constructionwand.data;
import net.minecraft.data.DataGenerator;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraftforge.client.model.generators.ExistingFileHelper;
import net.minecraftforge.client.model.generators.ItemModelProvider;
import net.minecraftforge.common.data.ExistingFileHelper;
import thetadev.constructionwand.ConstructionWand;
import thetadev.constructionwand.items.ModItems;

View file

@ -1,7 +1,7 @@
package thetadev.constructionwand.data;
import net.minecraft.data.DataGenerator;
import net.minecraftforge.common.data.ExistingFileHelper;
import net.minecraftforge.client.model.generators.ExistingFileHelper;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.GatherDataEvent;

View file

@ -3,7 +3,6 @@ package thetadev.constructionwand.data;
import net.minecraft.data.*;
import net.minecraft.item.Items;
import net.minecraft.item.crafting.SpecialRecipeSerializer;
import net.minecraft.tags.ItemTags;
import net.minecraft.util.IItemProvider;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.registry.Registry;
@ -23,7 +22,7 @@ public class RecipeGenerator extends RecipeProvider
@Override
protected void registerRecipes(@Nonnull Consumer<IFinishedRecipe> consumer) {
wandRecipe(consumer, ModItems.WAND_STONE, Inp.fromTag(ItemTags.field_232909_aa_)); //stone_tool_materials
wandRecipe(consumer, ModItems.WAND_STONE, Inp.fromTag(Tags.Items.COBBLESTONE));
wandRecipe(consumer, ModItems.WAND_IRON, Inp.fromTag(Tags.Items.INGOTS_IRON));
wandRecipe(consumer, ModItems.WAND_DIAMOND, Inp.fromTag(Tags.Items.GEMS_DIAMOND));
wandRecipe(consumer, ModItems.WAND_INFINITY, Inp.fromTag(Tags.Items.NETHER_STARS));

View file

@ -4,7 +4,6 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.color.ItemColors;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemModelsProperties;
import net.minecraft.item.ItemTier;
import net.minecraft.item.crafting.IRecipeSerializer;
import net.minecraftforge.api.distmarker.Dist;
@ -74,17 +73,6 @@ public class ModItems
register(r, "wand_upgrade", RecipeWandUpgrade.SERIALIZER);
}
@OnlyIn(Dist.CLIENT)
public static void registerModelProperties() {
for(Item item : WANDS) {
ItemModelsProperties.func_239418_a_(
item, ConstructionWand.loc("using_core"),
(stack, world, entity) -> entity == null || !(stack.getItem() instanceof ItemWand) ? 0 :
new WandOptions(stack).cores.get().getColor() > -1 ? 1 : 0
);
}
}
@OnlyIn(Dist.CLIENT)
public static void registerItemColors() {
ItemColors colors = Minecraft.getInstance().getItemColors();

View file

@ -24,8 +24,8 @@ public abstract class ItemCore extends ItemBase implements IWandCore
@OnlyIn(Dist.CLIENT)
public void addInformation(@Nonnull ItemStack itemstack, World worldIn, @Nonnull List<ITextComponent> lines, @Nonnull ITooltipFlag extraInfo) {
lines.add(new TranslationTextComponent(ConstructionWand.MODID + ".option.cores." + getRegistryName().toString() + ".desc")
.mergeStyle(TextFormatting.GRAY));
.applyTextStyle(TextFormatting.GRAY));
lines.add(new TranslationTextComponent(ConstructionWand.MODID + ".tooltip.core_tip")
.mergeStyle(TextFormatting.AQUA));
.applyTextStyle(TextFormatting.AQUA));
}
}

View file

@ -9,6 +9,7 @@ import net.minecraft.item.ItemUseContext;
import net.minecraft.util.ActionResult;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Hand;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
@ -36,6 +37,9 @@ public abstract class ItemWand extends ItemBase implements ICustomItemModel
{
public ItemWand(String name, Properties properties) {
super(name, properties);
addPropertyOverride(new ResourceLocation(ConstructionWand.MODID, "using_core"),
(stack, world, entity) -> entity == null || !(stack.getItem() instanceof ItemWand) ? 0 :
new WandOptions(stack).cores.get().getColor() > -1 ? 1 : 0);
}
@Nonnull
@ -106,13 +110,13 @@ public abstract class ItemWand extends ItemBase implements ICustomItemModel
if(Screen.hasShiftDown()) {
for(int i = 1; i < options.allOptions.length; i++) {
IOption<?> opt = options.allOptions[i];
lines.add(new TranslationTextComponent(opt.getKeyTranslation()).mergeStyle(TextFormatting.AQUA)
.append(new TranslationTextComponent(opt.getValueTranslation()).mergeStyle(TextFormatting.GRAY))
lines.add(new TranslationTextComponent(opt.getKeyTranslation()).applyTextStyle(TextFormatting.AQUA)
.appendSibling(new TranslationTextComponent(opt.getValueTranslation()).applyTextStyle(TextFormatting.GRAY))
);
}
if(!options.cores.getUpgrades().isEmpty()) {
lines.add(new StringTextComponent(""));
lines.add(new TranslationTextComponent(langTooltip + "cores").mergeStyle(TextFormatting.GRAY));
lines.add(new TranslationTextComponent(langTooltip + "cores").applyTextStyle(TextFormatting.GRAY));
for(IWandCore core : options.cores.getUpgrades()) {
lines.add(new TranslationTextComponent(options.cores.getKeyTranslation() + "." + core.getRegistryName().toString()));
@ -122,19 +126,19 @@ public abstract class ItemWand extends ItemBase implements ICustomItemModel
// Default tooltip: show block limit + active wand core
else {
IOption<?> opt = options.allOptions[0];
lines.add(new TranslationTextComponent(langTooltip + "blocks", limit).mergeStyle(TextFormatting.GRAY));
lines.add(new TranslationTextComponent(opt.getKeyTranslation()).mergeStyle(TextFormatting.AQUA)
.append(new TranslationTextComponent(opt.getValueTranslation()).mergeStyle(TextFormatting.WHITE)));
lines.add(new TranslationTextComponent(langTooltip + "shift").mergeStyle(TextFormatting.AQUA));
lines.add(new TranslationTextComponent(langTooltip + "blocks", limit).applyTextStyle(TextFormatting.GRAY));
lines.add(new TranslationTextComponent(opt.getKeyTranslation()).applyTextStyle(TextFormatting.AQUA)
.appendSibling(new TranslationTextComponent(opt.getValueTranslation()).applyTextStyle(TextFormatting.WHITE)));
lines.add(new TranslationTextComponent(langTooltip + "shift").applyTextStyle(TextFormatting.AQUA));
}
}
public static void optionMessage(PlayerEntity player, IOption<?> option) {
player.sendStatusMessage(
new TranslationTextComponent(option.getKeyTranslation()).mergeStyle(TextFormatting.AQUA)
.append(new TranslationTextComponent(option.getValueTranslation()).mergeStyle(TextFormatting.WHITE))
.append(new StringTextComponent(" - ").mergeStyle(TextFormatting.GRAY))
.append(new TranslationTextComponent(option.getDescTranslation()).mergeStyle(TextFormatting.WHITE))
new TranslationTextComponent(option.getKeyTranslation()).applyTextStyle(TextFormatting.AQUA)
.appendSibling(new TranslationTextComponent(option.getValueTranslation()).applyTextStyle(TextFormatting.WHITE))
.appendSibling(new StringTextComponent(" - ").applyTextStyle(TextFormatting.GRAY))
.appendSibling(new TranslationTextComponent(option.getDescTranslation()).applyTextStyle(TextFormatting.WHITE))
, true);
}

View file

@ -4,6 +4,6 @@ package thetadev.constructionwand.items.wand;
public class ItemWandInfinity extends ItemWand
{
public ItemWandInfinity(String name, Properties properties) {
super(name, properties.maxStackSize(1).isBurnable());
super(name, properties.maxStackSize(1));
}
}

View file

@ -7,7 +7,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import thetadev.constructionwand.basics.WandUtil;
@ -18,10 +18,10 @@ public class WandItemUseContext extends BlockItemUseContext
new BlockRayTraceResult(getBlockHitVec(rayTraceResult, pos), rayTraceResult.getFace(), pos, false));
}
private static Vector3d getBlockHitVec(BlockRayTraceResult rayTraceResult, BlockPos pos) {
Vector3d hitVec = rayTraceResult.getHitVec(); // Absolute coords of hit target
private static Vec3d getBlockHitVec(BlockRayTraceResult rayTraceResult, BlockPos pos) {
Vec3d hitVec = rayTraceResult.getHitVec(); // Absolute coords of hit target
Vector3d blockDelta = WandUtil.blockPosVec(rayTraceResult.getPos()).subtract(WandUtil.blockPosVec(pos)); // Vector between start and current block
Vec3d blockDelta = WandUtil.blockPosVec(rayTraceResult.getPos()).subtract(WandUtil.blockPosVec(pos)); // Vector between start and current block
return blockDelta.add(hitVec); // Absolute coords of current block hit target
}

View file

@ -6,7 +6,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import thetadev.constructionwand.api.IWandAction;
import thetadev.constructionwand.api.IWandSupplier;
@ -57,9 +57,9 @@ public class ActionAngel implements IWandAction
if(!player.isCreative() && !ConfigServer.ANGEL_FALLING.get() && player.fallDistance > 10) return placeSnapshots;
Vector3d playerVec = WandUtil.entityPositionVec(player);
Vector3d lookVec = player.getLookVec().mul(2, 2, 2);
Vector3d placeVec = playerVec.add(lookVec);
Vec3d playerVec = WandUtil.entityPositionVec(player);
Vec3d lookVec = player.getLookVec().mul(2, 2, 2);
Vec3d placeVec = playerVec.add(lookVec);
BlockPos currentPos = new BlockPos(placeVec);

View file

@ -92,8 +92,8 @@ public class PlaceSnapshot implements ISnapshot
@SuppressWarnings({"rawtypes", "unchecked"})
@Nullable
private static BlockState getPlaceBlockstate(World world, PlayerEntity player, BlockRayTraceResult rayTraceResult,
BlockPos pos, BlockItem item,
@Nullable BlockState supportingBlock, boolean targetMode) {
BlockPos pos, BlockItem item,
@Nullable BlockState supportingBlock, boolean targetMode) {
// Is block at pos replaceable?
BlockItemUseContext ctx = new WandItemUseContext(world, player, rayTraceResult, pos, item);
if(!ctx.canPlace()) return null;
@ -119,13 +119,13 @@ public class PlaceSnapshot implements ISnapshot
for(Property property : new Property[]{
BlockStateProperties.HORIZONTAL_FACING, BlockStateProperties.FACING, BlockStateProperties.FACING_EXCEPT_UP,
BlockStateProperties.ROTATION_0_15, BlockStateProperties.AXIS, BlockStateProperties.HALF, BlockStateProperties.STAIRS_SHAPE}) {
if(supportingBlock.hasProperty(property) && blockState.hasProperty(property)) {
if(supportingBlock.has(property) && blockState.has(property)) {
blockState = blockState.with(property, supportingBlock.get(property));
}
}
// Dont dupe double slabs
if(supportingBlock.hasProperty(BlockStateProperties.SLAB_TYPE) && blockState.hasProperty(BlockStateProperties.SLAB_TYPE)) {
if(supportingBlock.has(BlockStateProperties.SLAB_TYPE) && blockState.has(BlockStateProperties.SLAB_TYPE)) {
SlabType slabType = supportingBlock.get(BlockStateProperties.SLAB_TYPE);
if(slabType != SlabType.DOUBLE) blockState = blockState.with(BlockStateProperties.SLAB_TYPE, slabType);
}

View file

@ -1,6 +1,6 @@
modLoader="javafml"
loaderVersion="[33,)"
license="MIT License"
loaderVersion="[31,)"
[[mods]]
modId="constructionwand"
version="${file.jarVersion}"
@ -20,12 +20,12 @@ This is my first minecraft mod. May the odds be ever in your favor.
[[dependencies.constructionwand]]
modId="forge"
mandatory=true
versionRange="[33,)"
versionRange="[31,)"
ordering="NONE"
side="BOTH"
[[dependencies.constructionwand]]
modId="minecraft"
mandatory=true
versionRange="[1.16.2, 1.16.5]"
versionRange="[1.15.2]"
ordering="NONE"
side="BOTH"