mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-11-14 06:24:29 +01:00
Merge remote-tracking branch 'origin/mc1.16/dev' into mc1.16/dev
This commit is contained in:
commit
0a0acb3d4c
@ -1,6 +1,6 @@
|
||||
<p align="center"><img src="https://i.imgur.com/35JmqWB.gif" alt="Logo" width="100"></p>
|
||||
<h1 align="center">Create<br>
|
||||
<a href="https://www.patreon.com/simibubi"><img src="https://img.shields.io/badge/Supporters-60-ff5733" alt="Patreon"></a>
|
||||
<p align="center"><img src="https://i.imgur.com/SXaePW6.png" alt="Logo" width="200"></p>
|
||||
<h1 align="center">Create <br>
|
||||
<a href="https://www.patreon.com/simibubi"><img src="https://img.shields.io/badge/Supporters-80-ff5733" alt="Patreon"></a>
|
||||
<a href="https://www.curseforge.com/minecraft/mc-mods/create/files"><img src="https://img.shields.io/badge/Available%20for-MC%201.14,%201.15,%201.16-c70039" alt="Supported Versions"></a>
|
||||
<a href="https://github.com/Creators-of-Create/Create/blob/master/LICENSE"><img src="https://img.shields.io/github/license/Creators-of-Create/Create?style=flat&color=900c3f" alt="License"></a>
|
||||
<a href="https://discord.gg/hmaD7Se"><img src="https://img.shields.io/discord/620934202875183104?color=844685&label=Feedback%20%26%20Help&style=flat" alt="Discord"></a>
|
||||
@ -13,7 +13,7 @@ The added elements of tech are designed to leave as many design choices to the p
|
||||
|
||||
Check out the wiki and in-game Tool-tips for further info on how to use these features, and stay tuned for an ever-growing selection of possibilities for Creative and Survival Minecraft.
|
||||
|
||||
[<img src="https://i.imgur.com/0lLX9Oy.jpg" width="210">](https://github.com/simibubi/Create/issues "Report Issues")
|
||||
[<img src="https://i.imgur.com/0lLX9Oy.jpg" width="210">](https://github.com/Creators-of-Create/Create/issues "Report Issues")
|
||||
[<img src="https://i.imgur.com/bjEZraY.jpg" width="210">](https://www.youtube.com/playlist?list=PLyADkcfPLU8ywCXZPaDbQ_JZJL0CGDN5Z "Watch Videos")
|
||||
[<img src="https://i.imgur.com/aWrjfKJ.jpg" width="210">](https://discord.gg/hmaD7Se "Feedback & Help")
|
||||
[<img src="https://i.imgur.com/xj8o2xC.jpg" width="210">](https://www.patreon.com/simibubi "Support Us")
|
||||
|
@ -4,7 +4,7 @@ org.gradle.jvmargs=-Xmx3G
|
||||
org.gradle.daemon=false
|
||||
|
||||
# mod version info
|
||||
mod_version=0.3.1c
|
||||
mod_version=0.3.2
|
||||
minecraft_version=1.16.5
|
||||
forge_version=36.0.42
|
||||
|
||||
|
@ -1654,7 +1654,7 @@ d080b1b25e5bc8baf5aee68691b08c7f12ece3b0 assets/create/models/item/windmill_bear
|
||||
a80fb25a0b655e76be986b5b49fcb0f03461a1ab assets/create/models/item/zinc_nugget.json
|
||||
b1689617190c05ef34bd18456b0c7ae09bb3210f assets/create/models/item/zinc_ore.json
|
||||
6490fa0587db770cf7c794b47f3bcd2b691f4226 assets/create/sounds.json
|
||||
0f1b4b980afba9bf2caf583b88e261bba8b10313 data/create/advancements/aesthetics.json
|
||||
5d0cc4c0255dc241e61c173b31ddca70c88d08e4 data/create/advancements/aesthetics.json
|
||||
187921fa131b06721bfaf63f2623a28c141aae9a data/create/advancements/andesite_alloy.json
|
||||
0ea2db7173b5be28b289ea7c9a6a0cf5805c60c7 data/create/advancements/andesite_casing.json
|
||||
83c046bd200623933545c9e4326f782fb02c87fa data/create/advancements/arm_blaze_burner.json
|
||||
@ -1779,6 +1779,7 @@ c368cadffa9177fefb9e92ff4453b40bc8dd670d data/create/advancements/recipes/create
|
||||
8fffce2a5c5dd88d52e3b006fa92fb18cf2f1571 data/create/advancements/recipes/create.base/blasting/zinc_ingot_from_crushed.json
|
||||
4bb60ef5e186f12a9d52e61319db8c78300c64ab data/create/advancements/recipes/create.base/blasting/zinc_ingot_from_ore.json
|
||||
d1d8cf6e1c95b7d99bf873fa6fee033103f995fd data/create/advancements/recipes/create.base/crafting/appliances/copper_backtank.json
|
||||
f2dc28c600011e6e8e515cb4d56118b1bd45b743 data/create/advancements/recipes/create.base/crafting/appliances/crafting_blueprint.json
|
||||
46c04e685ab345a80598176f7ac68a044a76cd76 data/create/advancements/recipes/create.base/crafting/appliances/diving_boots.json
|
||||
5f06b7dcf2af11f30c2e10ade4ac3fd172bc04df data/create/advancements/recipes/create.base/crafting/appliances/diving_helmet.json
|
||||
dd487f98c411f1ff22cb7fc208b8cc24b27deb2f data/create/advancements/recipes/create.base/crafting/appliances/dough.json
|
||||
@ -2858,6 +2859,7 @@ f7879d404d7a848d818278b4e788f285a9087e63 data/create/recipes/compacting/blaze_ca
|
||||
7b2ef15dd28d1d8a450ea49a82dfb361d1adde4c data/create/recipes/compacting/diorite_from_flint.json
|
||||
7657603e95ccf83dd0d4b104635db66e531d092a data/create/recipes/compacting/granite_from_flint.json
|
||||
30030b15caa11b3a7c0104adb62fe74e8c7c0df1 data/create/recipes/crafting/appliances/copper_backtank.json
|
||||
c077375d16b4505e52548613fbc9356993556e6b data/create/recipes/crafting/appliances/crafting_blueprint.json
|
||||
9ad82ac5ce02654b7af7f1a570a6b2c01e140da3 data/create/recipes/crafting/appliances/diving_boots.json
|
||||
813081c6421b34e161ec44e8e470994c282f76be data/create/recipes/crafting/appliances/diving_helmet.json
|
||||
19526da3a59fc136654ff1bc93c0251581f397a9 data/create/recipes/crafting/appliances/dough.json
|
||||
|
@ -28,8 +28,8 @@
|
||||
"trigger": "create:bracket_apply",
|
||||
"conditions": {
|
||||
"accepted_entries": [
|
||||
"create:cogwheel",
|
||||
"create:large_cogwheel"
|
||||
"create:large_cogwheel",
|
||||
"create:cogwheel"
|
||||
]
|
||||
}
|
||||
},
|
||||
|
@ -0,0 +1,32 @@
|
||||
{
|
||||
"parent": "minecraft:recipes/root",
|
||||
"rewards": {
|
||||
"recipes": [
|
||||
"create:crafting/appliances/crafting_blueprint"
|
||||
]
|
||||
},
|
||||
"criteria": {
|
||||
"has_item": {
|
||||
"trigger": "minecraft:inventory_changed",
|
||||
"conditions": {
|
||||
"items": [
|
||||
{
|
||||
"item": "minecraft:crafting_table"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"has_the_recipe": {
|
||||
"trigger": "minecraft:recipe_unlocked",
|
||||
"conditions": {
|
||||
"recipe": "create:crafting/appliances/crafting_blueprint"
|
||||
}
|
||||
}
|
||||
},
|
||||
"requirements": [
|
||||
[
|
||||
"has_item",
|
||||
"has_the_recipe"
|
||||
]
|
||||
]
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
{
|
||||
"type": "minecraft:crafting_shapeless",
|
||||
"ingredients": [
|
||||
{
|
||||
"item": "minecraft:painting"
|
||||
},
|
||||
{
|
||||
"item": "minecraft:crafting_table"
|
||||
}
|
||||
],
|
||||
"result": {
|
||||
"item": "create:crafting_blueprint"
|
||||
}
|
||||
}
|
@ -22,6 +22,8 @@ public class BlueprintTransferHandler implements IRecipeTransferHandler<Blueprin
|
||||
PlayerEntity player, boolean maxTransfer, boolean doTransfer) {
|
||||
if (!(recipe instanceof IRecipe))
|
||||
return null;
|
||||
if (!doTransfer)
|
||||
return null;
|
||||
IRecipe<?> iRecipe = (IRecipe<?>) recipe;
|
||||
// Continued server-side in BlueprintItem.assignCompleteRecipe()
|
||||
AllPackets.channel.sendToServer(new BlueprintAssignCompleteRecipePacket(iRecipe.getId()));
|
||||
|
@ -477,9 +477,13 @@ public abstract class KineticTileEntity extends SmartTileEntity
|
||||
return d.getAxisDirection() == AxisDirection.POSITIVE ? axisSpeed : -axisSpeed;
|
||||
}
|
||||
|
||||
public static float convertToLinear(float speed) { return speed / 512f; }
|
||||
public static float convertToLinear(float speed) {
|
||||
return speed / 512f;
|
||||
}
|
||||
|
||||
public static float convertToAngular(float speed) { return speed * 3 / 10f; }
|
||||
public static float convertToAngular(float speed) {
|
||||
return speed * 3 / 10f;
|
||||
}
|
||||
|
||||
public boolean isOverStressed() {
|
||||
return overStressed;
|
||||
@ -556,9 +560,8 @@ public abstract class KineticTileEntity extends SmartTileEntity
|
||||
@Override
|
||||
public void requestModelDataUpdate() {
|
||||
super.requestModelDataUpdate();
|
||||
if (!this.removed) {
|
||||
FastRenderDispatcher.enqueueUpdate(this);
|
||||
}
|
||||
if (!this.removed)
|
||||
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> FastRenderDispatcher.enqueueUpdate(this));
|
||||
}
|
||||
|
||||
protected AxisAlignedBB cachedBoundingBox;
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.simibubi.create.content.contraptions.fluids;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.IdentityHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.function.Predicate;
|
||||
@ -13,12 +14,14 @@ import com.simibubi.create.foundation.tileEntity.SmartTileEntity;
|
||||
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
||||
import com.simibubi.create.foundation.tileEntity.behaviour.BehaviourType;
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
import com.simibubi.create.foundation.utility.WorldAttached;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockDisplayReader;
|
||||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
@ -266,4 +269,23 @@ public abstract class FluidTransportBehaviour extends TileEntityBehaviour {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
// for switching TEs, but retaining flows
|
||||
|
||||
public static final WorldAttached<Map<BlockPos, Map<Direction, PipeConnection>>> interfaceTransfer =
|
||||
new WorldAttached<>(HashMap::new);
|
||||
|
||||
public static void cacheFlows(IWorld world, BlockPos pos) {
|
||||
FluidTransportBehaviour pipe = TileEntityBehaviour.get(world, pos, FluidTransportBehaviour.TYPE);
|
||||
if (pipe != null)
|
||||
interfaceTransfer.get(world)
|
||||
.put(pos, pipe.interfaces);
|
||||
}
|
||||
|
||||
public static void loadFlows(IWorld world, BlockPos pos) {
|
||||
FluidTransportBehaviour newPipe = TileEntityBehaviour.get(world, pos, FluidTransportBehaviour.TYPE);
|
||||
if (newPipe != null)
|
||||
newPipe.interfaces = interfaceTransfer.get(world)
|
||||
.remove(pos);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ import java.util.Random;
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.AllShapes;
|
||||
import com.simibubi.create.content.contraptions.fluids.FluidPropagator;
|
||||
import com.simibubi.create.content.contraptions.fluids.FluidTransportBehaviour;
|
||||
import com.simibubi.create.content.contraptions.relays.elementary.BracketedTileEntityBehaviour;
|
||||
import com.simibubi.create.content.contraptions.wrench.IWrenchableWithBracket;
|
||||
import com.simibubi.create.foundation.advancement.AllTriggers;
|
||||
@ -63,7 +64,9 @@ public class AxisPipeBlock extends RotatedPillarBlock implements IWrenchableWith
|
||||
BlockState newState = AllBlocks.ENCASED_FLUID_PIPE.getDefaultState();
|
||||
for (Direction d : Iterate.directionsInAxis(getAxis(state)))
|
||||
newState = newState.with(EncasedPipeBlock.FACING_TO_PROPERTY_MAP.get(d), true);
|
||||
FluidTransportBehaviour.cacheFlows(world, pos);
|
||||
world.setBlockState(pos, newState);
|
||||
FluidTransportBehaviour.loadFlows(world, pos);
|
||||
}
|
||||
AllTriggers.triggerFor(AllTriggers.CASING_PIPE, player);
|
||||
return ActionResultType.SUCCESS;
|
||||
|
@ -13,6 +13,7 @@ import java.util.Random;
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.AllTileEntities;
|
||||
import com.simibubi.create.content.contraptions.fluids.FluidPropagator;
|
||||
import com.simibubi.create.content.contraptions.fluids.FluidTransportBehaviour;
|
||||
import com.simibubi.create.content.contraptions.wrench.IWrenchable;
|
||||
import com.simibubi.create.content.schematics.ISpecialBlockItemRequirement;
|
||||
import com.simibubi.create.content.schematics.ItemRequirement;
|
||||
@ -126,8 +127,10 @@ public class EncasedPipeBlock extends Block implements IWrenchable, ISpecialBloc
|
||||
break;
|
||||
}
|
||||
|
||||
FluidTransportBehaviour.cacheFlows(world, pos);
|
||||
world.setBlockState(pos, AllBlocks.FLUID_PIPE.get()
|
||||
.updateBlockState(equivalentPipe, firstFound, null, world, pos));
|
||||
FluidTransportBehaviour.loadFlows(world, pos);
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -66,9 +66,13 @@ public class FluidPipeBlock extends SixWayBlock implements IWaterLoggable, IWren
|
||||
if (context.getFace()
|
||||
.getAxis() == axis)
|
||||
return ActionResultType.PASS;
|
||||
if (!world.isRemote)
|
||||
if (!world.isRemote) {
|
||||
FluidTransportBehaviour.cacheFlows(world, pos);
|
||||
world.setBlockState(pos, AllBlocks.GLASS_FLUID_PIPE.getDefaultState()
|
||||
.with(GlassFluidPipeBlock.AXIS, axis).with(BlockStateProperties.WATERLOGGED, state.get(BlockStateProperties.WATERLOGGED)));
|
||||
.with(GlassFluidPipeBlock.AXIS, axis)
|
||||
.with(BlockStateProperties.WATERLOGGED, state.get(BlockStateProperties.WATERLOGGED)));
|
||||
FluidTransportBehaviour.loadFlows(world, pos);
|
||||
}
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
|
||||
@ -78,9 +82,12 @@ public class FluidPipeBlock extends SixWayBlock implements IWaterLoggable, IWren
|
||||
if (!AllBlocks.COPPER_CASING.isIn(player.getHeldItem(hand)))
|
||||
return ActionResultType.PASS;
|
||||
AllTriggers.triggerFor(AllTriggers.CASING_PIPE, player);
|
||||
if (!world.isRemote)
|
||||
if (!world.isRemote) {
|
||||
FluidTransportBehaviour.cacheFlows(world, pos);
|
||||
world.setBlockState(pos,
|
||||
EncasedPipeBlock.transferSixWayProperties(state, AllBlocks.ENCASED_FLUID_PIPE.getDefaultState()));
|
||||
FluidTransportBehaviour.loadFlows(world, pos);
|
||||
}
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,7 @@ import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.AllTileEntities;
|
||||
import com.simibubi.create.content.contraptions.fluids.FluidTransportBehaviour;
|
||||
import com.simibubi.create.content.schematics.ISpecialBlockItemRequirement;
|
||||
import com.simibubi.create.content.schematics.ItemRequirement;
|
||||
|
||||
@ -59,8 +60,10 @@ public class GlassFluidPipeBlock extends AxisPipeBlock implements IWaterLoggable
|
||||
BlockState newState;
|
||||
World world = context.getWorld();
|
||||
BlockPos pos = context.getPos();
|
||||
FluidTransportBehaviour.cacheFlows(world, pos);
|
||||
newState = toRegularPipe(world, pos, state).with(BlockStateProperties.WATERLOGGED, state.get(BlockStateProperties.WATERLOGGED));
|
||||
world.setBlockState(pos, newState, 3);
|
||||
FluidTransportBehaviour.loadFlows(world, pos);
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -22,6 +22,7 @@ import com.simibubi.create.foundation.utility.outliner.Outliner.OutlineEntry;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
import net.minecraft.inventory.EquipmentSlotType;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@ -33,24 +34,15 @@ import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.ITextProperties;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
|
||||
|
||||
@EventBusSubscriber(value = Dist.CLIENT)
|
||||
public class GoggleOverlayRenderer {
|
||||
|
||||
private static final Map<Object, OutlineEntry> outlines = CreateClient.OUTLINER.getOutlines();
|
||||
|
||||
@SubscribeEvent
|
||||
public static void lookingAtBlocksThroughGogglesShowsTooltip(RenderGameOverlayEvent.Post event) {
|
||||
MatrixStack ms = event.getMatrixStack();
|
||||
if (event.getType() != ElementType.HOTBAR)
|
||||
return;
|
||||
|
||||
public static void renderOverlay(MatrixStack ms, IRenderTypeBuffer buffer, int light, int overlay,
|
||||
float partialTicks) {
|
||||
RayTraceResult objectMouseOver = Minecraft.getInstance().objectMouseOver;
|
||||
|
||||
if (!(objectMouseOver instanceof BlockRayTraceResult))
|
||||
return;
|
||||
|
||||
@ -58,9 +50,8 @@ public class GoggleOverlayRenderer {
|
||||
if (!entry.isAlive())
|
||||
continue;
|
||||
Outline outline = entry.getOutline();
|
||||
if (outline instanceof ValueBox && !((ValueBox) outline).isPassive) {
|
||||
if (outline instanceof ValueBox && !((ValueBox) outline).isPassive)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
BlockRayTraceResult result = (BlockRayTraceResult) objectMouseOver;
|
||||
|
@ -95,9 +95,8 @@ public class BeltMovementHandler {
|
||||
|
||||
// Lock entities in place
|
||||
boolean isPlayer = entityIn instanceof PlayerEntity;
|
||||
if (entityIn instanceof LivingEntity && !isPlayer) {
|
||||
if (entityIn instanceof LivingEntity && !isPlayer)
|
||||
((LivingEntity) entityIn).addPotionEffect(new EffectInstance(Effects.SLOWNESS, 10, 1, false, false));
|
||||
}
|
||||
|
||||
final Direction beltFacing = blockState.get(BlockStateProperties.HORIZONTAL_FACING);
|
||||
final BeltSlope slope = blockState.get(BeltBlock.SLOPE);
|
||||
@ -138,12 +137,14 @@ public class BeltMovementHandler {
|
||||
movement = movement.add(0, -Math.abs(axis.getCoordinate(movement.x, movement.y, movement.z)), 0);
|
||||
|
||||
Vector3d centering = Vector3d.of(centeringDirection).scale(diffCenter * Math.min(Math.abs(movementSpeed), .1f) * 4);
|
||||
float step = entityIn.stepHeight;
|
||||
|
||||
if (!isPlayer) {
|
||||
if (!(entityIn instanceof LivingEntity)
|
||||
|| ((LivingEntity) entityIn).moveForward == 0 && ((LivingEntity) entityIn).moveStrafing == 0)
|
||||
movement = movement.add(centering);
|
||||
|
||||
float step = entityIn.stepHeight;
|
||||
if (!isPlayer)
|
||||
entityIn.stepHeight = 1;
|
||||
}
|
||||
|
||||
// Entity Collisions
|
||||
if (Math.abs(movementSpeed) < .5f) {
|
||||
@ -175,6 +176,8 @@ public class BeltMovementHandler {
|
||||
} else {
|
||||
entityIn.move(SELF, movement);
|
||||
}
|
||||
|
||||
entityIn.onGround = true;
|
||||
|
||||
if (!isPlayer)
|
||||
entityIn.stepHeight = step;
|
||||
@ -189,6 +192,7 @@ public class BeltMovementHandler {
|
||||
entityIn.setMotion(movement);
|
||||
entityIn.velocityChanged = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static boolean shouldIgnoreBlocking(Entity me, Entity other) {
|
||||
|
@ -59,6 +59,7 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
import net.minecraftforge.common.ForgeMod;
|
||||
import net.minecraftforge.common.util.FakePlayer;
|
||||
import net.minecraftforge.fml.common.registry.IEntityAdditionalSpawnData;
|
||||
import net.minecraftforge.fml.hooks.BasicEventHooks;
|
||||
@ -243,6 +244,36 @@ public class BlueprintEntity extends HangingEntity
|
||||
return 16 * size;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hitByEntity(Entity source) {
|
||||
if (!(source instanceof PlayerEntity) || world.isRemote)
|
||||
return super.hitByEntity(source);
|
||||
|
||||
PlayerEntity player = (PlayerEntity) source;
|
||||
double attrib = player.getAttribute(ForgeMod.REACH_DISTANCE.get())
|
||||
.getValue() + (player.isCreative() ? 0 : -0.5F);
|
||||
|
||||
Vector3d eyePos = source.getEyePosition(1);
|
||||
Vector3d look = source.getLook(1);
|
||||
Vector3d target = eyePos.add(look.scale(attrib));
|
||||
|
||||
Optional<Vector3d> rayTrace = getBoundingBox().rayTrace(eyePos, target);
|
||||
if (!rayTrace.isPresent())
|
||||
return super.hitByEntity(source);
|
||||
|
||||
Vector3d hitVec = rayTrace.get();
|
||||
BlueprintSection sectionAt = getSectionAt(hitVec.subtract(getPositionVec()));
|
||||
ItemStackHandler items = sectionAt.getItems();
|
||||
|
||||
if (items.getStackInSlot(9)
|
||||
.isEmpty())
|
||||
return super.hitByEntity(source);
|
||||
for (int i = 0; i < items.getSlots(); i++)
|
||||
items.setStackInSlot(i, ItemStack.EMPTY);
|
||||
sectionAt.save(items);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBroken(@Nullable Entity p_110128_1_) {
|
||||
if (!world.getGameRules()
|
||||
@ -309,98 +340,88 @@ public class BlueprintEntity extends HangingEntity
|
||||
if (player instanceof FakePlayer)
|
||||
return ActionResultType.PASS;
|
||||
|
||||
boolean holdingWrench = AllItems.WRENCH.isIn(player.getHeldItem(hand));
|
||||
BlueprintSection section = getSectionAt(vec);
|
||||
ItemStackHandler items = section.getItems();
|
||||
|
||||
if (!AllItems.WRENCH.isIn(player.getHeldItem(hand)) && !world.isRemote) {
|
||||
boolean empty = true;
|
||||
ItemStackHandler items = section.getItems();
|
||||
for (int i = 0; i < 9; i++) {
|
||||
if (!items.getStackInSlot(i)
|
||||
.isEmpty()) {
|
||||
empty = false;
|
||||
if (!holdingWrench && !world.isRemote && !items.getStackInSlot(9)
|
||||
.isEmpty()) {
|
||||
|
||||
IItemHandlerModifiable playerInv = new InvWrapper(player.inventory);
|
||||
boolean firstPass = true;
|
||||
int amountCrafted = 0;
|
||||
ForgeHooks.setCraftingPlayer(player);
|
||||
Optional<ICraftingRecipe> recipe = Optional.empty();
|
||||
|
||||
do {
|
||||
Map<Integer, ItemStack> stacksTaken = new HashMap<>();
|
||||
Map<Integer, ItemStack> craftingGrid = new HashMap<>();
|
||||
boolean success = true;
|
||||
|
||||
Search: for (int i = 0; i < 9; i++) {
|
||||
ItemStack requestedItem = items.getStackInSlot(i);
|
||||
if (requestedItem.isEmpty()) {
|
||||
craftingGrid.put(i, ItemStack.EMPTY);
|
||||
continue;
|
||||
}
|
||||
|
||||
for (int slot = 0; slot < playerInv.getSlots(); slot++) {
|
||||
if (!FilterItem.test(world, playerInv.getStackInSlot(slot), requestedItem))
|
||||
continue;
|
||||
ItemStack currentItem = playerInv.extractItem(slot, 1, false);
|
||||
if (stacksTaken.containsKey(slot))
|
||||
stacksTaken.get(slot)
|
||||
.grow(1);
|
||||
else
|
||||
stacksTaken.put(slot, currentItem.copy());
|
||||
craftingGrid.put(i, currentItem);
|
||||
continue Search;
|
||||
}
|
||||
|
||||
success = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty) {
|
||||
IItemHandlerModifiable playerInv = new InvWrapper(player.inventory);
|
||||
boolean firstPass = true;
|
||||
int amountCrafted = 0;
|
||||
ForgeHooks.setCraftingPlayer(player);
|
||||
Optional<ICraftingRecipe> recipe = Optional.empty();
|
||||
if (success) {
|
||||
CraftingInventory craftingInventory = new BlueprintCraftingInventory(craftingGrid);
|
||||
|
||||
do {
|
||||
Map<Integer, ItemStack> stacksTaken = new HashMap<>();
|
||||
Map<Integer, ItemStack> craftingGrid = new HashMap<>();
|
||||
boolean success = true;
|
||||
|
||||
Search: for (int i = 0; i < 9; i++) {
|
||||
ItemStack requestedItem = items.getStackInSlot(i);
|
||||
if (requestedItem.isEmpty()) {
|
||||
craftingGrid.put(i, ItemStack.EMPTY);
|
||||
continue;
|
||||
}
|
||||
|
||||
for (int slot = 0; slot < playerInv.getSlots(); slot++) {
|
||||
if (!FilterItem.test(world, playerInv.getStackInSlot(slot), requestedItem))
|
||||
continue;
|
||||
ItemStack currentItem = playerInv.extractItem(slot, 1, false);
|
||||
if (stacksTaken.containsKey(slot)) {
|
||||
stacksTaken.get(slot)
|
||||
.grow(1);
|
||||
} else {
|
||||
stacksTaken.put(slot, currentItem.copy());
|
||||
}
|
||||
craftingGrid.put(i, currentItem);
|
||||
continue Search;
|
||||
}
|
||||
if (!recipe.isPresent())
|
||||
recipe = world.getRecipeManager()
|
||||
.getRecipe(IRecipeType.CRAFTING, craftingInventory, world);
|
||||
ItemStack result = recipe.filter(r -> r.matches(craftingInventory, world))
|
||||
.map(r -> r.getCraftingResult(craftingInventory))
|
||||
.orElse(ItemStack.EMPTY);
|
||||
|
||||
if (result.isEmpty()) {
|
||||
success = false;
|
||||
break;
|
||||
} else if (result.getCount() + amountCrafted > 64) {
|
||||
success = false;
|
||||
} else {
|
||||
amountCrafted += result.getCount();
|
||||
result.onCrafting(player.world, player, 1);
|
||||
BasicEventHooks.firePlayerCraftingEvent(player, result, craftingInventory);
|
||||
NonNullList<ItemStack> nonnulllist = world.getRecipeManager()
|
||||
.getRecipeNonNull(IRecipeType.CRAFTING, craftingInventory, world);
|
||||
|
||||
if (firstPass)
|
||||
world.playSound(null, player.getBlockPos(), SoundEvents.ENTITY_ITEM_PICKUP,
|
||||
SoundCategory.PLAYERS, .2f, 1f + Create.RANDOM.nextFloat());
|
||||
player.inventory.placeItemBackInInventory(world, result);
|
||||
for (ItemStack itemStack : nonnulllist)
|
||||
player.inventory.placeItemBackInInventory(world, itemStack);
|
||||
firstPass = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (success) {
|
||||
CraftingInventory craftingInventory = new BlueprintCraftingInventory(craftingGrid);
|
||||
if (!success) {
|
||||
for (Entry<Integer, ItemStack> entry : stacksTaken.entrySet())
|
||||
playerInv.insertItem(entry.getKey(), entry.getValue(), false);
|
||||
break;
|
||||
}
|
||||
|
||||
if (!recipe.isPresent())
|
||||
recipe = world.getRecipeManager()
|
||||
.getRecipe(IRecipeType.CRAFTING, craftingInventory, world);
|
||||
ItemStack result = recipe.filter(r -> r.matches(craftingInventory, world))
|
||||
.map(r -> r.getCraftingResult(craftingInventory))
|
||||
.orElse(ItemStack.EMPTY);
|
||||
|
||||
if (result.isEmpty()) {
|
||||
success = false;
|
||||
} else if (result.getCount() + amountCrafted > 64) {
|
||||
success = false;
|
||||
} else {
|
||||
amountCrafted += result.getCount();
|
||||
result.onCrafting(player.world, player, 1);
|
||||
BasicEventHooks.firePlayerCraftingEvent(player, result, craftingInventory);
|
||||
NonNullList<ItemStack> nonnulllist = world.getRecipeManager()
|
||||
.getRecipeNonNull(IRecipeType.CRAFTING, craftingInventory, world);
|
||||
|
||||
if (firstPass)
|
||||
world.playSound(null, player.getBlockPos(), SoundEvents.ENTITY_ITEM_PICKUP,
|
||||
SoundCategory.PLAYERS, .2f, 1f + Create.RANDOM.nextFloat());
|
||||
player.inventory.placeItemBackInInventory(world, result);
|
||||
for (ItemStack itemStack : nonnulllist)
|
||||
player.inventory.placeItemBackInInventory(world, itemStack);
|
||||
firstPass = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!success) {
|
||||
for (Entry<Integer, ItemStack> entry : stacksTaken.entrySet())
|
||||
playerInv.insertItem(entry.getKey(), entry.getValue(), false);
|
||||
break;
|
||||
}
|
||||
|
||||
} while (player.isSneaking());
|
||||
ForgeHooks.setCraftingPlayer(null);
|
||||
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
} while (player.isSneaking());
|
||||
ForgeHooks.setCraftingPlayer(null);
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
|
||||
int i = section.index;
|
||||
|
@ -2,15 +2,19 @@ package com.simibubi.create.content.curiosities.tools;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.IdentityHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.simibubi.create.AllItems;
|
||||
import com.simibubi.create.content.curiosities.tools.BlueprintEntity.BlueprintCraftingInventory;
|
||||
import com.simibubi.create.content.curiosities.tools.BlueprintEntity.BlueprintSection;
|
||||
import com.simibubi.create.content.logistics.item.filter.AttributeFilterContainer.WhitelistMode;
|
||||
import com.simibubi.create.content.logistics.item.filter.FilterItem;
|
||||
import com.simibubi.create.content.logistics.item.filter.ItemAttribute;
|
||||
import com.simibubi.create.foundation.gui.AllGuiTextures;
|
||||
import com.simibubi.create.foundation.gui.GuiGameElement;
|
||||
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||
@ -19,14 +23,21 @@ import com.simibubi.create.foundation.utility.Pair;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.inventory.CraftingInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.item.crafting.ICraftingRecipe;
|
||||
import net.minecraft.item.crafting.IRecipeType;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.ListNBT;
|
||||
import net.minecraft.tags.ITag;
|
||||
import net.minecraft.tags.TagCollectionManager;
|
||||
import net.minecraft.util.math.EntityRayTraceResult;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.math.RayTraceResult.Type;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.common.util.Constants.NBT;
|
||||
import net.minecraftforge.items.ItemHandlerHelper;
|
||||
import net.minecraftforge.items.ItemStackHandler;
|
||||
|
||||
@ -37,6 +48,7 @@ public class BlueprintOverlayRenderer {
|
||||
static boolean lastSneakState;
|
||||
static BlueprintSection lastTargetedSection;
|
||||
|
||||
static Map<ItemStack, ItemStack[]> cachedRenderedFilters = new IdentityHashMap<>();
|
||||
static List<Pair<ItemStack, Boolean>> ingredients = new ArrayList<>();
|
||||
static ItemStack result = ItemStack.EMPTY;
|
||||
static boolean resultCraftable = false;
|
||||
@ -72,6 +84,7 @@ public class BlueprintOverlayRenderer {
|
||||
}
|
||||
|
||||
public static void rebuild(BlueprintSection sectionAt, boolean sneak) {
|
||||
cachedRenderedFilters.clear();
|
||||
ItemStackHandler items = sectionAt.getItems();
|
||||
boolean empty = true;
|
||||
for (int i = 0; i < 9; i++) {
|
||||
@ -206,13 +219,9 @@ public class BlueprintOverlayRenderer {
|
||||
RenderSystem.enableBlend();
|
||||
(pair.getSecond() ? AllGuiTextures.HOTSLOT_ACTIVE : AllGuiTextures.HOTSLOT).draw(ms, x, y);
|
||||
ItemStack itemStack = pair.getFirst();
|
||||
GuiGameElement.of(itemStack)
|
||||
.at(x + 3, y + 3)
|
||||
.render(ms);
|
||||
mc.getItemRenderer()
|
||||
.renderItemOverlayIntoGUI(mc.fontRenderer, itemStack, x + 3, y + 3,
|
||||
pair.getSecond() || itemStack.getCount() == 1 ? null
|
||||
: TextFormatting.GOLD.toString() + itemStack.getCount());
|
||||
String count = pair.getSecond() || itemStack.getCount() == 1 ? null
|
||||
: TextFormatting.GOLD.toString() + itemStack.getCount();
|
||||
drawItemStack(ms, mc, x, y, itemStack, count);
|
||||
x += 21;
|
||||
}
|
||||
|
||||
@ -229,12 +238,59 @@ public class BlueprintOverlayRenderer {
|
||||
} else {
|
||||
(resultCraftable ? AllGuiTextures.HOTSLOT_SUPER_ACTIVE : AllGuiTextures.HOTSLOT).draw(ms,
|
||||
resultCraftable ? x - 1 : x, resultCraftable ? y - 1 : y);
|
||||
GuiGameElement.of(result)
|
||||
.at(x + 3, y + 3)
|
||||
.render(ms);
|
||||
mc.getItemRenderer()
|
||||
.renderItemOverlayIntoGUI(mc.fontRenderer, result, x + 3, y + 3, null);
|
||||
drawItemStack(ms, mc, x, y, result, null);
|
||||
}
|
||||
}
|
||||
|
||||
public static void drawItemStack(MatrixStack ms, Minecraft mc, int x, int y, ItemStack itemStack, String count) {
|
||||
if (itemStack.getItem() instanceof FilterItem) {
|
||||
int step = AnimationTickHolder.getTicks(mc.world) / 10;
|
||||
ItemStack[] itemsMatchingFilter = getItemsMatchingFilter(itemStack);
|
||||
if (itemsMatchingFilter.length > 0)
|
||||
itemStack = itemsMatchingFilter[step % itemsMatchingFilter.length];
|
||||
}
|
||||
|
||||
GuiGameElement.of(itemStack)
|
||||
.at(x + 3, y + 3)
|
||||
.render(ms);
|
||||
mc.getItemRenderer()
|
||||
.renderItemOverlayIntoGUI(mc.fontRenderer, itemStack, x + 3, y + 3, count);
|
||||
}
|
||||
|
||||
private static ItemStack[] getItemsMatchingFilter(ItemStack filter) {
|
||||
return cachedRenderedFilters.computeIfAbsent(filter, itemStack -> {
|
||||
CompoundNBT tag = itemStack.getOrCreateTag();
|
||||
|
||||
if (AllItems.FILTER.isIn(itemStack) && !tag.getBoolean("Blacklist")) {
|
||||
ItemStackHandler filterItems = FilterItem.getFilterItems(itemStack);
|
||||
List<ItemStack> list = new ArrayList<>();
|
||||
for (int slot = 0; slot < filterItems.getSlots(); slot++) {
|
||||
ItemStack stackInSlot = filterItems.getStackInSlot(slot);
|
||||
if (!stackInSlot.isEmpty())
|
||||
list.add(stackInSlot);
|
||||
}
|
||||
return list.toArray(new ItemStack[list.size()]);
|
||||
}
|
||||
|
||||
if (AllItems.ATTRIBUTE_FILTER.isIn(itemStack)) {
|
||||
WhitelistMode whitelistMode = WhitelistMode.values()[tag.getInt("WhitelistMode")];
|
||||
ListNBT attributes = tag.getList("MatchedAttributes", NBT.TAG_COMPOUND);
|
||||
if (whitelistMode == WhitelistMode.WHITELIST_DISJ && attributes.size() == 1) {
|
||||
ItemAttribute fromNBT = ItemAttribute.fromNBT((CompoundNBT) attributes.get(0));
|
||||
if (fromNBT instanceof ItemAttribute.InTag) {
|
||||
ItemAttribute.InTag inTag = (ItemAttribute.InTag) fromNBT;
|
||||
ITag<Item> itag = TagCollectionManager.getTagManager()
|
||||
.getItems()
|
||||
.get(inTag.tagName);
|
||||
if (itag != null)
|
||||
return Ingredient.fromTag(itag)
|
||||
.getMatchingStacks();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new ItemStack[0];
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -17,8 +17,11 @@ import net.minecraft.client.renderer.WorldRenderer;
|
||||
import net.minecraft.client.renderer.entity.EntityRenderer;
|
||||
import net.minecraft.client.renderer.entity.EntityRendererManager;
|
||||
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
|
||||
import net.minecraft.client.renderer.texture.OverlayTexture;
|
||||
import net.minecraft.inventory.container.PlayerContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.vector.Matrix3f;
|
||||
|
||||
public class BlueprintRenderer extends EntityRenderer<BlueprintEntity> {
|
||||
@ -40,15 +43,30 @@ public class BlueprintRenderer extends EntityRenderer<BlueprintEntity> {
|
||||
.translate(-.5, -1 / 32f, -.5);
|
||||
if (entity.size == 2)
|
||||
sbb.translate(.5, 0, -.5);
|
||||
sbb.light(light)
|
||||
.renderInto(ms, buffer.getBuffer(RenderType.getSolid()));
|
||||
|
||||
RenderType entitySolid = RenderType.getEntitySolid(PlayerContainer.BLOCK_ATLAS_TEXTURE);
|
||||
sbb.asEntityModel()
|
||||
.light(light)
|
||||
.renderInto(ms, buffer.getBuffer(entitySolid));
|
||||
super.render(entity, yaw, pt, ms, buffer, light);
|
||||
|
||||
ms.push();
|
||||
|
||||
float fakeNormalXRotation = -15;
|
||||
int bl = light >> 4 & 0xf;
|
||||
int sl = light >> 20 & 0xf;
|
||||
boolean vertical = entity.rotationPitch != 0;
|
||||
if (entity.rotationPitch == -90)
|
||||
fakeNormalXRotation = -45;
|
||||
else if (entity.rotationPitch == 90 || yaw % 180 != 0) {
|
||||
bl /= 1.35;
|
||||
sl /= 1.35;
|
||||
}
|
||||
int itemLight = MathHelper.floor(sl + .5) << 20 | (MathHelper.floor(bl + .5) & 0xf) << 4;
|
||||
|
||||
MatrixStacker.of(ms)
|
||||
.rotateY(-yaw)
|
||||
.rotateX(entity.rotationPitch == -90 ? -45 : entity.rotationPitch == 0 ? -15 : -5);
|
||||
.rotateY(vertical ? 0 : -yaw)
|
||||
.rotateX(fakeNormalXRotation);
|
||||
Matrix3f copy = ms.peek()
|
||||
.getNormal()
|
||||
.copy();
|
||||
@ -60,28 +78,34 @@ public class BlueprintRenderer extends EntityRenderer<BlueprintEntity> {
|
||||
.rotateY(-yaw)
|
||||
.rotateX(entity.rotationPitch)
|
||||
.translate(0, 0, 1 / 32f + .001);
|
||||
|
||||
|
||||
if (entity.size == 3)
|
||||
ms.translate(-1, -1, 0);
|
||||
|
||||
MatrixStack squashedMS = new MatrixStack();
|
||||
squashedMS.peek()
|
||||
.getModel()
|
||||
.multiply(ms.peek()
|
||||
.getModel());
|
||||
|
||||
for (int x = 0; x < entity.size; x++) {
|
||||
ms.push();
|
||||
squashedMS.push();
|
||||
for (int y = 0; y < entity.size; y++) {
|
||||
BlueprintSection section = entity.getSection(x * entity.size + y);
|
||||
Couple<ItemStack> displayItems = section.getDisplayItems();
|
||||
ms.push();
|
||||
ms.scale(.5f, .5f, 1 / 1024f);
|
||||
squashedMS.push();
|
||||
squashedMS.scale(.5f, .5f, 1 / 1024f);
|
||||
displayItems.forEachWithContext((stack, primary) -> {
|
||||
if (stack.isEmpty())
|
||||
return;
|
||||
|
||||
ms.push();
|
||||
squashedMS.push();
|
||||
if (!primary) {
|
||||
ms.translate(0.325f, -0.325f, 1);
|
||||
ms.scale(.625f, .625f, 1);
|
||||
squashedMS.translate(0.325f, -0.325f, 1);
|
||||
squashedMS.scale(.625f, .625f, 1);
|
||||
}
|
||||
|
||||
Matrix3f n = ms.peek()
|
||||
Matrix3f n = squashedMS.peek()
|
||||
.getNormal();
|
||||
n.a00 = copy.a00;
|
||||
n.a01 = copy.a01;
|
||||
@ -95,14 +119,14 @@ public class BlueprintRenderer extends EntityRenderer<BlueprintEntity> {
|
||||
|
||||
Minecraft.getInstance()
|
||||
.getItemRenderer()
|
||||
.renderItem(stack, TransformType.GUI, light, overlay, ms, buffer);
|
||||
ms.pop();
|
||||
.renderItem(stack, TransformType.GUI, itemLight, OverlayTexture.DEFAULT_UV, squashedMS, buffer);
|
||||
squashedMS.pop();
|
||||
});
|
||||
ms.pop();
|
||||
ms.translate(1, 0, 0);
|
||||
squashedMS.pop();
|
||||
squashedMS.translate(1, 0, 0);
|
||||
}
|
||||
ms.pop();
|
||||
ms.translate(0, 1, 0);
|
||||
squashedMS.pop();
|
||||
squashedMS.translate(0, 1, 0);
|
||||
}
|
||||
|
||||
ms.pop();
|
||||
|
@ -37,7 +37,7 @@ public class ArmInstance extends SingleRotatingInstance implements IDynamicInsta
|
||||
private final ArmTileEntity arm;
|
||||
private final Boolean ceiling;
|
||||
|
||||
private boolean firstTick = true;
|
||||
private boolean firstRender = true;
|
||||
|
||||
private float baseAngle = Float.NaN;
|
||||
private float lowerArmAngle = Float.NaN;
|
||||
@ -69,8 +69,9 @@ public class ArmInstance extends SingleRotatingInstance implements IDynamicInsta
|
||||
|
||||
@Override
|
||||
public void beginFrame() {
|
||||
if (arm.phase == ArmTileEntity.Phase.DANCING) {
|
||||
if (arm.phase == ArmTileEntity.Phase.DANCING && tile.getSpeed() != 0) {
|
||||
animateArm(true);
|
||||
firstRender = true;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -91,20 +92,19 @@ public class ArmInstance extends SingleRotatingInstance implements IDynamicInsta
|
||||
this.upperArmAngle = upperArmAngleNow;
|
||||
this.headAngle = headAngleNow;
|
||||
|
||||
if (!settled || firstTick)
|
||||
if (!settled || firstRender)
|
||||
animateArm(false);
|
||||
|
||||
if (settled)
|
||||
firstTick = false;
|
||||
if (firstRender)
|
||||
firstRender = false;
|
||||
}
|
||||
|
||||
private void animateArm(boolean rave) {
|
||||
|
||||
int color;
|
||||
float baseAngle;
|
||||
float lowerArmAngle;
|
||||
float upperArmAngle;
|
||||
float headAngle;
|
||||
int color;
|
||||
|
||||
if (rave) {
|
||||
float renderTick = AnimationTickHolder.getRenderTime(this.arm.getWorld()) + (tile.hashCode() % 64);
|
||||
@ -112,14 +112,12 @@ public class ArmInstance extends SingleRotatingInstance implements IDynamicInsta
|
||||
lowerArmAngle = MathHelper.lerp((MathHelper.sin(renderTick / 4) + 1) / 2, -45, 15);
|
||||
upperArmAngle = MathHelper.lerp((MathHelper.sin(renderTick / 8) + 1) / 4, -45, 95);
|
||||
headAngle = -lowerArmAngle;
|
||||
|
||||
color = ColorHelper.rainbowColor(AnimationTickHolder.getTicks() * 100);
|
||||
} else {
|
||||
baseAngle = this.baseAngle;
|
||||
lowerArmAngle = this.lowerArmAngle - 135;
|
||||
upperArmAngle = this.upperArmAngle - 90;
|
||||
headAngle = this.headAngle;
|
||||
|
||||
color = 0xFFFFFF;
|
||||
}
|
||||
|
||||
@ -182,4 +180,5 @@ public class ArmInstance extends SingleRotatingInstance implements IDynamicInsta
|
||||
super.remove();
|
||||
models.forEach(InstanceData::delete);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -40,12 +40,11 @@ public class ArmRenderer extends KineticTileEntityRenderer {
|
||||
protected void renderSafe(KineticTileEntity te, float pt, MatrixStack ms, IRenderTypeBuffer buffer, int light,
|
||||
int overlay) {
|
||||
super.renderSafe(te, pt, ms, buffer, light, overlay);
|
||||
|
||||
ArmTileEntity arm = (ArmTileEntity) te;
|
||||
|
||||
boolean usingFlywheel = FastRenderDispatcher.available(te.getWorld());
|
||||
|
||||
ItemStack item = arm.heldItem;
|
||||
boolean hasItem = !item.isEmpty();
|
||||
boolean usingFlywheel = FastRenderDispatcher.available(te.getWorld());
|
||||
|
||||
if (usingFlywheel && !hasItem) return;
|
||||
|
||||
@ -61,21 +60,27 @@ public class ArmRenderer extends KineticTileEntityRenderer {
|
||||
|
||||
MatrixStack msLocal = new MatrixStack();
|
||||
MatrixStacker msr = MatrixStacker.of(msLocal);
|
||||
int color = 0xFFFFFF;
|
||||
|
||||
float baseAngle = arm.baseAngle.get(pt);
|
||||
float lowerArmAngle = arm.lowerArmAngle.get(pt) - 135;
|
||||
float upperArmAngle = arm.upperArmAngle.get(pt) - 90;
|
||||
float headAngle = arm.headAngle.get(pt);
|
||||
float baseAngle;
|
||||
float lowerArmAngle;
|
||||
float upperArmAngle;
|
||||
float headAngle;
|
||||
int color;
|
||||
|
||||
boolean rave = arm.phase == Phase.DANCING;
|
||||
float renderTick = AnimationTickHolder.getRenderTime(te.getWorld()) + (te.hashCode() % 64);
|
||||
boolean rave = arm.phase == Phase.DANCING && te.getSpeed() != 0;
|
||||
if (rave) {
|
||||
float renderTick = AnimationTickHolder.getRenderTime(te.getWorld()) + (te.hashCode() % 64);
|
||||
baseAngle = (renderTick * 10) % 360;
|
||||
lowerArmAngle = MathHelper.lerp((MathHelper.sin(renderTick / 4) + 1) / 2, -45, 15);
|
||||
upperArmAngle = MathHelper.lerp((MathHelper.sin(renderTick / 8) + 1) / 4, -45, 95);
|
||||
headAngle = -lowerArmAngle;
|
||||
color = ColorHelper.rainbowColor(AnimationTickHolder.getTicks() * 100);
|
||||
} else {
|
||||
baseAngle = arm.baseAngle.get(pt);
|
||||
lowerArmAngle = arm.lowerArmAngle.get(pt) - 135;
|
||||
upperArmAngle = arm.upperArmAngle.get(pt) - 90;
|
||||
headAngle = arm.headAngle.get(pt);
|
||||
color = 0xFFFFFF;
|
||||
}
|
||||
|
||||
msr.centre();
|
||||
|
@ -222,7 +222,7 @@ public interface ItemAttribute {
|
||||
|
||||
public static class InTag implements ItemAttribute {
|
||||
|
||||
ResourceLocation tagName;
|
||||
public ResourceLocation tagName;
|
||||
|
||||
public InTag(ResourceLocation tagName) {
|
||||
this.tagName = tagName;
|
||||
|
@ -191,12 +191,11 @@ public class SchematicHandler {
|
||||
return;
|
||||
if (activeSchematicItem != null)
|
||||
this.overlay.renderOn(ms, activeHotbarSlot);
|
||||
|
||||
currentTool.getTool()
|
||||
.renderOverlay(ms, buffer);
|
||||
selectionScreen.renderPassive(ms, partialTicks);
|
||||
}
|
||||
|
||||
|
||||
public void onMouseInput(int button, boolean pressed) {
|
||||
if (!active)
|
||||
return;
|
||||
|
@ -14,11 +14,10 @@ public class SchematicHotbarSlotOverlay extends AbstractGui {
|
||||
MainWindow mainWindow = Minecraft.getInstance().getWindow();
|
||||
int x = mainWindow.getScaledWidth() / 2 - 88;
|
||||
int y = mainWindow.getScaledHeight() - 19;
|
||||
RenderSystem.enableAlphaTest();
|
||||
RenderSystem.enableDepthTest();
|
||||
RenderSystem.enableBlend();
|
||||
matrixStack.push();
|
||||
AllGuiTextures.SCHEMATIC_SLOT.draw(matrixStack, this, x + 20 * slot, y);
|
||||
RenderSystem.disableAlphaTest();
|
||||
matrixStack.pop();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -21,6 +21,7 @@ import com.simibubi.create.content.contraptions.components.structureMovement.tra
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.train.CouplingRenderer;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.train.capability.CapabilityMinecartController;
|
||||
import com.simibubi.create.content.contraptions.components.turntable.TurntableHandler;
|
||||
import com.simibubi.create.content.contraptions.goggles.GoggleOverlayRenderer;
|
||||
import com.simibubi.create.content.contraptions.goggles.IHaveGoggleInformation;
|
||||
import com.simibubi.create.content.contraptions.relays.belt.item.BeltConnectorHandler;
|
||||
import com.simibubi.create.content.curiosities.armor.CopperBacktankArmorLayer;
|
||||
@ -228,6 +229,7 @@ public class ClientEvents {
|
||||
CreateClient.SCHEMATIC_HANDLER.renderOverlay(ms, buffer, light, overlay, partialTicks);
|
||||
LinkedControllerClientHandler.renderOverlay(ms, buffer, light, overlay, partialTicks);
|
||||
BlueprintOverlayRenderer.renderOverlay(ms, buffer, light, overlay, partialTicks);
|
||||
GoggleOverlayRenderer.renderOverlay(ms, buffer, light, overlay, partialTicks);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
|
@ -968,6 +968,10 @@ public class StandardRecipeGen extends CreateRecipeProvider {
|
||||
.patternLine("P P")
|
||||
.patternLine("P P")
|
||||
.patternLine("G G")),
|
||||
|
||||
CRAFTING_BLUEPRINT = create(AllItems.CRAFTING_BLUEPRINT).unlockedBy(() -> Items.CRAFTING_TABLE)
|
||||
.viaShapeless(b -> b.addIngredient(Items.PAINTING)
|
||||
.addIngredient(Items.CRAFTING_TABLE)),
|
||||
|
||||
SLIME_BALL = create(() -> Items.SLIME_BALL).unlockedBy(AllItems.DOUGH::get)
|
||||
.viaShapeless(b -> b.addIngredient(AllItems.DOUGH.get())
|
||||
|
@ -136,6 +136,7 @@ public class ToolSelectionScreen extends Screen {
|
||||
matrixStack.pop();
|
||||
}
|
||||
|
||||
RenderSystem.enableBlend();
|
||||
matrixStack.pop();
|
||||
}
|
||||
|
||||
|
@ -133,9 +133,9 @@ public class CreateMainMenuScreen extends AbstractSimiScreen {
|
||||
int bShortWidth = 98;
|
||||
int bLongWidth = 200;
|
||||
|
||||
addButton(new Button(center - 100, yStart + 24 + -16, bLongWidth, bHeight, Lang.translate("menu.return"),
|
||||
addButton(new Button(center - 100, yStart + 92, bLongWidth, bHeight, Lang.translate("menu.return"),
|
||||
$ -> onClose()));
|
||||
addButton(new Button(center - 100, yStart + 48 + -16, bShortWidth, bHeight, Lang.translate("menu.configure"),
|
||||
addButton(new Button(center - 100, yStart + 24 + -16, bLongWidth, bHeight, Lang.translate("menu.configure"),
|
||||
$ -> linkTo(BaseConfigScreen.forCreate(this))));
|
||||
|
||||
Button gettingStarted = new Button(center + 2, yStart + 48 + -16, bShortWidth, bHeight,
|
||||
@ -148,11 +148,11 @@ public class CreateMainMenuScreen extends AbstractSimiScreen {
|
||||
String issueTrackerLink = "https://github.com/Creators-of-Create/Create/issues";
|
||||
String supportLink = "https://github.com/Creators-of-Create/Create/wiki/Supporting-the-Project";
|
||||
|
||||
addButton(new Button(center - 100, yStart + 68, bShortWidth, bHeight, Lang.translate("menu.project_page"),
|
||||
addButton(new Button(center - 100, yStart + 48 + -16, bShortWidth, bHeight, Lang.translate("menu.project_page"),
|
||||
$ -> linkTo(projectLink)));
|
||||
addButton(new Button(center + 2, yStart + 68, bShortWidth, bHeight, Lang.translate("menu.report_bugs"),
|
||||
$ -> linkTo(issueTrackerLink)));
|
||||
addButton(new Button(center - 100, yStart + 92, bLongWidth, bHeight, Lang.translate("menu.support"),
|
||||
addButton(new Button(center - 100, yStart + 68, bShortWidth, bHeight, Lang.translate("menu.support"),
|
||||
$ -> linkTo(supportLink)));
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,7 @@ import it.unimi.dsi.fastutil.longs.Long2DoubleMap;
|
||||
import it.unimi.dsi.fastutil.longs.Long2DoubleOpenHashMap;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.texture.OverlayTexture;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
@ -37,6 +38,7 @@ public class SuperByteBuffer extends TemplateBuffer {
|
||||
|
||||
// Vertex Texture Coords
|
||||
private SpriteShiftFunc spriteShiftFunc;
|
||||
private boolean isEntityModel;
|
||||
|
||||
// Vertex Lighting
|
||||
private boolean shouldLight;
|
||||
@ -78,7 +80,6 @@ public class SuperByteBuffer extends TemplateBuffer {
|
||||
Matrix3f normalMat = transforms.peek()
|
||||
.getNormal()
|
||||
.copy();
|
||||
// normalMat.multiply(transforms.peek().getNormal());
|
||||
|
||||
Matrix4f modelMat = input.peek()
|
||||
.getModel()
|
||||
@ -119,9 +120,9 @@ public class SuperByteBuffer extends TemplateBuffer {
|
||||
pos.transform(modelMat);
|
||||
builder.vertex(pos.getX(), pos.getY(), pos.getZ());
|
||||
|
||||
// builder.color((byte) Math.max(0, nx * 255), (byte) Math.max(0, ny * 255), (byte) Math.max(0, nz * 255), a);
|
||||
if (shouldColor) {
|
||||
// float lum = (r < 0 ? 255 + r : r) / 256f;
|
||||
if (isEntityModel) {
|
||||
builder.color(255, 255, 255, 255);
|
||||
} else if (shouldColor) {
|
||||
int colorR = Math.min(255, (int) (((float) this.r) * instanceDiffuse));
|
||||
int colorG = Math.min(255, (int) (((float) this.g) * instanceDiffuse));
|
||||
int colorB = Math.min(255, (int) (((float) this.b) * instanceDiffuse));
|
||||
@ -141,7 +142,10 @@ public class SuperByteBuffer extends TemplateBuffer {
|
||||
spriteShiftFunc.shift(builder, u, v);
|
||||
} else
|
||||
builder.texture(u, v);
|
||||
|
||||
|
||||
if (isEntityModel)
|
||||
builder.overlay(OverlayTexture.DEFAULT_UV);
|
||||
|
||||
if (shouldLight) {
|
||||
int light = packedLightCoords;
|
||||
if (lightTransform != null) {
|
||||
@ -158,14 +162,18 @@ public class SuperByteBuffer extends TemplateBuffer {
|
||||
} else
|
||||
builder.light(getLight(buffer, i));
|
||||
|
||||
builder.normal(nx, ny, nz)
|
||||
.endVertex();
|
||||
if (isEntityModel)
|
||||
builder.normal(input.peek().getNormal(), nx, ny, nz);
|
||||
else
|
||||
builder.normal(nx, ny, nz);
|
||||
builder.endVertex();
|
||||
}
|
||||
|
||||
transforms = new MatrixStack();
|
||||
|
||||
spriteShiftFunc = null;
|
||||
shouldColor = false;
|
||||
isEntityModel = false;
|
||||
shouldLight = false;
|
||||
otherBlockLight = -1;
|
||||
}
|
||||
@ -286,6 +294,11 @@ public class SuperByteBuffer extends TemplateBuffer {
|
||||
a = 255;
|
||||
return this;
|
||||
}
|
||||
|
||||
public SuperByteBuffer asEntityModel() {
|
||||
isEntityModel = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
private static int getLight(World world, Vector4f lightPos) {
|
||||
BlockPos.Mutable pos = new BlockPos.Mutable();
|
||||
@ -295,7 +308,7 @@ public class SuperByteBuffer extends TemplateBuffer {
|
||||
block += blockLightCache.computeIfAbsent(pos.toLong(), $ -> world.getLightLevel(LightType.BLOCK, pos));
|
||||
return ((int) sky) << 20 | ((int) block) << 4;
|
||||
}
|
||||
|
||||
|
||||
public boolean isEmpty() {
|
||||
return ((Buffer) template).limit() == 0;
|
||||
}
|
||||
|
@ -1,20 +1,24 @@
|
||||
modLoader="javafml"
|
||||
loaderVersion="[34,)"
|
||||
#issueTrackerURL=""
|
||||
modLoader="javafml"
|
||||
loaderVersion="[34,)"
|
||||
issueTrackerURL="https://github.com/Creators-of-Create/Create/issues"
|
||||
license="MIT"
|
||||
|
||||
[[mods]]
|
||||
[[mods]]
|
||||
modId="create"
|
||||
version="${file.jarVersion}"
|
||||
displayName="Create"
|
||||
displayName="Create"
|
||||
#updateJSONURL=""
|
||||
authors="simibubi"
|
||||
displayURL="https://www.curseforge.com/minecraft/mc-mods/create"
|
||||
logoFile="logo.png"
|
||||
#credits=""
|
||||
authors="simibubi"
|
||||
description='''
|
||||
Technology that empowers the player.'''
|
||||
Technology that empowers the player.
|
||||
'''
|
||||
|
||||
[[dependencies.create]]
|
||||
[[dependencies.create]]
|
||||
modId="forge"
|
||||
mandatory=true
|
||||
mandatory=true
|
||||
versionRange="[35.1.16,)"
|
||||
ordering="NONE"
|
||||
side="BOTH"
|
||||
@ -24,4 +28,4 @@ Technology that empowers the player.'''
|
||||
mandatory=true
|
||||
versionRange="[1.16.4,1.17)"
|
||||
ordering="NONE"
|
||||
side="BOTH"
|
||||
side="BOTH"
|
||||
|
BIN
src/main/resources/logo.png
Normal file
BIN
src/main/resources/logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 58 KiB |
Loading…
Reference in New Issue
Block a user