Skip to content
This repository has been archived by the owner on Nov 27, 2021. It is now read-only.

Commit

Permalink
Merge pull request #10 from Toad-Dev/fabric-merith
Browse files Browse the repository at this point in the history
Bugfixes
  • Loading branch information
Merith-TK authored May 16, 2021
2 parents d197268 + 9353ded commit a475f55
Show file tree
Hide file tree
Showing 9 changed files with 144 additions and 229 deletions.
14 changes: 0 additions & 14 deletions .github/workflows/main-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,3 @@ jobs:
with:
name: cc-restiched
path: build/libs

- name: Upload Coverage
run: bash <(curl -s https://codecov.io/bash)
continue-on-error: true

- name: Lint Lua code
run: |
test -d bin || mkdir bin
test -f bin/illuaminate || wget -q -Obin/illuaminate https://squiddev.cc/illuaminate/linux-x86-64/illuaminate
chmod +x bin/illuaminate
bin/illuaminate lint
- name: Check whitespace
run: python3 tools/check-lines.py
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ If you need help getting started with CC: Tweaked, want to show off your latest
Main Known issue
* Mods that add blocks that can be used as peripherals for CC:T On forge, dont work with CC:R.
* This is because of the differences between forge and fabric, and that mod devs, to my knowledge have not agreed upon a standard method in which to implement cross compatibility between mods,
* Storage Peripherals throw a java "StackOverflowError" when using `pushItems()`,
* Work around, you are probably using `pushItems(chest, 1)` or simular. please use `pushItems(chest, 1, nil, 1)`.
* [Fixed (d10f297c): please report if bug persists]</br> ~~Storage Peripherals throw a java "StackOverflowError" when using `pushItems()`,~~
* ~~Work around, you are probably using `pushItems(chest, 1)` or similar. please use `pushItems(chest, 1, nil, 1)`.~~

## Known Working mods that add Peripherals
* Please let me know of other mods that work with this one
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
import net.minecraft.client.render.VertexFormatElement;
import net.minecraft.client.render.VertexFormats;
import net.minecraft.client.render.model.BakedQuad;
import net.minecraft.client.util.math.Vector4f;
import net.minecraft.util.math.Matrix4f;
import net.minecraft.util.math.Quaternion;

import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
Expand Down Expand Up @@ -50,41 +50,31 @@ public static void transformQuadsTo(VertexFormat format, List<BakedQuad> output,
}

private static BakedQuad doTransformQuad(VertexFormat format, BakedQuad quad, Matrix4f transform) {
int[] vertexData = quad.getVertexData()
.clone();
int offset = 0;
int[] vertexData = quad.getVertexData().clone();
BakedQuad copy = new BakedQuad(vertexData, -1, quad.getFace(), ((BakedQuadAccess)quad).getSprite(), true);
for (int i = 0; i < format.getElements()
.size(); ++i) // For each vertex element
{
VertexFormatElement element = format.getElements()
.get(i);
if (element.getType() == VertexFormatElement.Type.POSITION && element.getFormat() == VertexFormatElement.Format.FLOAT && element.getSize() == 3) // When we find a position
// element

int offsetBytes = 0;
for (int v = 0; v < 4; ++v) {
for (VertexFormatElement element : format.getElements()) // For each vertex element
{
for (int j = 0; j < 4; ++j) // For each corner of the quad
int start = offsetBytes / Integer.BYTES;
if (element.getType() == VertexFormatElement.Type.POSITION && element.getFormat() == VertexFormatElement.Format.FLOAT) // When we find a position element
{
int start = offset + j * format.getVertexSize();
if ((start % 4) == 0) {
start = start / 4;

// Extract the position
Quaternion pos = new Quaternion(Float.intBitsToFloat(vertexData[start]),
Float.intBitsToFloat(vertexData[start + 1]),
Float.intBitsToFloat(vertexData[start + 2]),
1);
Vector4f pos = new Vector4f(Float.intBitsToFloat(vertexData[start]),
Float.intBitsToFloat(vertexData[start+1]),
Float.intBitsToFloat(vertexData[start+2]),
1);

// Transform the position
transform.multiply(pos);
// Transform the position
pos.transform(transform);

// Insert the position
vertexData[start] = Float.floatToRawIntBits(pos.getX());
vertexData[start + 1] = Float.floatToRawIntBits(pos.getY());
vertexData[start + 2] = Float.floatToRawIntBits(pos.getZ());
}
// Insert the position
vertexData[start] = Float.floatToRawIntBits(pos.getX());
vertexData[start+1] = Float.floatToRawIntBits(pos.getY());
vertexData[start+2] = Float.floatToRawIntBits(pos.getZ());
}
offsetBytes += element.getSize();
}
offset += element.getSize();
}
return copy;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,10 @@ public BakedModel apply(@Nonnull BakedModel originalModel, @Nonnull ItemStack st
Identifier overlay = turtle.getOverlay(stack);
boolean christmas = HolidayUtil.getCurrentHoliday() == Holiday.CHRISTMAS;
String label = turtle.getLabel(stack);
boolean flip = label != null && (label.equals("Dinnerbone") || label.equals("Grumm"));
// TODO Make TurtleTool render for turtle items again.
TurtleModelCombination combo = new TurtleModelCombination(colour != -1, !(leftUpgrade instanceof TurtleTool) ? leftUpgrade : null, !(rightUpgrade instanceof TurtleTool) ? rightUpgrade : null, overlay, christmas, flip);
// TODO make upside down turtle items render properly (currently inivisible)
//boolean flip = label != null && (label.equals("Dinnerbone") || label.equals("Grumm"));
boolean flip = false;
TurtleModelCombination combo = new TurtleModelCombination(colour != -1, leftUpgrade, rightUpgrade, overlay, christmas, flip);

BakedModel model = TurtleSmartItemModel.this.m_cachedModels.get(combo);
if (model == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ public static IPeripheral getPeripheral( @Nonnull World world, @Nonnull BlockPos

ArrayList<SaturatedMethod> saturated = new ArrayList<>( 0 );

// This seems to add inventory methods, how???
List<NamedMethod<PeripheralMethod>> tileMethods = PeripheralMethod.GENERATOR.getMethods( tile.getClass() );
if( !tileMethods.isEmpty() ) addSaturated( saturated, tile, tileMethods );

Expand Down
Loading

0 comments on commit a475f55

Please sign in to comment.